public ActionResult SelectLocationAndPizzaType()
        {
            int id = Convert.ToInt32(TempData["ID"]);

            Models.AdminSelection um = new Models.AdminSelection();
            DateTime now             = DateTime.Now;
            DateTime compareTime;

            if (db.UserHasOrder(id))
            {
                compareTime = db.GetUserLastOrderTime(id).AddHours(24);
                um.RestrictionOnLocation = now < compareTime;
                if (um.RestrictionOnLocation)
                {
                    ViewBag.Time         = compareTime.Subtract(now).ToString(@"hh\:mm");
                    ViewBag.LocaiontInfo = db.GetUserLastOrderLocation(id).DMLocationId + " " + db.GetUserLastOrderLocation(id).DMCity + ", " + db.GetUserLastOrderLocation(id).DMState;
                    ViewBag.location     = TempData["LID"] = db.GetUserLastOrderLocation(id).DMLocationId;
                }
            }
            else
            {
                um.RestrictionOnLocation = false;
            }
            TempData["ID"] = id;
            return(View(um));
        }
 public ActionResult AdminViewInventory(Models.AdminSelection s)
 {
     ViewBag.Message      = "Location#" + s.SelectedLocationID.ToString() + " Inventory";
     ViewBag.Pepperoni    = 1000 - db.GetIngredientUsed("Pepperoni", s.SelectedLocationID);
     ViewBag.Mushrooms    = 1000 - db.GetIngredientUsed("Mushrooms", s.SelectedLocationID);
     ViewBag.Onions       = 1000 - db.GetIngredientUsed("Onions", s.SelectedLocationID);
     ViewBag.Sausage      = 1000 - db.GetIngredientUsed("Sausage", s.SelectedLocationID);
     ViewBag.Bacon        = 1000 - db.GetIngredientUsed("Bacon", s.SelectedLocationID);
     ViewBag.Extracheese  = 1000 - db.GetIngredientUsed("Extra cheese", s.SelectedLocationID);
     ViewBag.Blackolives  = 1000 - db.GetIngredientUsed("Black olives", s.SelectedLocationID);
     ViewBag.Greenpeppers = 1000 - db.GetIngredientUsed("Green peppers", s.SelectedLocationID);
     return(View());
 }
 public ActionResult AdminViewCustomer(Models.AdminSelection s)
 {
     ViewBag.Message = "Customers of Location#" + s.SelectedLocationID.ToString();
     foreach (var u in db.GetUsersByLocationID(s.SelectedLocationID))
     {
         user             = new Models.AppUser();
         user.UserName    = u.DMUserName;
         user.FullName    = u.DMFullName;
         user.PhoneNumber = u.DMPhoneNumber;
         userList.Add(user);
     }
     return(View(userList));
 }
 public ActionResult AdminMenu(Models.AdminSelection s)
 {
     TempData["LID"] = s.SelectedLocationID;
     if (s.SelectedOption == 1)
     {
         return(RedirectToAction("AdminViewOrders", s));
     }
     if (s.SelectedOption == 2)
     {
         return(RedirectToAction("AdminViewCustomer", s));
     }
     if (s.SelectedOption == 3)
     {
         return(RedirectToAction("AdminViewInventory", s));
     }
     else
     {
         return(View());
     }
 }
        public ActionResult SelectLocationAndPizzaType(Models.AdminSelection s)
        {
            int id = Convert.ToInt32(TempData["ID"]);

            TempData["ID"] = id;
            Models.AdminSelection um = new Models.AdminSelection();
            DateTime now             = DateTime.Now;
            DateTime compareTime;

            if (db.UserHasOrder(id))
            {
                compareTime = db.GetUserLastOrderTime(id).AddHours(24);
                um.RestrictionOnLocation = now < compareTime;
                if (um.RestrictionOnLocation)
                {
                    int lid = Convert.ToInt32(TempData["LID"]);
                    TempData["LID"] = lid;
                }
                else
                {
                    TempData["LID"] = s.SelectedLocationID;
                }
            }
            else
            {
                TempData["LID"] = s.SelectedLocationID;
            }
            if (s.SelectedOption == 1)
            {
                return(RedirectToAction("OrderPreset"));
            }
            else if (s.SelectedOption == 2)
            {
                return(RedirectToAction("OrderCustomized"));
            }
            else
            {
                return(View());
            }
        }