コード例 #1
0
        private string GetRulePreview(LogicBuilder.Workflow.Activities.Rules.Rule rule)
        {
            StringBuilder rulePreview = new StringBuilder();

            if (rule != null)
            {
                rulePreview.Append("IF ");
                if (rule.Condition != null)
                {
                    rulePreview.Append(rule.Condition.ToString() + " ");
                }
                rulePreview.Append("THEN ");

                foreach (RuleAction action in rule.ThenActions)
                {
                    rulePreview.Append(action.ToString());
                    rulePreview.Append(' ');
                }

                if (rule.ElseActions.Count > 0)
                {
                    rulePreview.Append("ELSE ");
                    foreach (RuleAction action in rule.ElseActions)
                    {
                        rulePreview.Append(action.ToString());
                        rulePreview.Append(' ');
                    }
                }
            }

            return(rulePreview.ToString());
        }
コード例 #2
0
        private static RuleSymbolInfo AnalyzeRule(RuleChainingBehavior behavior, Rule rule, RuleValidation validator, Tracer tracer)
        {
            RuleSymbolInfo rsi = new RuleSymbolInfo();

            if (rule.Condition != null)
            {
                rsi.conditionDependencies = rule.Condition.GetDependencies(validator);

                if ((rsi.conditionDependencies != null) && (tracer != null))
                {
                    tracer.TraceConditionSymbols(rule.Name, rsi.conditionDependencies);
                }
            }

            if (rule.thenActions != null)
            {
                rsi.thenSideEffects = GetActionSideEffects(behavior, rule.thenActions, validator);

                if ((rsi.thenSideEffects != null) && (tracer != null))
                {
                    tracer.TraceThenSymbols(rule.Name, rsi.thenSideEffects);
                }
            }

            if (rule.elseActions != null)
            {
                rsi.elseSideEffects = GetActionSideEffects(behavior, rule.elseActions, validator);

                if ((rsi.elseSideEffects != null) && (tracer != null))
                {
                    tracer.TraceElseSymbols(rule.Name, rsi.elseSideEffects);
                }
            }

            return(rsi);
        }
コード例 #3
0
 internal RuleState(Rule rule)
 {
     this.Rule = rule;
 }