/// <summary> /// /// This method will find the RuleSetReport indicated by the RuleSet ID. If it's not /// found and if the caller has flagged it, the function will initialize a new one /// (with the provided ID) and add it to our list of RuleSetReports. /// /// <param name="pnRuleSetId">The ID of the RuleSet whose report we are interested in</param> /// <param name="pbCreateNew">Indicator for whether or not we should create a new RuleSetReport if one is not found</param> /// <returns>The RuleSetReport that describes the execution of a specific RuleSet</returns> /// </summary> public WonkaBizRuleSetReportNode FindRuleSetReport(int pnRuleSetId, bool pbCreateNew = false) { WonkaBizRuleSetReportNode RuleSetReportNode = null; if (RuleSetResults.Where(x => x.RuleSetID == pnRuleSetId).Count() > 0) { RuleSetReportNode = RuleSetResults.Where(x => x.RuleSetID == pnRuleSetId).FirstOrDefault(); } else if (pbCreateNew) { RuleSetReportNode = new WonkaBizRuleSetReportNode() { RuleSetID = pnRuleSetId }; RuleSetResults.Add(RuleSetReportNode); } else { throw new WonkaBizRuleException(pnRuleSetId, -1, "ERROR! This RuleSetReport does not exist!"); } return(RuleSetReportNode); }
/// <summary> /// /// This method will return all RuleSetReports that are flagged as failures and have their /// severity rating set to WARNING. /// /// <returns>The list of failed RuleSetReports whose respective RuleSets are set as WARNING</returns> /// </summary> public List <WonkaBizRuleSetReportNode> GetRuleSetWarningFailures() { return(RuleSetResults.Where(x => x.ErrorSeverity == RULE_SET_ERR_LVL.ERR_LVL_WARNING).ToList()); }
/// <summary> /// /// This method will return all RuleSetReports that are flagged as failures and have their /// severity rating set to SEVERE. /// /// <returns>The list of failed RuleSetReports whose respective RuleSets are set as SEVERE</returns> /// </summary> public List <WonkaBreRuleSetReportNode> GetRuleSetSevereFailures() { return(RuleSetResults.Where(x => x.ErrorSeverity == RULE_SET_ERR_LVL.ERR_LVL_SEVERE).ToList()); }