StrataFrame Forum

Broken Rules

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

By Tim Dol - 6/25/2008

Is there a way to turn off checking broken rules (not at the form level).  I turned off CheckCurrentRowBeforeNavigate but it didn't seem to have any effect.  I can certainly create a property in the business object for this but wanted to know if something already existed.

Thanks

Tim

By Dustin Taylor - 6/25/2008

The easiest way I can think of is to set the IgnoreRuesAndForceSave to True on the business objec'ts BusinessRulesChecked event. So on the business object itself:

Private Sub MyBO_BusinessRulesChecked(ByVal e As MicroFour.StrataFrame.Business.BusinessRulesCheckedEventArgs) Handles Me.BusinessRulesChecked
   e.IgnoreRulesAndForceSave = True
End Sub

Hope it helps Smile

By Dustin Taylor - 6/25/2008

Trent mentioned another good idea: add a custom property on the business object (or base busines object) to identify whether or not to ignore the rules, and override the OnCheckRulesOnCurrentRow event to test for that property:

'-- This is set by the custom property below

Private _IgnoreRules As Boolean = False
 
''' <summary>
''' Gets or sets _IgnoreRules
''' </summary>
Public Property IgnoreRules() As Boolean
    Get
        Return Me._IgnoreRules
    End Get
    Set(ByVal value As Boolean)
        Me._IgnoreRules = value
    End Set
End Property
 
Protected Overrides Sub OnCheckRulesOnCurrentRow(ByVal e As MicroFour.StrataFrame.Business.CheckRulesEventArgs)
    '-- Only check the rules if _IgnoreRules is False

    If Not _IgnoreRules Then MyBase.OnCheckRulesOnCurrentRow(e)
End Sub

Probably the slickest way to go about what you are trying to do BigGrin

By Tim Dol - 6/25/2008

Perfect. Thank you very much!