How to set BO undirty ?


Author
Message
Philipp Guntermann
Philipp Guntermann
StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)
Group: Forum Members
Posts: 141, Visits: 263
Hi,

i have an issue with my maintanance forms allways starting with the maintanance toolstrip showing the save and undo buttons enabled and the navigate buttons disabled.

i guess this is because automations on the form cause the bo to become dirty. ?

so within the bo, i tried this, to set it "undirty":

        protected override void OnIsDirtyChanged(bool DirtyShouldBe)
        {
            if (this.isDirty && this.EditingState ==  BusinessEditingState.Idle)
                this.Save();
            base.OnIsDirtyChanged(DirtyShouldBe);
        }

however, this throws a stackoverflow exception.

So, what is the appropriate way to handle this ?

thanks.


Replies
Philipp Guntermann
Philipp Guntermann
StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)
Group: Forum Members
Posts: 141, Visits: 263
this is what it shows right before the breakpoint:

  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.raise_IsDirtyChanged(object sender, System.EventArgs e) + 0xa4 Bytes 
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.OnIsDirtyChanged(bool DirtyShouldBe) + 0x27 Bytes 
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.CurrentView_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e) + 0x13f Bytes 
  System.Data.dll!System.Data.DataView.OnListChanged(System.ComponentModel.ListChangedEventArgs e = {System.ComponentModel.ListChangedEventArgs}) + 0x10e Bytes 
  System.Data.dll!System.Data.DataView.IndexListChanged(object sender, System.ComponentModel.ListChangedEventArgs e = {System.ComponentModel.ListChangedEventArgs}) + 0x1a Bytes 
  System.Data.dll!System.Data.DataView.IndexListChangedInternal(System.ComponentModel.ListChangedEventArgs e) + 0x4b Bytes 
  System.Data.dll!System.Data.DataViewListener.IndexListChanged(System.ComponentModel.ListChangedEventArgs e) + 0x3c Bytes 
  System.Data.dll!System.Data.Index.OnListChanged.AnonymousMethod(System.Data.DataViewListener listener, System.ComponentModel.ListChangedEventArgs args, bool arg2, bool arg3) + 0x7 Bytes 
  System.Data.dll!System.Data.Listeners<System.Data.DataViewListener>.Notify<System.ComponentModel.ListChangedEventArgs,bool,bool>(System.ComponentModel.ListChangedEventArgs arg1 = {System.ComponentModel.ListChangedEventArgs}, bool arg2 = false, bool arg3 = false, System.Data.Listeners<System.Data.DataViewListener>.Action<System.Data.DataViewListener,System.ComponentModel.ListChangedEventArgs,bool,bool> action = {Method = {Void <OnListChanged>b__2(System.Data.DataViewListener, System.ComponentModel.ListChangedEventArgs, Boolean, Boolean)}}) + 0x75 Bytes 
  System.Data.dll!System.Data.Index.OnListChanged(System.ComponentModel.ListChangedEventArgs e) + 0x9b Bytes 
  System.Data.dll!System.Data.Index.RecordStateChanged(int oldRecord, System.Data.DataViewRowState oldOldState, System.Data.DataViewRowState oldNewState, int newRecord, System.Data.DataViewRowState newOldState, System.Data.DataViewRowState newNewState) + 0xfa Bytes 
  System.Data.dll!System.Data.DataTable.RecordStateChanged(int record1 = 0, System.Data.DataViewRowState oldState1 = Unchanged, System.Data.DataViewRowState newState1 = ModifiedOriginal, int record2 = 2, System.Data.DataViewRowState oldState2 = None, System.Data.DataViewRowState newState2 = ModifiedCurrent) + 0x7f Bytes 
  System.Data.dll!System.Data.DataTable.SetNewRecordWorker(System.Data.DataRow row = {System.Data.DataRow}, int proposedRecord, System.Data.DataRowAction action = Change, bool isInMerge, int position, bool fireEvent = true, out System.Exception deferredException = null) + 0x29d Bytes 
  System.Data.dll!System.Data.DataTable.SetNewRecord(System.Data.DataRow row, int proposedRecord, System.Data.DataRowAction action, bool isInMerge, bool fireEvent) + 0x3d Bytes 
  System.Data.dll!System.Data.DataRow.EndEdit() + 0x48 Bytes 
  System.Data.dll!System.Data.DataRow.this[System.Data.DataColumn].set(System.Data.DataColumn column, object value) + 0xe4 Bytes 
  System.Data.dll!System.Data.DataRow.this[string].set(string columnName, object value) + 0x19 Bytes 


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
The stack trace begins (at the bottom) with an edit, so you are going to have to look at the data table to determine the field that is changed.  You may have to look at the row as well:

MyBO.CurrentDataTable.Rows(0).RowState

MyBO.CurrentDataTable.Rows(0)("MyField", Original)
MyBO.CurrentDataTable.Rows(0)("MyField", Current)

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