Exemplo n.º 1
0
        public ActionResult BookParty()
        {
            //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");
            }

            PartyDAL agent = new PartyDAL();
            ViewBag.list1 = agent.GetVenues();

            return View();
        }
Exemplo n.º 2
0
        public ActionResult ViewPartyBookings()
        {
            //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");
            }

            PartyDAL agent = new PartyDAL();
            var userid = Convert.ToInt32(Session["UserID"].ToString());
            List<ViewPartyBookings> bookingList = agent.Bookings(10001, "");

            return View(bookingList);
        }
Exemplo n.º 3
0
        public string MakeBooking(string VenueName, string EventDate, string Cost)
        {
            PartyDAL agent = new PartyDAL();
            var venueid = agent.FindVenueId(VenueName);

            PartyBooking booking =  new PartyBooking();
            booking.EmployeeID = Convert.ToInt32(Session["UserID"].ToString());
            booking.VenueID = Convert.ToInt32(venueid);
            booking.EventDate = Convert.ToDateTime(EventDate);
            booking.Cost = Convert.ToDouble(Cost);
            bool res = agent.MakeBooking(booking);
            if (res)
            {
                return "DONE";
            }

            else
            {
                return "ERROR";
            }
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        public DeliveryModel Bookings()
        {
            PartyDAL agent = new PartyDAL();
            DeliveryModel bookings = new DeliveryModel();

            try
            {
                ConnectionStr = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

                conn = new SqlConnection(ConnectionStr);
                conn.Open();
            }
            catch (Exception e)
            {
                Debug.WriteLine("SQL Server connection failed " + e.Message);
                return null;
            }

            try
            {
                cmd = new SqlCommand("SELECT EmployeeID, BookingID FROM PartyBookingDB WHERE ApprovalStatus = 'P'", conn);

                SqlDataReader reader = cmd.ExecuteReader();
                bookings.EmployeeIDCollection = new List<int>();

                while (reader.Read())
                {
                    bookings.EmployeeIDCollection.Add(reader.GetInt32(0));
                    i = i + 1;
                }

                reader.Close();
            }

            catch (Exception err)
            {
                Debug.WriteLine(err.Message);
                return null;
            }

            conn.Close();

            try
            {
                for (int j = 0; j < i; j++)
                {
                    List<ViewPartyBookings> temp = agent.Bookings(bookings.EmployeeIDCollection[j], "P");
                    bookings.bookingCollection = new List<ViewPartyBookings>();

                    foreach (var item in temp)
                    {
                        bookings.bookingCollection.Add(item);
                    }
                }
            }

            catch (Exception err)
            {
                Debug.WriteLine(err.Message);
                return null;
            }

            return bookings;
        }