コード例 #1
0
        public ActionResult GuardarReservacion(Reservation pReservation)
        {
            bool valor;

            try
            {
                pReservation.Action = "Reservado";
                pReservation.State  = true;
                ReservationBL _reservationBL = new ReservationBL();
                if (_reservationBL.Create(pReservation) != null)
                {
                    valor = true;
                }
                else
                {
                    valor = false;
                }

                return(Json(valor, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "Home", "Index")));
            }
        }
コード例 #2
0
        public void TestInsertIntoReservationFail1()
        {
            ReservationBL re    = new ReservationBL();
            Reservation   reser = new Reservation(2, 1, 2, null, 123456, 10000.00, DateTime.Now);

            Assert.False(re.InsertIntoReservation(reser));
        }
コード例 #3
0
        public static void YNChoice(List <string> choicedSeat, Schedules sch, string map, Reservation res)
        {
            ScheduleBL    schedule = new ScheduleBL();
            ReservationBL reser    = new ReservationBL();

            Console.Write($"\n                      ^: Bạn muốn đặt vé không   (Y/N) : ");
            char tiep = ' ';

            do
            {
                tiep = Tieptuc(tiep);
                switch (tiep)
                {
                case 'Y':
                    reser.InsertIntoReservation(res);
                    schedule.BuySeats(sch, map);
                    InformationTickets(res, 0);
                    break;

                case 'y':
                    reser.InsertIntoReservation(res);
                    schedule.BuySeats(sch, map);
                    InformationTickets(res, 0);
                    break;

                case 'N':
                    ComeBackMenu(sch, 0);
                    break;

                case 'n':
                    ComeBackMenu(sch, 0);
                    break;
                }
            } while (tiep != 'Y' && tiep != 'N' && tiep != 'y' && tiep != 'n');
        }
コード例 #4
0
        public void TestInsertIntoReservationFail()
        {
            ReservationBL re    = new ReservationBL();
            Reservation   reser = new Reservation(0, 0, 0, "A5 A6 A7 A8", 123456, 10000.00, DateTime.Now);

            Assert.False(re.InsertIntoReservation(reser));
        }
コード例 #5
0
        public void TestInsertIntoReservation()
        {
            ReservationBL re    = new ReservationBL();
            Reservation   reser = new Reservation(2, 1, 2, "A5 A6 A7 A8", 123456, 10000.00, DateTime.Now);

            Assert.True(re.InsertIntoReservation(reser));
        }
コード例 #6
0
        public ActionResult CancelarReservacion(int id)
        {
            Reservation   reservation   = new Reservation();
            ReservationBL reservationBL = new ReservationBL();

            reservation.Action        = "Libre";
            reservation.ReservationID = id;
            reservation.State         = true;
            reservationBL.Edit(reservation);
            return(RedirectToAction("Index", "Reservation", new { id = Session["UserID"] }));
        }
コード例 #7
0
        public void TestReservationByCustomerId1()
        {
            ReservationBL re = new ReservationBL();

            Assert.Null(re.GetReservationByCustomerId(0));
        }
コード例 #8
0
        public void HistoryBookingTicket()
        {
            ReservationBL reser = new ReservationBL();

            // List<Reservation> list = null;
            try {
                List <Reservation> list = reser.GetReservationByCustomerId(UserInterface.LoginCinema.GetCustomer().Customer_id);
                if (list.Count == 0 || list == null)
                {
                    Console.WriteLine("Bạn chưa có giao dịch nào với Rạp Thế Giới ! Đặt vé ngay bạn yêu nhé.");
                    Console.WriteLine("Nhập <Enter> để trở lại.");
                    Console.ReadLine();
                    return;
                }
                else
                {
                    Console.Clear();
                    Console.WriteLine("                              Thông tin vé đặt trước  ");
                    Console.WriteLine("                             _________________________");
                    Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
                    Console.WriteLine("STT   | Tên Phim                 | Ngày Chiếu               | Số Lượng (V-T)    |Giá Tiền ");
                    Console.WriteLine("_____________________________________________________________________________________________");

                    for (int i = 0; i < list.Count; i++)
                    {
                        ScheduleBL sch        = new ScheduleBL();
                        Schedules  schedule   = sch.GetScheduleByIdSchedule(list[i].Schedule_id);
                        MoviesBL   movie      = new MoviesBL();
                        Movies     informatin = movie.getMovieById(schedule.Movie_id);
                        string     start1     = string.Format("{0:D2}:{1:D2}", schedule.Start_time.Hours, schedule.Start_time.Minutes);
                        string     end1       = string.Format("{0:D2}:{1:D2}", schedule.End_time.Hours, schedule.End_time.Minutes);
                        string     time       = schedule.Show_date.ToString($"{schedule.Show_date:dd/MM/yyyy}");
                        string     datetime   = time + " " + start1 + " - " + end1;
                        string[]   a          = list[i].Seats.Trim().Split(" ");

                        string format = string.Format($"{i+1,-6}| {informatin.Name,-25}| {datetime,-25}| {CheckCount(a),-18}|{ChoiceMapSeats.Tien (list[i].Price.ToString ()),-9} VND");
                        Console.WriteLine(format);
                        Console.WriteLine("");
                    }
                    Console.WriteLine("_____________________________________________________________________________________________");
                    Console.WriteLine("\n\n\n0. Quay lại.");
                    Console.WriteLine("*: Nhập số thứ tự để xem chi tiết vé .");
                    Console.WriteLine("---------------------------------------------------------------------------------------------");
                    Console.Write("#Chọn :  ");
                    int number;
                    while (true)
                    {
                        bool isINT = Int32.TryParse(Console.ReadLine(), out number);
                        if (!isINT)
                        {
                            Console.WriteLine("Giá trị sai vui lòng nhập lại. ");
                            Console.Write("#Chọn: ");
                        }
                        else if (number < 0 || number > list.Count)
                        {
                            Console.WriteLine($"Giá trị sai vui lòng nhập lại 0 -> {list.Count}.");
                            Console.Write("#Chọn : ");
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (number == 0)
                    {
                        return;
                    }
                    ChoiceMapSeats.InformationTickets(list[number - 1], 1);
                    Console.Write("                   Nhập <Enter> để trở lại.");
                    Console.ReadLine();
                    return;
                }
            } catch (System.Exception) {
                List <Reservation> list = reser.GetReservationByCustomerId(Login.GetCustomer1().Customer_id);
                if (list.Count == 0 || list == null)
                {
                    Console.WriteLine("Bạn chưa có giao dịch nào với Rạp Thế Giới ! Đặt vé ngay bạn yêu nhé.");
                    Console.WriteLine("Nhập <Enter> để trở lại.");
                    Console.ReadLine();
                    return;
                }
                else
                {
                    Console.Clear();
                    Console.WriteLine("                              Thông tin vé đặt trước  ");
                    Console.WriteLine("                             _________________________");
                    Console.WriteLine("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
                    Console.WriteLine("STT   | Tên Phim                 | Ngày Chiếu               | Số Lượng (V-T)    |Giá Tiền ");
                    Console.WriteLine("_____________________________________________________________________________________________");

                    for (int i = 0; i < list.Count; i++)
                    {
                        ScheduleBL sch        = new ScheduleBL();
                        Schedules  schedule   = sch.GetScheduleByIdSchedule(list[i].Schedule_id);
                        MoviesBL   movie      = new MoviesBL();
                        Movies     informatin = movie.getMovieById(schedule.Movie_id);
                        string     start1     = string.Format("{0:D2}:{1:D2}", schedule.Start_time.Hours, schedule.Start_time.Minutes);
                        string     end1       = string.Format("{0:D2}:{1:D2}", schedule.End_time.Hours, schedule.End_time.Minutes);
                        string     time       = schedule.Show_date.ToString($"{schedule.Show_date:dd/MM/yyyy}");
                        string     datetime   = time + " " + start1 + " - " + end1;
                        string[]   a          = list[i].Seats.Trim().Split(" ");

                        string format = string.Format($"{i+1,-6}| {informatin.Name,-25}| {datetime,-25}| {CheckCount(a),-18}|{ChoiceMapSeats.Tien (list[i].Price.ToString ()),-9} VND");
                        Console.WriteLine(format);
                        Console.WriteLine("");
                    }
                    Console.WriteLine("_____________________________________________________________________________________________");
                    Console.WriteLine("\n\n\n0. Quay lại.");
                    Console.WriteLine("*: Nhập số thứ tự để xem chi tiết vé .");
                    Console.WriteLine("---------------------------------------------------------------------------------------------");
                    Console.Write("#Chọn :  ");
                    int number;
                    while (true)
                    {
                        bool isINT = Int32.TryParse(Console.ReadLine(), out number);
                        if (!isINT)
                        {
                            Console.WriteLine("Giá trị sai vui lòng nhập lại. ");
                            Console.Write("#Chọn: ");
                        }
                        else if (number < 0 || number > list.Count)
                        {
                            Console.WriteLine($"Giá trị sai vui lòng nhập lại 0 -> {list.Count}.");
                            Console.Write("#Chọn : ");
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (number == 0)
                    {
                        return;
                    }
                    ChoiceMapSeats.InformationTickets(list[number - 1], 1);
                    Console.Write("                   Nhập <Enter> để trở lại.");
                    Console.ReadLine();
                    return;
                }
            }
        }