Пример #1
0
        public void Test_Search_DateEquals()
        {
            DateTime filterValue = DateTime.Now.AddDays(-2);
            //---------------Execute Test ----------------------
            IFilterClause filterClause =
                _filterClauseFactory.CreateDateFilterClause("TestColumn", FilterClauseOperator.OpEquals, filterValue);
            //---------------Test Result -----------------------
            string expectedFilterClause = string.Format("TestColumn = '{0}'", filterValue.ToString("dd MMM yyyy HH:mm:ss"));

            Assert.AreEqual(expectedFilterClause, filterClause.GetFilterClauseString("%", "'"));
        }
Пример #2
0
        ///<summary>
        /// Returns the filter clause for this control
        ///</summary>
        ///<param name="filterClauseFactory"></param>
        ///<returns></returns>
        public virtual IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory)
        {
            DateTime date = _dateTimePicker.Value;

            date = date.Date;
            if (_filterClauseOperator == FilterClauseOperator.OpLike)
            {
                IFilterClause startClause = filterClauseFactory.CreateDateFilterClause(
                    _propertyName, FilterClauseOperator.OpGreaterThanOrEqualTo, date);
                IFilterClause endClause = filterClauseFactory.CreateDateFilterClause(
                    _propertyName, FilterClauseOperator.OpLessThan, date.AddDays(1));
                return(filterClauseFactory.CreateCompositeFilterClause(
                           startClause, FilterClauseCompositeOperator.OpAnd, endClause));
            }
            return(filterClauseFactory.CreateDateFilterClause(_propertyName, _filterClauseOperator, date));
        }
Пример #3
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());
        }
 ///<summary>
 /// Returns the filter clause for this control
 ///</summary>
 ///<param name="filterClauseFactory"></param>
 ///<returns></returns>
 public virtual IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory) {
     DateTime date = _dateTimePicker.Value;
     date = date.Date;
     if (_filterClauseOperator == FilterClauseOperator.OpLike)
     {
         IFilterClause startClause = filterClauseFactory.CreateDateFilterClause(
             _propertyName, FilterClauseOperator.OpGreaterThanOrEqualTo, date);
         IFilterClause endClause = filterClauseFactory.CreateDateFilterClause(
             _propertyName, FilterClauseOperator.OpLessThan, date.AddDays(1));
         return filterClauseFactory.CreateCompositeFilterClause(
             startClause, FilterClauseCompositeOperator.OpAnd, endClause);
     }
     return filterClauseFactory.CreateDateFilterClause(_propertyName, _filterClauseOperator, date);
 }
        ///<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();
        }