Exemple #1
0
        public RoleOptions RoleMenu(string operation)
        {
            List <string> roleMenuItems = new List <string> {
                "Tier3User", "Tier2User", "Tier1User", "Tier0User", "Exit"
            };
            MenuDesigner RoleMenu       = new MenuDesigner(roleMenuItems, $"{UserRepository.currentUser.Username} : {operation} : Choose Role");
            int          roleMenuChoice = RoleMenu.MenuDesign();

            switch (roleMenuChoice)
            {
            case 0:
                return(RoleOptions.Tier3User);

            case 1:
                return(RoleOptions.Tier2User);

            case 2:
                return(RoleOptions.Tier1User);

            case 3:
                return(RoleOptions.Tier0User);

            case 4:
                return(RoleOptions.Exit);

            default:
                return(RoleOptions.Exit);
            }
        }
Exemple #2
0
        public SuperAdminOptions SuperAdminMenu()
        {
            List <string> superAdminMenuItems = new List <string> {
                "Create User", "Delete User", "Update User", "View Users", "Send Message", $"View Messages[{MessageRepository.UnreadMessageCounter()}]", "Exit"
            };
            MenuDesigner SuperAdminMenu       = new MenuDesigner(superAdminMenuItems, $"{UserRepository.currentUser.Username} : MainMenu");
            int          superadminMenuChoice = SuperAdminMenu.MenuDesign();

            switch (superadminMenuChoice)
            {
            case 0:
                return(SuperAdminOptions.CreateUser);

            case 1:
                return(SuperAdminOptions.DeleteUser);

            case 2:
                return(SuperAdminOptions.UpdateUser);

            case 3:
                return(SuperAdminOptions.ViewUsers);

            case 4:
                return(SuperAdminOptions.SendMessage);

            case 5:
                return(SuperAdminOptions.ViewMessages);

            case 6:
                return(SuperAdminOptions.Exit);

            default:
                return(SuperAdminOptions.Exit);
            }
        }
Exemple #3
0
        public Tier1UserOptions Tier1UserMenu()
        {
            List <string> Tier1UserMenuItems = new List <string> {
                "View Message", "Send Message", $"View Messages[{MessageRepository.UnreadMessageCounter()}]", "Exit"
            };
            MenuDesigner Tier1UserMenu   = new MenuDesigner(Tier1UserMenuItems, $"{UserRepository.currentUser.Username} : MainMenu");
            int          tier1UserChoice = Tier1UserMenu.MenuDesign();

            switch (tier1UserChoice)
            {
            case 0:
                return(Tier1UserOptions.ViewMessage);

            case 1:
                return(Tier1UserOptions.SendMessage);

            case 2:
                return(Tier1UserOptions.ViewMessages);

            case 3:
                return(Tier1UserOptions.Exit);

            default:
                return(Tier1UserOptions.Exit);
            }
        }
Exemple #4
0
        public UpdateOptions UpdateMenu()
        {
            List <string> updateMenuItems = new List <string> {
                "Username", "Password", "Role", "Exit"
            };
            MenuDesigner UpdateMenu       = new MenuDesigner(updateMenuItems, $"{UserRepository.currentUser.Username} : Update User");
            int          updateMenuChoice = UpdateMenu.MenuDesign();

            switch (updateMenuChoice)
            {
            case 0:
                return(UpdateOptions.Username);

            case 1:
                return(UpdateOptions.Password);

            case 2:
                return(UpdateOptions.Role);

            case 3:
                return(UpdateOptions.Exit);

            default:
                return(UpdateOptions.Exit);
            }
        }
Exemple #5
0
        public MainMenuOptions MainMenu()
        {
            List <string> mainMenuItems = new List <string> {
                "Login", "Register", "Exit"
            };
            MenuDesigner MainMenu1      = new MenuDesigner(mainMenuItems, "MainMenu");
            int          mainMenuChoice = MainMenu1.MenuDesign();

            switch (mainMenuChoice)
            {
            case 0:
                return(MainMenuOptions.Login);

            case 1:
                return(MainMenuOptions.Register);

            case 2:
                return(MainMenuOptions.Exit);

            default:
                return(MainMenuOptions.Exit);
            }
        }
Exemple #6
0
        public string TitleOrBodyEdit(int messageToBeEditedId, out int choiceToEdit)
        {
            Console.Clear();
            List <string> TitleOrBodyMenuItems = new List <string> {
                "Title", "Body", "Exit"
            };
            MenuDesigner TitleOrBodyMenu = new MenuDesigner(TitleOrBodyMenuItems, $"{UserRepository.currentUser.Username} : Edit Message");
            int          choice          = TitleOrBodyMenu.MenuDesign();

            Console.WriteLine();

            switch (choice)
            {
            case 0:
                // Title
                Console.Clear();
                Various.Header($"{UserRepository.currentUser.Username} : Edit Message : Edit Title");
                string title;

                Console.WriteLine(MessageRepository.ViewMessageWithoutChangingRead(messageToBeEditedId));
                Console.WriteLine();
                Various.SystemMessageDirections("Title must be max 15 characters long and cannot be void");
                Console.Write("Type the title of the message: ");
                title = Various.TypeLetterByLetterWithoutMaskingSTR(15);

                // Checks if Esc is pressed
                if (title == "")
                {
                    choiceToEdit = -1;
                    return("");
                }
                choiceToEdit = 0;
                return(title);

            case 1:
                // Body
                Console.Clear();
                Various.Header($"{UserRepository.currentUser.Username} : Edit Message : Edit Body");

                string body;
                Console.WriteLine(MessageRepository.ViewMessageWithoutChangingRead(messageToBeEditedId));
                Console.WriteLine();
                Various.SystemMessageDirections("Body must be max 250 characters long and cannot be void");
                Console.Write("Type the body of the message: ");
                body = Various.TypeLetterByLetterWithoutMaskingSTR(249);

                // Checks if Esc is pressed
                if (body == "")
                {
                    choiceToEdit = -1;
                    return("");
                }
                choiceToEdit = 1;
                return(body);

            case 2:
                choiceToEdit = -1;
                return("");

            default:
                choiceToEdit = -1;
                return("");
            }
        }