public static void CheckAdminNotifications()
        {
            string currentUsername     = _db.RetrieveCurrentUserFromDatabase();
            string currentUsernameRole = _db.RetrieveCurrentUsernameRoleFromDatabase();

            print.QuasarScreen(currentUsername);
            print.UniversalLoadingOutput("Loading");
            string pendingUsernameCheck = _text.GetPendingUsername();

            if (pendingUsernameCheck == " ")
            {
                Console.WriteLine("There are no pending User registrations\n\n(Press any key to continue)");
                Console.ReadKey();
                ActiveUserFunctions.UserFunctionMenuScreen(currentUsernameRole);
            }
            else
            {
                string yes              = "Yes";
                string no               = "No";
                string requestMsg       = "\r\nYou have 1 pending User registration request. Would you like to create new user?\n";
                string yesOrNoSelection = SelectMenu.MenuRow(new List <string> {
                    yes, no
                }, currentUsername, requestMsg).option;

                if (yesOrNoSelection == yes)
                {
                    SuperAdminFunctions.CreateNewUserFromRequestFunction();
                }
                else if (yesOrNoSelection == no)
                {
                    ActiveUserFunctions.UserFunctionMenuScreen(currentUsernameRole);
                }
            }
        }
Пример #2
0
        //Handles creation/deleting/viewing/editing of users by super_admin
        public static void CreateNewUserFromRequestFunction()
        {
            string currentUsername     = _db.RetrieveCurrentUserFromDatabase();
            string currentUsernameRole = _db.RetrieveCurrentUsernameRoleFromDatabase();
            string pendingUsername     = _text.GetPendingUsername();

            if (pendingUsername == " ")
            {
                print.UniversalLoadingOutput("Action in progress");
                Console.Write("There are no pending requests.\n\n(Press any key to continue)");
                Console.ReadKey();
                ActiveUserFunctions.UserFunctionMenuScreen(currentUsernameRole);
            }
            else
            {
                pendingUsername = pendingUsername.Remove(0, 10);
                string pendingPassphrase = _text.GetPendingPassphrase().Remove(0, 12);
                string yes              = "Yes";
                string no               = "No";
                string createUserMsg    = $"\r\nYou are about to create a new entry :\nUsername: {pendingUsername} - Password: {pendingPassphrase}\n\nWould you like to proceed?\n\n";
                string yesOrNoSelection = SelectMenu.MenuRow(new List <string> {
                    yes, no
                }, currentUsername, createUserMsg).option;

                if (yesOrNoSelection == yes)
                {
                    string pendingRole = print.SelectUserRole();

                    _db.InsertNewUserIntoDatabase(pendingUsername, pendingPassphrase, pendingRole);
                    print.QuasarScreen(currentUsername);
                    print.UniversalLoadingOutput("Creating new user in progress");

                    _text.ClearNewUserRegistrationList();
                    _text.CreateNewUserLogFile(pendingUsername);

                    print.ColoredText($"User {pendingUsername} has been created successfully. Status : {pendingRole}.\n\n(Press any key to continue)", ConsoleColor.DarkGreen);
                    Console.ReadKey();
                    ActiveUserFunctions.UserFunctionMenuScreen(currentUsernameRole);
                }
                else if (yesOrNoSelection == no)
                {
                    ActiveUserFunctions.UserFunctionMenuScreen(currentUsernameRole);
                }
            }
        }
Пример #3
0
        private static void CheckUsernameAvailabilityInPendingList(string usernameCheck, string passphraseCheck)
        {
            var    _text = new DataToTextFile();
            string pendingUsernameCheck = _text.GetPendingUsername();

            if (pendingUsernameCheck == $"username: {usernameCheck}")
            {
                print.QuasarScreen("Not Registered");
                print.ColoredText("\r\nYour Account Request is Pending. Please wait for the administrator to grant you access.\n\nPress any key to return to Login Screen", ConsoleColor.DarkGreen);
            }
            else
            {
                _text.NewUsernameRequestToList(usernameCheck, passphraseCheck);
                print.QuasarScreen("Not Registered");
                print.ColoredText("\r\nNew account request is registered. Please wait for the administrator to grant you access.\n\nPress any key to return to Login Screen", ConsoleColor.DarkGreen);
            }
            Console.ReadKey();
            ApplicationMenu.LoginScreen();
        }