/// <summary> /// /// This method will archive the results of a particular rule's execution by storing them as a /// a RuleReportNode and by inserting it into a RuleSetReportNode. /// /// <param name="poRule">The business rule that we have executed</param> /// <param name="peRuleErrCd">The error (i.e., result) code of that rule's execution</param> /// <param name="psRuleErrorDesc">The general description of the rule's error (if there is one)</param> /// <param name="psVerboseError">The verbose description of the rule's error (if there is one)</param> /// <returns>The indicator for whether or not the rule's execution results were successfully archived</returns> /// </summary> public bool ArchiveRuleExecution(WonkaBizRule poRule, ERR_CD peRuleErrCd, string psRuleErrorDesc, string psVerboseError) { bool bResult = true; WonkaBizRuleSetReportNode RuleSetReportNode = FindRuleSetReport(poRule.ParentRuleSetId, true); if (RuleSetReportNode != null) { WonkaBizRuleReportNode RuleReportNode = new WonkaBizRuleReportNode(poRule); RuleReportNode.ErrorCode = peRuleErrCd; RuleReportNode.ErrorDescription = psRuleErrorDesc; RuleReportNode.VerboseError = psVerboseError; RuleSetReportNode.RuleResults.Add(RuleReportNode); } return(bResult); }
/// <summary> /// /// This method will flag the failure of a particular RuleSet by /// /// 1.) Setting the error properties on the corresponding RuleSetReport /// 2.) Adding the RuleSetReport to the Failures list /// 3.) Marking the RuleTree as a failure (since the failure of only one RuleSet flags the whole tree) /// /// <param name="poTargetRuleSet">The target RuleSet which will be marked as a failure</param> /// <param name="peRuleSetErrCd">The type of failure for the RuleSet</param> /// <param name="psRuleSetErrMsg">The error message that will provide details about the RuleSet's failure</param> /// <returns>The list of RuleReports that describes the execution of a specific RuleSet</returns> /// </summary> public bool AddResultSetFailure(WonkaBizRuleSet poTargetRuleSet, ERR_CD peRuleSetErrCd, string psRuleSetErrMsg) { bool bResult = true; WonkaBizRuleSetReportNode RuleSetReportNode = FindRuleSetReport(poTargetRuleSet.RuleSetId, false); if (RuleSetReportNode != null) { RuleSetReportNode.ErrorSeverity = poTargetRuleSet.ErrorSeverity; RuleSetReportNode.ErrorCode = peRuleSetErrCd; RuleSetReportNode.ErrorDescription = psRuleSetErrMsg; if ((poTargetRuleSet.ErrorSeverity == RULE_SET_ERR_LVL.ERR_LVL_WARNING) || (poTargetRuleSet.ErrorSeverity == RULE_SET_ERR_LVL.ERR_LVL_SEVERE)) { RuleSetFailures.Add(RuleSetReportNode); OverallRuleTreeResult = ERR_CD.CD_FAILURE; } } return(bResult); }
/// <summary> /// /// This method will score the execution of a RuleSet, setting its status (success, failure, etc.) /// on the corresponding RuleSetReport. /// /// <param name="pnRuleSetId">The ID of the RuleSet whose report we are interested in</param> /// <param name="psRuleSetDesc">The description of the RuleSet (that we are passing onto the report)</param> /// <param name="psCustomId">The customId of the RuleSet (that we are passing onto the report)</param> /// <param name="peRuleSetErrCd">The status code of the target RuleSet's execution</param> /// <returns>Indicates whether or not we successfully set the RuleSetReport</returns> /// </summary> public bool SetRuleSetStatus(int pnRuleSetId, string psRuleSetDesc, string psCustomId, ERR_CD peRuleSetErrCd) { bool bResult = true; WonkaBizRuleSetReportNode RuleSetReport = FindRuleSetReport(pnRuleSetId, true); if (RuleSetReport != null) { RuleSetReport.RuleSetDescription = psRuleSetDesc; RuleSetReport.ErrorCode = peRuleSetErrCd; RuleSetReport.CustomId = psCustomId; } return(bResult); }