From 55ab7c6cf297256bf37ba5a1cdcce1d5bdd78d64 Mon Sep 17 00:00:00 2001 From: Im_Alpha Date: Mon, 13 Dec 2021 07:17:44 -0800 Subject: [PATCH] updated menu and uiprint working on menu switch still and rearranged project folders --- .../Implementations/UiPrint.cs | 39 ++++++++++++++ .../SystemAccountManager.cs | 44 ++++++++------- ...obbyProjectGenerator.UserManagement.csproj | 1 - .../Implementations/InMemoryUserService.cs | 53 ------------------- .../Implementations/UiPrint.cs | 17 +++--- .../Implementations/User_Authentication.cs | 17 ------ .../Implementations/User_Manager.cs | 21 -------- .../TeamHobby.HobbyProjectGenerator.sln | 6 --- .../TeamHobby.UserManagement.Tests.csproj | 4 -- Source Code/main/Controller.cs | 8 +++ Source Code/main/main.csproj | 1 - 11 files changed, 82 insertions(+), 129 deletions(-) create mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.DataAccess/Implementations/UiPrint.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator/Implementations/InMemoryUserService.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator/Implementations/User_Authentication.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator/Implementations/User_Manager.cs diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.DataAccess/Implementations/UiPrint.cs b/Source Code/TeamHobby.HobbyProjectGenerator.DataAccess/Implementations/UiPrint.cs new file mode 100644 index 0000000..3f31b36 --- /dev/null +++ b/Source Code/TeamHobby.HobbyProjectGenerator.DataAccess/Implementations/UiPrint.cs @@ -0,0 +1,39 @@ +// Print Statements used throughout the program. + +namespace TeamHobby.HobbyProjectGenerator.DataAccess +{ + public class UiPrint + { + public void InitialMenu() + { + // Create intial menu + Console.WriteLine("What would you like to access?"); + int num = 1; + Console.WriteLine(num + ".User Management"); + num += 1; + Console.WriteLine(num + ".Logging"); + } + public void UserManagementMenu(string username) + { + // Menu for all UserManagement options + int menu = 0; + Console.WriteLine($"Welcome {username} to User Management.\n"); + Console.WriteLine("What would you like to do?\n"); + Console.WriteLine(menu + ") To exit User Management.\n"); + menu += 1; + Console.WriteLine(menu + ") Create a new account.\n"); + menu += 1; + Console.WriteLine(menu + ") Edit an account.\n"); + menu += 1; + Console.WriteLine(menu + ") Delete an account.\n"); + menu += 1; + Console.WriteLine(menu + ") Disable an account.\n"); + menu += 1; + Console.WriteLine(menu + ") Enable an account.\n"); + menu += 1; + Console.WriteLine(menu + ") View logs.\n"); + menu += 1; + Console.WriteLine(menu + ") View Archive.\n"); + } + } +} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/SystemAccountManager.cs b/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/SystemAccountManager.cs index 14e948d..9ff8082 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/SystemAccountManager.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/SystemAccountManager.cs @@ -5,7 +5,6 @@ using System.Text; using System.Threading.Tasks; using System.Data.Odbc; using TeamHobby.HobbyProjectGenerator.UserManagement; -using TeamHobby.HobbyProjectGenerator.Implementations; using TeamHobby.HobbyProjectGenerator.DataAccess; namespace TeamHobby.HobbyProjectGenerator.UserManagement @@ -112,17 +111,29 @@ namespace TeamHobby.HobbyProjectGenerator.UserManagement { // db.users layout (UserName, Password, RoleID, IsActive, CreatedBy, CreatedDate) // db.roles layout (RoleID(AutoGen), Role, CreatedBy, CreatedDate) - - // Menu for all UserManagement options - int menu = 0; - Console.WriteLine($"Welcome {user.username} to User Management.\n"); - Console.WriteLine("What would you like to do?\n"); - Console.WriteLine((menu + 1) + ". Create a new account."); - Console.WriteLine((menu + 1) + ". Edit an account."); - Console.WriteLine((menu + 1) + ". Delete an account."); - Console.WriteLine((menu + 1) + ". Disable an account."); - Console.WriteLine((menu + 1) + ". Enable an account."); - + // Create UiPrint Object + UiPrint ui = new UiPrint(); + // Print User Management menu + ui.UserManagementMenu(user.username); + // Create bool object for menu loop + bool menuLoop = true; + // Create loop for menu + while (menuLoop is true) { + // Get user choice + int menuChoice = Convert.ToInt32(Console.ReadLine()); + // Complete the appropriate action + switch (menuChoice) + { + case 0: + return "Exiting UserManagement.\n"; + break; + case 1: + break; + default: + Console.WriteLine("Invalid input.\nPlease enter a valid option.\n"); + break; + } + } @@ -196,14 +207,7 @@ namespace TeamHobby.HobbyProjectGenerator.UserManagement bool foo = true; - while (foo == true) - { - // sub menu - ui.SystemAccountMenu(); - // - - } - + } } diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/TeamHobby.HobbyProjectGenerator.UserManagement.csproj b/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/TeamHobby.HobbyProjectGenerator.UserManagement.csproj index 8141c68..be6931d 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/TeamHobby.HobbyProjectGenerator.UserManagement.csproj +++ b/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/TeamHobby.HobbyProjectGenerator.UserManagement.csproj @@ -8,7 +8,6 @@ - diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/Implementations/InMemoryUserService.cs b/Source Code/TeamHobby.HobbyProjectGenerator/Implementations/InMemoryUserService.cs deleted file mode 100644 index db60f66..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator/Implementations/InMemoryUserService.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace TeamHobby.HobbyProjectGenerator.Implementations -{ - public class InMemoryUserService - { - // Make it readonly so it can't be changed - private readonly IList _logstore; - - public InMemoryUserService() - { - _logstore = new List(); - } - - public IList GetAllUsers() - { - return _logstore; - } - - public bool User(string username) - { - try - { - //DateTime.UtcNow.ToString() + "->" + username; old way of doing it - _logstore.Add($"{DateTime.UtcNow}->{username}"); // New way of doing it - return true; - } - catch - { - return false; - } - } - /* - public bool User(DateTime timestamp, string username) - { - try - { - //DateTime.UtcNow.ToString() + "->" + username; old way of doing it - _logstore.Add($"{timestamp.ToUniversalTime()}->{username}"); // New way of doing it - return true; - } - catch - { - return false; - } - } - */ - } -} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/Implementations/UiPrint.cs b/Source Code/TeamHobby.HobbyProjectGenerator/Implementations/UiPrint.cs index d4e3cc5..411358d 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/Implementations/UiPrint.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/Implementations/UiPrint.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using TeamHobby.HobbyProjectGenerator.UserManagement; // Print Statements used throughout the program. @@ -21,12 +22,16 @@ namespace TeamHobby.HobbyProjectGenerator } public void SystemAccountMenu() { - // Create intial menu - Console.WriteLine("What would you like to do?"); - int num = 1; - Console.WriteLine(num + ".Create a new account."); - num += 1; - Console.WriteLine(num + ".Access Admin Features"); + UserAccount user = new UserAccount(); + // Menu for all UserManagement options + int menu = 0; + Console.WriteLine($"Welcome {user.username} to User Management.\n"); + Console.WriteLine("What would you like to do?\n"); + Console.WriteLine((menu + 1) + ". Create a new account."); + Console.WriteLine((menu + 1) + ". Edit an account."); + Console.WriteLine((menu + 1) + ". Delete an account."); + Console.WriteLine((menu + 1) + ". Disable an account."); + Console.WriteLine((menu + 1) + ". Enable an account."); } } } diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/Implementations/User_Authentication.cs b/Source Code/TeamHobby.HobbyProjectGenerator/Implementations/User_Authentication.cs deleted file mode 100644 index c92ae09..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator/Implementations/User_Authentication.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace TeamHobby.HobbyProjectGenerator -{ - public class User_Authentication - { - public IList GetAllUsers() - { - throw new NotImplementedException(); - } - - public bool User(string username) - { - //Console.WriteLine("Hello World!"); - //Console.WriteLine("Testing console"); - throw new NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/Implementations/User_Manager.cs b/Source Code/TeamHobby.HobbyProjectGenerator/Implementations/User_Manager.cs deleted file mode 100644 index 3d463a9..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator/Implementations/User_Manager.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace TeamHobby.HobbyProjectGenerator.Implementations -{ - public class User_Manager - { - public IList GetAllUsers() - { - throw new NotImplementedException(); - } - - public bool User(string username) - { - throw new NotImplementedException(); - } - } -} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln index b41037d..5234556 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln @@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31919.166 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator", "TeamHobby.HobbyProjectGenerator.csproj", "{C75B6909-FD9E-4382-94B6-7CA2CE371C9A}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.UserManagement.Tests", "..\TeamHobby.UserManagement.Tests\TeamHobby.UserManagement.Tests.csproj", "{5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.Models", "..\TeamHobby.HobbyProjectGenerator.Models\TeamHobby.HobbyProjectGenerator.Models.csproj", "{75DED6C2-D404-4E71-A58B-0F616DB5C062}" @@ -25,10 +23,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C75B6909-FD9E-4382-94B6-7CA2CE371C9A}.Release|Any CPU.Build.0 = Release|Any CPU {5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|Any CPU.ActiveCfg = Release|Any CPU {5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|Any CPU.Build.0 = Release|Any CPU diff --git a/Source Code/TeamHobby.UserManagement.Tests/TeamHobby.UserManagement.Tests.csproj b/Source Code/TeamHobby.UserManagement.Tests/TeamHobby.UserManagement.Tests.csproj index ec4c663..f72bee8 100644 --- a/Source Code/TeamHobby.UserManagement.Tests/TeamHobby.UserManagement.Tests.csproj +++ b/Source Code/TeamHobby.UserManagement.Tests/TeamHobby.UserManagement.Tests.csproj @@ -14,8 +14,4 @@ - - - - diff --git a/Source Code/main/Controller.cs b/Source Code/main/Controller.cs index 0166aad..dad01c3 100644 --- a/Source Code/main/Controller.cs +++ b/Source Code/main/Controller.cs @@ -11,6 +11,14 @@ namespace TeamHobby.HobbyProjectGenerator.Main { public static void Main(string[] args) { + // Console customization + // Change the look of the console + Console.Title = "HobbyProjectGenerator"; + // Change console text color + Console.ForegroundColor = ConsoleColor.Green; + // Change terminal height + Console.WindowHeight = 40; + // Creating the Factory class string dbType = "sql"; RDSFactory factory = new RDSFactory(); diff --git a/Source Code/main/main.csproj b/Source Code/main/main.csproj index 463e46e..c203f89 100644 --- a/Source Code/main/main.csproj +++ b/Source Code/main/main.csproj @@ -16,7 +16,6 @@ -