Esempio n. 1
0
 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);
     }
 }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        /// <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);
        }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
 protected void AddRestriction <T>(string column, EOperator op, InterRestrictionOperator interRestrictionOperator, int level, params object[] values)
 {
     AddRestriction(CreateRestriction <T>(column, op, interRestrictionOperator, level, values));
 }
Esempio n. 8
0
 protected void AddRestriction(string fullColumnName, EOperator op, InterRestrictionOperator interRestrictionOperator, int level, params object[] values)
 {
     AddRestriction(CreateRestriction(fullColumnName, op, interRestrictionOperator, level, values));
 }
Esempio n. 9
0
 private StringRestrictionBuilder Add(string column, EOperator op, InterRestrictionOperator andOr, int level, params object[] values)
 {
     AddRestriction(column, op, andOr, level, values);
     return(this);
 }