Exemplo n.º 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());
 }
Exemplo n.º 2
0
        public void Test_FilterClause_WithEnum()
        {
            //---------------Set up test pack-------------------

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            IFilterClause filterClause =
                _filterClauseFactory.CreateEnumFilterClause("TestColumn", FilterClauseOperator.OpEquals, PurchaseOrderStatus.Processed);

            //---------------Test Result -----------------------
            string expectedFilterClause = string.Format("TestColumn = '{0}'", PurchaseOrderStatus.Processed);

            Assert.AreEqual(expectedFilterClause, filterClause.GetFilterClauseString("%", "'"));
        }
 ///<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();
 }