Ejemplo n.º 1
0
 public static bool IsTriggerForPhase(this IRule rule, RuleExecutionPhase phase){
     //@"rule".contract_NotNull(rule);
     if (rule.IsTrigger()){
         var phases_ = (string) rule.Params["sys.trigger.phases", ""];
         var phases = phases_.Split(',', '_', ';', ' ');
         var phase_ = phase.ToString();
         if (Array.IndexOf(phases, phase_) != -1)
             return true;
     }
     return false;
 }
Ejemplo n.º 2
0
        public static IRule MakeTrigger(this IRule rule, RuleExecutionPhase phase, params RuleExecutionPhase[] phases){
            //@"rule".contract_NotNull(rule);
            rule.Params[Constants.Meta.IsTrigger] = true;
            var phases_ = new List<string>();
            phases_.Add(phase.ToString());
            if (phases != null){
                foreach (var p in phases)
                    phases_.Add(p.ToString());
            }

            rule.Params["sys.trigger.phases"] = string.Join(";", phases_.ToArray());
            return rule;
        }