Beispiel #1
0
        internal object[] GetPredicateValues(FilterPredicate predicate)
        {
            int length = Math.Min(predicate.Values.Count, predicate.FilterFunction.ParameterCount);

            object[] objArray = new object[length];
            for (int index = 0; index < length; ++index)
            {
                object key = predicate.Values[index];
                objArray[index] = this.IsParameter(key) ? this.parameters[(string)key] : key;
            }
            return(objArray);
        }
Beispiel #2
0
        internal static string GetExpression(
            FilterExpression filterExpression,
            FilterPredicate predicate)
        {
            string name = DataUtils.EscapeName(filterExpression.FieldName);
            string str  = FilterExpression.GetCompositeExpression(name, predicate.Function, (object)predicate.Values);

            if (string.IsNullOrEmpty(str))
            {
                str = FilterExpression.GetSingleExpression(name, predicate.Function, (object)predicate.Values);
            }
            return(str);
        }
Beispiel #3
0
        public int GetValidPredicateCount()
        {
            int num = 0;

            for (int index = 0; index < this.predicates.Count; ++index)
            {
                FilterPredicate predicate = this.predicates[index];
                if (predicate != null && predicate.Function != GridKnownFunction.NoFilter && this.IsPredicateValid(predicate))
                {
                    ++num;
                }
            }
            return(num);
        }
Beispiel #4
0
 private bool IsPredicateValid(FilterPredicate filterPredicate)
 {
     object[] predicateValues = this.GetPredicateValues(filterPredicate);
     if (predicateValues.Length == 0)
     {
         return(false);
     }
     for (int index = 0; index < predicateValues.Length; ++index)
     {
         if (predicateValues[index] == null)
         {
             return(false);
         }
     }
     return(true);
 }
Beispiel #5
0
        public override bool Equals(object obj)
        {
            FilterPredicate filterPredicate = obj as FilterPredicate;

            if (filterPredicate == null || this.function != filterPredicate.function || (this.binaryOperator != filterPredicate.BinaryOperator || this.values.Count != filterPredicate.values.Count))
            {
                return(false);
            }
            for (int index = 0; index < this.values.Count; ++index)
            {
                if (this.values[index] != filterPredicate.values[index])
                {
                    return(false);
                }
            }
            return(true);
        }