public override Rule AddNewRule(string name, string pageTypeLeft, string pageTypeRight, string ruleTextLeft, string ruleTextRight) { if (!RuleExists(name)) { RuleEventArgs e = new RuleEventArgs(); e.RuleName = name; e.CurrentRule = null; if (OnCreatingRule != null) { OnCreatingRule(null, e); } if (!e.CancelEvent) { Rule newRule = new Rule(name, pageTypeLeft, pageTypeRight); newRule.RuleTextLeft = ruleTextLeft; newRule.RuleTextRight = ruleTextRight; RuleDataStore.Save(newRule); e.CurrentRule = newRule; if (OnCreatedRule != null) { OnCreatedRule(null, e); } UpdateCache(); return(newRule); } else { return(null); } } return(null); }
public override Identity Save(Rule rel) { Identity id; RuleEventArgs e = new RuleEventArgs(); e.RuleName = rel.RuleName; e.CurrentRule = rel; if (OnSavingRule != null) { OnSavingRule(null, e); } if (e.CurrentRule != null && e.CurrentRule.Id != null && !e.CancelEvent && RuleExists(rel.Id)) { Rule existingRule = GetRule(rel.Id); id = RuleDataStore.Save(rel, existingRule.Id); if (OnSavedRule != null) { OnSavedRule(null, e); } UpdateCache(); return(id); } UpdateCache(); throw new Exception("Rule not found."); }
private void OnRuleSelectionChanged(RuleEventArgs e) { if (RuleSelectionChanged != null) { RuleSelectionChanged(this, e); } }
public override Rule AddNewRule(string name, string pageTypeLeft, string pageTypeRight, string ruleTextLeft, string ruleTextRight) { if (!RuleExists(name)) { RuleEventArgs e = new RuleEventArgs(); e.RuleName = name; e.CurrentRule = null; if (OnCreatingRule != null) OnCreatingRule(null, e); if (!e.CancelEvent) { Rule newRule = new Rule(name, pageTypeLeft, pageTypeRight); newRule.RuleTextLeft = ruleTextLeft; newRule.RuleTextRight = ruleTextRight; RuleDataStore.Save(newRule); e.CurrentRule = newRule; if (OnCreatedRule != null) OnCreatedRule(null, e); UpdateCache(); return newRule; } else return null; } return null; }
private void FireRuleProcessed(string rule) { if (this.OnRuleProcessing != null) { RuleEventArgs args = new RuleEventArgs(rule); this.OnRuleProcessed(this, args); } }
/// <summary> /// Helper method for raising the <see cref="Changed">Changed</see> event /// </summary> /// <param name="args">Rule Event Arguments</param> protected void RaisePrologMtChanged(RuleEventArgs args) { PrologMtEventHandler d = this.Changed; if (d != null) { d(this, new PrologMtEventArgs((PNode)this, args)); } }
/// <summary> /// The engine rule matched event handler. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The event args. /// </param> private void EngineRuleMatched(object sender, RuleEventArgs e) { if (Preferences.Current.EnableLogging) { this.LogQueue.Enqueue(new LogModel { RuleName = e.Rule.Name, Url = e.Path, Message = e.Message, Referer = e.Referer }); } }
public override void Invoke(object sender, RuleEventArgs e) { OnBeginRuleEvaluation(this); employee.OverTimeHours = 1.5 * 15 + 2 * (employee.HoursWorked - 60); OnRulePassed(this); OnEndRuleEvaluation(this); }
/// <summary> /// Helper method for raising the <see cref="RuleRetracted">Rule Retracted</see> event manually /// </summary> /// <param name="args"></param> protected void RaiseRuleRetracted(RuleEventArgs args) { RuleEventHandler d = this.RuleRetracted; args.PrologKB = this; if (d != null) { d(this, args); } this.RaisePrologMtChanged(args); }
private void tvRules_AfterSelect(object sender, TreeViewEventArgs e) { RuleEventArgs args = new RuleEventArgs(null); if (e.Node.Nodes.Count == 0) { args = new RuleEventArgs(_ruleNodeMap[e.Node]); } OnRuleSelectionChanged(args); }
public override void Invoke(object sender, RuleEventArgs e) { bool pass = (GenerateRandomNumbers.GetRandomNumber(999)) % 2 == 0; _logger.Log(string.Format("Results: {1} :: Rule Name: {0}, ", Name, pass ? "PASSED" : "FAILED")); if (pass) { OnRulePassed(this); } else { OnRuleFailed(this); } }
public override void Invoke(object sender, RuleEventArgs e) { OnBeginRuleEvaluation(this); if (employee.EmployeeType == EmployeeType.Salary) { OnRulePassed(this); } else { OnRuleFailed(this); } OnEndRuleEvaluation(this); }
public override void Invoke(object sender, RuleEventArgs e) { OnBeginRuleEvaluation(this); if (employee.HoursWorked > 40 && employee.HoursWorked <= 45) { OnRulePassed(this); } else { OnRuleFailed(this); } OnEndRuleEvaluation(this); }
private void RuleTreeView_RuleSelectionChanged(object sender, RuleEventArgs e) { if (e.SelectedRule != null) { IRuleConfiguration config = _configFactory.GetRuleConfigurationFor(e.SelectedRule.GetType()); _view.DisplayRuleConfiguration(config); CurrentConfiguration = config; } else { _view.ClearRuleConfiguration(); CurrentConfiguration = null; } HasChanges = false; }
/// <summary> /// Helper method for raising the <see cref="RuleRetracted">Rule Retracted</see> event manually /// </summary> /// <param name="t">Rule</param> protected void RaiseRuleRetracted(Rule t) { RuleEventHandler d = this.RuleRetracted; PrologMtEventHandler e = this.Changed; if (d != null || e != null) { RuleEventArgs args = new RuleEventArgs(t, (PNode)this, false); if (d != null) { d(this, args); } if (e != null) { e(this, new PrologMtEventArgs((PNode)this, args)); } } }
public override void DeleteRule(string name) { RuleEventArgs e = new RuleEventArgs(); e.RuleName = name; e.CurrentRule = GetRule(name); if (e.CurrentRule != null && e.CurrentRule.Id != null) { if (OnDeletingRule != null) { OnDeletingRule(null, e); } if (!e.CancelEvent) { RuleDataStore.Delete(e.CurrentRule); } if (OnDeletedRule != null) { OnDeletedRule(null, e); } } UpdateCache(); }
public static void DeleteRule(RuleEventArgs e) { DeleteRule(e.RuleID); }
public override void Invoke(object sender, RuleEventArgs e) { OnBeginRuleEvaluation(this); OnEndRuleEvaluation(this); }
public static string LoadRuleXml(RuleEventArgs e) { return(LoadRuleXml(e.RuleID)); }
public override void DeleteRule(string name) { RuleEventArgs e = new RuleEventArgs(); e.RuleName = name; e.CurrentRule = GetRule(name); if (e.CurrentRule != null && e.CurrentRule.Id != null) { if (OnDeletingRule != null) OnDeletingRule(null, e); if (!e.CancelEvent) { RuleDataStore.Delete(e.CurrentRule); } if (OnDeletedRule != null) OnDeletedRule(null, e); } UpdateCache(); }
public override Identity Save(Rule rel) { Identity id; RuleEventArgs e = new RuleEventArgs(); e.RuleName = rel.RuleName; e.CurrentRule = rel; if (OnSavingRule != null) OnSavingRule(null, e); if (e.CurrentRule != null && e.CurrentRule.Id != null && !e.CancelEvent && RuleExists(rel.Id)) { Rule existingRule = GetRule(rel.Id); id = RuleDataStore.Save(rel, existingRule.Id); if (OnSavedRule != null) OnSavedRule(null, e); UpdateCache(); return id; } UpdateCache(); throw new Exception("Rule not found."); }
private void OnRuleMismatched(object sender, RuleEventArgs e) { Console.WriteLine(string.Format(Resources.Resources.OnRuleMismatchedEventMessage, e.Rule, e.FileName)); }
/// <summary> /// Event Handler which handles the <see cref="RuleList.RuleRemoved">Rule Removed</see> event from the underlying Rule Collection by raising the PrologKB's <see cref="RuleRetracted">Rule Retracted</see> event /// </summary> /// <param name="sender">Sender</param> /// <param name="args">Rule Event Arguments</param> protected virtual void OnRuleRetracted(Object sender, RuleEventArgs args) { this.RaiseRuleRetracted(args); }
/// <summary> /// Creates a new set of PrologKB Event Arguments /// </summary> /// <param name="g">PrologKB</param> /// <param name="args">Rule Event Arguments</param> public PrologMtEventArgs(PNode g, RuleEventArgs args) : this(g) { this._args = args; }
private void TreeViewImp_RuleSelectionChanged(object sender, RuleEventArgs e) { throw new NotImplementedException(); }
/// <summary> /// Creates a new set of Cancellable PrologKB Event Arguments /// </summary> /// <param name="g">PrologKB</param> /// <param name="args">Rule Event Arguments</param> public CancellablePrologMtEventArgs(PNode g, RuleEventArgs args) : base(g, args) { }
public void HandlePassedRule(object sender, RuleEventArgs args) { logger.Debug("Handle Passed Rule was called"); this.calledRules.Push(args.RuleName + " passed"); }