Exemplo n.º 1
0
 public static Boolean CheckRuleIsValid(Rule ruleToEval, ObjectInstance oi, out RuleViolation violatedRule)
 {
     try
     {
         if (CheckCondition(ruleToEval.Condition, oi))
         {
             if (ruleToEval.Assertion(oi) != true)
             {
                 violatedRule = new RuleViolation(ruleToEval, oi);
                 return(false);
             }
             else
             {
                 violatedRule = null;
                 return(true);
             }
         }
         violatedRule = null;
         return(true);
     }
     catch (Exception ex)
     {
         violatedRule = new RuleViolationFromException(ruleToEval, oi, ex);
         return(false);
     }
 }
Exemplo n.º 2
0
 public static Boolean CheckRuleIsValid(Rule ruleToEval, ObjectInstance oi, out RuleViolation violatedRule)
 {
   try
   {
     if (CheckCondition(ruleToEval.Condition, oi))
     {
       if (ruleToEval.Assertion(oi) != true)
       {
         violatedRule = new RuleViolation(ruleToEval, oi);
         return false;
       }
       else
       {
         violatedRule = null;
         return true;
       }
     }
     violatedRule = null;
     return true;
   }
   catch(Exception ex)
   {
     violatedRule = new RuleViolationFromException(ruleToEval, oi, ex);
     return false;
   }
 }