示例#1
0
 public Repository(GrowOnlineDevEntities _context)
 {
     this.context   = _context;
     this.entitySet = context.Set <T>();
     this.context.Configuration.ProxyCreationEnabled = true;
     this.context.Configuration.LazyLoadingEnabled   = true;
 }
示例#2
0
        public ProductMasterViewModel GetAllProduct(int currentPage, string CategoryName)
        {
            try
            {
                int maxRows = 10;
                using (GrowOnlineDevEntities entities = new GrowOnlineDevEntities())
                {
                    ProductMasterViewModel customerModel = new ProductMasterViewModel();

                    customerModel.Customers = (from customer in entities.Shop_Product_Master
                                               where customer.crp_catagory == CategoryName && customer.Status == "Active"
                                               select customer)
                                              .OrderBy(customer => customer.pkSkuId)
                                              .Skip((currentPage - 1) * maxRows)
                                              .Take(maxRows).ToList();

                    double pageCount = (double)((decimal)entities.Shop_Product_Master.Count() / Convert.ToDecimal(maxRows));
                    customerModel.PageCount = (int)Math.Ceiling(pageCount);

                    customerModel.CurrentPageIndex = currentPage;

                    return(customerModel);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
 /// <summary>
 /// Dispose Context
 /// </summary>
 public void Dispose()
 {
     if (context != null)
     {
         context.Dispose();
         context = null;
     }
 }
示例#4
0
        public double CheckMinProductPrice()
        {
            GrowOnlineDevEntities objGrowOnlineDevEntities = new GrowOnlineDevEntities();
            var minPrice       = objGrowOnlineDevEntities.Shop_Product_Master.Min(x => x.IntPrice);
            var minPriceDouble = Convert.ToDouble(minPrice);

            return(minPriceDouble);
        }
示例#5
0
 public UnitOfWork(GrowOnlineDevEntities dbContext)
 {
     this.context = dbContext;
 }