Exemplo n.º 1
0
 // Lấy ra movie detail  nhờ id.
 public static void InformationMovieById(int movie_id)
 {
     while (true)
     {
         Console.Clear();
         MoviesBL movie      = new MoviesBL();
         Movies   informatin = movie.getMovieById(movie_id);
         Console.WriteLine("--------------------------------------------------------------------------------------------");
         Console.WriteLine($"-----------------  {informatin.Name}");
         Console.WriteLine("--------------------------------------------------------------------------------------------");
         Console.WriteLine($" Ngày phát hành          :  {informatin.Release_date.Day}/{informatin.Release_date.Month}/{informatin.Release_date.Year}");
         Console.WriteLine($" Thể loại                :  {informatin.Genre}");
         Console.WriteLine($" Diễn viên               :  {informatin.Actor}");
         Console.WriteLine($" Đạo diễn                :  {informatin.Direction}");
         Console.WriteLine($" Thời lượng              :  {informatin.Duration} Phút");
         Console.WriteLine($" Hãng sản xuất           :  {informatin.Producers}");
         Console.Write($" Nội dung                :  ");
         for (int i = 0; i < informatin.Detail_movie.ToCharArray().Length; i++)
         {
             Console.Write($"{informatin.Detail_movie[i]}");
             if (i % 61 == 0 && i != 0)
             {
                 Console.WriteLine();
                 Console.Write($"                           ");
             }
         }
         ChoiceForInformationMovieById(movie_id);
     }
 }
        // Lấy ra và hiển thị toàn bộ các phim đang chiếu.
        public void ListMovie()
        {
            MoviesBL movie = new MoviesBL();

            Console.WriteLine();
            foreach (var item in movie.GetMovies())
            {
                string format = string.Format($"{item.Movie_id,1}.     {item.Name,-40}   {item.Duration,37} Phút\n       {item.Genre,-20} \n");
                Console.WriteLine(format);
            }
            Console.WriteLine("--------------------------------------------------------------------------------------------");
        }
Exemplo n.º 3
0
 public void MenuBookingTicker()
 {
     while (true)
     {
         Console.Clear();
         // MenuBookingTicker menu cho đặt vé.
         MoviesBL movie = new MoviesBL();
         Console.WriteLine("============================================================================================");
         Console.WriteLine("----------------------------  Chọn Phim Bạn Muốn Xem  --------------------------------------");
         Console.WriteLine("--------------------------------------------------------------------------------------------");
         Console.WriteLine();
         // Show ra tất cả các phim đang có trong danh sách.
         foreach (var item in movie.GetMovies())
         {
             string format = string.Format($"{item.Movie_id,1}.     {item.Name,-40}   {item.Duration,37} Phút\n       {item.Genre,-20} \n");
             Console.WriteLine(format);
         }
         Console.WriteLine("--------------------------------------------------------------------------------------------");
         int number;
         Console.WriteLine("0. Quay lại menu chính.");
         Console.WriteLine("*: Nhập số thứ tự để chọn phim.");
         Console.WriteLine("--------------------------------------------------------------------------------------------");
         Console.Write("#Chọn :  ");
         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 > movie.GetMovies().Count)
             {
                 Console.WriteLine($"Giá trị sai vui lòng nhập lại 0 -> {movie.GetMovies ().Count}.");
                 Console.Write("#Chọn : ");
             }
             else
             {
                 break;
             }
         }
         if (number == 0)
         {
             CinemaInterface.Cinema();
         }
         ChooseMovieScheduleForYou(number);
         Console.ReadLine();
     }
 }
Exemplo n.º 4
0
 public static void ShowInformationMovie()
 {
     while (true)
     {
         Console.Clear();
         Console.WriteLine("============================================================================================");
         Console.WriteLine("---------------------------- 	Danh sách các phim đang chiếu ------------------------------");
         Console.WriteLine("--------------------------------------------------------------------------------------------");
         ListMovie();
         int      number;
         MoviesBL movie = new MoviesBL();
         Console.WriteLine("0. Quay lại menu chính.");
         Console.WriteLine("*: Nhập số thứ tự của phim để xem thông tin chi tiết phim.");
         Console.WriteLine("--------------------------------------------------------------------------------------------");
         Console.Write("#Chọn :  ");
         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 > movie.GetMovies().Count)
             {
                 Console.WriteLine($"Giá trị sai vui lòng nhập lại 0 -> {movie.GetMovies ().Count}.");
                 Console.Write("#Chọn : ");
             }
             else
             {
                 break;
             }
         }
         if (number == 0)
         {
             CinemaInterface.Cinema();
             return;
         }
         Console.Clear();
         InformationMovieById(number);
     }
 }
Exemplo n.º 5
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.º 6
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.º 7
0
        // ----- Show Information Seats . Seat selecting and Seat have been selected.
        public static void ShowSeatChoice(string[] rowsArr, int cols, string[] seated, List <string> choicedSeat, Schedules schedule, string[] map_chaire_not_placed)
        {
            Console.Clear();
            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   datetime   = string.Format($"{schedule.Show_date:dd/MM/yyyy}");

            Console.WriteLine("=========================================================================================================");
            Console.WriteLine($"Rạp chiếu phim thế giới.");
            Console.WriteLine("\n• CHỌN GHẾ \n");
            Console.WriteLine($"Phim : {informatin.Name}.     Ngày chiếu : {datetime}.     Lịch chiếu : {start1} - {end1}");
            Console.WriteLine("---------------------------------------------------------------------------------------------------------");
            Console.BackgroundColor = ConsoleColor.Gray;
            Console.ForegroundColor = System.ConsoleColor.Black;
            Console.WriteLine("\n                                              Màn Hình                                                   \n");
            Console.ResetColor();
            Console.WriteLine("---------------------------------------------------------------------------------------------------------");
            Console.WriteLine("\n");
            Console.WriteLine("+++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++++");
            Console.WriteLine("|                                                                                                        |");
            // Show information Mapseat User choice
            for (int i = 0; i < rowsArr.Length; i++)
            {
                if (i == 0)
                {
                    Console.Write("|    ");
                }
                for (int j = 1; j <= cols; j++)
                {
                    if (j == 3 || j == 9)
                    {
                        Console.Write("   .   ");
                    }
                    string seat = rowsArr[i] + j;
                    bool   flag = true;
                    if (i < 3 || i > 10 || j < 3 || j > 8)
                    {
                        for (int k = 0; k < seated.Length; k++)
                        {
                            if (seat == seated[k])
                            {
                                string format1 = "";
                                if (seated[k].Length == 3)
                                {
                                    format1 = "[_√√_] ";
                                }
                                else
                                {
                                    format1 = "[_√√_]";
                                }
                                Console.BackgroundColor = ConsoleColor.Green;
                                Console.ForegroundColor = System.ConsoleColor.Black;
                                string format = string.Format($"{format1}");
                                Console.Write(format);
                                Console.ResetColor();
                                Console.Write("  ");
                                flag = false;
                            }
                        }
                        for (int k = 0; k < choicedSeat.Count; k++)
                        {
                            if (seat == choicedSeat[k])
                            {
                                string format1 = "";
                                if (choicedSeat[k].Length == 3)
                                {
                                    format1 = "[^﹏^] ";
                                }
                                else
                                {
                                    format1 = "[^﹏^]";
                                }
                                Console.BackgroundColor = ConsoleColor.Yellow;
                                Console.ForegroundColor = System.ConsoleColor.Blue;
                                string format = string.Format($"{format1}");
                                Console.Write(format);
                                Console.ResetColor();
                                Console.Write("  ");
                                flag = false;
                            }
                        }
                        for (int k = 0; k < map_chaire_not_placed.Length; k++)
                        {
                            if (seat == map_chaire_not_placed[k])
                            {
                                string format1 = "";
                                if (map_chaire_not_placed[k].Length == 3)
                                {
                                    format1 = "       ";
                                }
                                else
                                {
                                    format1 = "      ";
                                }
                                string format = string.Format($"{format1}  ");
                                Console.Write(format);
                                flag = false;
                            }
                        }
                        if (flag)
                        {
                            Console.BackgroundColor = ConsoleColor.Gray;
                            Console.ForegroundColor = System.ConsoleColor.Black;
                            Console.Write($"[_{seat}_]");
                            Console.ResetColor();
                            Console.Write("  ");
                        }
                    }
                    else
                    {
                        for (int k = 0; k < seated.Length; k++)
                        {
                            if (seat == seated[k])
                            {
                                string format1 = "";
                                if (seated[k].Length == 3)
                                {
                                    format1 = "[_√√_] ";
                                }
                                else
                                {
                                    format1 = "[_√√_]";
                                }
                                Console.BackgroundColor = ConsoleColor.Green;
                                Console.ForegroundColor = System.ConsoleColor.Black;
                                string format = string.Format($"{format1}");
                                Console.Write(format);
                                Console.ResetColor();
                                Console.Write("  ");
                                flag = false;
                            }
                        }
                        for (int k = 0; k < choicedSeat.Count; k++)
                        {
                            if (seat == choicedSeat[k])
                            {
                                string format1 = "";
                                if (choicedSeat[k].Length == 3)
                                {
                                    format1 = "[^﹏^] ";
                                }
                                else
                                {
                                    format1 = "[^﹏^]";
                                }
                                Console.BackgroundColor = ConsoleColor.Yellow;
                                Console.ForegroundColor = System.ConsoleColor.Blue;
                                string format = string.Format($"{format1}");
                                Console.Write(format);
                                Console.ResetColor();
                                Console.Write("  ");
                                flag = false;
                            }
                        }
                        for (int k = 0; k < map_chaire_not_placed.Length; k++)
                        {
                            if (seat == map_chaire_not_placed[k])
                            {
                                string format1 = "";
                                if (map_chaire_not_placed[k].Length == 3)
                                {
                                    format1 = "       ";
                                }
                                else
                                {
                                    format1 = "      ";
                                }
                                string format = string.Format($"{format1}  ");
                                Console.Write(format);
                                flag = false;
                            }
                        }
                        if (flag)
                        {
                            Console.BackgroundColor = ConsoleColor.Red;
                            Console.ForegroundColor = System.ConsoleColor.Yellow;
                            Console.Write("[V:" + seat + "]");
                            Console.ResetColor();
                            Console.Write("  ");
                        }
                    }
                }
                Console.WriteLine("     |\n|                                                                                                        |");
                Console.Write("|    ");
            }
            Console.Write("                                                                                                    |");
            Console.WriteLine("\n|                                                                                                        |");
            Console.WriteLine("+++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++++");
            Console.WriteLine("\n");
            Console.Write("       ");
            Console.BackgroundColor = ConsoleColor.Gray;
            Console.ForegroundColor = System.ConsoleColor.Black;
            Console.Write("[_XX_]");
            Console.ResetColor();
            Console.Write(" : Ghế trống  ");
            Console.BackgroundColor = ConsoleColor.Green;
            Console.ForegroundColor = System.ConsoleColor.Black;
            Console.Write("[_√√_]");
            Console.ResetColor();
            Console.Write(" : Ghế đã có người đặt   ");
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.ForegroundColor = System.ConsoleColor.Blue;
            Console.Write("[^﹏^]");
            Console.ResetColor();
            Console.Write(" : Ghế đang chọn  ");
            Console.BackgroundColor = ConsoleColor.Red;
            Console.ForegroundColor = System.ConsoleColor.Yellow;
            Console.Write("[V:__]");
            Console.ResetColor();
            Console.WriteLine(" : Ghế VIP ");
            Console.WriteLine("\n     _______________________________________________________________________________________________");
            // 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     _______________________________________________________________________________________________");
        }
Exemplo n.º 8
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.º 9
0
        //  Show thông tin vé.
        public static void InformationMovieBookingTickets(Schedules schedule, List <string> choicedSeat, string map)
        {
            Console.Clear();
            MoviesBL    movie        = new MoviesBL();
            Movies      informatin   = movie.getMovieById(schedule.Movie_id);
            RoomBL      room         = new RoomBL();
            Rooms       infor        = room.GetRoomById(schedule.Room_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      datetime     = string.Format($"{schedule.Show_date:dd/MM/yyyy}");
            string      choiced      = "";
            Random      random       = new Random();
            int         randomNumber = random.Next(0, 100000000);
            Reservation reser        = new Reservation();

            reser.Reservation_id = 0;
            reser.Schedule_id    = schedule.Schedule_id;
            try {
                reser.Customer_id = UserInterface.LoginCinema.GetCustomer().Customer_id;
                foreach (var item in choicedSeat)
                {
                    choiced = choiced + " " + item;
                }
                reser.Seats       = choiced.Trim();
                reser.Code_ticket = randomNumber;
                reser.Price       = PaymentFareSeat(choicedSeat);
                string a = Tien(PaymentFareSeat(choicedSeat).ToString()) + "   VND";

                string time = $"{start1} - {end1}";
                Console.Clear();
                Console.WriteLine($"                      √√√√√ Rạp chiếu phim thế giới.\n");
                Console.WriteLine($"                      Thông tin vé đặt trước  !");
                Console.WriteLine($"                     –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––");
                Console.WriteLine($"                    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    |  Tên Phim          :   {string.Format ($"{informatin.Name,-47}")}|");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    |  Phòng Chiếu       :   {string.Format ($"{infor.Name,-47}")}|");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    |  Ngày Chiếu        :   {string.Format ($"{datetime,-47}")}|");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    |  Lịch Chiếu        :   {string.Format ($"{time,-47}")}|");
                Console.WriteLine($"                    |                                                                       |");
                Console.Write($"                    |  Ghế Ngồi          :   ");
                int count = 0;
                for (int i = 0; i < choicedSeat.Count; i++)
                {
                    count++;
                    Console.Write($"{choicedSeat[i]} :  {Tien(PaymentFare(choicedSeat[i]).ToString())} VND    ");
                    if (count == 2)
                    {
                        count = 0;
                    }
                    if ((i + 1) % 2 == 0)
                    {
                        Console.Write("       |\n                    |                        ");
                    }
                }
                if (count == 1)
                {
                    Console.WriteLine("                           |");
                }
                else
                {
                    Console.WriteLine("                                               |");
                }
                // Console.Write ("|\n");
                // Console.WriteLine ($"                    |  Ghế Ngồi          :   {string.Format ($"{choiced,-47}")}|");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    |-----------------------------------------------------------------------|");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    |  Tổng Tiền         :   {string.Format ($"{a,-47}")}|");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+");
                Console.WriteLine($"                     _______________________________________________________________________");
                YNChoice(choicedSeat, schedule, map, reser);
            } catch (System.Exception) {
                reser.Customer_id = Login.GetCustomer1().Customer_id;
                foreach (var item in choicedSeat)
                {
                    choiced = choiced + " " + item;
                }
                reser.Seats       = choiced.Trim();
                reser.Code_ticket = randomNumber;
                reser.Price       = PaymentFareSeat(choicedSeat);
                string a = Tien(PaymentFareSeat(choicedSeat).ToString()) + "   VND";

                string time = $"{start1} - {end1}";
                Console.Clear();
                Console.WriteLine($"                      √√√√√ Rạp chiếu phim thế giới.\n");
                Console.WriteLine($"                      Thông tin vé đặt trước  !");
                Console.WriteLine($"                     –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––");
                Console.WriteLine($"                    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    |  Tên Phim          :   {string.Format ($"{informatin.Name,-47}")}|");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    |  Phòng Chiếu       :   {string.Format ($"{infor.Name,-47}")}|");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    |  Ngày Chiếu        :   {string.Format ($"{datetime,-47}")}|");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    |  Lịch Chiếu        :   {string.Format ($"{time,-47}")}|");
                Console.WriteLine($"                    |                                                                       |");
                Console.Write($"                    |  Ghế Ngồi          :   ");
                int count = 0;
                for (int i = 0; i < choicedSeat.Count; i++)
                {
                    count++;
                    Console.Write($"{choicedSeat[i]} :  {Tien(PaymentFare(choicedSeat[i]).ToString())} VND    ");
                    if (count == 2)
                    {
                        count = 0;
                    }
                    if ((i + 1) % 2 == 0)
                    {
                        Console.Write("       |\n                    |                        ");
                    }
                }
                if (count == 1)
                {
                    Console.WriteLine("                           |");
                }
                else
                {
                    Console.WriteLine("                                               |");
                }
                // Console.Write ("|\n");
                // Console.WriteLine ($"                    |  Ghế Ngồi          :   {string.Format ($"{choiced,-47}")}|");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    |-----------------------------------------------------------------------|");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    |  Tổng Tiền         :   {string.Format ($"{a,-47}")}|");
                Console.WriteLine($"                    |                                                                       |");
                Console.WriteLine($"                    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+");
                Console.WriteLine($"                     _______________________________________________________________________");
                YNChoice(choicedSeat, schedule, map, reser);

                throw;
            }
        }
Exemplo n.º 10
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("---------------------------------------------------------------------");
        }
        // Lấy ra movie detail  nhờ id.
        public void InformationMovieById(int movie_id)
        {
            while (true)
            {
                Console.Clear();
                MoviesBL movie      = new MoviesBL();
                Movies   informatin = movie.getMovieById(movie_id);
                Console.WriteLine("--------------------------------------------------------------------------------------------");
                Console.WriteLine($"-----------------  {informatin.Name}");
                Console.WriteLine("--------------------------------------------------------------------------------------------");
                Console.WriteLine($" Ngày phát hành          :  {informatin.Release_date.Day}/{informatin.Release_date.Month}/{informatin.Release_date.Year}");
                Console.WriteLine($" Thể loại                :  {informatin.Genre}");
                Console.WriteLine($" Diễn viên               :  {informatin.Actor}");
                Console.WriteLine($" Đạo diễn                :  {informatin.Direction}");
                Console.WriteLine($" Thời lượng              :  {informatin.Duration} Phút");
                Console.WriteLine($" Hãng sản xuất           :  {informatin.Producers}");
                Console.Write($" Nội dung                :  ");
                for (int i = 0; i < informatin.Detail_movie.ToCharArray().Length; i++)
                {
                    Console.Write($"{informatin.Detail_movie[i]}");
                    if (i % 61 == 0 && i != 0)
                    {
                        Console.WriteLine();
                        Console.Write($"                           ");
                    }
                }
                Console.WriteLine($"");
                Console.WriteLine("--------------------------------------------------------------------------------------------");
                Console.WriteLine("1. Xem lịch chiếu phim.");
                Console.WriteLine("\n2. Xem thông tin phim khác.");
                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 > 2)
                    {
                        Console.WriteLine("Giá trị sai vui lòng nhập lại 1 - 2. ");
                        Console.Write("#Chọn : ");
                    }
                    else
                    {
                        break;
                    }
                }
                switch (number)
                {
                case 1:
                    Schedule_Infor_By_IDMOVIE_DATE(movie_id);
                    break;

                case 2:
                    Console.Clear();
                    return;
                }
            }
        }
        // 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.º 13
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.º 14
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;
                }
            }
        }