Пример #1
0
        private Dictionary <int, Dictionary <int, decimal> > CalculateSum()
        {
            var Sklad   = sklad.Read(null);
            var Product = product.Read(null);
            Dictionary <int, Dictionary <int, decimal> > productsklad = new Dictionary <int, Dictionary <int, decimal> >();

            if (TempData["ErrorLack"] != null)
            {
                ModelState.AddModelError("", TempData["ErrorLack"].ToString());
            }
            foreach (var sklad in Sklad)
            {
                Dictionary <int, decimal> count = new Dictionary <int, decimal>();
                foreach (var pro in Product)
                {
                    count.Add((int)pro.Id, product.ReadSP(new BusinessLogic.BindingModel.ProductSkladBM {
                        SkladId = (int)sklad.Id, ProductId = (int)pro.Id
                    }).Where(x => x.Status == BusinessLogica.Enum.Status.Пополнение).Sum(x => x.Count) -
                              product.ReadSP(new BusinessLogic.BindingModel.ProductSkladBM {
                        SkladId = (int)sklad.Id, ProductId = (int)pro.Id
                    }).Where(x => x.Status == BusinessLogica.Enum.Status.Списание).Sum(x => x.Count));
                    if ((product.ReadSP(new BusinessLogic.BindingModel.ProductSkladBM {
                        SkladId = (int)sklad.Id, ProductId = (int)pro.Id
                    }).Where(x => x.Status == BusinessLogica.Enum.Status.Пополнение).Sum(x => x.Count) -
                         product.ReadSP(new BusinessLogic.BindingModel.ProductSkladBM {
                        SkladId = (int)sklad.Id, ProductId = (int)pro.Id
                    }).Where(x => x.Status == BusinessLogica.Enum.Status.Списание).Sum(x => x.Count)) > 0)
                    {
                    }
                }
                productsklad.Add((int)sklad.Id, count);
            }
            return(productsklad);
        }
Пример #2
0
        public IActionResult Sklad()
        {
            if (TempData["ErrorLack"] != null)
            {
                ModelState.AddModelError("", TempData["ErrorLack"].ToString());
            }

            ViewBag.Sklad = sklad.Read(null);

            return(View());
        }