public ProductCollectionInfo Get(int pageNumber, int pageSize) { try { var products = _commonDb.Query <ProductWithDescription>($"select * from ({SubQuery}) subQuery order by code offset {pageNumber * pageSize - pageSize} rows fetch next {pageSize} rows only"); var collectionInfo = new ProductCollectionInfo(); _commonDb.GetPageCount(pageSize, "select count(1) from products", collectionInfo); collectionInfo.Entities = products; return(collectionInfo); } catch (Exception e) { throw new ProductOperationException($"Products get error!", e); } }
public IEntityCollectionInfo <Product> GetEntityCollectionInfo(int pageNumber, int pageSize) { var collectionInfo = new ProductCollectionInfo(); collectionInfo.Entities = _commonDb.Query <Product>($"select * from products order by id offset {pageNumber * pageSize - pageSize} rows fetch next {pageSize} rows only"); _commonDb.GetPageCount(pageSize, "select count(1) from products", collectionInfo); return(collectionInfo); }
public IEntityCollectionInfo <MenuOnDay> GetEntityCollectionInfo(int pageNumber, int pageSize) { var collectionInfo = new MenuOnDayCollectionInfo(); collectionInfo.Entities = _commonDb.Query <MenuOnDay>($"select * from MenuOnDay order by date desc offset {pageNumber * pageSize - pageSize} rows fetch next {pageSize} rows only"); _commonDb.GetPageCount(pageSize, "select count(1) from MenuOnDay", collectionInfo); return(collectionInfo); }
public IEntityCollectionInfo <Dish> GetEntityCollectionInfo(int pageNumber, int pageSize) { var collectionInfo = new DishCollectionInfo(); collectionInfo.Entities = _commonDb.Query <Dish>( $"select * from Dish order by d.Id offset {pageNumber * pageSize - pageSize} rows fetch next {pageSize} rows.only"); _commonDb.GetPageCount(pageSize, "select count(1) from Dish", collectionInfo); return(collectionInfo); }
public UnitCollectionInfo Get(int pageNumber, int pageSize) { try { var collectionInfo = new UnitCollectionInfo(); collectionInfo.Entities = _commonDb.Query <ProductUnit>($"select * from units order by code offset {pageNumber*pageSize-pageSize} rows fetch next {pageSize} rows only"); _commonDb.GetPageCount(pageSize, "select count(1) from units", collectionInfo); return(collectionInfo); } catch (Exception e) { throw new ProductUnitOperationException($"Units get error!", e); } }
public CategoryCollectionInfo Get(int pageNumber, int pageSize) { try { var collectionInfo = new CategoryCollectionInfo(); var query = $"select * from categories order by code offset {pageNumber * pageSize - pageSize} rows fetch next {pageSize} rows only"; collectionInfo.Entities = _commonDb.Query <ProductCategory>(query); _commonDb.GetPageCount(pageSize, $"select count(1) from categories", collectionInfo); return(collectionInfo); } catch (Exception e) { throw new CategoryOperationException($"Categories get error!", e); } }