public void FinBy_test(string criteria, string value, string value2)
        {
            CustomRepository <string> repo = new CustomRepository <string>();
            DateTime date1, date2;
            DataSet  ds;

            if (DateTime.TryParse(value, out date1) && DateTime.TryParse(value2, out date2))
            {
                ds = (DataSet)repo.FindBy(criteria, date1, date2, "МЕЖДУ");
            }
            else
            {
                ds = (DataSet)repo.FindBy(criteria, new string[] { value, value2 });
            }
            Assert.IsTrue(ds.Tables["Customer"].Rows.Count > 0);
        }
Exemple #2
0
        public object GetCustomersByBirthday(DateTime date)
        {
            _lastQuery = QueryCriteria.Bithday;
            _paramsObjects.Clear();
            _paramsObjects.Add(date);
            CustomRepository <DateTime> _repo = new CustomRepository <DateTime>();

            return(_repo.FindBy(QueryCriteria.Bithday, date));
        }
Exemple #3
0
        public object GetCustomersByLastName(string lastName)
        {
            _lastQuery = QueryCriteria.LastName;
            _paramsObjects.Clear();
            _paramsObjects.Add(lastName);
            CustomRepository <string> _repo = new CustomRepository <string>();

            return(_repo.FindBy(QueryCriteria.LastName, lastName));
        }
Exemple #4
0
        public object GetCustomerByAddress(string streetName, string city = "Славянск")
        {
            _lastQuery = QueryCriteria.Address;
            _paramsObjects.Clear();
            _paramsObjects.Add(streetName);
            _paramsObjects.Add(city);
            var _repo = new CustomRepository <string>();

            return(_repo.FindBy(QueryCriteria.Address, new [] { city, streetName }));
        }
Exemple #5
0
        private Object FillData()
        {
            switch (_lastQuery)
            {
            case QueryCriteria.LastName:
                CustomRepository <string> repo = new CustomRepository <string>();
                return(repo.FindBy(QueryCriteria.LastName, _paramsObjects[0].ToString()));

            case QueryCriteria.Address:
                repo = new CustomRepository <string>();
                return(repo.FindBy(QueryCriteria.Address, _paramsObjects.Cast <string>().ToArray()));

            case QueryCriteria.Bithday:
                CustomRepository <DateTime> repo2 = new CustomRepository <DateTime>();
                if (_paramsObjects.Count == 2)
                {
                    return(repo2.FindByPredicate(QueryCriteria.Bithday, Convert.ToDateTime(_paramsObjects[0]),
                                                 _paramsObjects[1].ToString()));
                }
                else if (_paramsObjects.Count == 3)
                {
                    return(repo2.FindByBetween(QueryCriteria.Bithday, Convert.ToDateTime(_paramsObjects[0]),
                                               Convert.ToDateTime(_paramsObjects[0])));
                }
                else
                {
                    return(repo2.FindBy(QueryCriteria.Bithday, _paramsObjects.Cast <DateTime>().ToArray()));
                }

            case QueryCriteria.Glossary:
                return(_glossaryRepository.FindBy(_paramsObjects[0].ToString(), (int)_paramsObjects[1]));

            case QueryCriteria.GetGlossaries:
                return(_glossaryRepository.FillAll());

            default:
            {
                return(FillAllCustomers());
            }
            }
        }