public IEnumerable <Product> PaginationGeneral(int sizePagination, int nowPagination, bool dest, string filter, ProductOderDemoContext db) { List <Product> listProduct = new List <Product>(); ProductOderDemoContext productContext = db; using (productContext = new ProductOderDemoContext()) { int totalRecords = productContext.Product.Count(); int skipRow = (nowPagination - 1) * sizePagination; if (dest) { listProduct = productContext.Product .Skip(skipRow).Take(sizePagination) .ToList(); } if (filter != null && filter != "") { // if(sizePagination==0 && nowPagination == 0) // { // listProduct = productContext.Product // .Where(p => p.ProductName.Contains(filter) || p.OtherProductDetails.Contains(filter) // || p.ProductCategoryCode.Contains(filter) // ) // .ToList(); //} if (sizePagination != 0 && nowPagination != 0) { if (!filter.Equals("") || filter != null) { if (filter.Equals("ALL")) { return(productContext.Product .Skip(skipRow).Take(sizePagination) .ToList()); } else { return(productContext.Product .Where(p => p.ProductName.Contains(filter) || p.OtherProductDetails.Contains(filter) || p.ProductCategoryCode.Contains(filter) ) .Skip(skipRow).Take(sizePagination) .ToList()); } } } if (sizePagination == 0 && nowPagination == 0 && filter.Equals("ALL")) { return(productContext.Product.ToList()); } else { return(new List <Product>()); } } } return(listProduct); }
public IEnumerable <Customer> PaginationGeneral(int sizePagination, int nowPagination, bool dest, string filter, ProductOderDemoContext db) { List <Customer> listCustomer = new List <Customer>(); ProductOderDemoContext productContext = db; using (productContext = new ProductOderDemoContext()) { int totalRecords = productContext.Customer.Count(); int skipRow = (nowPagination - 1) * sizePagination; if (dest) { listCustomer = productContext.Customer .Skip(skipRow).Take(sizePagination) .ToList(); } if (filter != null && filter != "") { if (sizePagination != 0 && nowPagination != 0) { if (!filter.Equals("") || filter != null) { if (filter.Equals("ALL")) { return(productContext.Customer .Skip(skipRow).Take(sizePagination) .ToList()); } else { return(productContext.Customer .Where(p => p.CustomerAddress.Contains(filter) || p.CustomerEmail.Contains(filter) || p.CustomerId.Contains(filter) || p.CustomerLogin.Contains(filter) || p.CustomerName.Contains(filter) || (p.CustomerPhone + "").Contains(filter) || p.CustomerPassword.Contains(filter) ) .Skip(skipRow).Take(sizePagination) .ToList()); } } } if (sizePagination == 0 && nowPagination == 0 && filter.Equals("ALL")) { return(productContext.Customer.ToList()); } else { return(new List <Customer>()); } } } return(listCustomer); }
public IEnumerable <String> testLoading() { ProductOderDemoContext db = new ProductOderDemoContext(); var testGroupBy = db.Product.GroupBy(s => s.ProductName); List <String> list = new List <String>(); Hashtable ht = new Hashtable(); foreach (var item in testGroupBy) { ht[item.Key] = list; } return(list); }
public int CountProductFilter(string filter, ProductOderDemoContext db, bool conditionCount) { ProductOderDemoContext productContext = db; if (conditionCount) { int count = db.Product.Where(c => c.ProductCategoryCode.Contains(filter) || c.ProductName.Contains(filter) || c.OtherProductDetails.Contains(filter) || (c.ProductPrice + "").Contains(filter) ).Count(); return(count); } else { int count = db.Product.Count(); return(count); } }
public int CountProductFilter(string filter, ProductOderDemoContext db, bool conditionCount) { ProductOderDemoContext productContext = db; if (conditionCount) { int count = db.RefProductCategories.Where(c => c.ProductCategoryCode.Contains(filter) || c.ProductCategoryDescription.Contains(filter) ).Count(); return(count); } else { int count = db.RefProductCategories.Count(); return(count); } }
public int CountCustomerOrdersFilter(string filter, ProductOderDemoContext db, bool conditionCount) { ProductOderDemoContext productContext = db; if (conditionCount) { int count = db.CustomerOrders.Where(p => p.OderPlaceDatatime.Contains(filter) || p.OrderId.Contains(filter) || p.CustomerId.Contains(filter) || p.CustomerId.Contains(filter) || p.OderPlaceDatatime.Contains(filter) || p.OrderId.Contains(filter) || p.OrderShoppingCharges.Contains(filter) || p.OrderStatusCode.Contains(filter) || p.OtherOrtherDetails.Contains(filter) || p.ShippingMethodCode.Contains(filter) ).Count(); return(count); } else { int count = db.CustomerOrders.Count(); return(count); } }
public IEnumerable <CustomerOrders> PaginationGeneral(int sizePagination, int nowPagination, bool dest, string filter, ProductOderDemoContext db) { List <CustomerOrders> listCustomerOrders = new List <CustomerOrders>(); ProductOderDemoContext productContext = db; using (productContext = new ProductOderDemoContext()) { int totalRecords = productContext.Customer.Count(); int skipRow = (nowPagination - 1) * sizePagination; if (dest) { listCustomerOrders = productContext.CustomerOrders .Skip(skipRow).Take(sizePagination) .ToList(); } if (filter != null && filter != "") { // if(sizePagination==0 && nowPagination == 0) // { // listProduct = productContext.Product // .Where(p => p.ProductName.Contains(filter) || p.OtherProductDetails.Contains(filter) // || p.ProductCategoryCode.Contains(filter) // ) // .ToList(); //} if (sizePagination != 0 && nowPagination != 0) { if (!filter.Equals("") || filter != null) { if (filter.Equals("ALL")) { return(productContext.CustomerOrders .Skip(skipRow).Take(sizePagination) .ToList()); } else { return(productContext.CustomerOrders .Where(p => p.OderPlaceDatatime.Contains(filter) || p.OrderId.Contains(filter) || p.CustomerId.Contains(filter) || p.CustomerId.Contains(filter) || p.OderPlaceDatatime.Contains(filter) || p.OrderId.Contains(filter) || p.OrderShoppingCharges.Contains(filter) || p.OrderStatusCode.Contains(filter) || p.OtherOrtherDetails.Contains(filter) || p.ShippingMethodCode.Contains(filter) ) .Skip(skipRow).Take(sizePagination) .ToList()); } } } if (sizePagination == 0 && nowPagination == 0 && filter.Equals("ALL")) { return(productContext.CustomerOrders.ToList()); } else { return(new List <CustomerOrders>()); } } } return(listCustomerOrders); }