StrataFrame Forum

Error Saving not firing

http://forum.strataframe.net/Topic16328.aspx

By Keith Chisarik - 5/12/2008

I have a BO declared as

Private WithEvents BO As BOLIB.BO = New BOLIB.BO

I add records, then set ErrorSavingMode to ContinueOnError

BO.ErrorSavingMode = MicroFour.StrataFrame.Business.ErrorSavingOptions.ContinueOnError

Calls to BO.SAVE() fail, but ErrorSaving does not fire to tell me what is going wrong. I added code to other methods on the BO (AfterAddNew) and they fire as expected, what might be causing ErrorSaving not to fire?

By Keith Chisarik - 5/12/2008

Hmm I had broken rules, so if broken rules exist that trumps ErrorSaving?
By Keith Chisarik - 5/12/2008

Can I easily display the BrokenRules collection to the user if the BO is not the forms PrimaryBusinessObject or will I have to code for that?
By Greg McGuffey - 5/12/2008

Keith,



I'm not sure on this, but I'd check out the SaveByForm() method of the BO. The broken rules handling is done by the standard form, so if the BO is on the form, I think using the SaveByForm() method will get the broken rules shown.
By Trent L. Taylor - 5/13/2008

Hmm I had broken rules, so if broken rules exist that trumps ErrorSaving?

Yes, but you can handle the BusinessRulesChecked event and set the e.IgnoreRulesAndForceSave to True and any rules will be ignored....if you have this need.

Can I easily display the BrokenRules collection to the user if the BO is not the forms PrimaryBusinessObject or will I have to code for that?

Sure, we do this in our medical app so that they can tell when there are broken rules on other pages as well as on web applications.  You can just enumerate the BrokenRules collection (either on the BO or in the BusinessRulesChecked event)

Dim msg As String = ""
For each rule as BusinessRules in MyBo.BrokenRules.ToArray()
    msg &= rule.FieldName & ControlChars.CrLf & rule.Description
Next