Beispiel #1
0
        public static void RunAdmin(Admin admin)
        {
            var choice = AdminMenu();
            switch (choice)
            {
                case 1: //Create new competition
                    CreateCompetition();
                    AddReferees();
                    AddDiversToCompetition(TempCompetition.Rounds);
                    TempCompetition.SortDiveOrder();
                    admin.AddCompetition(TempCompetition);
                    break;

                case 2: // Add new diver to database
                    var diver = CreateDiver();
                    admin.AddDiver(diver);
                    break;

                case 3: // Add new referee to database
                    var referee = CreateReferee();
                    admin.AddReferee(referee);
                    break;

                case 4: // Show all competitions, choose one to start
                    DisplayCompetitions();
                    var id = ChooseCompetition();
                    if (id > 0)
                    {
                        admin.StartCompetition(id);
                        WriteLine($"Competition {id} has started!");
                    }
                    Thread.Sleep(1000);
                    Clear();
                    break;

                case 5:
                    WriteLine("Testsend");
                    ReadLine();
                    ClientNetworkHandler.SendToServer("SendJudge");
                    ReadLine();
                    break;

                case 0: // Logout user
                    ClientNetworkHandler.SendAndReceive("Logout");
                    LoginHandler.userState = LoginHandler.UserState.None;
                    // LoginHandler.LoginMenu();
                    break;

                default:
                    WriteLine("Try again!");
                    break;
            }
        }