示例#1
0
        // This parameter list data brought from program class
        public void CinemaTicketApp(List <MovieSeatDetails> ListOfSeat)
        {
            CustomersList customers = new CustomersList();
            // This list is to get the stored user data from customers list
            List <CustomerDetails> ListOfCustomer = customers.ListOfCustomer();

            MoviesList movies = new MoviesList();
            // This list is to get the stored movie data from movies list
            List <MovieDetails> ListOfMovie = movies.ListOfMovies();

            bool menu = true;

            while (menu)
            {
                Console.WriteLine("Welcome to TGV Cinema Ticket App");
                Console.WriteLine("1. View all movies");
                Console.WriteLine("2. Login");
                Console.WriteLine("3. Exit app\n");

                Console.Write("Enter your option: ");
                var option = Console.ReadLine();

                switch (option)
                {
                case "1":
                    // Print the all cinema by using this method, ListOfMovie has the all movies stored inside.
                    PrintCinemaMovies(ListOfMovie);
                    Console.WriteLine("Login to buy a movie ticket of your favourite movie.");
                    Thread.Sleep(3000);
                    Console.Clear();
                    break;

                case "2":
                    Console.Clear();
                    Console.Write("Username : "******"\nPassword : "******"3":
                    Console.WriteLine("\nThanks for using. Have a nice day!\n");
                    Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("\nInvalid Option\n");
                    Thread.Sleep(1000);
                    Console.Clear();
                    break;
                }
            }
        }
示例#2
0
        public static void SelectMovie(List <MovieSeatDetails> ListOfSeat)
        {
            MoviesList movies = new MoviesList();
            // This list stored all movies
            List <MovieDetails> ListOfMovies = movies.ListOfMovies();

            bool menu = true;

            while (menu)
            {
                Console.WriteLine("You login as cinema");
                Console.WriteLine("1. Select a movie");
                Console.WriteLine("2. Logout");

                Console.Write("\nEnter your option : ");
                var option = Console.ReadLine();

                switch (option)
                {
                case "1":
                    Console.Clear();
                    Console.WriteLine("Select a movie");
                    // This method grab all movies and print it
                    PrintScreen(ListOfMovies);
                    Console.Write("\nEnter movie id : ");
                    var movieID = Console.ReadLine();

                    // This linq is used to check the movie id valid or not
                    var CheckMID = (from c in ListOfMovies
                                    where c.MovieID.ToString() == movieID
                                    select c).SingleOrDefault();

                    if (CheckMID != null)
                    {
                        Console.Clear();
                        // menu = false , so this will stop the while loop
                        menu = false;
                        // Bring the movie id that is valid and the random seat to the next class
                        SelectMovieTimeScreen.SelectDateTime(CheckMID, ListOfSeat);
                    }
                    else
                    {
                        Console.WriteLine("Invalid Option");
                        Thread.Sleep(1000);
                        Console.Clear();
                    }
                    break;

                case "2":
                    Console.WriteLine("Thanks for using. Have a nice day!");
                    Thread.Sleep(2000);
                    Console.Clear();
                    CinemaMainScreen logout = new CinemaMainScreen();
                    // Go back to the login page
                    logout.CinemaTicketApp(ListOfSeat);
                    break;

                default:
                    Console.WriteLine("Invalid Option");
                    Thread.Sleep(1000);
                    Console.Clear();
                    break;
                }
            }
        }