/// <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; }
public static RuleSet When(string ruleName, Func<UserEventList, bool> op) { var ruleset = new RuleSet(ruleName, op); return ruleset; }
/// <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 }); } } }
/// <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); }