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; } }
public void OnAddNewRefereeToDatabase(object source, EventArgs args) { var admin = new Admin(); foreach (var box in RefereeFormTextBoxes) { if (!IsNullOrEmpty(box.Text)) continue; ErrorMessageBox("Tomt Fält", "Det finns 1 eller flera tomma fält"); return; } if (NewReferee.PasswordBox.Text != NewReferee.CheckPasswordBox.Text) { ErrorMessageBox("Fel lösenord", "Lösenorden stämmer inte överrens!"); return; } var referee = new Referee(NewReferee.FirstnameBox.Text, NewReferee.CountryBox.Text, NewReferee.PasswordBox.Text, NewReferee.UsernameBox.Text); admin.AddReferee(referee); MessageBox.Show( "Domare tillagd till databasen!", "Domare tillagd", MessageBoxButtons.OK); NewReferee.Close(); }