コード例 #1
0
        public string BookMealIntoDatabase(string EmpId, string MenuId, string NoOfPlates, string Cost)
        {
            FoodDAL agent = new FoodDAL();

            MakeBookingDetails obj = new MakeBookingDetails();

            obj.EmployeeId = Convert.ToInt32(EmpId);
            obj.MenuId = Convert.ToInt32(MenuId);
            obj.NumberOfPlates = Convert.ToInt32(NoOfPlates);
            obj.DateOfBooking = DateTime.Today.ToShortDateString();
            obj.TotalAmount = Convert.ToDouble(Cost);

            bool res = agent.InsertBookingIntoDatabase(obj);

            if (res)
            {
                return ("DONE");
            }

            else
            {
                return ("ERROR");
            }
        }
コード例 #2
0
        public ActionResult ViewAll()
        {
            //Authentication
            string type = (string)Session["UserRole"];
            if (type == null)
            {
                return RedirectToAction("Register", "UserAccount");
            }
            else if (type.CompareTo("U") != 0)
            {
                Session["UserID"] = null;
                Session["UserRole"] = null;
                return RedirectToAction("Login", "UserAccount");
            }

            var temp = Session["UserID"];
            var userId = Convert.ToInt32(temp.ToString());
            MovieDAL agent1 = new MovieDAL();
            FoodDAL agent2 = new FoodDAL();
            PartyDAL agent3 = new PartyDAL();

            AllBookings bookingCollection = new AllBookings();

            bookingCollection.MovieBookings = agent1.Bookings(userId);
            bookingCollection.FoodBookings = agent2.MealBookings(userId);
            bookingCollection.PartyBookings = agent3.Bookings(userId, "");

            return View(bookingCollection);
        }
コード例 #3
0
        public ActionResult ViewFoodBookings()
        {
            //Authentication
            string type = (string)Session["UserRole"];
            if (type == null)
            {
                return RedirectToAction("Register", "UserAccount");
            }
            else if (type.CompareTo("U") != 0)
            {
                Session["UserID"] = null;
                Session["UserRole"] = null;
                return RedirectToAction("Login", "UserAccount");
            }

            FoodDAL agent = new FoodDAL();
            var temp = Session["UserID"];
            var userId = Convert.ToInt32(temp.ToString());
            List<ViewMealBookings> bookingList = agent.MealBookings(userId);

            return View(bookingList);
        }
コード例 #4
0
        public ActionResult SearchMenus(string optionNumber, string optionValue)
        {
            int optNo = Convert.ToInt32(optionNumber);
            List<MealSearchModel> searchMenu = new List<MealSearchModel>();
            FoodDAL agent = new FoodDAL();

            switch (optNo)
            {
                case 1:
                    searchMenu = agent.SearchByFoodCourt(optionValue);
                    break;
                case 2:
                    searchMenu = agent.SearchByCaterer(optionValue);
                    break;
                case 3:
                    searchMenu = agent.SearchBySpecialty(optionValue);
                    break;
                case 4:
                    bool option = Convert.ToBoolean(optionValue);
                    searchMenu = agent.SearchByDishType(option);
                    break;
            }

            ViewBag.option = optNo;

            return PartialView("_SearchResultsPartial", searchMenu);
        }