internal void DataEditorMenu(DataEditor User) { bool InUse = true; Console.Clear(); Console.WriteLine($"Welcome back, {Users.User.Username}"); while (InUse == true) { Console.WriteLine("What do you want to do?"); Console.WriteLine("V - View messages"); Console.WriteLine("C - Change password"); Console.WriteLine("L - Logout"); string Selection = Console.ReadLine(); switch (Selection.ToLower()) { case "v": Console.Clear(); Console.WriteLine("Enter a username or type r to return to the Main Menu:"); string User2 = Console.ReadLine(); if (User2.ToLower() == "r") { break; } bool UserInSystem = true; while (UserInSystem == true) { UserInSystem = Database_Access.NameCheck(User2); if (UserInSystem == true) { Console.Clear(); Console.WriteLine($"The user {User2} cannot be found!"); Console.WriteLine("Please enter a valid username:"******"Choose action:"); Console.WriteLine("S - Send message"); Console.WriteLine("E - Edit message"); Console.WriteLine("R - Return to the previous screen"); string ActionSelection = Console.ReadLine(); switch (ActionSelection.ToLower()) { case "r": Console.Clear(); break; case "s": DataViewer.SendMessage(User2); break; case "e": Console.WriteLine("Select the message ID you want to edit:"); int messageeditid = int.Parse(Console.ReadLine()); User.EditMessage(messageeditid, User2); break; default: Console.WriteLine("Please use one of the available actions."); break; } break; case "c": Console.Clear(); DataViewer.ChangePassword(); break; case "l": Console.Clear(); InUse = false; Console.WriteLine("You were successfully logged out."); break; default: Console.WriteLine("Please use one of the available actions."); break; } } }
internal void SuperAdminMenu(SuperAdmin SuperAdmin) { bool InUse = true; Console.Clear(); Console.WriteLine($"Welcome back, {User.Username}"); while (InUse == true) { Console.WriteLine("What do you want to do?"); Console.WriteLine("V - View messages"); Console.WriteLine("A - Admininstratrion menu"); Console.WriteLine("C - Change password"); Console.WriteLine("L - Logout"); string Selection = Console.ReadLine(); switch (Selection.ToLower()) { case "v": Console.Clear(); Console.WriteLine("Enter a username or type r to go back to the Main Menu:"); string User2 = Console.ReadLine(); if (User2.ToLower() == "r") { break; } bool UserOtherInSystem = true; while (UserOtherInSystem == true) { UserOtherInSystem = Database_Access.NameCheck(User2); if (UserOtherInSystem == true) { Console.Clear(); Console.WriteLine($"The user {User2} cannot be found!"); Console.WriteLine("Please enter a valid username:"******"Choose action:"); Console.WriteLine("S - Send message"); Console.WriteLine("E - Edit message"); Console.WriteLine("D - Delete message"); Console.WriteLine("R - Return to the previous screen"); string ActionSelection = Console.ReadLine(); switch (ActionSelection.ToLower()) { case "r": Console.Clear(); break; case "s": DataViewer.SendMessage(User2); break; case "e": Console.WriteLine("Select the message ID you want to edit:"); int messageeditid = int.Parse(Console.ReadLine()); SuperAdmin.EditMessage(messageeditid, User2); break; case "d": Console.WriteLine("Copy and Paste the message ID of the message you want to delete:"); int messagedeleteid = int.Parse(Console.ReadLine()); SuperAdmin.DeleteMessage(messagedeleteid, User2); break; default: Console.WriteLine("Please use one of the available actions."); break; } break; case "a": Console.Clear(); Console.WriteLine("L - List of registered users"); Console.WriteLine("R - Return to the Main Menu"); string AdminSelection = Console.ReadLine(); switch (AdminSelection.ToLower()) { case "r": break; case "l": Console.Clear(); SuperAdmin.ListUsers(); Console.WriteLine("Choose action:"); Console.WriteLine("C - Create a new user"); Console.WriteLine("P - Promote an existing user"); Console.WriteLine("D - Demote an existing user"); Console.WriteLine("E - Erase an existing user's account"); Console.WriteLine("R - Return to Previous Screen"); string SuperUserSelection = Console.ReadLine(); string UserOther = ""; bool UserInList = true; switch (SuperUserSelection.ToLower()) { case "r": Console.Clear(); break; case "c": SuperAdmin.CreateUser(); break; case "p": Console.WriteLine("Please pick a user from the list:"); UserOther = Console.ReadLine(); while (UserInList == true) { UserInList = Database_Access.NameCheck(UserOther); if (UserInList == true) { Console.Clear(); Console.WriteLine($"The username {UserOther} cannot be found!"); Console.WriteLine("Please enter a valid username:"******"d": Console.WriteLine("Please pick a user from the list:"); UserOther = Console.ReadLine(); while (UserInList == true) { UserInList = Database_Access.NameCheck(UserOther); if (UserInList == true) { Console.Clear(); Console.WriteLine($"The username {UserOther} cannot be found!"); Console.WriteLine("Please enter a valid username:"******"e": Console.WriteLine("Please pick a user from the list:"); UserOther = Console.ReadLine(); while (UserInList == true) { UserInList = Database_Access.NameCheck(UserOther); if (UserInList == true) { Console.Clear(); Console.WriteLine($"The username {UserOther} cannot be found!"); Console.WriteLine("Please enter a valid username:"******""; while (SecurityCheck.ToLower() != "y" && SecurityCheck.ToLower() != "n") { Console.WriteLine($"The user {UserOther} will be PERMANENTLY DELETED"); Console.WriteLine("as will all the messages they have sent or received!"); Console.WriteLine("ARE YOU SURE?"); Console.WriteLine("[ Y / N]"); SecurityCheck = Console.ReadLine(); } if (SecurityCheck.ToLower() != "y") { SuperAdmin.DeleteUser(UserOther); } else { break; } break; default: Console.WriteLine("Please use one of the available actions."); break; } break; default: Console.WriteLine("Please use one of the available actions."); break; } break; case "c": Console.Clear(); DataViewer.ChangePassword(); break; case "l": Console.Clear(); InUse = false; Console.WriteLine("You have been successfully logged out."); break; default: Console.WriteLine("Please use one of the available actions."); break; } } }