Exemplo n.º 1
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');
        }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ScheduleBL objScheduleBL = new ScheduleBL();
     DataSet ds = new DataSet();
     ds = objScheduleBL.RetrieveSchedule();
     GVSchedules.DataSource = ds;
     GVSchedules.DataBind();
 }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ScheduleBL objScheduleBL = new ScheduleBL();
        DataSet    ds            = new DataSet();

        ds = objScheduleBL.RetrieveSchedule();
        GVSchedules.DataSource = ds;
        GVSchedules.DataBind();
    }
    public void SelectTimeByDateAndIdMovieTrueTest()
    {
        string regex    = @"(?<year>\d{2,4})-(?<month>\d{1,2})-(?<day>\d{1,2})";
        string datetime = "2018-07-26";

        Assert.Matches(regex, datetime);
        ScheduleBL sch = new ScheduleBL();

        Assert.NotNull(sch.SelectTime(1, datetime));
    }
Exemplo n.º 5
0
    public void SelecDateTimeFail()
    {
        string regex    = @"(?<year>\d{2,4})-(?<month>\d{1,2})-(?<day>\d{1,2})";
        string datetime = "2018-077-26";

        Assert.DoesNotMatch(regex, datetime);
        ScheduleBL sch = new ScheduleBL();

        Assert.Null(sch.SelectTime(1, datetime));
    }
    public void SelectScheduleTimeByTestFail(int movie_id, string datetime, string time)
    {
        string regexDate = @"(?<year>\d{2,4})-(?<month>\d{1,2})-(?<day>\d{1,2})";
        string regexTime = @"^(\d{1,2}|\d\.\d{2}):([0-5]\d):([0-5]\d)(\.\d+)?$";

        Assert.DoesNotMatch(regexDate, datetime);
        Assert.DoesNotMatch(regexTime, time);
        ScheduleBL sch = new ScheduleBL();

        Assert.Null(sch.SelectTimeBy(movie_id, datetime, time));
    }
        public void getScheduleTest()
        {
            // Arrange
            var obj = new ScheduleBL();

            // Act
            var obj2 = obj.GetTrains("", "", "");

            // Assert
            Console.WriteLine($"Number of entries: {obj2.Count()}");
            foreach (var item in obj2)
            {
                Console.WriteLine($"Train - {item.Train}, Number - {item.Number}");
            }
        }
Exemplo n.º 8
0
        public void ChooseMovieScheduleForYou(int movie_id)
        {
            Console.Clear();
            MoviesBL   movie     = new MoviesBL();
            ScheduleBL schechule = new ScheduleBL();
            RoomBL     room      = new RoomBL();
            // information . Lấy ra phim nhờ id movie
            Movies informatin = movie.getMovieById(movie_id);
            // list lấy ra tất cả lịch chiếu của phim.
            List <DateTime> list             = schechule.SelectDatetime(movie_id);
            TimeSpan        datefortimespan  = DateTime.Now.TimeOfDay;
            DateTime        comparedatetime  = DateTime.Now;
            string          comparedatetime1 = comparedatetime.ToString($"{comparedatetime:dd/MM/yyyy}");
            // Array này lấy ra ngày để connect tới database format by yyyy-MM-dd.
            List <string> array = new List <string> ();
            // Array1 này. Lưu lại thời gian để so sách với thời gian hiện tại.
            List <string> array1 = new List <string> ();

            int dem = 0;

            string[] arr1 = new string[] { "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy", "Chủ nhật" };
            string[] arr2 = new string[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
            Console.WriteLine("============================================================================================");
            Console.WriteLine($"----------------- Chọn Ngày Chiếu Của Phim  :  {informatin.Name} ");
            Console.WriteLine("============================================================================================");
            for (int i = 0; i < list.Count; i++)
            {
                string date = list[i].Date.ToString($"{list[i].Date:dd/MM/yyyy}");
                if (list[i].Date > DateTime.Now && comparedatetime1.CompareTo(date) < 0 || comparedatetime1.CompareTo(date) == 0)
                {
                    string date1 = list[i].Date.ToString($"{list[i].Date:yyyy-MM-dd}");
                    array.Add(date1);
                    array1.Add(date);
                    int    count = -1;
                    string week  = $"{list[i].Date.DayOfWeek}";
                    for (int j = 0; j < arr2.Length; j++)
                    {
                        if (arr2[j] == week)
                        {
                            count = j;
                            break;
                        }
                    }
                    string format = string.Format($"{dem+1,2}.  {date}   {arr1[count],-8}  ");
                    dem++;
                    Console.WriteLine($"{format}");
                    Console.WriteLine();
                }
            }
            Console.WriteLine("--------------------------------------------------------------------------------------------");
            int number;

            Console.WriteLine("0. Quay lại menu chính.");
            Console.WriteLine("*: Nhập số thứ tự để chọn ngày chiếu.");
            Console.WriteLine("--------------------------------------------------------------------------------------------");
            Console.Write("#Chọn :  ");
            while (true)
            {
                bool isINT = Int32.TryParse(Console.ReadLine(), out number);
                if (!isINT)
                {
                    Console.WriteLine("Bạn vừa nhập sai giá trị, vui lòng nhập lại.");
                    Console.Write("#Chọn: ");
                }
                else if (number < 0 || number > array.Count)
                {
                    Console.WriteLine($"Giá trị trong khoảng từ 0 - > { array.Count }");
                    Console.Write("#Chọn: ");
                }
                else
                {
                    break;
                }
            }
            if (number == 0)
            {
                CinemaInterface.Cinema();
            }
            ShowScheduleByMovieIdAndDatetime(movie_id, schechule, array1[number - 1], array[number - 1]);
        }
Exemplo n.º 9
0
        public static void ShowScheduleByMovieIdAndDatetime(int movie_id, ScheduleBL schechule, string datetime, string datetimeforDatabase)
        {
            Console.Clear();
            MoviesBL movie            = new MoviesBL();
            Movies   informatin       = movie.getMovieById(movie_id);
            RoomBL   room             = new RoomBL();
            TimeSpan datefortimespan  = DateTime.Now.TimeOfDay;
            DateTime comparedatetime  = DateTime.Now;
            string   comparedatetime1 = comparedatetime.ToString($"{comparedatetime:dd/MM/yyyy}");

            // Lấy ra lịch chiếu nhờ STT của Ngày chiếu.
            Console.WriteLine("=====================================================================");
            Console.WriteLine($"-Chọn Lịch Chiếu Của Phim  :  {informatin.Name} Ngày {datetime} -");
            Console.WriteLine("---------------------------------------------------------------------");
            Console.WriteLine("STT  |  Lịch Chiếu          |  Phòng          |  Số ghế còn lại    ");
            Console.WriteLine("---------------------------------------------------------------------");
            List <Schedules> demons = schechule.SelectTime(movie_id, datetimeforDatabase);
            // Lưu tất cả các TimeSpan để so sánh với DateTime.Now.TimeOfDay
            List <string> list1 = new List <string> ();
            // List2 để lấy ra các thời gian show ra màn hình.
            List <string> list2 = new List <string> ();

            string tym_one = string.Format("{0:D2}:{1:D2}:{2:D2}", datefortimespan.Hours, datefortimespan.Minutes, datefortimespan.Seconds);
            int    count1  = 0;

            foreach (var item in demons)
            {
                string timeText = string.Format("{0:D2}:{1:D2}:{2:D2}", item.Start_time.Hours, item.Start_time.Minutes, item.Start_time.Seconds);
                list1.Add(timeText);
            }
            for (int j = 0; j < demons.Count; j++)
            {
                Rooms  ro     = room.GetRoomById(demons[j].Room_id);
                string date1  = demons[j].Show_date.ToString($"{demons[j].Show_date:yyyy-MM-dd}");
                string timeTe = string.Format("{0:D2}:{1:D2}:{2:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes, demons[j].Start_time.Seconds);
                // Schedules sche = schechule.SelectTimeBy (demons[j].Movie_id,date1,timeTe);
                if (comparedatetime1.CompareTo(datetime) == 0)
                {
                    if (tym_one.CompareTo(list1[j]) < 0)
                    {
                        string start = string.Format("{0:D2}:{1:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes);
                        string end   = string.Format("{0:D2}:{1:D2}", demons[j].End_time.Hours, demons[j].End_time.Minutes);
                        count1++;
                        string addtimetolist2 = string.Format("{0:D2}:{1:D2}:{2:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes, demons[j].Start_time.Seconds);
                        list2.Add(addtimetolist2);
                        Schedules sche   = schechule.SelectTimeBy(demons[j].Movie_id, date1, timeTe);
                        string[]  count  = sche.Schedule_room_seat.Trim().Split(";");
                        string[]  seated = count[2].Split(",");
                        string[]  chaier = ro.Chaire_not_placed.Split(",");
                        int       a      = 0;
                        if (seated[0] != "")
                        {
                            a = ro.Number_Of_seats - seated.Length;
                        }
                        else
                        {
                            a = ro.Number_Of_seats;
                        }
                        if (chaier[0] != "")
                        {
                            a = a - chaier.Length;
                        }
                        string format = string.Format($"{count1}.   | {start,-5} -  {end,-5}       |  {ro.Name,-10}     | {a}");
                        Console.WriteLine(format);
                    }
                }
                else
                {
                    string start = string.Format("{0:D2}:{1:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes);
                    string end   = string.Format("{0:D2}:{1:D2}", demons[j].End_time.Hours, demons[j].End_time.Minutes);
                    count1++;
                    Schedules sche   = schechule.SelectTimeBy(demons[j].Movie_id, date1, timeTe);
                    string[]  count  = sche.Schedule_room_seat.Trim().Split(";");
                    string[]  seated = count[2].Split(",");
                    int       a      = 0;
                    if (seated[0] != "")
                    {
                        a = ro.Number_Of_seats - seated.Length;
                    }
                    else
                    {
                        a = ro.Number_Of_seats;
                    }
                    string[] chaier = ro.Chaire_not_placed.Split(",");
                    if (chaier[0] != "")
                    {
                        a = a - chaier.Length;
                    }
                    string addtimetolist2 = string.Format("{0:D2}:{1:D2}:{2:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes, demons[j].Start_time.Seconds);
                    list2.Add(addtimetolist2);
                    string format = string.Format($"{count1}.   | {start,-5} -  {end,-5}       |  {ro.Name,-10}     |  {a }");
                    Console.WriteLine(format);
                }
            }
            Console.WriteLine("---------------------------------------------------------------------");
            int number1;

            Console.WriteLine("0. Quay lại menu chính.");
            Console.WriteLine("*: Nhập số thứ tự để suất chiếu.");
            Console.WriteLine("---------------------------------------------------------------------");
            Console.Write("#Chọn :  ");
            while (true)
            {
                bool isINT = Int32.TryParse(Console.ReadLine(), out number1);
                if (!isINT)
                {
                    Console.WriteLine("Bạn vừa nhập sai giá trị, vui lòng nhập lại.");
                    Console.Write("#Chọn: ");
                }
                else if (number1 < 0 || number1 > list2.Count)
                {
                    Console.WriteLine($"Giá trị trong khoảng từ 0 - > { list2.Count }");
                    Console.Write("#Chọn: ");
                }
                else
                {
                    break;
                }
            }
            if (number1 == 0)
            {
                CinemaInterface.Cinema();
            }
            Console.Clear();
            Schedules sch = schechule.SelectTimeBy(movie_id, datetimeforDatabase, list2[number1 - 1]);

            ChoiceMapSeats.MenuChoiceSeats(sch);
        }
Exemplo n.º 10
0
        public static void MenuChoiceSeats(Schedules scheduleUp)
        {
            List <string> choicedSeat = new List <string> ();

            while (true)
            {
                // ------------------------ Map Seats in Database with Schedule.
                ScheduleBL schechuleBl = new ScheduleBL();
                string     showdate    = scheduleUp.Show_date.ToString($"{scheduleUp.Show_date:yyyy-MM-dd}");
                string     starttime   = string.Format("{0:D2}:{1:D2}:{2:D2}", scheduleUp.Start_time.Hours, scheduleUp.Start_time.Minutes, scheduleUp.Start_time.Seconds);
                Schedules  schedule    = schechuleBl.SelectTimeBy(scheduleUp.Movie_id, showdate, starttime);
                string     map         = schedule.Schedule_room_seat;
                Console.Clear();
                string[]      mapArr  = map.Split(";");
                string[]      rowsArr = mapArr[0].Split(" ");
                int           cols    = Int32.Parse(mapArr[1]);
                List <string> succer  = new List <string> ();
                string[]      seated  = mapArr[2].Split(",");
                succer = AddlistByMapSeat(succer, seated);
                // -------------- Map not
                RoomBL   room = new RoomBL();
                Rooms    ro   = room.GetRoomById(schedule.Room_id);
                string   map_ = ro.Chaire_not_placed;
                string[] map_chaire_not_placed = map_.Split(",");

                // -----------------------------------
                ShowSeatChoice(rowsArr, cols, seated, choicedSeat, schedule, map_chaire_not_placed);
                Console.WriteLine("\n        0. Quay lại.");
                Console.WriteLine("\n        *: Nhập số số ghế theo định dạng A1, A2, A3 để chọn ghế.");
                Console.WriteLine("\n     _______________________________________________________________________________________________");
                string   choice;
                string[] choiced;
                // Cho khánh hàng nhập các ghế mà khách hàng muốn chọn, Phải nhập đúng định dạng thì mới được break ra khỏi While(true).
                while (true)
                {
                    Console.Write("\n        •√ Bạn chọn ghế :");
                    choice = Console.ReadLine().Trim().ToUpper();
                    if (choice == "0")
                    {
                        BookingTicker tick = new BookingTicker();
                        tick.MenuBookingTicker();
                        return;
                    }
                    try {
                        if (choice[choice.Length - 1] == ',')
                        {
                            choice = choice.Remove(choice.Length - 1, 1);
                        }
                    } catch (System.Exception) { }
                    choiced = choice.Split(",");
                    if (CheckInsertIntoChoice(choiced) == true)
                    {
                        break;
                    }
                    else
                    {
                        Console.Clear();
                        ShowSeatChoice(rowsArr, cols, seated, choicedSeat, schedule, map_chaire_not_placed);
                        Console.WriteLine("\n        #: Bạn đã nhập sai định dạng ghế VD : A1, A2, A3. Vui lòng nhập lại!! Hoặc chọn 0 để thoát");
                    }
                }
                string test = "";
                test = CheckSeatInSchedule(choiced, succer, test, rowsArr, cols, map_chaire_not_placed);
                if (test != "")
                {
                    Console.Clear();
                    Console.WriteLine("\n                    -------------------------------------------------------------------------------");
                    Console.WriteLine("                          #: Ghế " + test + " mà bạn chọn không có trong danh sách hoặc đã được đặt rồi. ");
                    Console.WriteLine("                             Vui lòng chọn lại ghế hoặc thoát");
                    Console.WriteLine("\n                    -------------------------------------------------------------------------------");
                    ComeBackMenu(scheduleUp, 0);
                    return;
                }

                string checkedSeat = "";
                // List<string> choicedSeat = new List<string> ();
                for (int i = 0; i < choiced.Length; i++)
                {
                    if (succer.FindIndex(x => x == choiced[i]) == -1)
                    {
                        if (choicedSeat.FindIndex(x => x == choiced[i]) == -1)
                        {
                            succer.Add(choiced[i]);
                            choicedSeat.Add(choiced[i]);
                        }
                        else
                        {
                            checkedSeat = checkedSeat + " " + choiced[i];
                        }
                    }
                }

                ShowSeatChoice(rowsArr, cols, seated, choicedSeat, schedule, map_chaire_not_placed);
                ChoiceBookingAndContinue();
                if (checkedSeat != "")
                {
                    Console.WriteLine("             Bạn vừa chọn ghế " + checkedSeat + " này rồi ! ");
                }
                Console.Write("\n             #Chọn : ");
                int number;
                while (true)
                {
                    bool isINT = Int32.TryParse(Console.ReadLine(), out number);
                    if (!isINT)
                    {
                        Console.Clear();
                        ShowSeatChoice(rowsArr, cols, seated, choicedSeat, schedule, map_chaire_not_placed);
                        ChoiceBookingAndContinue();
                        Console.WriteLine("\n             • Giá trị sai vui lòng nhập lại.");
                        Console.Write("\n             #Chọn : ");
                    }
                    else if (number < 0 || number > 2)
                    {
                        Console.Clear();
                        ShowSeatChoice(rowsArr, cols, seated, choicedSeat, schedule, map_chaire_not_placed);
                        ChoiceBookingAndContinue();
                        Console.WriteLine("\n             • Giá trị sai vui lòng nhập lại 1 hoặc 2. ");
                        Console.Write("\n             #Chọn : ");
                    }
                    else
                    {
                        break;
                    }
                }
                Console.WriteLine();
                switch (number)
                {
                case 1:
                    map = AddSeatsForSchedule(choicedSeat, seated, map);
                    InformationMovieBookingTickets(schedule, choicedSeat, map);
                    choicedSeat = null;
                    choicedSeat = new List <string> ();
                    break;

                case 2:
                    Console.Clear();
                    break;
                }
            }
        }
Exemplo n.º 11
0
        public static void InformationTickets(Reservation res, int count)
        {
            ScheduleBL sch        = new ScheduleBL();
            Schedules  schedule   = sch.GetScheduleByIdSchedule(res.Schedule_id);
            MoviesBL   movie      = new MoviesBL();
            Movies     informatin = movie.getMovieById(schedule.Movie_id);
            RoomBL     room       = new RoomBL();
            Rooms      ro         = room.GetRoomById(schedule.Room_id);
            string     timeshow   = ShowDay(schedule.Show_date, schedule.Start_time, schedule.End_time);

            Console.Clear();
            Console.WriteLine($"                   ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-++++");
            Console.WriteLine($"                   |                           √√ VÉ ĐẶT TRƯỚC √√                                 |");
            Console.WriteLine($"                   |                                                                              |");
            Console.WriteLine($"                   |                                                                              |");
            try
            {
                Console.WriteLine($"                   |   • Khánh Hàng : {String.Format(UserInterface.LoginCinema.GetCustomer ().Name),-20}  • SĐT {String.Format(UserInterface.LoginCinema.GetCustomer ().Phone),-31} |");
            }
            catch (System.Exception)
            {
                Console.WriteLine($"                   |   • Khánh Hàng : {String.Format(Login.GetCustomer1 ().Name),-20}  • SĐT {String.Format(Login.GetCustomer1 ().Phone),-31} |");
            }
            Console.WriteLine($"                   |                                                                              |");
            Console.WriteLine($"                   |   • Mẫu số : 01/VE2/003                • Ký Hiệu  : MT/17T                   |");
            Console.WriteLine($"                   |                                                                              |");
            Console.WriteLine($"                   |   • Số vé : {res.Code_ticket,-6}                   • MST : 0303675393-001                |");
            Console.WriteLine($"                   |                                                                              |");
            Console.WriteLine($"                   |  CÔNG TY TNHH CINEMA MẠNH ĐẠT - CHI NHÁNH HÀ NỘI                             |");
            Console.WriteLine($"                   |  Toà nhà VTC, Số 18 đường Tam Trinh  quận Hai Bà Trưng, thành phố Hà Nội     |");
            Console.WriteLine($"                   |                                                                              |");
            Console.WriteLine($"                   |  ............................................................................|");
            Console.WriteLine($"                   |                                                                              |");
            if (count == 0)
            {
                Console.WriteLine($"                   |   CIMENA THẾ GIỚI {DateTime.Now} BOX1 ONLINE                            |");
            }
            else
            {
                Console.WriteLine($"                   |   CIMENA THẾ GIỚI {res.Create_on} BOX1 ONLINE                           |");
            }
            Console.WriteLine($"                   |                                                                              |");
            Console.WriteLine($"                   |  ============================================================================|");
            Console.WriteLine($"                   |                                                                              |");
            Console.WriteLine($"                   |   √ {string.Format ($"{informatin.Name.ToUpper (),-73}")}|");
            Console.WriteLine($"                   |                                                                              |");
            Console.WriteLine($"                   |   √ Thời gian chiếu :   {string.Format ($"{timeshow,-53}")}|");
            Console.WriteLine($"                   |                                                                              |");

            Console.Write($"                   |   √ Phòng chiếu     : {string.Format ($"{ro.Name,-6}")}    Ghế   ");
            string[] arraySeat = res.Seats.Trim().Split(" ");
            int      dem       = 0;

            for (int i = 0; i < arraySeat.Length; i++)
            {
                dem++;
                Console.Write($"{arraySeat[i]} :  {Tien(PaymentFare(arraySeat[i]).ToString())} VND  ");
                if (dem == 2)
                {
                    dem = 0;
                }
                if ((i + 1) % 2 == 0)
                {
                    Console.Write("   |\n                   |                                       ");
                }
            }

            if (dem == 1)
            {
                Console.WriteLine("                     |");
            }
            else
            {
                Console.WriteLine("                                       |");
            }
            Console.WriteLine($"                   |                                                                              |");
            Console.WriteLine($"                   |  ============================================================================|");
            Console.WriteLine($"                   |                                                                              |");
            Console.WriteLine($"                   |   √ Giá Tiền                                   VND   {Tien(res.Price.ToString()),-15}         | ");
            Console.WriteLine($"                   |                                                (Đã bao gồm 5% VAT)           |");
            Console.WriteLine($"                   ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-++++");
            Console.WriteLine($"                     ____________________________________________________________________________");
            if (count == 0)
            {
                Console.WriteLine();
                Console.WriteLine($"                          #: Vui lòng nhớ số điện thoại và số vé để đối chiếu                    ");
                Console.WriteLine($"                          #: Quý khánh vui lòng đến trước suất chiếu 15 phút để lấy vé           ");
                Console.WriteLine($"                             Quá thời gian lấy vé, chúng tôi sẽ không hoàn lại tiền vé của bạn   ");
                Console.WriteLine($"                             và vé đặt sẽ tự động bị huỷ.                                        ");
                Console.WriteLine($"                     ____________________________________________________________________________");
                ComeBackMenu(schedule, 1);
            }
            else
            {
                return;
            }
        }
Exemplo n.º 12
0
        public void ChooseMovieScheduleForYou(int movie_id)
        {
            Console.Clear();
            MoviesBL   movie     = new MoviesBL();
            ScheduleBL schechule = new ScheduleBL();
            RoomBL     room      = new RoomBL();
            // information . Lấy ra phim nhờ id movie
            Movies informatin = movie.getMovieById(movie_id);
            // list lấy ra tất cả lịch chiếu của phim.
            List <DateTime> list             = schechule.SelectDatetime(movie_id);
            TimeSpan        datefortimespan  = DateTime.Now.TimeOfDay;
            DateTime        comparedatetime  = DateTime.Now;
            string          comparedatetime1 = comparedatetime.ToString($"{comparedatetime:dd/MM/yyyy}");
            // Array này lấy ra ngày để connect tới database format by yyyy-MM-dd.
            List <string> array = new List <string> ();
            // Array1 này. Lưu lại thời gian để so sách với thời gian hiện tại.
            List <string> array1 = new List <string> ();

            int dem = 0;

            string[] arr1 = new string[] { "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy", "Chủ nhật" };
            string[] arr2 = new string[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
            Console.WriteLine("============================================================================================");
            Console.WriteLine($"----------------- Chọn Ngày Chiếu Của Phim  :  {informatin.Name} ");
            Console.WriteLine("============================================================================================");
            for (int i = 0; i < list.Count; i++)
            {
                string date = list[i].Date.ToString($"{list[i].Date:dd/MM/yyyy}");
                if (list[i].Date > DateTime.Now && comparedatetime1.CompareTo(date) < 0 || comparedatetime1.CompareTo(date) == 0)
                {
                    string date1 = list[i].Date.ToString($"{list[i].Date:yyyy-MM-dd}");
                    array.Add(date1);
                    array1.Add(date);
                    int    count = -1;
                    string week  = $"{list[i].Date.DayOfWeek}";
                    for (int j = 0; j < arr2.Length; j++)
                    {
                        if (arr2[j] == week)
                        {
                            count = j;
                            break;
                        }
                    }
                    string format = string.Format($"{dem+1,2}.  {date}   {arr1[count],-8}  ");
                    dem++;
                    Console.WriteLine($"{format}");
                    Console.WriteLine();
                }
            }
            int number;

            Console.Write(" * ^: Nhập số STT để chọn ngày chiếu : ");
            while (true)
            {
                bool isINT = Int32.TryParse(Console.ReadLine(), out number);
                if (!isINT)
                {
                    Console.WriteLine("Bạn vừa nhập sai giá trị, vui lòng nhập lại.");
                    Console.Write("#Chọn: ");
                }
                else if (number <= 0 || number > array.Count)
                {
                    Console.WriteLine($"Giá trị trong khoảng từ 1 - > { array.Count }");
                    Console.Write("#Chọn: ");
                }
                else
                {
                    break;
                }
            }
            Console.Clear();
            // Lấy ra lịch chiếu nhờ STT của Ngày chiếu.
            Console.WriteLine("=====================================================================");
            Console.WriteLine($"-Chọn Lịch Chiếu Của Phim  :  {informatin.Name} Ngày {array1[number - 1]} -");
            Console.WriteLine("---------------------------------------------------------------------");
            Console.WriteLine("STT  |  Lịch Chiếu          |  Phòng          |   Số Ghế    ");
            Console.WriteLine("---------------------------------------------------------------------");
            List <Schedules> demons = schechule.SelectTime(movie_id, array[number - 1]);
            // Lưu tất cả các TimeSpan để so sánh với DateTime.Now.TimeOfDay
            List <string> list1 = new List <string> ();
            // List2 để lấy ra các thời gian show ra màn hình.
            List <string> list2 = new List <string> ();

            string tym_one = string.Format("{0:D2}:{1:D2}:{2:D2}", datefortimespan.Hours, datefortimespan.Minutes, datefortimespan.Seconds);
            int    count1  = 0;

            foreach (var item in demons)
            {
                string timeText = string.Format("{0:D2}:{1:D2}:{2:D2}", item.Start_time.Hours, item.Start_time.Minutes, item.Start_time.Seconds);
                list1.Add(timeText);
            }
            for (int j = 0; j < demons.Count; j++)
            {
                Rooms ro = room.GetRoomById(demons[j].Room_id);
                if (comparedatetime1.CompareTo(array1[number - 1]) == 0)
                {
                    if (tym_one.CompareTo(list1[j]) < 0)
                    {
                        string start = string.Format("{0:D2}:{1:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes);
                        string end   = string.Format("{0:D2}:{1:D2}", demons[j].End_time.Hours, demons[j].End_time.Minutes);
                        count1++;
                        string addtimetolist2 = string.Format("{0:D2}:{1:D2}:{2:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes, demons[j].Start_time.Seconds);
                        list2.Add(addtimetolist2);
                        string format = string.Format($"{count1}.   | {start,-5} -  {end,-5}       |  {ro.Name,-10}     | {ro.Number_Of_seats}");
                        Console.WriteLine(format);
                    }
                }
                else
                {
                    string start = string.Format("{0:D2}:{1:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes);
                    string end   = string.Format("{0:D2}:{1:D2}", demons[j].End_time.Hours, demons[j].End_time.Minutes);
                    count1++;
                    string addtimetolist2 = string.Format("{0:D2}:{1:D2}:{2:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes, demons[j].Start_time.Seconds);
                    list2.Add(addtimetolist2);
                    string format = string.Format($"{count1}.   | {start,-5} -  {end,-5}       |  {ro.Name,-10}     |  {ro.Number_Of_seats}");
                    Console.WriteLine(format);
                }
            }
            Console.WriteLine("======================================================================");
            int number1;

            Console.Write(" * ^: Nhập số STT để chọn ngày chiếu : ");
            while (true)
            {
                bool isINT = Int32.TryParse(Console.ReadLine(), out number1);
                if (!isINT)
                {
                    Console.WriteLine("Bạn vừa nhập sai giá trị, vui lòng nhập lại.");
                    Console.Write("#Chọn: ");
                }
                else if (number1 <= 0 || number1 > list2.Count)
                {
                    Console.WriteLine($"Giá trị trong khoảng từ 1 - > { list2.Count }");
                    Console.Write("#Chọn: ");
                }
                else
                {
                    break;
                }
            }
            Console.Clear();
            Schedules sch    = schechule.SelectTimeBy(movie_id, array[number - 1], list2[number1 - 1]);
            string    start1 = string.Format("{0:D2}:{1:D2}", sch.Start_time.Hours, sch.Start_time.Minutes);
            string    end1   = string.Format("{0:D2}:{1:D2}", sch.End_time.Hours, sch.End_time.Minutes);

            Console.WriteLine("=====================================================================");
            Console.WriteLine($"Rạp chiếu phim thế giới.");
            Console.WriteLine($"Phim : {informatin.Name}.  Ngày chiếu : {array1[number - 1]}. Lịch chiếu : {start1} - {end1}");
            Console.WriteLine("---------------------------------------------------------------------");
            Console.WriteLine("---------------------------------------------------------------------");
            Console.WriteLine("CHỌN GHẾ ");
            Console.WriteLine("---------------------------------------------------------------------");
        }
        // Show toàn bộ các lịch chiếu của phim, so sách với mốc thời gian hiện tại nếu thời gian đã qua thì k in nữa.
        public static void Schedule_Infor_By_IDMOVIE_DATE(int movie_id)
        {
            Console.Clear();
            MoviesBL        movie            = new MoviesBL();
            Movies          informatin       = movie.getMovieById(movie_id);
            ScheduleBL      sch              = new ScheduleBL();
            List <DateTime> list             = sch.SelectDatetime(movie_id);
            List <string>   array            = new List <string> ();
            TimeSpan        datefortimespan  = DateTime.Now.TimeOfDay;
            DateTime        comparedatetime  = DateTime.Now;
            string          comparedatetime1 = comparedatetime.ToString($"{comparedatetime:dd/MM/yyyy}");
            int             dem              = 0;

            // Khai báo 2 mảng để in ra thứ nhờ Date.DayOfWeek return về 1 ngày trong tuần.
            string[] arr1 = new string[] { "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy", "Chủ nhật" };
            string[] arr2 = new string[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
            Console.WriteLine("============================================================================================");
            Console.WriteLine($"----------------- Lịch chiếu phim :   {informatin.Name} ");
            Console.WriteLine("============================================================================================");
            Console.WriteLine("Ngày chiếu                |   Thời gian chiếu ( Thời gian bắt đầu - Thời gian kết thúc )");
            Console.WriteLine("============================================================================================");
            for (int i = 0; i < list.Count; i++)
            {
                string date = list[i].Date.ToString($"{list[i].Date:dd/MM/yyyy}");
                // So sánh các mốc thời gian chiếu của phim nếu lớn hơn  hoặc bằng thời gian hiện tại thì show ra GUI. Nếu < thì k show.
                if (list[i].Date > DateTime.Now && comparedatetime1.CompareTo(date) < 0 || comparedatetime1.CompareTo(date) == 0)
                {
                    string date1 = list[i].Date.ToString($"{list[i].Date:yyyy-MM-dd}");
                    array.Add(date1);
                    int count = -1;
                    // Lấy ra ngày trong tuần và so sánh để lấy ra index. Chuyền vào arr1 để dịch ngày đó sang tiếng việt.
                    string week = $"{list[i].Date.DayOfWeek}";
                    for (int j = 0; j < arr2.Length; j++)
                    {
                        if (arr2[j] == week)
                        {
                            count = j;
                            break;
                        }
                    }
                    string format = string.Format($"{dem+1,2}. {list[i].Date:dd/MM/yyyy} {arr1[count],-10} |  ");
                    Console.Write($"{format}");
                    // Format time HH:MM:SS
                    List <Schedules> demons  = sch.SelectTime(movie_id, array[dem]);
                    string           tym_one = string.Format("{0:D2}:{1:D2}:{2:D2}", datefortimespan.Hours, datefortimespan.Minutes, datefortimespan.Seconds);
                    // Add tất cả thời gian chiếu trong ngày vào.
                    List <string> list1 = new List <string> ();
                    foreach (var item in demons)
                    {
                        string timeText = string.Format("{0:D2}:{1:D2}:{2:D2}", item.Start_time.Hours, item.Start_time.Minutes, item.Start_time.Seconds);
                        list1.Add(timeText);
                    }
                    for (int j = 0; j < demons.Count; j++)
                    {
                        // Nếu ngày hiện tại bằng ngày chiếu của phim. Thì so sánh các khoảng thời gian chiếu trong ngày với thời gian hiện tại.
                        if (comparedatetime1.CompareTo(date) == 0)
                        {
                            if (tym_one.CompareTo(list1[j]) < 0)
                            {
                                string start = string.Format("{0:D2}:{1:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes);
                                string end   = string.Format("{0:D2}:{1:D2}", demons[j].End_time.Hours, demons[j].End_time.Minutes);
                                Console.Write($" {start} - {end} ");
                                if (j == 3)
                                {
                                    Console.WriteLine();
                                    Console.Write("                          |                  ");
                                }
                            }
                        }
                        else
                        {
                            string start = string.Format("{0:D2}:{1:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes);
                            string end   = string.Format("{0:D2}:{1:D2}", demons[j].End_time.Hours, demons[j].End_time.Minutes);
                            Console.Write($" {start} - {end} ");
                            if (j == 3)
                            {
                                Console.WriteLine();
                                Console.Write("                          |                 ");
                            }
                        }
                    }
                    dem++;
                    Console.WriteLine("");
                    Console.WriteLine("__________________________|_________________________________________________________________");
                }
            }

            Console.WriteLine($"");
            Console.WriteLine("--------------------------------------------------------------------------------------------");
            Console.WriteLine("1. Đặt vé.");
            Console.WriteLine("\n2. Trở lại.");
            Console.WriteLine("\n3. Trở về menu chính.");
            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 > 3)
                {
                    Console.WriteLine("Giá trị sai vui lòng nhập lại 1 - 3. ");
                    Console.Write("#Chọn : ");
                }
                else
                {
                    break;
                }
            }
            switch (number)
            {
            case 1:
                BookingTicker ticket = new BookingTicker();
                ticket.ChooseMovieScheduleForYou(movie_id);
                break;

            case 2:
                Console.Clear();
                return;

            case 3:
                CinemaInterface cinema = new CinemaInterface();
                cinema.Cinema();
                break;
            }
            Console.WriteLine();
        }
Exemplo n.º 14
0
        // Show toàn bộ các lịch chiếu của phim, so sách với mốc thời gian hiện tại nếu thời gian đã qua thì k in nữa.
        public static void ShowScheduleTimeForMovieId(int movie_id)
        {
            Console.Clear();
            MoviesBL        movie            = new MoviesBL();
            Movies          informatin       = movie.getMovieById(movie_id);
            ScheduleBL      sch              = new ScheduleBL();
            List <DateTime> list             = sch.SelectDatetime(movie_id);
            List <string>   array            = new List <string> ();
            TimeSpan        datefortimespan  = DateTime.Now.TimeOfDay;
            DateTime        comparedatetime  = DateTime.Now;
            string          comparedatetime1 = comparedatetime.ToString($"{comparedatetime:dd/MM/yyyy}");
            int             dem              = 0;

            // Khai báo 2 mảng để in ra thứ nhờ Date.DayOfWeek return về 1 ngày trong tuần.
            string[] arr1 = new string[] { "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy", "Chủ nhật" };
            string[] arr2 = new string[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
            Console.WriteLine("============================================================================================");
            Console.WriteLine($"----------------- Lịch chiếu phim :   {informatin.Name} ");
            Console.WriteLine("============================================================================================");
            Console.WriteLine("Ngày chiếu                |   Thời gian chiếu ( Thời gian bắt đầu - Thời gian kết thúc )");
            Console.WriteLine("============================================================================================");
            for (int i = 0; i < list.Count; i++)
            {
                string date = list[i].Date.ToString($"{list[i].Date:dd/MM/yyyy}");
                // So sánh các mốc thời gian chiếu của phim nếu lớn hơn  hoặc bằng thời gian hiện tại thì show ra GUI. Nếu < thì k show.
                if (list[i].Date > DateTime.Now && comparedatetime1.CompareTo(date) < 0 || comparedatetime1.CompareTo(date) == 0)
                {
                    string date1 = list[i].Date.ToString($"{list[i].Date:yyyy-MM-dd}");
                    array.Add(date1);
                    int count = -1;
                    // Lấy ra ngày trong tuần và so sánh để lấy ra index. Chuyền vào arr1 để dịch ngày đó sang tiếng việt.
                    string week = $"{list[i].Date.DayOfWeek}";
                    for (int j = 0; j < arr2.Length; j++)
                    {
                        if (arr2[j] == week)
                        {
                            count = j;
                            break;
                        }
                    }
                    string format = string.Format($"{dem+1,2}. {list[i].Date:dd/MM/yyyy} {arr1[count],-10} |  ");
                    Console.Write($"{format}");
                    // Format time HH:MM:SS
                    List <Schedules> demons  = sch.SelectTime(movie_id, array[dem]);
                    string           tym_one = string.Format("{0:D2}:{1:D2}:{2:D2}", datefortimespan.Hours, datefortimespan.Minutes, datefortimespan.Seconds);
                    // Add tất cả thời gian chiếu trong ngày vào.
                    List <string> list1 = new List <string> ();
                    foreach (var item in demons)
                    {
                        string timeText = string.Format("{0:D2}:{1:D2}:{2:D2}", item.Start_time.Hours, item.Start_time.Minutes, item.Start_time.Seconds);
                        list1.Add(timeText);
                    }
                    for (int j = 0; j < demons.Count; j++)
                    {
                        // Nếu ngày hiện tại bằng ngày chiếu của phim. Thì so sánh các khoảng thời gian chiếu trong ngày với thời gian hiện tại.
                        if (comparedatetime1.CompareTo(date) == 0)
                        {
                            if (tym_one.CompareTo(list1[j]) < 0)
                            {
                                string start = string.Format("{0:D2}:{1:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes);
                                string end   = string.Format("{0:D2}:{1:D2}", demons[j].End_time.Hours, demons[j].End_time.Minutes);
                                Console.Write($" {start} - {end} ");
                                if (j == 3)
                                {
                                    Console.WriteLine();
                                    Console.Write("                          |  ");
                                }
                            }
                        }
                        else
                        {
                            string start = string.Format("{0:D2}:{1:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes);
                            string end   = string.Format("{0:D2}:{1:D2}", demons[j].End_time.Hours, demons[j].End_time.Minutes);
                            Console.Write($" {start} - {end} ");
                            if (j == 3)
                            {
                                Console.WriteLine();
                                Console.Write("                          |  ");
                            }
                        }
                    }
                    dem++;
                    Console.WriteLine("");
                    Console.WriteLine("__________________________|_________________________________________________________________");
                }
            }
            ChoiceMenuBookingAndComeBack(movie_id);
        }
Exemplo n.º 15
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;
                }
            }
        }
        public void CreateSchedule(User us)
        {
            Console.Clear();
            string row1 = "=====================================================================";
            string row2 = "---------------------------------------------------------------------";

            Console.WriteLine(row1);
            Console.WriteLine("Tạo lịch chiếu phim.");
            Console.WriteLine(row2);
            Console.WriteLine("[Danh sách Phim]\n");
            MovieBL mbl = new MovieBL();

            string[]     properties = { "MovieId", "MovieName", "MovieCategory", "MovieTime", "MovieDateStart", "MovieDateEnd" };
            string[]     cols       = { "Mã phim", "Tên phim", "Thể loại", "Thời lượng(Phút)", "Ngày bắt đầu", "Ngày kết thúc" };
            List <Movie> movies     = mbl.GetMoviesByCineId(us.Cine.CineId);

            // cine = cbl.GetCinemaByCineId(us.Cine.CineId);
            cs.DisplayTableData(movies, properties, cols, "dd/MM/yyyy");
            Console.WriteLine(row1);
            Console.Write("\nChọn phim(theo mã): "); sche.MovieId = cs.input(Console.ReadLine());
            while (mbl.GetMovieByMovieId(sche.MovieId) == null)
            {
                Console.Write("Không có mã này, mời bạn nhập lại: "); sche.MovieId = cs.input(Console.ReadLine());
            }
            cine = us.Cine;
            Console.Clear();
            List <ScheduleDetail> lsd = null;
            int?       scheNewId;
            ScheduleBL sbl     = new ScheduleBL();
            Schedule   scheNew = null;

            while (true)
            {
                // row1 = "========================================";
                // row2 = "----------------------------------------";
                Console.WriteLine(row1);
                Console.WriteLine("Tạo lịch chiếu phim.");
                Console.WriteLine(row2);
                Console.WriteLine("[Danh sách phòng]\n");
                string[] proper = { "RoomId", "RoomName", "RTName" };
                string[] col    = { "Mã phòng", "Tên phòng", "Loại phòng" };
                lr = rbl.GetRoomsByCineId(1);
                cs.DisplayTableData(lr, proper, col, null);
                Console.WriteLine(row1);
                Console.Write("\nChọn phòng(theo mã): "); sche.RoomId = cs.input(Console.ReadLine());
                while (rbl.GetRoomByRoomId(sche.RoomId) == null)
                {
                    Console.Write("Không có mã này, mời bạn nhập lại: "); sche.RoomId = cs.input(Console.ReadLine());
                }
                // while (sbl.GetScheduleByMovieIdAndRoomId(sche.MovieId, sche.RoomId) != null)
                // {
                //     Console.Write("Trùng lịch chiếu, mời bạn nhập lại: ");
                //     sche.RoomId = cs.input(Console.ReadLine());
                //     while (rbl.GetRoomByRoomId(sche.RoomId) == null)
                //     {
                //         Console.Write("Không có mã này, mời bạn nhập lại: "); sche.RoomId = cs.input(Console.ReadLine());
                //     }
                // }
                scheNew = sbl.GetScheduleByMovieIdAndRoomId(sche.MovieId, sche.RoomId);
                if (scheNew == null)
                {
                    scheNewId = null;
                }
                else
                {
                    scheNewId = scheNew.ScheId;
                }
                movie = mbl.GetMovieByMovieId(sche.MovieId);
                room  = rbl.GetRoomByRoomId(sche.RoomId);

                lsd = DisplayTime(movie, room, scheNew);
                // Console.Write("Không tìm thấy khung giờ hoặc trùng, bạn có muốn chọn lại?(C/K)");
                // string choice = Console.ReadLine();
                // switch (choice)
                // {
                //     case "C":
                //         scheNew = sbl.GetScheduleByMovieIdAndRoomId(sche.MovieId, sche.RoomId);
                //         movie = mbl.GetMovieByMovieId(sche.MovieId);
                //         room = rbl.GetRoomByRoomId(sche.RoomId);
                //         lsd = DisplayTime(movie, room, scheNew);
                //         break;
                //     case "c":
                //         scheNew = sbl.GetScheduleByMovieIdAndRoomId(sche.MovieId, sche.RoomId);
                //         movie = mbl.GetMovieByMovieId(sche.MovieId);
                //         room = rbl.GetRoomByRoomId(sche.RoomId);
                //         lsd = DisplayTime(movie, room, scheNew);
                //         break;
                //     case "K":
                //         mn.menuManager(us);
                //         return;
                //     case "k":
                //         mn.menuManager(us);
                //         return;
                //     default:
                //         continue;
                //         // break;
                // }
                if (lsd != null)
                {
                    break;
                }

                Console.Clear();
                Console.WriteLine("Phim: {0} tại phòng: {1} đã đủ suất chiếu !", movie.MovieName, room.RoomName);
            }

            Console.Clear();
            Console.WriteLine(row1);
            Console.WriteLine("Tạo lịch chiếu phim.");
            Console.WriteLine(row2);
            Console.WriteLine("[Chi tiết lịch chiếu]\n");
            Console.WriteLine("Bộ phim: " + movie.MovieName);
            Console.WriteLine("Chiếu tại rạp: " + cine.CineName);
            Console.WriteLine("Chiếu tại phòng: " + room.RoomName);
            Console.WriteLine("Trong các khung giờ lặp mỗi ngày từ ngày {0} - {1} cụ thể như sau: ", movie.MovieDateStart.ToString("dd/MM/yyyy"), movie.MovieDateEnd.ToString("dd/MM/yyyy"));
            int    count    = 1;
            string timeline = "";

            if (scheNew != null)
            {
                timeline = scheNew.ScheTimeline;
            }

            for (int i = 1; i < lsd.Count - 1; i++)
            {
                if (lsd[0].SchedTimeStart?.ToString("HH:mm") == lsd[i].SchedTimeStart?.ToString("HH:mm"))
                {
                    break;
                }
                count++;
            }
            for (int i = 0; i < count; i++)
            {
                try
                {
                    Console.WriteLine("{0}.{1} -> {2}", i + 1, lsd[i].SchedTimeStart?.ToString("HH:mm"), lsd[i].SchedTimeEnd?.ToString("HH:mm"));
                    if (timeline == "")
                    {
                        timeline = timeline + lsd[i].SchedTimeStart?.ToString("HH:mm");
                    }
                    else
                    {
                        timeline = timeline + ", " + lsd[i].SchedTimeStart?.ToString("HH:mm");
                    }
                }
                catch (System.Exception)
                {
                }
            }
            // foreach (var item in lsd)
            // {
            //     if (Schedule)
            //     {

            //     }
            //     {
            //         Console.WriteLine("{0}.{1} {2} -> {3}", count, item.SchedTimeEnd?.ToString("dd/MM/yyyy"), item.SchedTimeStart?.ToString("HH:mm"), item.SchedTimeEnd?.ToString("HH:mm"));
            //     }
            //     if (timeline == "")
            //     {
            //         timeline = timeline + item.SchedTimeStart?.ToString("HH:mm");
            //     }
            //     else
            //     {
            //         timeline = timeline + ", " + item.SchedTimeStart?.ToString("HH:mm");
            //     }
            //     count++;
            // }
            sche = new Schedule(scheNewId, 0, null, timeline, sche.RoomId, sche.MovieId, lsd);
            Console.WriteLine(row1);
            while (true)
            {
                Console.Write("Xác nhận tạo lịch chiếu?(C/K)");
                string choice = Console.ReadLine();
                switch (choice)
                {
                case "C":
                    sbl.CreateSchedule(sche);
                    break;

                case "c":
                    sbl.CreateSchedule(sche);
                    break;

                case "K":
                    break;

                case "k":
                    break;

                default:
                    continue;
                    // break;
                }
                break;
            }
            Console.Clear();

            mn.menuManager(us);
        }