コード例 #1
0
        public ActionResult ViewOrders()
        {
            var o = db.GetOrders();

            string custID = TempData["custid"] as string;

            TempData.Keep();

            foreach (var i in o)
            {
                if (i.CustID == custID)
                {
                    orders            = new Models.OrderHistory();
                    orders.OrderID    = i.OrderID;
                    orders.Size       = i.Size;
                    orders.Crust      = i.Crust;
                    orders.Topping1   = i.Topping1;
                    orders.Topping2   = i.Topping2;
                    orders.Topping3   = i.Topping3;
                    orders.Topping4   = i.Topping4;
                    orders.Topping5   = i.Topping5;
                    orders.Qty        = i.Qty;
                    orders.Subtotal   = i.Subtotal;
                    orders.TimePlaced = i.Time;
                    orders.DatePlaced = i.Date;
                    orderhistorylist.Add(orders);
                }
            }
            return(View(orderhistorylist));
        }
コード例 #2
0
 public ActionResult ViewRestaurantData(Models.OrderHistory or)
 {
     TempData["location"] = or.Location;
     if (or.Data == 1)
     {
         return(RedirectToAction("ViewRestaurantData_Customers"));
     }
     else if (or.Data == 2)
     {
         return(RedirectToAction("ViewRestaurantData_OrdersAndSales"));
     }
     else
     {
         return(RedirectToAction("ViewRestaurantData_Inventory"));
     }
 }
コード例 #3
0
        public IActionResult HistorySelected(Models.OrderHistory historyOptions)
        {
            /*
             *  if option for store orders
             *  should be able to view order history
             *  if option for store orders by customer (filtering)
             *  should be able to view order history for a customer
             */

            if (historyOptions.All)
            {
                return(RedirectToAction("StoreHistory", new { storeID = historyOptions.StoreId }));
            }
            else
            {
                // Can use /STOREHISTORY/ combo of customer name and store ID
                return(RedirectToAction("StoreCustomerHistory", new { storeID = historyOptions.StoreId,
                                                                      customerName = historyOptions.Customer.Name }));
            }
        }
コード例 #4
0
        public ActionResult ViewRestaurantData_OrdersAndSales()
        {
            orderhistorylist = new List <Models.OrderHistory>();
            var o = db.GetOrders();

            decimal totalsubtotal = 0.00M;
            int     custqty       = 0;
            int     orderqty      = 0;
            int     location      = (int)TempData["location"];

            TempData.Keep();

            foreach (var i in o)
            {
                if (i.Location == location)
                {
                    custqty++;
                    orders          = new OrderHistory();
                    orders.OrderID  = i.OrderID;
                    orders.Size     = i.Size;
                    orders.Crust    = i.Crust;
                    orders.Topping1 = i.Topping1;
                    orders.Topping2 = i.Topping2;
                    orders.Topping3 = i.Topping3;
                    orders.Topping4 = i.Topping4;
                    orders.Topping5 = i.Topping5;
                    orders.Qty      = i.Qty;
                    orderqty       += i.Qty;
                    orders.Subtotal = i.Subtotal;
                    totalsubtotal  += i.Subtotal;
                    orders.Date     = i.Date;
                    orders.Time     = i.Time;
                    orderhistorylist.Add(orders);
                }
            }
            ViewBag.OrdersAndSales = $"Total Orders Placed: {custqty}\n" +
                                     $"Total Pizzas Ordered: {orderqty}\n" +
                                     $"Overall Subtotal: ${Decimal.Round(totalsubtotal, 2)}";
            return(View(orderhistorylist));
        }