Пример #1
0
 ///<summary>
 /// Returns the filter clause for this control
 ///</summary>
 ///<param name="filterClauseFactory"></param>
 ///<returns></returns>
 public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory)
 {
     if (_comboBox.SelectedIndex > 0)
     {
         if (_comboBox.SelectedIndex != -1 && _comboBox.SelectedItem.ToString().Length > 0)
         {
             var selectedEnum = Enum.Parse(EnumType, _comboBox.SelectedItem.ToString());
             return
                 (filterClauseFactory.CreateEnumFilterClause(_propertyName, _filterClauseOperator,
                                                             selectedEnum));
         }
         return(filterClauseFactory.CreateNullFilterClause());
     }
     return(filterClauseFactory.CreateNullFilterClause());
 }
Пример #2
0
 ///<summary>
 /// Returns the filter clause for this control
 ///</summary>
 ///<param name="filterClauseFactory"></param>
 ///<returns></returns>
 public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory)
 {
     if (_comboBox.SelectedIndex != -1 && _comboBox.SelectedItem.ToString().Length > 0)
     {
         return
             (filterClauseFactory.CreateStringFilterClause(_propertyName, _filterClauseOperator,
                                                           _comboBox.SelectedItem.ToString()));
     }
     return(filterClauseFactory.CreateNullFilterClause());
 }
        public void TestCompositeWithNullClauses()
        {
            IFilterClause nullFilterClause = itsFilterClauseFactory.CreateNullFilterClause();
            IFilterClause intFilterClause  =
                itsFilterClauseFactory.CreateIntegerFilterClause("TestColumnInt", FilterClauseOperator.OpEquals, 12);
            IFilterClause compositeClause =
                itsFilterClauseFactory.CreateCompositeFilterClause(nullFilterClause, FilterClauseCompositeOperator.OpOr,
                                                                   intFilterClause);

            Assert.AreEqual("TestColumnInt = 12", compositeClause.GetFilterClauseString());
        }
 ///<summary>
 /// Returns the filter clause for this control
 ///</summary>
 ///<param name="filterClauseFactory"></param>
 ///<returns></returns>
 public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory)
 {
     string filterValue = _textBox.Text;
     if (String.IsNullOrEmpty(filterValue)) return filterClauseFactory.CreateNullFilterClause();
     IFilterClause currentClause = filterClauseFactory.CreateStringFilterClause(_propertyNames[0], _filterClauseOperator, filterValue);
     for (int i = 1; i < _propertyNames.Count; i++)
     {
         IFilterClause rightClause = filterClauseFactory.CreateStringFilterClause(_propertyNames[i], _filterClauseOperator, filterValue);
         currentClause = filterClauseFactory.CreateCompositeFilterClause(currentClause, FilterClauseCompositeOperator.OpOr, rightClause);
     }
     return currentClause;
 }
Пример #5
0
        ///<summary>
        /// Returns the filter clause for this control
        ///</summary>
        ///<param name="filterClauseFactory"></param>
        ///<returns></returns>
        public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory)
        {
            string filterValue = _textBox.Text;

            if (String.IsNullOrEmpty(filterValue))
            {
                return(filterClauseFactory.CreateNullFilterClause());
            }
            IFilterClause currentClause = filterClauseFactory.CreateStringFilterClause(_propertyNames[0], _filterClauseOperator, filterValue);

            for (int i = 1; i < _propertyNames.Count; i++)
            {
                IFilterClause rightClause = filterClauseFactory.CreateStringFilterClause(_propertyNames[i], _filterClauseOperator, filterValue);
                currentClause = filterClauseFactory.CreateCompositeFilterClause(currentClause, FilterClauseCompositeOperator.OpOr, rightClause);
            }
            return(currentClause);
        }
Пример #6
0
        ///<summary>
        /// Returns the filter clause for this control
        ///</summary>
        ///<param name="filterClauseFactory"></param>
        ///<returns></returns>
        public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory)
        {
            if (_dateRangeComboBox.SelectedIndex > 0)
            {
                FilterClauseOperator op          = _includeStartDate ? FilterClauseOperator.OpGreaterThanOrEqualTo : FilterClauseOperator.OpGreaterThan;
                IFilterClause        startClause = filterClauseFactory.CreateDateFilterClause(_propertyName, op, _dateRangeComboBox.StartDate);
                op = _includeEndDate
                    ? FilterClauseOperator.OpLessThanOrEqualTo
                    : FilterClauseOperator.OpLessThan;
                IFilterClause endClause = filterClauseFactory.CreateDateFilterClause(_propertyName, op, _dateRangeComboBox.EndDate);

                return
                    (filterClauseFactory.CreateCompositeFilterClause(startClause, FilterClauseCompositeOperator.OpAnd,
                                                                     endClause));
            }
            return(filterClauseFactory.CreateNullFilterClause());
        }
Пример #7
0
        /// <summary>
        /// See <see cref="IFilterControl.GetFilterClause"/>
        /// </summary>
        public IFilterClause GetFilterClause()
        {
            if (_filterControls.Count == 0)
            {
                return(_clauseFactory.CreateNullFilterClause());
            }
            ICustomFilter filterUi = _filterControls[0];
            IFilterClause clause   = filterUi.GetFilterClause(_clauseFactory);

            for (int i = 1; i < _filterControls.Count; i++)
            {
                filterUi = _filterControls[i];
                clause   =
                    _clauseFactory.CreateCompositeFilterClause(clause, FilterClauseCompositeOperator.OpAnd,
                                                               filterUi.GetFilterClause(_clauseFactory));
            }
            return(clause);
        }
Пример #8
0
 ///<summary>
 /// Returns the filter clause for this control
 ///</summary>
 ///<param name="filterClauseFactory"></param>
 ///<returns></returns>
 public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory)
 {
     return(_textBox.Text.Length > 0
                ? filterClauseFactory.CreateStringFilterClause(_propertyName, _filterClauseOperator, _textBox.Text)
                : filterClauseFactory.CreateNullFilterClause());
 }
 ///<summary>
 /// Returns the filter clause for this control
 ///</summary>
 ///<param name="filterClauseFactory"></param>
 ///<returns></returns>
 public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory) {
     if (_comboBox.SelectedIndex > 0)
     {
         if (_comboBox.SelectedIndex != -1 && _comboBox.SelectedItem.ToString().Length > 0)
         {
             var selectedEnum = Enum.Parse(EnumType, _comboBox.SelectedItem.ToString());
             return
                 filterClauseFactory.CreateEnumFilterClause(_propertyName, _filterClauseOperator,
                                                         selectedEnum);
         }
         return filterClauseFactory.CreateNullFilterClause();
     }
     return filterClauseFactory.CreateNullFilterClause();
 }
 ///<summary>
 /// Returns the filter clause for this control
 ///</summary>
 ///<param name="filterClauseFactory"></param>
 ///<returns></returns>
 public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory) {
     return string.IsNullOrEmpty(_constantvalue)
                ? filterClauseFactory.CreateNullFilterClause()
                : filterClauseFactory.CreateStringFilterClause(_propertyName, _filterClauseOperator, _constantvalue);
 }
Пример #11
0
 ///<summary>
 /// Returns the filter clause for this control
 ///</summary>
 ///<param name="filterClauseFactory"></param>
 ///<returns></returns>
 public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory)
 {
     return(string.IsNullOrEmpty(_constantvalue)
                ? filterClauseFactory.CreateNullFilterClause()
                : filterClauseFactory.CreateStringFilterClause(_propertyName, _filterClauseOperator, _constantvalue));
 }
 ///<summary>
 /// Returns the filter clause for this control
 ///</summary>
 ///<param name="filterClauseFactory"></param>
 ///<returns></returns>
 public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory) {
     if (_comboBox.SelectedIndex != -1 && _comboBox.SelectedItem.ToString().Length > 0)
     {
         return
             filterClauseFactory.CreateStringFilterClause(_propertyName, _filterClauseOperator,
                                                     _comboBox.SelectedItem.ToString());
     }
     return filterClauseFactory.CreateNullFilterClause();
 }
        ///<summary>
        /// Returns the filter clause for this control
        ///</summary>
        ///<param name="filterClauseFactory"></param>
        ///<returns></returns>
        public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory) {
            if (_dateRangeComboBox.SelectedIndex > 0)
            {
                FilterClauseOperator op = _includeStartDate ? FilterClauseOperator.OpGreaterThanOrEqualTo : FilterClauseOperator.OpGreaterThan;
                IFilterClause startClause = filterClauseFactory.CreateDateFilterClause(_propertyName, op, _dateRangeComboBox.StartDate);
                op = _includeEndDate
                    ? FilterClauseOperator.OpLessThanOrEqualTo
                    : FilterClauseOperator.OpLessThan;
                IFilterClause endClause = filterClauseFactory.CreateDateFilterClause(_propertyName, op, _dateRangeComboBox.EndDate);

                return
                    filterClauseFactory.CreateCompositeFilterClause(startClause, FilterClauseCompositeOperator.OpAnd,
                                                               endClause);
            }
            return filterClauseFactory.CreateNullFilterClause();
        }