Example #1
0
        public void HandleEvents(WonkaBreRulesEngine poRulesEngine, RuleTreeReport poRuleTreeReport)
        {
            var ruleTreeLog   = RuleTreeEvents.GetFilterChanges <CallRuleTreeEvent>(RuleTreeEventFilter).Result;
            var ruleSetLog    = RuleSetEvents.GetFilterChanges <CallRuleSetEvent>(RuleSetEventFilter).Result;
            var ruleLog       = RuleEvents.GetFilterChanges <CallRuleEvent>(RuleEventFilter).Result;
            var ruleSetErrLog = RuleSetErrorEvents.GetFilterChanges <RuleSetErrorEvent>(RuleSetErrorEventFilter).Result;

            /**
             * if (ruleTreeLog.Count > 0)
             *  System.Console.WriteLine("RuleTree Called that Belongs to : (" + ruleTreeLog[0].Event.TreeOwner + ")");
             **/

            if (ruleSetLog.Count > 0)
            {
                foreach (EventLog <CallRuleSetEvent> TmpRuleSetEvent in ruleSetLog)
                {
                    if (TmpRuleSetEvent.Event != null)
                    {
                        poRuleTreeReport.RuleSetIds.Add(TmpRuleSetEvent.Event.RuleSetId);
                    }
                }
            }

            if (ruleLog.Count > 0)
            {
                foreach (EventLog <CallRuleEvent> TmpRuleEvent in ruleLog)
                {
                    if (TmpRuleEvent.Event != null)
                    {
                        poRuleTreeReport.RuleIds.Add(TmpRuleEvent.Event.RuleId); // TmpRuleEvent.Event.RuleType
                    }
                }
            }

            if (ruleSetErrLog.Count > 0)
            {
                foreach (EventLog <RuleSetErrorEvent> TmpRuleSetError in ruleSetErrLog)
                {
                    if (TmpRuleSetError.Event != null)
                    {
                        if (TmpRuleSetError.Event.SevereFailure)
                        {
                            poRuleTreeReport.RuleSetFailures.Add(TmpRuleSetError.Event.RuleSetId);
                        }
                        else
                        {
                            poRuleTreeReport.RuleSetWarnings.Add(TmpRuleSetError.Event.RuleSetId);
                        }
                    }
                }
            }
        }
Example #2
0
        public void HandleEvents(WonkaBizRulesEngine poRulesEngine, RuleTreeReport poRuleTreeReport)
        {
            var ruleTreeLog   = RuleTreeEvents.GetFilterChanges <CallRuleTreeEvent>(RuleTreeEventFilter).Result;
            var ruleSetLog    = RuleSetEvents.GetFilterChanges <CallRuleSetEvent>(RuleSetEventFilter).Result;
            var ruleLog       = RuleEvents.GetFilterChanges <CallRuleEvent>(RuleEventFilter).Result;
            var ruleSetErrLog = RuleSetErrorEvents.GetFilterChanges <RuleSetErrorEvent>(RuleSetErrorEventFilter).Result;

            /**
             * if (ruleTreeLog.Count > 0)
             *  System.Console.WriteLine("RuleTree Called that Belongs to : (" + ruleTreeLog[0].Event.TreeOwner + ")");
             **/

            if (ruleSetLog.Count > 0)
            {
                foreach (EventLog <CallRuleSetEvent> TmpRuleSetEvent in ruleSetLog)
                {
                    if (TmpRuleSetEvent.Event != null)
                    {
                        poRuleTreeReport.RuleSetIds.Add(TmpRuleSetEvent.Event.RuleSetId);
                    }
                }
            }

            if (ruleLog.Count > 0)
            {
                foreach (EventLog <CallRuleEvent> TmpRuleEvent in ruleLog)
                {
                    if (TmpRuleEvent.Event != null)
                    {
                        poRuleTreeReport.RuleIds.Add(TmpRuleEvent.Event.RuleId); // TmpRuleEvent.Event.RuleType
                    }
                }
            }

            if (ruleSetErrLog.Count > 0)
            {
                foreach (EventLog <RuleSetErrorEvent> TmpRuleSetError in ruleSetErrLog)
                {
                    if (TmpRuleSetError.Event != null)
                    {
                        if (TmpRuleSetError.Event.SevereFailure)
                        {
                            poRuleTreeReport.RuleSetFailures.Add(TmpRuleSetError.Event.RuleSetId);
                        }
                        else
                        {
                            poRuleTreeReport.RuleSetWarnings.Add(TmpRuleSetError.Event.RuleSetId);
                        }
                    }
                }
            }

            if (poRulesEngine.AllRuleSets != null)
            {
                foreach (string sTmpCustomId in poRuleTreeReport.RuleSetFailures)
                {
                    WonkaBizRuleSet FoundRuleSet =
                        poRulesEngine.AllRuleSets.Where(x => x.CustomId == sTmpCustomId).FirstOrDefault();

                    if (!String.IsNullOrEmpty(FoundRuleSet.CustomId))
                    {
                        poRuleTreeReport.RuleSetFailMessages[FoundRuleSet.CustomId] = FoundRuleSet.CustomFailureMsg;
                    }
                }
            }
        }