public void Cinema()
        {
            while (true)
            {
                Console.Clear();
                MenuCinema();
                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 > 4)
                    {
                        Console.WriteLine("Giá trị sai vui lòng nhập lại từ 1 - 4.");
                        Console.Write("#Chọn : ");
                    }
                    else
                    {
                        break;
                    }
                }

                /*
                 * TryParse phương pháp không ném một ngoại lệ nếu chuyển đổi thất bại. Nó loại bỏ sự cần thiết phải sử dụng xử lý ngoại lệ
                 * để kiểm tra cho một Format Exception trong trường hợp không hợp lệ và không thể được thành công phân tích cú pháp.
                 */
                Console.WriteLine("=============================================================");
                switch (number)
                {
                case 1:
                    Console.Clear();
                    MoviesInformation infomovie = new MoviesInformation();
                    infomovie.ShowInformationMovie();
                    break;

                case 2:
                    BookingTicker ticker = new BookingTicker();
                    ticker.MenuBookingTicker();
                    Console.Clear();
                    break;

                case 3:
                    Information info = new Information();
                    // info.Information_acc ();
                    Console.ReadLine();
                    break;

                case 4:
                    UserInterface user = new UserInterface();
                    user.InterfaceCinema();
                    return;
                }
            }
        }
Exemple #2
0
        public static void ComeBackMenu(Schedules scheduleUp, int count)
        {
            while (true)
            {
                if (count == 0)
                {
                    Console.WriteLine("\n                      1. Đặt Lại Ghế\n\n                      2. Quay Lại Menu Chính");
                }
                if (count == 1)
                {
                    Console.WriteLine("\n                          1. Đặt thêm vé cho bộ phim khác.\n\n                          2. Quay Lại Menu Chính");
                }
                Console.WriteLine("                    ------------------------------------------------------------------------------");
                Console.Write("\n                          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 hoặc 2. ");
                        Console.Write("                          #Chọn : ");
                    }
                    else
                    {
                        break;
                    }
                }
                switch (number)
                {
                case 1:
                    Console.Clear();
                    if (count == 0)
                    {
                        MenuChoiceSeats(scheduleUp);
                    }
                    if (count == 1)
                    {
                        BookingTicker bookig = new BookingTicker();
                        bookig.MenuBookingTicker();
                    }
                    return;

                case 2:
                    CinemaInterface.Cinema();
                    Console.Clear();
                    return;
                }
            }
        }
Exemple #3
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;
                }
            }
        }