Exemplo n.º 1
0
 public void Process(CriteriaOperator operand, bool mustBeLogical)
 {
     if (ReferenceEquals(operand, null)) return;
     if (mustBeLogical) {
         if ((BooleanCriteriaState)operand.Accept(this) == BooleanCriteriaState.Value) throw new ArgumentException(MustBeLogical);
     } else {
         if ((BooleanCriteriaState)operand.Accept(this) == BooleanCriteriaState.Logical) throw new ArgumentException(MustBeArithmetical);
     }
 }
Exemplo n.º 2
0
 public void Process(CriteriaOperator criteria)
 {
     if (!ReferenceEquals(criteria, null))
     {
         criteria.Accept(this);
     }
 }
Exemplo n.º 3
0
        private OperandValue GetCustomFunctionOperandValue(CriteriaOperator theOperator)
        {
            var functionOperator = theOperator as FunctionOperator;

            return(!ReferenceEquals(functionOperator, null)? (functionOperator.OperatorType == FunctionOperatorType.Custom
                    ? new OperandValue(theOperator.Accept(this)): null): null);
        }
 public CriteriaOperator ReplaceCriteriaByFieldName(List <string> fieldsToReplace, CriteriaOperator op)
 {
     if (fieldsToReplace.Count == 0)
     {
         return(null);
     }
     this.fieldsToReplace = fieldsToReplace;
     return(op.Accept <CriteriaOperator>(this));
 }
Exemplo n.º 5
0
        private static CriteriaOperator ValidatePrefilterCriteria(CriteriaOperator criteria)
        {
            if (ReferenceEquals(criteria, null))
            {
                return(null);
            }
            var validator = new FilterValidator();

            return(criteria.Accept(validator) as CriteriaOperator);
        }
Exemplo n.º 6
0
        internal IList GetDataSource(object forObject)
        {
            CriteriaOperator criteria = null;

            if (Properties == null)
            {
                return(null);
            }
            IList propertyDataSource =
                (Properties.DataSourceMemberInfo != null) &&
                (GridEditingObject != null)
                    ? Properties.DataSourceMemberInfo.GetValue(forObject) as IList
                    : null;
            IList dataSource = new List <ImageComboBoxItem>();

            if (propertyDataSource == null)
            {
                for (int i = 0; i < Properties.Items.Count; i++)
                {
                    dataSource.Add(Properties.Items[i]);
                }
            }
            else
            {
                for (int i = 0; i < Properties.Items.Count; i++)
                {
                    ImageComboBoxItem item = Properties.Items[i];
                    if (propertyDataSource.Contains(item.Value))
                    {
                        dataSource.Add(item);
                    }
                }
            }
            string criteriaString = Properties.Model.DataSourceCriteria;

            if (!String.IsNullOrEmpty(criteriaString))
            {
                criteria = CriteriaOperator.Parse(criteriaString);
            }
            if (!ReferenceEquals(criteria, null))
            {
                criteria.Accept(new EnumCriteriaParser(
                                    Properties.PropertyMemberInfo.Name,
                                    Properties.PropertyMemberInfo.MemberType));
                ICollection filteredDataSource =
                    new ExpressionEvaluator(ImageComboBoxItemProperties, criteria, true).Filter(dataSource);
                dataSource.Clear();
                foreach (ImageComboBoxItem item in filteredDataSource)
                {
                    dataSource.Add(item);
                }
            }
            return(dataSource);
        }
Exemplo n.º 7
0
        IEnumerable GetDataSource()
        {
            IEnumerable dataSource = null;

            if (_dataSourceProperty != null)
            {
                dataSource = _dataSourceProperty.GetValue(CurrentObject, null) as IEnumerable;
                if (dataSource != null)
                {
                    bool hasItems = (dataSource).GetEnumerator().MoveNext();
                    if (!hasItems)
                    {
                        dataSource = null;
                    }
                }
            }
            if (dataSource == null)
            {
                if (string.IsNullOrEmpty(_isNullCriteria))
                {
                    if (_isNullMode == DataSourcePropertyIsNullMode.SelectAll)
                    {
                        return(descriptor.Values);
                    }
                    if (_isNullMode == DataSourcePropertyIsNullMode.SelectNothing)
                    {
                        return(null);
                    }
                }
                else
                {
                    CriteriaOperator criteriaOperator = CriteriaOperator.Parse(_isNullCriteria);
                    if (!ReferenceEquals(criteriaOperator, null))
                    {
                        dataSource = new List <object>();
                        foreach (object item in descriptor.Values)
                        {
                            ((IList)dataSource).Add(CreateEditItem(item));
                        }
                        criteriaOperator.Accept(new EnumCriteriaParser(PropertyName, _propertyType));
                        var filteredDataSource = new ExpressionEvaluator(PropertyDescriptorCollection, criteriaOperator, true).Filter(dataSource);
                        ((IList)dataSource).Clear();
                        foreach (ListEditItem item in filteredDataSource)
                        {
                            ((IList)dataSource).Add(item);
                        }
                    }
                }
            }
            return(dataSource);
        }
Exemplo n.º 8
0
 public BooleanCriteriaState Process(CriteriaOperator operand)
 {
     if(ReferenceEquals(operand, null)) return BooleanCriteriaState.Logical;
     return (BooleanCriteriaState)operand.Accept(this);
 }
Exemplo n.º 9
0
 public void Validate(CriteriaOperator criteria)
 {
     if(!ReferenceEquals(criteria, null))
         criteria.Accept(this);
 }
Exemplo n.º 10
0
 protected object Process(CriteriaOperator operand)
 {
     if(ReferenceEquals(operand, null))
         return null;
     object value = operand.Accept(this);
     return FixValue(value);
 }
Exemplo n.º 11
0
 private CriteriaOperator Process(CriteriaOperator operand)
 {
     if (!ReferenceEquals(operand, null))
         return (CriteriaOperator)operand.Accept(this);
     return null;
 }
Exemplo n.º 12
0
 private void Process(CriteriaOperator operand)
 {
     if (!ReferenceEquals(operand, null))
         operand.Accept(this);
 }
Exemplo n.º 13
0
 private OperandValue GetCustomFunctionOperandValue(CriteriaOperator theOperator){
     var functionOperator = theOperator as FunctionOperator;
     return !ReferenceEquals(functionOperator,null)? (functionOperator.OperatorType == FunctionOperatorType.Custom
             ? new OperandValue(theOperator.Accept(this)): null): null;
 }
Exemplo n.º 14
0
        private object Accept(CriteriaOperator criteriaOperator)
        {
            if (ReferenceEquals(criteriaOperator, null))
            {
                return null;
            }

            object value = criteriaOperator.Accept(this);
            return value == DBNull.Value ? null : value;
        }
Exemplo n.º 15
0
 public static object Process(CriteriaOperator op, List<XPMemberInfo> memberInfos) {
     return op.Accept(new FullTextOperatorProcessor(memberInfos)) ;
 }
Exemplo n.º 16
0
 public static object Process(CriteriaOperator op, IEnumerable <XPMemberInfo> memberInfos)
 {
     return(op.Accept(new FullTextOperatorProcessor(memberInfos)));
 }
Exemplo n.º 17
0
 public static string Process(CriteriaOperator op)
 {
     return(op.Accept(new CustomCriteriaToLinqWhereParser()).ToString());
 }
Exemplo n.º 18
0
 // Возвращает формат агрегированного значения указанного выражения
 public static string GetSelectValue(CriteriaOperator aggregateProperty, Aggregate aggregate, SelectSqlGeneratorBase generator)
 {
     string property = ReferenceEquals(aggregateProperty, null) ? "*" : (string)aggregateProperty.Accept(generator);
     return String.Format(agg[(int)aggregate], property);
 }