Exemple #1
0
        private RuleExpressionCondition SetRuleCondition(RuleExpressionCondition condition, ConditionObject conditionObj)
        {
            CodeBinaryOperatorExpression operatorExpression = (CodeBinaryOperatorExpression)condition.Expression;

            CodePropertyReferenceExpression leftExpression = (CodePropertyReferenceExpression)operatorExpression.Left;
            leftExpression.PropertyName = conditionObj.field;

            CodePrimitiveExpression rightExpression = (CodePrimitiveExpression)operatorExpression.Right;
            rightExpression.Value = conditionObj.value;

            return condition;
        }
        private ConditionObject RuleObjectCondition(RuleExpressionCondition condition)
        {
            ConditionObject conditionObj = new ConditionObject();

            CodeBinaryOperatorExpression operatorExpression = (CodeBinaryOperatorExpression)condition.Expression;

            CodeFieldReferenceExpression leftExpression = (CodeFieldReferenceExpression)operatorExpression.Left;
            conditionObj.field = leftExpression.FieldName;

            CodePrimitiveExpression rightExpression = (CodePrimitiveExpression)operatorExpression.Right;
            conditionObj.value = rightExpression.Value.ToString();

            return conditionObj;
        }