Exemplo n.º 1
0
        public List <Products> GetProducts(SortDefinitions sortDefinitions, int startIndex, int pageSize)
        {
            string sqlText;
            var    sortText = GetSortText(sortDefinitions);

            if (startIndex > -1 && pageSize > 0)
            {
                sqlText = GetPagedQuery(sortText, startIndex, pageSize);
            }
            else
            {
                sqlText = GetProductsSQL();
            }

            return(_database.CreateSqlStringAccessor <Products>(sqlText).Execute().ToList());
        }
Exemplo n.º 2
0
        private string GetSortText(SortDefinitions sortDefinitions)
        {
            string sortDefinition;

            if (sortDefinitions != null && sortDefinitions.SoftItems.Count > 0)
            {
                sortDefinition = string.Join(" , ", sortDefinitions.SoftItems.Select(p => string.Format("{0} {1}", p.ColumnName, (p.SortOrder == SortOrder.None)?"":p.SortOrder.ToString())));

                sortDefinition = string.Format(" ORDER BY {0}", sortDefinition);
            }
            else
            {
                sortDefinition = "ORDER BY " + string.Join(",", KeyColumns);
            }
            return(sortDefinition);
        }
 public List <Products> GetAllBySortingAndPaged(SortDefinitions sortDefinitions, int startIndex, int pageSize)
 {
     return(_productsDao.GetProducts(sortDefinitions, startIndex, pageSize));
 }
 public List <Categories> GetAllBySorting(SortDefinitions sortDefinitions)
 {
     return(_categoriesDao.GetCategories(sortDefinitions, -1, 0));
 }
 public List <Categories> GetAllBySortingAndPaged(SortDefinitions sortDefinitions, int startIndex, int pageSize)
 {
     return(_categoriesDao.GetCategories(sortDefinitions, startIndex, pageSize));
 }
 public List <Customers> GetAllBySorting(SortDefinitions sortDefinitions)
 {
     return(_customersDao.GetCustomers(sortDefinitions, -1, 0));
 }
 public List <Customers> GetAllBySortingAndPaged(SortDefinitions sortDefinitions, int startIndex, int pageSize)
 {
     return(_customersDao.GetCustomers(sortDefinitions, startIndex, pageSize));
 }
 public List <Products> GetAllBySorting(SortDefinitions sortDefinitions)
 {
     return(_productsDao.GetProducts(sortDefinitions, -1, 0));
 }