I am trying to build Rules with my custom UI and execute with CodeDom for my workflow module. I don’t want to use the Rules interface which is given with WF. In order to build/ execute a Rule, I am creating a Condition and ThenAction/ElseActions. At present I am able to execute a single condition successfully. Means Suppose an Order Entity is there with the properties like OrderID, Amount, NoOfItems, Discount, and TotalAmount.
Able to Build the Below condition:
if (this.Amount > 1000)
thisDiscount = 100;
Building Left / Right conditions:
CodePropertyReferenceExpression technologyRef = new CodePropertyReferenceExpression(thisRef, " Amount");
CodePrimitiveExpression wfConstant = new CodePrimitiveExpression(1000);
// if ( this. Amount > 1000)
CodeBinaryOperatorExpression cond = new CodeBinaryOperatorExpression();
cond.Left = technologyRef;
cond.Operator = CodeBinaryOperatorType.GreaterThanOrEqual;
cond.Right = wfConstant;
Rule rule = new Rule("rule1");
rule.Condition = new RuleExpressionCondition(cond);
Not Able to Build the Below condition:
if (this.Amount > 1000 && NoOfItems > 5)
thisDiscount = 150;
Can anyone help me to build multiple conditions for a Rule? Means validation on multiple properties in a single IF statement.