Exemplo n.º 1
0
        public void SweepstakesMenu(Sweepstakes sweepstakes)
        {
            UserInterface.PrintStatus($"Welcome to the Management Menu for {sweepstakes.Name}");
            string[] choices = { "1.) Add Contestant", "2.) View Contestant", "3.) Pick Winner" };
            UserInterface.PrintSelections(choices);
            sweepstakes.DisplayContestants();
            char type = UserInterface.GetMenuInputFor("Select an Action: ");

            switch (type)
            {
            case '1':
                sweepstakes.RegisterContestant();
                SweepstakesMenu(sweepstakes);
                break;

            case '2':
                while (true)
                {
                    string contestant = UserInterface.GetUserInputFor("Enter Registration Number for more info: ");
                    if (sweepstakes.CheckForContestant(contestant) == true)
                    {
                        sweepstakes.PrintContestantInfo(sweepstakes.contestants[Convert.ToInt32(contestant)]);
                        SweepstakesMenu(sweepstakes);
                        break;
                    }
                    else if (sweepstakes.CheckForContestant(contestant) == false)
                    {
                        UserInterface.PrintStatus($"{contestant} was not a valid registration number. Try again");
                    }
                }
                break;

            case '3':
                sweepstakes.PickWinner();
                firm.Manager.CloseSweepstakes();
                UserInterface.PrintStatus($"Back to main menu.");
                break;

            case '4':
                UserInterface.PrintStatus($"Back to Main Menu.");
                break;

            default:
                UserInterface.PrintStatus("Incorrect selection entered. Try Again");
                SweepstakesMenu(sweepstakes);
                break;
            }
        }