Exemplo n.º 1
0
 /// <summary>
 /// Adds a new Ruleset to the event client
 /// </summary>
 /// <param name="ruleSet">The RuleSet to Add</param>
 /// <returns></returns>
 public EventClient Add(RuleSet ruleSet)
 {
     _rules.Add(ruleSet);
     return this;
 }
Exemplo n.º 2
0
        public static RuleSet When(string ruleName, Func<UserEventList, bool> op)
        {
            var ruleset = new RuleSet(ruleName, op);

            return ruleset;
        }
Exemplo n.º 3
0
 /// <summary>
 /// INTERNAL - Runs the specified rule
 /// </summary>
 /// <param name="r">RuleSet to run</param>
 private void RunRule(RuleSet r)
 {
     //Make sure it hasn't been run before
     if (!_eventStore.UserRules.Any(ur => ur.RuleName == r.Name))
     {
         //try run the rule
         if (r.Operation(_eventStore.UserEvents))
         {
             //success!
             r.Action(r);
             _eventStore.UserRules.Add(new UserRule { RuleName = r.Name, Executed = DateTime.Now });
         }
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Adds a new Ruleset to the event client
 /// </summary>
 /// <param name="ruleSet">The RuleSet to Add</param>
 /// <returns></returns>
 public EventClient Add(RuleSet ruleSet)
 {
     _rules.Add(ruleSet);
     return(this);
 }