Controlling BO Updates in a less than typical scenarios


Author
Message
geoffAtDatagaard
geoffAtDatagaard
StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)StrataFrame Beginner (21 reputation)
Group: Forum Members
Posts: 3, Visits: 5
I am currently evaluating SF as a framework for our migration to .NET
I have played extensively with several other products over the past 6 months or so, and I was suprised when I did stumble onto SF that I hadn't come across it before.
At first glance, it seems to me it should at least be holding as prominent a position as other tools such as IB,ES...

Anyway, I want to evaluate SF's capacity to adapt to some less than typical scenario's and I'd appreciate a heads-up from anyone who's willing.

Lets suppose I have a BO called IncidentBO, and I have it hooked up to an SF Maintenance Form.
I want to allow the user to Add a New or Edit an exisiting Incident.

However, when the user saves an Edited Incident, I want to leave the original row untouched and add a new row, which has the new details.
I already have a PK structure that supports this.
What I would like an insight into is where to hook the logic I would use and how to turn the updated BO into a new BO instance so it gets inserted.

I think the answer to this will also give me an insight into some other questions I have.

Cheers

Geoff

Replies
Fabian R Silva, -
Fabian R Silva, -
StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)StrataFrame User (317 reputation)
Group: StrataFrame Users
Posts: 153, Visits: 1.2K
Thanks Edhy for this old post. this saved me this time. something simple about how to update a BO was complicated to think and you give the correct solution, fill a BO with needed-to-update record, copy from that BO to actual BO, alter field as needed, save that and voila Smile

gracias nuevamente!

Edhy Rijo (9/25/2008)
geoffAtDatagaard (09/25/2008)
I want to allow the user to Add a New or Edit an existing Incident. However, when the user saves an Edited Incident, I want to leave the original row untouched and add a new row, which has the new details.
I already have a PK structure that supports this.
What I would like an insight into is where to hook the logic I would use and how to turn the updated BO into a new BO instance so it gets inserted.



Basically what I understand from your message above is the that when you Edit a record, actually you want to simply create a new one with the information of the edited one (a copied record).  That is pretty easy to accomplish by manipulating the primary bo Editing State and using the CopyData methods of the BO. 

Of course such an action is not what I would consider a standard or common rule, so it would not be a straight forward path from the framework stand point, but it is doable as the framework is very flexible and allow you to go anywhere your business rules require.

Edited 12 Years Ago by Fabian R Silva, -
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Fabian,

I am glad you were able to find the information you needed, that is exactly what the forums are for. 

I keep using that technique over and over all the time, specially now that I am using the DevExpress Grid control via the SF Binding Source and when editing multiple records in a child form, could cause the records in the BO to go crazy and yield to the wrong data being saved, copying those records to another temporary BO and handling the data there and then re-fill the original one does the trick all the time and everybody is happy.

Of course, sometimes with this trick there could be some sort of processing penalties, but in my case it is not noticeable for the end user.  Hope with the upcoming SF V2 binding to other controls like DevExpress could be done more naturally without a binding source.

Edhy Rijo

Terry Bottorff
Terry Bottorff
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 448, Visits: 12K
Edhy I see you use a "Temporary BO" in some of your forms. So does that mean you have a Temp table in your database or are you able to get a Temp BO some other way?

TIA
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Terry,

Terry Bottorff (7/10/2013)
Edhy I see you use a "Temporary BO" in some of your forms. So does that mean you have a Temp table in your database or are you able to get a Temp BO some other way?TIA


No temporary table anywhere, just another instance of the BO either dropped in the form or programatically instantiated for the purpose on hand, here is a pseudo code:

Suppose I have a BO or OrdenItemsBO in the form, and this is used to show the Order Items in a grid or listview, then I want to do some process in another instance of the same BO:

Using TempBo As New OrdenItemsBO
     '  Now copy the records to the TempBO
     TempBO.CopyDataFrom(Me.
OrdenItemsBO1, Here the copy type required by SF)
    
     '  Now I have all the records in the temp bo and I can do whatever I want, then save it and re-fill the
OrdenItemsBO1 to show the changes
     For each TempBORecord in TempBO.GetEnumerable()
          ' Here do what you want with each record
     End For

     If TempBO.IsDirty = True Then
         
TempBO.Save()
          Me.OrdenItemsBO1.FillAll()
     End If
End Using


Again, above is just pseudo code from my head, not a real example.  And this would be needed in case you want to process some records from the whole list.  I also use a lot of BO.Filter conditions before copying the data to the TempBO, but be aware that when using BO.Filter or BO.Sort conditions, that these must be set to empty before adding new records, or your new records will not be included in the BO.CurrentView.

Edhy Rijo

Terry Bottorff
Terry Bottorff
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 448, Visits: 12K
Some days(months) I wonder where my brain is. So the second(temp) BO is its own Entity and its data does not get mixed with the original BO unless of course you choose to do so? Is that correct?

TIA.
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Terry Bottorff (7/10/2013)
So the second(temp) BO is its own Entity and its data does not get mixed with the original BO unless of course you choose to do so? Is that correct?

Yes, you are correct, you can have as many instances of the same BO in your form and they all be independent of each other.  Trust me, I have been amazed the more I work with SF of how flexible and useful the concept of using a BO is, and on top of that, you add all the useful methods and properties provided by SF to handle things like Filter, Sort, CurrentView and something that many may not be aware of BO.CurrentDataTable.AcceptChanges() method, in a table where you may have done many record changes and then you copy those records to another table, by calling the BO.CurrentDataTable.AcceptChanges() method will tell the BO not to complaint of the changes and ask to save the BO, very cool.

Edhy Rijo

Terry Bottorff
Terry Bottorff
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 448, Visits: 12K
Never a day goes by that I don't learn something new. Wow. And Version 2 somewhere Soon?
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
StrataFrame 2.0 is picking up more and more steam as we move forward.  We are still finishing up the core of StrataFrame 2.0 which is the most complicated and time consuming area.  It will be well worth the wait, though.  I am excited about using it as well on our other product lines (i.e. medical software).  As far as time lines, we may have a beta before Christmas, but there won't be an official release until at least the January.  It will be worth the wait though, I promise!
Terry Bottorff
Terry Bottorff
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 448, Visits: 12K
Thanks for the mini time line.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
geoffAtDatagaard - 17 Years Ago
geoffAtDatagaard - 17 Years Ago
Edhy Rijo - 17 Years Ago
Trent L. Taylor - 17 Years Ago
geoffAtDatagaard - 17 Years Ago
Edhy Rijo - 17 Years Ago
                         We use scalar methods consistently within our medical software and...
Trent L. Taylor - 17 Years Ago
Fabian R Silva, - - 12 Years Ago
Edhy Rijo - 12 Years Ago
Terry Bottorff - 12 Years Ago
                         Hi Terry, [quote][b]Terry Bottorff (7/10/2013)[/b][hr]Edhy I see you...
Edhy Rijo - 12 Years Ago
                             Some days(months) I wonder where my brain is. So the second(temp) BO...
Terry Bottorff - 12 Years Ago
                                 [quote][b]Terry Bottorff (7/10/2013)[/b][hr]So the second(temp) BO is...
Edhy Rijo - 12 Years Ago
                                     Never a day goes by that I don't learn something new. Wow. And Version...
Terry Bottorff - 12 Years Ago
                                         StrataFrame 2.0 is picking up more and more steam as we move forward....
Trent L. Taylor - 12 Years Ago
                                             Thanks forthe mini time line.
Terry Bottorff - 12 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search