Beispiel #1
0
        public override object Execute()
        {
            foreach (NewCriteria <T> criteria in _criterias)
            {
                if (criteria != null)
                {
                    switch (criteria.Criteria)
                    {
                    case Utilites.QueryCriteria.ID:
                        CustomerAccess.GetCustomersByID(Convert.ToInt32(criteria.First));
                        break;

                    case Utilites.QueryCriteria.Bithday:
                        if (criteria.Predicate == "Between")
                        {
                            CustomerAccess.GetCustomersByBirthdayBetween(Convert.ToDateTime(criteria.First),
                                                                         Convert.ToDateTime(criteria.Second));
                        }
                        else
                        {
                            CustomerAccess.GetCustomersByBirthOfDay(Convert.ToDateTime(criteria.First),
                                                                    criteria.Predicate);
                        }
                        break;

                    default:
                        CustomerAccess.GetDataByCriteria(criteria.Criteria,
                                                         criteria.Values.Cast <object>().ToArray(), criteria.Predicate);
                        break;
                    }
                }
            }
            return(CustomerAccess.GetData());
        }
Beispiel #2
0
        public void CustomerAccess_GetCustomersByID_TestMethod(int id)
        {
            SqlConnection connection = ConnectionManager.Connection;

            connection.Open();

            CustomerAccess.FillDictionary();
            CustomerAccess.FillCustomerData();
            CustomerAccess.GetCustomersByID(id);
            DataSet dataSet = (DataSet)CustomerAccess.GetData();

            Assert.IsTrue(dataSet.Tables["Customer"].Rows.Count > 0);
        }
Beispiel #3
0
 public object FindByID(int id)
 {
     CustomerAccess.GetCustomersByID(id);
     return(CustomerAccess.GetData());
 }