Verifying MarkOld call on dataportal (IsDirty not reset)

Verifying MarkOld call on dataportal (IsDirty not reset)

Old forum URL: forums.lhotka.net/forums/t/2873.aspx


NickTower posted on Tuesday, May 15, 2007

My basic question is how can I set a breakpoint on my businessbase MarkOld method to see that it gets called by the simpledataportal on the server?

My issue is after saving a list of businessbase objects that have been edited in a datagridview, that my list is still showing IsDirty = True.

Any help would be much appreciated.

Nick

P.S.  I saw another post where Rocky mentioned using the bindingsource EndEdit call prior to saving to the DB, but that hasn't helped.  Here's my code for save button click:

If Not mSuppliers.IsDirty Then

  MainForm.StatusLabel.Text = "Already saved."

  Exit Sub

End If

Me.SupplierListBindingSource.RaiseListChangedEvents = False

Me.SupplierListBindingSource.EndEdit()

Dim temp As SupplierList = mSuppliers.Clone

Try

  Using busy As StatusBusy = New StatusBusy("Saving Supplier List...")

    Me.SupplierListBindingSource.DataSource = Nothing

    mSuppliers = temp.Save

    Me.SupplierListBindingSource.DataSource = mSuppliers

  End Using

  MainForm.StatusLabel.Text = "Last Saved " & Now.ToString

Catch ex As Csla.DataPortalException

MessageBox.Show(ex.BusinessException.ToString, "Error Saving", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

Catch ex As Exception

MessageBox.Show(ex.ToString, "Error Saving", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

Finally

Me.SupplierListBindingSource.RaiseListChangedEvents = True

End Try

NickTower replied on Tuesday, May 15, 2007

I apologize, this is the code for saving my list to the dataporal, seeing rocky's notes in the book that distinguish between local and remote portal saving.

Nick

----

If Not mSuppliers.IsDirty Then

MainForm.StatusLabel.Text = "Already saved."

Exit Sub

End If

Me.SupplierListBindingSource.EndEdit()

Me.SupplierListBindingSource.RaiseListChangedEvents = False

Try

Using busy As StatusBusy = New StatusBusy("Saving Supplier List...")

mSuppliers = mSuppliers.Save

End Using

MainForm.StatusLabel.Text = "Last Saved " & Now.ToString

Catch ex As Csla.DataPortalException

MessageBox.Show(ex.BusinessException.ToString, "Error Saving", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

Catch ex As Exception

MessageBox.Show(ex.ToString, "Error Saving", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

Finally

Me.SupplierListBindingSource.RaiseListChangedEvents = True

End Try

RockfordLhotka replied on Tuesday, May 15, 2007

The data portal only calls MarkOld on the root object. If you are saving a list of objects, then the objects in the list are child objects and you must call MarkOld yourself within those objects.

Copyright (c) Marimer LLC