Пример #1
0
        public ActionResult GetOrderReportData()
        {
            int MenCategory       = (productorder.GetAll()).Where(x => x.CustomerID == (int)Session["LoginId"] && x.ProductHistory.MainCategory.Category_name == "Men").Count();
            int WomenCategory     = (productorder.GetAll()).Where(x => x.CustomerID == (int)Session["LoginId"] && x.ProductHistory.MainCategory.Category_name == "Women").Count();
            int LifeStyleCategory = (productorder.GetAll()).Where(x => x.CustomerID == (int)Session["LoginId"] && x.ProductHistory.MainCategory.Category_name == "Life Style").Count();


            Ratio obj = new Ratio();

            obj.MenCategory       = MenCategory;
            obj.WomenCategory     = WomenCategory;
            obj.LifeStyleCategory = LifeStyleCategory;

            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public ActionResult codVSpaypal()
        {
            var chartData = new object[3];

            chartData[0] = new object[] {
                "Payment Type",
                "Count"
            };

            int paypal         = productorder.GetAll().Where(x => x.Order.PayMentMethod == "PayPal").Count();
            int cashOnDelivery = productorder.GetAll().Where(x => x.Order.PayMentMethod == "Cash On Delivery").Count();

            chartData[1] = new object[] { "Cash On Delivery Payment", cashOnDelivery };
            chartData[2] = new object[] { "PayPal Payment", paypal };

            return(Json(chartData));
        }
Пример #3
0
        public ActionResult PostprofitbyCategory()
        {
            var chartData = new object[4];

            chartData[0] = new object[] {
                "Category Type",
                "Count"
            };

            int ManCategory       = productorder.GetAll().Where(x => x.Order.PayMentMethod == "PayPal").Count();
            int WomenCategory     = productorder.GetAll().Where(x => x.Order.PayMentMethod == "Cash On Delivery").Count();
            int LifeStyleCategory = productorder.GetAll().Where(x => x.Order.PayMentMethod == "Cash On Delivery").Count();

            chartData[1] = new object[] { "Cash On Delivery Payment", cashOnDelivery };
            chartData[2] = new object[] { "PayPal Payment", paypal };

            return(Json(chartData));
        }
        public ActionResult COnfirmOrder()
        {
            var UserName = User.Identity.GetUserName();

            ViewBag.Total    = cart_Service.GetCartTotal(cart_Service.GetCartID());
            ViewBag.TotalQTY = cart_Service.GetCartItems().FindAll(x => x.cartId == cart_Service.GetCartID()).Sum(q => q.quantity);
            var confirm = _productOrdersRepository.GetAll(); //db.productrders.ToList();
            var cart    = _productOrdersRepository.GetAll(); //db.Cart_Items.ToList();

            CustomerOrder mealOrder = new CustomerOrder();

            mealOrder.OrderNumber = mealOrder.GenVoucher();
            mealOrder.Total       = ViewBag.Total;
            mealOrder.UserOrder   = UserName;
            mealOrder.Status      = "Paid";
            mealOrder.OrderDate   = DateTime.Now.Date.ToLongDateString();
            _CustomerOrderRepository.Insert(mealOrder);
            //db.MealOrders.Add(mealOrder);
            //db.SaveChanges();

            ProductOrder foodOrder = new ProductOrder();

            foreach (var item in confirm)
            {
                foreach (var i in cart)
                {
                    if (UserName == item.UserEmail && item.cart_id == i.cart_id)
                    {
                        var statusUpdate = _productOrdersRepository.GetById(item.cart_item_id); //db.productrders.Find(item.cart_item_id);
                        statusUpdate.OrderStatus = "Checked Out";
                        statusUpdate.OrderId     = mealOrder.OrderId;
                        _productOrdersRepository.Update(statusUpdate);
                        //db.Entry(statusUpdate).State = EntityState.Modified;
                        //db.SaveChanges();
                        cart_Service.EmptyCart();
                    }
                }
            }

            return(RedirectToAction("OnceOff", new { tot = mealOrder.Total }));
        }
Пример #5
0
        public IHttpActionResult GetOrderReportData(int id)
        {
            try
            {
                var c  = productorder.GetAll();
                var x2 = c.Where(x1 => x1.CustomerID == id && x1.ProductHistory.MainCategory.Category_name == "Men").Count();
            }catch (Exception exc)
            {
            }

            int MenCategory       = (productorder.GetAll()).Where(x => x.CustomerID == id && x.ProductHistory.MainCategory.Category_name == "Men").Count();
            int WomenCategory     = (productorder.GetAll()).Where(x => x.CustomerID == id && x.ProductHistory.MainCategory.Category_name == "Women").Count();
            int LifeStyleCategory = (productorder.GetAll()).Where(x => x.CustomerID == id && x.ProductHistory.MainCategory.Category_name == "Life Style").Count();


            Ratio obj = new Ratio();

            obj.MenCategory       = MenCategory;
            obj.WomenCategory     = WomenCategory;
            obj.LifeStyleCategory = LifeStyleCategory;

            return(Json(obj));
        }
Пример #6
0
        public ActionResult GetAllProductOrders()
        {
            var productOrders = _productOrderRepository.GetAll();

            return(Ok(productOrders));
        }