StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Application Framework - V1
»
Business Objects and Data Access (How do I?)
»
Using SeekByPrimaryKey
Using SeekByPrimaryKey
Post Reply
Like
0
Prev
1
2
Jump To Page
Using SeekByPrimaryKey
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
Trent Taylor
Trent Taylor
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
What does your code look like now? Also, why are you calling edit? As you as you make a change the BO will become dirty. So there is really no need to place the BO in edit mode.
Reply
Like
0
Bill Cunnien
Bill Cunnien
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 785,
Visits: 3.6K
Here's the code...I did take out the Edit(). I am now testing without it. I'll let you know if that changes anything.
for (int i = 0; i < listPartNum.SelectedItems.Count; i++)
{
int mPartIndex = (int)listPartNum.SelectedItems[i].Tag;
if (partsBO1.SeekToPrimaryKey(mPartIndex))
{
waitWindow1.Message += partsBO1.partnum + "\r";
if (chkProdAppend.Checked) { partsBO1.prodnotes += txtNewNote.Text; }
if (chkProdReplace.Checked) { partsBO1.prodnotes = txtNewNote.Text; }
if (chkShipAppend.Checked) { partsBO1.shipnotes += txtNewNote.Text; }
if (chkShipReplace.Checked) { partsBO1.shipnotes = txtNewNote.Text; }
partsBO1.Save();
}
}
Reply
Like
0
Bill Cunnien
Bill Cunnien
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 785,
Visits: 3.6K
If I select the first four in the list...only the first one is persisted.
If I pick the second through the fourth...only the second one (first in my selected items) is persisted.
I have got to take off. I'll try to check in later today to see if I can try working on this again.
Reply
Like
0
Trent Taylor
Trent Taylor
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
First, I would use a foreach. I would do something more like this:
foreach(ListViewItem i in listPartNum.SelectedItems)
{
//-- Find the item
if(!partsBO1.SeekToPrimaryKey((int)i.Tag)) { continue; }
//-- Update the record
if (chkProdAppend.Checked) { partsBO1.prodnotes += txtNewNote.Text; }
if (chkProdReplace.Checked) { partsBO1.prodnotes = txtNewNote.Text; }
if (chkShipAppend.Checked) { partsBO1.shipnotes += txtNewNote.Text; }
if (chkShipReplace.Checked) { partsBO1.shipnotes = txtNewNote.Text; }
}
//-- Save outside of the loop
partsBO1.Save();
Reply
Like
0
Edhy Rijo
E
Edhy Rijo
posted 15 Years Ago
ANSWER
Post Details
Share Post
E
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
Hi Bill,
Adding to Trent's reply, I have a this suggestion:
1- I use the ListView extensively, and in your case, I would use the ListView.Checked property instead of MultiSelect, with this you will have better control on what records are currently checked since the list view has a collection for it, and it will be easier for the End User to just click the box or double click the record to check it. (See attached screenshoot)
If Me.lstTransactionItems.CheckedItems.Count > 0 Then
For Each listItem As ListViewItem In Me.lstTransactionItems.Items
If listItem.Checked Then
If Me.BizTransactionItemsForListView.SeekToPrimaryKey(listItem.Tag) Then
Me.BizTransactionItemsForListView.DeleteCurrentRow(True)
End If
End If
Next
Me.lstTransactionItems.Requery()
End If
As you can see, in my case I am deleting the current row, but you'll get the idea, and of course my code is in VB
Edhy Rijo
Attachments
CheckedListView.png
(
125 views,
59.00 KB
)
Reply
Like
0
Bill Cunnien
Bill Cunnien
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 785,
Visits: 3.6K
Hi Edhy,
I did try using the checked property; however, the user loses the range select (click, shift-click) option. The user would prefer to do that than click 30+ checkboxes.
Trent, I tried that code, but I am getting the same results. Only the first record is getting persisted; however, all selected items are being seeked because the part number shows up in the wait window perfectly.
I am tackling this again today. After a really nice weekend, hopefully, I'll be able to conquer this pesky little issue.
Thanks!!
Ling
Reply
Like
0
Trent Taylor
Trent Taylor
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
Then there has to be something either set within your BO or some other logic moving the CurrentRowIndex because I have done this repeatedly. You are welcome to supply a sample, but I know that this will work as it is a common piece of logic.
Reply
Like
0
Bill Cunnien
Bill Cunnien
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 785,
Visits: 3.6K
There was other logic resetting CheckButton.
I discovered that and replaced the CheckButtons with a RadioGroup (a little cleaner). I was able to remove all of my extra fancy code to manage the checkbuttons and now the form works as expected. It is clean and fast!
Thanks for all the help!!
Have a great day!
Bill
Reply
Like
0
Trent Taylor
Trent Taylor
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
Glad you got to the bottom of it!
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Like
0
Prev
1
2
Jump To Page
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search