private Parsers.IExpression parseBinaryExpression(Expression expression) { Parsers.IExpression result = null; BinaryExpression binaryExpression = expression as BinaryExpression; if (binaryExpression != null) { var nodeType = binaryExpression.NodeType; if (nodeType == ExpressionType.AndAlso || nodeType == ExpressionType.OrElse) { var conditionExpression = new Parsers.ConditionalExpression(); conditionExpression.Left = getExpression(binaryExpression.Left); conditionExpression.Right = getExpression(binaryExpression.Right); switch (nodeType) { case ExpressionType.AndAlso: conditionExpression.Operator = Parsers.BooleanOperator.And; break; case ExpressionType.OrElse: conditionExpression.Operator = Parsers.BooleanOperator.Or; break; } result = conditionExpression; } else { Parsers.DataFieldExpression fieldExpression = null; switch (nodeType) { case ExpressionType.Equal: fieldExpression = createDataFieldExpression(Parsers.ConditionalOperator.Equals, binaryExpression); break; case ExpressionType.NotEqual: fieldExpression = createDataFieldExpression(Parsers.ConditionalOperator.NotEquals, binaryExpression); break; case ExpressionType.LessThan: fieldExpression = createDataFieldExpression(Parsers.ConditionalOperator.Less, binaryExpression); break; case ExpressionType.LessThanOrEqual: fieldExpression = createDataFieldExpression(Parsers.ConditionalOperator.EqualsOrLess, binaryExpression); break; case ExpressionType.GreaterThan: fieldExpression = createDataFieldExpression(Parsers.ConditionalOperator.Greater, binaryExpression); break; case ExpressionType.GreaterThanOrEqual: fieldExpression = createDataFieldExpression(Parsers.ConditionalOperator.EqualsOrGereater, binaryExpression); break; } result = fieldExpression; } } return(result); }
private Parsers.IExpression parseBinaryExpression(Expression expression) { Parsers.IExpression result = null; BinaryExpression binaryExpression = expression as BinaryExpression; if (binaryExpression != null) { var nodeType = binaryExpression.NodeType; if (nodeType == ExpressionType.AndAlso || nodeType == ExpressionType.OrElse) { var conditionExpression = new Parsers.ConditionalExpression(); conditionExpression.Left = getExpression(binaryExpression.Left); conditionExpression.Right = getExpression(binaryExpression.Right); switch (nodeType) { case ExpressionType.AndAlso: conditionExpression.Operator = Parsers.BooleanOperator.And; break; case ExpressionType.OrElse: conditionExpression.Operator = Parsers.BooleanOperator.Or; break; } result = conditionExpression; } else { Parsers.DataFieldExpression fieldExpression = null; switch (nodeType) { case ExpressionType.Equal: fieldExpression = createDataFieldExpression(Parsers.ConditionalOperator.Equals, binaryExpression); break; case ExpressionType.NotEqual: fieldExpression = createDataFieldExpression(Parsers.ConditionalOperator.NotEquals, binaryExpression); break; case ExpressionType.LessThan: fieldExpression = createDataFieldExpression(Parsers.ConditionalOperator.Less, binaryExpression); break; case ExpressionType.LessThanOrEqual: fieldExpression = createDataFieldExpression(Parsers.ConditionalOperator.EqualsOrLess, binaryExpression); break; case ExpressionType.GreaterThan: fieldExpression = createDataFieldExpression(Parsers.ConditionalOperator.Greater, binaryExpression); break; case ExpressionType.GreaterThanOrEqual: fieldExpression = createDataFieldExpression(Parsers.ConditionalOperator.EqualsOrGereater, binaryExpression); break; } result = fieldExpression; } } return result; }