SetDirtyOnAdd


Author
Message
Brad Vick
Brad Vick
StrataFrame Novice (51 reputation)StrataFrame Novice (51 reputation)StrataFrame Novice (51 reputation)StrataFrame Novice (51 reputation)StrataFrame Novice (51 reputation)StrataFrame Novice (51 reputation)StrataFrame Novice (51 reputation)StrataFrame Novice (51 reputation)StrataFrame Novice (51 reputation)
Group: Forum Members
Posts: 33, Visits: 88
We would like a new SetDirtyOnAdd property that works just like the SetDirtyOnEdit property for business objects.  If a user clicks to add a record and never actually enters any data, when they close the screen we don't want to show the save changes confirmation message.  Is this possible?
Replies
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: 6.9K
This is obviously much more difficult since you are truly adding a new record to the data table within the BO.  Without looping ADO.NET has no way of telling nor does the BO since we rely on the ADO.NET row to tell us the state.

Editing is entirely different because a row already exists, so it is just a matter of not setting the row state to anything and just letting nature take it's course.  When adding a new row, you have to have something to put values into ... so you HAVE to create a new row.

The only two options I see for you is to either write a method to loop....or drop on a second BO which all of the fields are bound to.  Then use a second BO as your "permanent" BO which has the data from the editing BO copied into it using the CopyDataFrom method on the BO in the BeforeSave or AfterSave and where you feel you need to make the transition.  This will require more work but would allow you to have the "clean" row.  In any case, you are going to have to create this logic yourself as the BOs and ADO.NET do not have a method to do this natively.

Pertti Karjalainen
Pertti Karjalainen
StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)StrataFrame User (146 reputation)
Group: Forum Members
Posts: 54, Visits: 4K
This is where Foxpro's getfldstate() -function would come VERY handy, as it shows the add -status as well as the buffer status.  Would be nice if the framework would provide this at some point or another.  It really is a nit, but customers can be real nit-picky about this kind of stuff -- they want as speedy of a UI experience as possible with as few alerts as (safely) possible.  This is one of those.

Pertti

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: 6.9K
As mentioned above, if you have this need you can implement it yourself.  The GetFldState is replaced in ADO.NET by looking at the version of the field, which you can do just like you did in FoxPro.  All fields in ADO.NET have a buffer, this is how concurrency works.

MyBO.CurrentRow.Item("MyField",Version....)

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search