private void ProcessNodeType(BinaryExpression expression) { if (IsLogicalOperator(expression.NodeType) && ExpressionTypeMap.InterRestrictionOperatorMap.ContainsKey(expression.NodeType)) { _lastInterOperator = ExpressionTypeMap.InterRestrictionOperatorMap[expression.NodeType]; } else if (ExpressionTypeMap.OperatorMap.ContainsKey(expression.NodeType)) { // Check if this should be a null operator, else choose the mapped operator if (expression.NodeType == ExpressionType.Equal && ( (expression.Left is ConstantExpression && (expression.Left as ConstantExpression).Value == null) || (expression.Right is ConstantExpression && (expression.Right as ConstantExpression).Value == null))) { _current.Operator = EOperator.IsNull; } else { _current.Operator = ExpressionTypeMap.OperatorMap[expression.NodeType]; } } else { //we don't know the nodeType and cannot handle it, throw exception by visiting base base.VisitBinary(expression); } }
protected void SetPrevInterRestrictionOperator(InterRestrictionOperator interRestrictionOperator) { if (GetRestrictions().Count > 0) { //set interoperator of last item GetRestrictions().LastOrDefault().InterOperator = interRestrictionOperator; } }
private void ProcessNodeType(BinaryExpression expression) { if (IsLogicalOperator(expression.NodeType) && ExpressionTypeMap.InterRestrictionOperatorMap.ContainsKey(expression.NodeType)) { _lastInterOperator = ExpressionTypeMap.InterRestrictionOperatorMap[expression.NodeType]; } else if (ExpressionTypeMap.OperatorMap.ContainsKey(expression.NodeType)) { _current.Operator = ExpressionTypeMap.OperatorMap[expression.NodeType]; } else { //we don't know the nodeType and cannot handle it, throw exception by visiting base base.VisitBinary(expression); } }
public void Add(string property, EOperator op, int level, InterRestrictionOperator interOperator, object value) { string column = DynamicPropertyHelper.GetColumnName <T>(property); AddRestriction <T>(column, op, interOperator, level, value); }
/// <summary> /// Create the SuperOffice restriction /// </summary> /// <param name="fullColumnName">Column name including table (dot syntax)</param> /// <param name="op">Operator to compare value</param> /// <param name="interRestrictionOperator">And / Or</param> /// <param name="level">Level of the restriction (for parenthesis). This corrosponds directly with the InterParenthesis value of a SuperOffice ArchiveRestrictionInfo</param> /// <param name="values">Value(s) for column comparison in restriction</param> /// <returns>Newly created archive restriction info</returns> protected ArchiveRestrictionInfo CreateRestriction(string fullColumnName, EOperator op, InterRestrictionOperator interRestrictionOperator, int level, params object[] values) { ArchiveRestrictionInfo r = new ArchiveRestrictionInfo(); r.Name = fullColumnName; r.Operator = op.ToString().ToLower(); r.Values = ConvertValues(values); r.InterParenthesis = level; r.IsActive = true; SetPrevInterRestrictionOperator(interRestrictionOperator); return(r); }
protected ArchiveRestrictionInfo CreateRestriction <T>(string column, EOperator op, InterRestrictionOperator interRestrictionOperator, int level, params object[] values) { string fullColumnName = DynamicPropertyHelper.GetFullDotSyntaxColumnName <T>(column); return(CreateRestriction(fullColumnName, op, interRestrictionOperator, level, values)); }
protected void AddRestriction <T>(string column, EOperator op, InterRestrictionOperator interRestrictionOperator, int level, params object[] values) { AddRestriction(CreateRestriction <T>(column, op, interRestrictionOperator, level, values)); }
protected void AddRestriction(string fullColumnName, EOperator op, InterRestrictionOperator interRestrictionOperator, int level, params object[] values) { AddRestriction(CreateRestriction(fullColumnName, op, interRestrictionOperator, level, values)); }
private StringRestrictionBuilder Add(string column, EOperator op, InterRestrictionOperator andOr, int level, params object[] values) { AddRestriction(column, op, andOr, level, values); return(this); }