Exemplo n.º 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);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public WonkaInvocationEvents(Contract poWonkaEngineContract)
        {
            RuleTreeEvents      = poWonkaEngineContract.GetEvent(WonkaExtensions.CONST_EVENT_CALL_RULE_TREE);
            RuleTreeEventFilter = RuleTreeEvents.CreateFilterAsync().Result;

            RuleSetEvents      = poWonkaEngineContract.GetEvent(WonkaExtensions.CONST_EVENT_CALL_RULE_SET);
            RuleSetEventFilter = RuleSetEvents.CreateFilterAsync().Result;

            RuleEvents      = poWonkaEngineContract.GetEvent(WonkaExtensions.CONST_EVENT_CALL_RULE);
            RuleEventFilter = RuleEvents.CreateFilterAsync().Result;

            RuleSetErrorEvents      = poWonkaEngineContract.GetEvent(WonkaExtensions.CONST_EVENT_RULE_SET_ERROR);
            RuleSetErrorEventFilter = RuleSetErrorEvents.CreateFilterAsync().Result;
        }
Exemplo n.º 3
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;
                    }
                }
            }
        }