コード例 #1
0
        public ActionResult Index()
        {
            ViewBag.userName = Session["userName"];
            ViewBag.logged   = Session["LoggedIN"];

            Product_Report re        = Report.report();
            ReportDetails  reDetails = new ReportDetails();

            reDetails.productName          = product.Get(re.Product_ID).Product_Name;
            reDetails.category             = category.Get(product.Get(re.Product_ID).Category_ID).Category_Name;
            reDetails.subCategory          = subCategory.Get(product.Get(re.Product_ID).Sub_Category_ID).Sub_Category_Name;
            reDetails.productPicture       = product.Get(re.Product_ID).Product_Picture;
            reDetails.productPrice         = product.Get(re.Product_ID).Product_Price;
            reDetails.totalSellingQuantity = re.Selling_Quantity;

            int summation = 0, x = 0;
            IEnumerable <Product_Report> reportList = Report.GetAllValues();

            foreach (Product_Report r in reportList)
            {
                x          = product.Get(r.Product_ID).Product_Price *r.Selling_Quantity;
                summation += x;
            }
            ViewBag.totalSellingPrice = summation;

            return(View(reDetails));
        }
コード例 #2
0
        public int Delete(int id)
        {
            Product_Report proRE = this.context.Product_Report.SingleOrDefault(x => x.Product_ID == id);

            this.context.Product_Report.Remove(proRE);

            return(this.context.SaveChanges());
        }
コード例 #3
0
        public int Update(Product_Report product_report)
        {
            Product_Report proRe = this.context.Product_Report.SingleOrDefault(x => x.Product_ID == product_report.Product_ID);

            proRe.Selling_Quantity = product_report.Selling_Quantity;

            return(this.context.SaveChanges());
        }
コード例 #4
0
 public int Update(Product_Report Product_Report)
 {
     return(this.data.Update(Product_Report));
 }
コード例 #5
0
 public int Insert(Product_Report Product_Report)
 {
     return(this.data.Insert(Product_Report));
 }
        //
        // GET: /BuyingConfimation/

        public ActionResult Index()
        {
            ViewBag.userName = Session["userName"];
            ViewBag.logged   = Session["LoggedIN"];

            iCart_Service           cart          = Service_Center.GetCart_Service();
            iProduct_Service        productAll    = Service_Center.GetProduct_Service();//
            iBuying_History_Service buyingHistory = Service_Center.GetBuying_History_Service();
            iProduct_Report_Service report        = Service_Center.GetProduct_Report_Service();

            IEnumerable <Cart> FullCart = cart.Get(Session["userName"].ToString());

            foreach (Cart c in FullCart)
            {
                Product pro = new Product();
                IEnumerable <Product> proAll = productAll.GetAllValues();

                foreach (Product p in proAll)
                {
                    if (p.Id == c.ProductID)
                    {
                        int before = productAll.Get(p.Id).Product_Quantity;
                        int after  = before - c.BuyingQuantity;

                        pro.Id = p.Id;
                        pro.Product_Quantity = after;

                        int y = productAll.Update(pro);
                    }
                }

                Buying_History buy = new Buying_History();
                Product_Report rep = new Product_Report();

                buy.Product_ID      = c.ProductID;
                buy.User_Name       = Session["userName"].ToString();
                buy.Buying_Quantity = c.BuyingQuantity;
                buy.Buying_Date     = DateTime.Now.ToLocalTime();

                IEnumerable <Product_Report> proReport = report.GetAllValues();
                bool check     = false;
                int  productID = 0;

                foreach (Product_Report r in proReport)
                {
                    if (r.Product_ID == c.ProductID)
                    {
                        check     = true;
                        productID = r.Product_ID;
                        break;
                    }
                }

                if (check == true)
                {
                    int beforeQuantity = report.Get(productID).Selling_Quantity;
                    int afterQuantity  = beforeQuantity + c.BuyingQuantity;

                    rep.Product_ID       = productID;
                    rep.Selling_Quantity = afterQuantity;

                    int p = report.Update(rep);
                }
                else
                {
                    rep.Product_ID       = c.ProductID;
                    rep.Selling_Quantity = c.BuyingQuantity;

                    int j = report.Insert(rep);
                }

                int i = buyingHistory.Insert(buy);
            }



            int de = cart.DeleteUserCart(Session["userName"].ToString());

            //ViewBag.row = cartRow;
            return(View());
        }
コード例 #7
0
 public int Insert(Product_Report product_report)
 {
     this.context.Product_Report.Add(product_report);
     return(this.context.SaveChanges());
 }