Esempio n. 1
0
        public void Test_Search_EqualsWithString()
        {
            //---------------Execute Test ----------------------
            IFilterClause filterClause =
                _filterClauseFactory.CreateStringFilterClause("TestColumn", FilterClauseOperator.OpEquals, "testvalue");

            //---------------Test Result -----------------------
            Assert.AreEqual("TestColumn = 'testvalue'", filterClause.GetFilterClauseString("%", ""));
            //---------------Tear Down -------------------------
        }
 ///<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;
 }
Esempio n. 3
0
 ///<summary>
 /// Returns the filter clause for this control
 ///</summary>
 ///<param name="filterClauseFactory"></param>
 ///<returns></returns>
 public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory)
 {
     if (_checkBox.Checked)
     {
         return
             (filterClauseFactory.CreateStringFilterClause(_propertyName,
                                                           FilterClauseOperator.OpEquals, "true"));
     }
     return
         (filterClauseFactory.CreateStringFilterClause(_propertyName,
                                                       FilterClauseOperator.OpEquals, "false"));
 }
        public void TestCompositeWithAnd()
        {
            IFilterClause stringFilterClause =
                itsFilterClauseFactory.CreateStringFilterClause("TestColumnString", FilterClauseOperator.OpEquals,
                                                                "testvalue");
            IFilterClause intFilterClause =
                itsFilterClauseFactory.CreateIntegerFilterClause("TestColumnInt", FilterClauseOperator.OpEquals, 12);
            IFilterClause compositeClause =
                itsFilterClauseFactory.CreateCompositeFilterClause(stringFilterClause,
                                                                   FilterClauseCompositeOperator.OpAnd, intFilterClause);

            Assert.AreEqual("(TestColumnString = 'testvalue') and (TestColumnInt = 12)",
                            compositeClause.GetFilterClauseString());
        }
Esempio n. 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);
        }
Esempio n. 6
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());
 }
Esempio n. 7
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) {
     return string.IsNullOrEmpty(_constantvalue)
                ? filterClauseFactory.CreateNullFilterClause()
                : filterClauseFactory.CreateStringFilterClause(_propertyName, _filterClauseOperator, _constantvalue);
 }
 public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory)
 {
     return filterClauseFactory.CreateStringFilterClause(PropertyName, FilterClauseOperator.OpEquals, _box.Text);
 }
Esempio n. 10
0
 public IFilterClause GetFilterClause(IFilterClauseFactory filterClauseFactory)
 {
     return(filterClauseFactory.CreateStringFilterClause(PropertyName, FilterClauseOperator.OpEquals, _box.Text));
 }
Esempio n. 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 (_checkBox.Checked)
     {
         return
             filterClauseFactory.CreateStringFilterClause(_propertyName,
                                                     FilterClauseOperator.OpEquals, "true");
     }
     return
         filterClauseFactory.CreateStringFilterClause(_propertyName,
                                                 FilterClauseOperator.OpEquals, "false");
 }
 ///<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();
 }