Esempio n. 1
0
        public static RuleCondition Create(Rule rule, XmlNode node)
        {
            RuleCondition cond = new RuleCondition();

            cond.Rule        = rule;
            cond.CodeSnippet = node.InnerXml;
            return(cond);
        }
Esempio n. 2
0
        public static ConditionList Create(Rule rule, XmlNodeList nodeList)
        {
            ConditionList condList = new ConditionList();

            condList.Rule = rule;
            foreach (XmlNode node in nodeList)
            {
                condList.List.Add(RuleCondition.Create(rule, node));
            }
            return(condList);
        }
Esempio n. 3
0
        /// <summary>
        /// foamliu, 2009/04/28, 对表达式列表求值.
        /// </summary>
        /// <returns></returns>
        public bool Evaluate()
        {
            bool bResult;

            for (int i = 0; i < m_rule.ConditionList.List.Count; i++)
            {
                RuleCondition cond = m_rule.ConditionList[i];
                MethodInfo    mi   = m_instance.GetType().GetMethod("_EvaluateCondition" + i);
                bResult = (bool)mi.Invoke(m_instance, new object[] { m_rule.AppData });
                if (!bResult)
                {
                    return(false);
                }
            }
            return(true);
        }