/// --------------------------------------------------------------- /// <summary> /// /// </summary> /// <returns></returns> /// ----------------------------------------------------------------------- public bool IsSatisfied(RuleValidationService service) { ConfigureObject(service); foreach (var statement in tblRuleStatements) { _results.Add(statement.IsSatisfied(service)); } return(_ruleConnectors.Count == 0 ? _results[0] : ProcessResults(_rsBracketNo, _ruleConnectors, _results)); }
/// ------------------------------------------------------------------------ /// <summary> /// Determines of the condiions for the rule set have been satisfied. /// </summary> /// <returns>boolean</returns> /// ------------------------------------------------------------------------ public bool IsSatisfied(RuleValidationService service) { ConfigureObject(service); if (tblRuleSets.Count == 0) { return(true); } foreach (var ruleSet in tblRuleSets) { _ruleSetResults.Add(_service.IsSatisfied(ruleSet)); } return(_ruleConnectors.Count == 0 ? _ruleSetResults[0] : ProcessResults(_rsBracketNo, _ruleConnectors, _ruleSetResults)); }
private void ConfigureObject(RuleValidationService service) { if (service == null) { throw new NullReferenceException("RuleValidationService object not provided."); } _service = service; if (RsBracketNo == null) { throw new ArgumentNullException("RsBracketNo", "Required Properties were not provided."); } if (RuleConnectors == null) { throw new ArgumentNullException("RuleConnectors", "Required Properties were not provided."); } var rsBracketNo = RsBracketNo.Split(','); var ruleConnectors = RuleConnectors.Split(','); if (rsBracketNo == null || ruleConnectors == null) { throw new NullReferenceException("RsBracketNo or RuleConnectors was not provided."); } if (!String.IsNullOrEmpty(rsBracketNo[0])) { foreach (var bracket in rsBracketNo) { _rsBracketNo.Add(Convert.ToInt32((string)bracket)); } } if (!String.IsNullOrEmpty(ruleConnectors[0])) { foreach (var connector in ruleConnectors) { _ruleConnectors.Add(Convert.ToInt32((string)connector)); } } ProcessCollection(); }
/// ------------------------------------------------------------------------ /// <summary> /// Determines of the condiions for the rule set have been satisfied. /// </summary> /// <returns>boolean</returns> /// ------------------------------------------------------------------------ public abstract bool IsSatisfied(RuleValidationService service);