示例#1
0
        //Страница бронирования мест
        //Id - это id сеанса(Schedule)
        public IActionResult OnGet(int id)
        {
            Id = id;
            //Не авторизован - на главную станицу
            if (!_authService.IsAuthenticated)
            {
                return(Redirect(Url.Content("~/")));
            }
            var schedule = ScheduleDAO.GetSchedule($"id_schedule = {id}").FirstOrDefault();

            schedule.Hall = ScheduleDAO.GetHallByScheduleId(id);

            var bookings = BookingDAO.GetBookingByScheduleId(id);

            foreach (var booking in bookings)
            {
                booking.Schedule = schedule;
            }

            BookingPageViewModel = new BookingPageViewModel
            {
                //Передаем сеанс с указаным id
                Schedule = schedule,
                //Передаем все бронирования на этот сеанс
                BookingsInSchedule = bookings
            };
            return(Page());
        }
        public IActionResult Index(IFormCollection data)
        {
            if (!Authentication.AuthenticateByCookie(HttpContext))
            {
                return(Redirect("/Receptionists/Authentication/Login?Area=Receptionists&Ctrl=Rooms&Act=Index"));
            }

            BookingDAO.Update();

            List <string> StylesSelected = new List <string>();
            List <string> SizesSelected  = new List <string>();

            foreach (var obj in data)
            {
                if (obj.Key.StartsWith("roomstyle"))
                {
                    StylesSelected = obj.Value.ToList();
                }
                else
                if (obj.Key.StartsWith("roomsize"))
                {
                    SizesSelected = obj.Value.ToList();
                }
            }

            ViewBag.StylesSelected = StylesSelected;
            ViewBag.SizesSelected  = SizesSelected;

            string str = string.Join(",", StylesSelected);

            ViewData.Model = RoomsDAO.GetRoomsViewModel(StylesSelected, SizesSelected);

            return(View());
        }
        public IActionResult Index()
        {
            if (!Authentication.AuthenticateByCookie(HttpContext))
            {
                return(Redirect("/Receptionists/Authentication/Login?Area=Receptionists&Ctrl=Rooms&Act=Index"));
            }

            BookingDAO.Update();

            List <string> StylesSelected = new List <string>();
            List <string> SizesSelected  = new List <string>();

            foreach (var roomstyle in RoomStyleDAO.GetAllRoomStyle())
            {
                StylesSelected.Add(roomstyle.RoomStyleID.ToString());
            }

            foreach (var roomsize in RoomSizeDAO.GetAllRoomSize())
            {
                SizesSelected.Add(roomsize.RoomSizeID.ToString());
            }

            ViewBag.StylesSelected = StylesSelected;
            ViewBag.SizesSelected  = SizesSelected;
            ViewData.Model         = RoomsDAO.GetRoomsViewModel();

            return(View());
        }
        public async Task <IActionResult> Create(int RoomID, DateTime CheckInDate, DateTime CheckOutDate, Guest guest, Payment payment, int Amount)
        {
            int guestid   = GuestDAO.InsertGuest(guest);
            int paymentid = PaymentDAO.InsertPayment(payment);
            int bookingid = BookingDAO.InsertBooking(new Booking()
            {
                RoomID       = RoomID,
                CheckInDate  = CheckInDate.AddHours(14),
                CheckOutDate = CheckOutDate.AddHours(12).AddMinutes(5),
                GuestID      = guestid,
                Amount       = (int)(CheckOutDate - CheckInDate).TotalDays * RoomsDAO.GetRoomModel(RoomID).RoomType.Price,
                PaymentID    = paymentid,
            });

            var    model = BookingDAO.GetBookingModel(bookingid);
            string body  = await Utlities.RenderViewToStringAsync <BookingModel>(this, "~/Areas/Guests/Views/Partial/_ConfirmEmail.cshtml", model);

            MailMessage mail = new MailMessage();

            mail.From = new MailAddress("*****@*****.**");
            mail.To.Add(guest.Email);
            mail.Subject    = "Congratulations on your successful booking";
            mail.Body       = body;
            mail.IsBodyHtml = true;

            Utlities.SendEmail(mail);

            return(View());
        }
 public ControllerClass(HotelContext db)
 {
     roomDAO       = new RoomDAO(db);
     guestDAO      = new GuestDAO(db);
     bookingDAO    = new BookingDAO(db);
     dictionaryDAO = new DictionaryDAO(db);
     this.view     = new ViewClass(dictionaryDAO.GetRoomTypes(), dictionaryDAO.GetGuestStatus());
 }
 public IActionResult CreateNewBooking(Booking booking)
 {
     ViewBag.Name       = CurUser.Name;
     booking.CustomerId = CurUser.UserId;
     booking.State      = "Pending";
     BookingDAO.CreateBooking(booking);
     return(View("Index", BookingDAO.GetBookings(CurUser.UserId)));
 }
示例#7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Account re = (Account)Session["account"];
         //  this.gvViewHistory.DataSource = BookingDAO.getAllBookingFilmByUsername(re.UserName);
         // this.gvViewHistory.DataBind();
         list = BookingDAO.getAllBookingFilmByUsername(re.UserName);
     }
 }
示例#8
0
        private void btnDeleteBooking_Click(object sender, EventArgs e)
        {
            BookingDAO ud = new BookingDAO();

            ud.removeBooking(deleteId);
            BookingView.DataSource = null;
            DataTable dataTable = ud.showBooking();

            BookingView.DataSource = dataTable;
        }
        public IActionResult Checkout(int id, bool isEdit = true)
        {
            if (!Authentication.AuthenticateByCookie(HttpContext))
            {
                return(Redirect("/Receptionists/Authentication/Login?are=Receptionists&ctrl=Activities&act=Checkout"));
            }

            ViewBag.isEdit = isEdit;
            BookingModel model = BookingDAO.GetBookingModel(id);

            return(View(model));
        }
示例#10
0
        private void ShowData()
        {
            BookingDAO b = new BookingDAO();

            //sd.showData(cbxClass.Text, cbxDepartment.Text, cbxSubject.Text);

            b.showBooking();
            BookingView.DataSource = null;
            DataTable dataTable = b.showBooking();

            BookingView.DataSource = dataTable;
        }
 static void Main(string[] args)
 {
     using (HotelContext dB = new HotelContext())
     {
         RoomDAO         rd         = new RoomDAO(dB);
         GuestDAO        gd         = new GuestDAO(dB);
         BookingDAO      bd         = new BookingDAO(dB);
         DictionaryDAO   d          = new DictionaryDAO(dB);
         ControllerClass controller = new ControllerClass(dB);
         controller.Start();
     }
 }
        public IActionResult Index()
        {
            if (!Authentication.AuthenticateByCookie(HttpContext))
            {
                return(Redirect("/Receptionists/Authentication/Login?are=Receptionists&ctrl=Activities&act=Index"));
            }

            BookingDAO.Update();

            ActivitiesViewModel model = ActivitiesDAO.GetActivitiesViewModel();

            return(View(model));
        }
示例#13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["id"];

            if (string.IsNullOrEmpty(id))
            {
                Response.Redirect("Index.aspx");
            }
            else
            {
                BookingDAO.DeleteBooking(id);
                Response.Redirect("Profile.aspx");
            }
        }
示例#14
0
        public IActionResult Create(int RoomID, DateTime CheckInDate, DateTime CheckOutDate, Guest guest, Payment payment, int Amount)
        {
            int guestid   = GuestDAO.InsertGuest(guest);
            int paymentid = PaymentDAO.InsertPayment(payment);
            int bookingid = BookingDAO.InsertBooking(new Booking()
            {
                RoomID       = RoomID,
                CheckInDate  = CheckInDate.AddHours(14),
                CheckOutDate = CheckOutDate.AddHours(12).AddMinutes(5),
                GuestID      = guestid,
                Amount       = (int)(CheckOutDate - CheckInDate).TotalDays * RoomsDAO.GetRoomModel(RoomID).RoomType.Price,
                PaymentID    = paymentid,
            });

            return(View());
        }
示例#15
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            Booking b = new Booking();

            b.FirstName     = txtFirstName.Text;
            b.LastName      = txtLastName.Text;
            b.IndentityCard = Convert.ToInt32(txtIdentityCard.Text);
            b.PhoneNumber   = Convert.ToInt32(txtPhone.Text);
            b.TypeRoom      = txtTypeRoom.Text;
            b.Address       = txtAddress.Text;
            b.BillAmount    = Double.Parse(txtBill.Text);
            b.DateOfBooking = dateTimePicker1.Value.Date;

            BookingDAO bd = new BookingDAO();

            bd.bookingRoom(b);
            MessageBox.Show("Book successful!");
        }
        //[Area("Receptionists")]
        //public IActionResult Index()
        //{
        //    if (!Authentication.AuthenticateByCookie(HttpContext))
        //        return Redirect("/Receptionists/Authentication/Login?are=Receptionists&ctrl=Bookings&act=Index");

        //    return View();
        //}

        public IActionResult Index(DateTime fromdate, DateTime todate)
        {
            if (!Authentication.AuthenticateByCookie(HttpContext))
            {
                return(Redirect("/Receptionists/Authentication/Login?are=Receptionists&ctrl=Bookings&act=Index"));
            }

            BookingDAO.Update();

            if (fromdate == DateTime.MinValue || todate == DateTime.MinValue)
            {
                fromdate = DateTime.Now.AddDays(-30);
                todate   = DateTime.Now.AddDays(30);
            }

            List <BookingModel> list = BookingDAO.GetBookingsViewModel(fromdate, todate);

            return(View(list));
        }
示例#17
0
        public JsonResult CreateBooking(int RoomID, DateTime CheckInDate, DateTime CheckOutDate, Guest guest, Payment payment)
        {
            int guestid   = GuestDAO.InsertGuest(guest);
            int paymentid = PaymentDAO.InsertPayment(payment);

            Booking booking = new Booking();

            booking.RoomID       = RoomID;
            booking.GuestID      = guestid;
            booking.PaymentID    = paymentid;
            booking.CheckInDate  = CheckInDate;
            booking.CheckOutDate = CheckOutDate;

            int bookingid = BookingDAO.InsertBooking(booking);

            return(Json(new
            {
                data = booking
            }));
        }
示例#18
0
 public IActionResult OnGet(int id)
 {
     UserViewModel          = UserDAO.GetUserById(id);
     UserViewModel.Bookings = BookingDAO.GetBookingsByUserId(id);
     foreach (var booking in UserViewModel.Bookings)
     {
         booking.Schedule      = ScheduleDAO.GetSchedule($"id_schedule = {booking.ScheduleId}").FirstOrDefault();
         booking.Schedule.Hall = ScheduleDAO.GetHallByScheduleId(booking.Schedule.Id);
         booking.Schedule.Film = FilmViewModelDAO.GetFilms($"WHERE id = {booking.Schedule.FilmId}", false).FirstOrDefault();
         if (booking.Row == 0)
         {
             booking.Schedule.PricePerSeat /= 2;
         }
         else if (booking.Row == booking.Schedule.Hall.SeatsRowCount.Length - 1)
         {
             booking.Schedule.PricePerSeat = Math.Round(booking.Schedule.PricePerSeat * (decimal)1.2);
         }
     }
     return(Page());
 }
        public IActionResult Checkin(int id, bool isEdit = true)
        {
            if (!Authentication.AuthenticateByCookie(HttpContext))
            {
                return(Redirect("/Receptionists/Authentication/Login?are=Receptionists&ctrl=Activities&act=Checkin"));
            }

            ViewBag.isEdit = isEdit;
            BookingModel model = BookingDAO.GetBookingModel(id);

            if (StayDAO.GetALLGuestsOfBooking(id).Count == 0)
            {
                StayDAO.InsertStay(new Stay()
                {
                    BookingID = model.BookingID,
                    Status    = null,
                    FromDate  = DateTime.Now,
                    GuestID   = model.Guest.GuestID,
                    ToDate    = null
                });
            }

            return(View(model));
        }
 public IActionResult UpdateBooking(Booking booking)
 {
     BookingDAO.UpdateBooking(booking);
     return(View("BookingDetails", BookingDAO.GetBooking(booking.BookingId)));
 }
 public IActionResult BookingDetails(string BookingId)
 {
     ViewBag.Name = CurUser.Name;
     return(View(BookingDAO.GetBooking(BookingId)));
 }
示例#22
0
 public static bool CreateBooking(Booking b)
 {
     return(BookingDAO.CreateBooking(b));
 }
示例#23
0
 public static bool CheckRoomBook(int id)
 {
     return(BookingDAO.CheckRoomBook(id));
 }
示例#24
0
 public static bool ReadBookingNew(int id)
 {
     return(BookingDAO.ReadBookingNew(id));
 }
示例#25
0
 public static bool UpdateBooking(Booking b)
 {
     return(BookingDAO.UpdateBooking(b));
 }
示例#26
0
 public static Booking GetBookingByToken(string token)
 {
     return(BookingDAO.GetBookingByToken(token));
 }
示例#27
0
 public static IEnumerable <Booking> GetAllBooking(bool newBooking)
 {
     return(BookingDAO.GetAllBooking(newBooking));
 }
 public IActionResult DeleteBooking(Booking booking)
 {
     BookingDAO.DeleteBooking(booking.BookingId);
     return(View("Index", BookingDAO.GetBookings(CurUser.UserId)));
 }
 public IActionResult ConfirmCheckOut(int bookingId, int extraChange)
 {
     return(Json(BookingDAO.ConfirmCheckOut(bookingId, extraChange)));
 }
 public IActionResult EditBooking(string BookingId)
 {
     return(View("EditBooking", BookingDAO.GetBooking(BookingId)));
 }