Public Function ValidateDCR_RoutingNum(ByVal RoutingNum As String, ByVal AccountNum As String) As String '<Steven Potter> 01/07/2010 'Validate Account Information Dim Msg As String = Nothing Dim ilValid As Boolean = False ilValid = oRoutingValidation.validateinfo(RoutingNum, AccountNum) If ilValid = False Then Msg = "Invalid Routing Number Entered" AddErrorProviderBrokenRule("DCR_RoutingNum", Msg) End If Return Msg '<Steven Potter> End FunctionBut I think your missing the point here. At the end of CHeckRulesHook its returning a boolean value
return Me.ErrorProviderBrokenRuleCount = 0this was code added by the BO generator.
mmSaveDataResult Result = mmSaveDataResult.RulesPassed;Heres the full code
/// <summary> /// Checks the business object's rules /// </summary> /// <param name="businessObject">Business object</param> /// <param name="ds">DataSet</param> /// <param name="tableName">DataTable name</param> /// <returns>mmSaveDataResult enumerated value</returns> protected virtual mmSaveDataResult CheckRules(mmBusinessObject businessObject, DataSet ds, string tableName) { mmSaveDataResult Result = mmSaveDataResult.RulesPassed; if (businessObject.AutoCheckRules) { if (businessObject.BusinessRuleObj != null) { // Store the current row number and row on the business rule object businessObject.BusinessRuleObj.CurrentRow = businessObject.RowNum; businessObject.BusinessRuleObj.DataRow = businessObject.DataRow; // Check the business rules Result = businessObject.BusinessRuleObj.CheckRules(ds, tableName, businessObject.UseErrorProvider); } // Check any child object business rules mmSaveDataResult ChildResult; foreach (mmBusinessObject ChildBizObj in businessObject.RefBizObj) { if (ChildBizObj.AutoSaveOnParentSaved && ChildBizObj.GetCurrentDataSet() != null) { // Call Save PreProcess method on the child object. This ensures any // EndEdit or setting of parent foreign keys is done before checking rules if (ChildBizObj.PreSaveProcessing(ChildBizObj.GetCurrentDataSet(), ChildBizObj.TableName)) { // Make a recursive call to check the child object's business rules ChildResult = this.CheckRules(ChildBizObj, ChildBizObj.GetCurrentDataSet(), ChildBizObj.TableName); // Set RulesChecked flag ChildBizObj.RulesCheckedByParent = true; // Store the ChildResult in the overall Result variable if the severity is // greater than the current setting if (ChildResult == mmSaveDataResult.RulesBroken) { // Clear the RulesChecked flag since the rules failed ChildBizObj.RulesCheckedByParent = false; Result = ChildResult; } else if (ChildResult == mmSaveDataResult.RuleWarnings && Result == mmSaveDataResult.RulesPassed) { Result = ChildResult; } } else { Result = mmSaveDataResult.SaveCanceled; break; // Bail out if the child object's PreSaveProcessing returns false } } } } return Result; }