Пример #1
0
        public static void GuestsMenuEnjoy()
        {
            GuestHeading();

            MainScreen.ChangeColorToBlue();
            Console.WriteLine("  What would you like to do now?\n");
            Thread.Sleep(500);
            MainScreen.ChangeColorToRed();
            Console.WriteLine("\t1. Choose another movie\n" +
                              "\t2. Go back to the main menu");
            Console.Write("  > ");
            int menuType = 0;

            Console.ForegroundColor = ConsoleColor.Gray;
            string userInput = Console.ReadLine();

            try
            {
                CustomException.ValidateInput(Convert.ToInt32(userInput), menuType);
            }
            catch (CustomException)
            {
                GuestsMenuEnjoy();
            }
            catch (OverflowException)
            {
                CustomException.OverflowErrorMessage();
                GuestsMenuEnjoy();
            }
            catch (FormatException)
            {
                CustomException.FormatErrorMessage();
                GuestsMenuEnjoy();
            }
            switch (userInput)
            {
            case "1":
                Console.Clear();
                GuestsMenu();
                break;

            case "2":
                MainScreen.ChangeColorToDarkGray();
                Console.WriteLine("\n  Taking you back to Main Screen.");
                MainScreen.ChangeColorToRed();
                Thread.Sleep(1000);
                MainScreen.Loading(150);
                MainScreen.MainMenu();
                break;

            default:
                break;
            }
        }
Пример #2
0
        private static void AdminMenuMoviesPlayingToday()
        {
            AdminHeading();

            MainScreen.ChangeColorToDarkYellow();
            Console.WriteLine("  Welcome MoviePlex Administrator.\n\n");
            MainScreen.ChangeColorToBlue();
            Console.Write("  How many movies are playing today?");
            MainScreen.ChangeColorToDarkGray();
            Console.WriteLine(" (Maximum 10)");
            MainScreen.ChangeColorToBlue();
            Console.Write("  > ");
            int menuType = 2;

            Console.ForegroundColor = ConsoleColor.Gray;
            string userInput = Console.ReadLine();

            if (userInput == "")
            {
                CustomException.NoInputDetected();
                AdminMenuMoviesPlayingToday();
            }

            try
            {
                CustomException.ValidateInput(Convert.ToInt32(userInput), menuType);
            }
            catch (CustomException)
            {
                AdminMenuMoviesPlayingToday();
            }
            catch (OverflowException)
            {
                CustomException.OverflowErrorMessage();
                AdminMenuMoviesPlayingToday();
            }
            catch (FormatException)
            {
                CustomException.FormatErrorMessage();
                AdminMenuMoviesPlayingToday();
            }
            switch (userInput)
            {
            default:
                playingToday = Convert.ToInt32(userInput);
                Thread.Sleep(500);
                AdminMenuAddMovies();
                break;
            }
        }
Пример #3
0
        public static bool UserInput(string userInput)
        {
            int menuType = 0;

            userInput = userInput.ToLower();

            switch (userInput)
            {
            case "1":
            case "admin":
            case "administrator":
            {
                ChangeColorToDarkYellow();
                Loading(150);
                Admin adminObj = new Admin();
                ChangeColorToGray();
                Admin.AdminMenu();
                return(false);
            }

            case "2":
            case "guest":
            {
                ChangeColorToDarkYellow();
                Loading(150);
                ChangeColorToGray();
                Guests.GuestsMenu();
                return(false);
            }

            default:
            {
                if (userInput.Equals(""))
                {
                    CustomException.NoInputDetected();
                    MainMenu();
                }
                else if (userInput.Contains("ad") || userInput.Contains("adm") || userInput.Contains("gu") || userInput.Contains("gue"))
                {
                    ChangeColorToDarkYellow();
                    Console.WriteLine("  You made a mistake in spelling.");
                    TryAgain();
                }
                else
                {
                    try
                    {
                        CustomException.ValidateInput(Convert.ToInt32(userInput), menuType);
                    }
                    catch (CustomException)
                    {
                    }
                    catch (OverflowException)
                    {
                        CustomException.OverflowErrorMessage();
                    }
                    catch (FormatException)
                    {
                        CustomException.FormatErrorMessage();
                    }
                }
                MainMenu();
                return(true);
            }
            }
        }