diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/SystemAccountManager.cs b/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/SystemAccountManager.cs index a159178..e1129a2 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/SystemAccountManager.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/SystemAccountManager.cs @@ -218,7 +218,7 @@ namespace TeamHobby.HobbyProjectGenerator.UserManagement { // Exit menu case 0: - return "Exiting UserManagement.\n"; + return "Back to Login"; // Create account case 1: UserAccount newUser = new UserAccount(newCredentials.GetUserName(), @@ -227,7 +227,7 @@ namespace TeamHobby.HobbyProjectGenerator.UserManagement bool accountValid = accountService.CreateUserRecord(newUser,user.username, dbSource); if (accountValid is true) { - Console.WriteLine("Account created Successfully"); + Console.WriteLine("\nAccount created Successfully"); break; } else @@ -270,9 +270,7 @@ namespace TeamHobby.HobbyProjectGenerator.UserManagement break; } } - - string dbAction = user.username; - return dbAction; + return "Back to Login"; } } } diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln index b7c8ff3..8e45f2d 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln @@ -4,8 +4,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00 VisualStudioVersion = 17.0.31919.166 MinimumVisualStudioVersion = 10.0.40219.1 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}" + ProjectSection(ProjectDependencies) = postProject + {AA48A66C-FA36-4AF9-A782-CEC22838EB8F} = {AA48A66C-FA36-4AF9-A782-CEC22838EB8F} + {2E7193B8-86B6-48DA-9671-CD84615A5F5D} = {2E7193B8-86B6-48DA-9671-CD84615A5F5D} + EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "main", "..\main\main.csproj", "{30C7EBF3-3957-46E5-86C1-C13356841ECA}" EndProject @@ -23,7 +25,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGener EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.ArchiveTests", "..\TeamHobby.HobbyProjectGenerator.ArchiveTests\TeamHobby.HobbyProjectGenerator.ArchiveTests.csproj", "{C5EBD1F8-C806-4BF9-B2D7-8876072630FD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamHobby.UserManagement.xTests", "TeamHobby.UserManagement.xTests\TeamHobby.UserManagement.xTests.csproj", "{6D575AF1-C138-44C5-B701-5AEC4ACEAA7A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.UserManagement.xTests", "TeamHobby.UserManagement.xTests\TeamHobby.UserManagement.xTests.csproj", "{6D575AF1-C138-44C5-B701-5AEC4ACEAA7A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D29D9225-3748-4067-AF07-E677A525EF39}" + ProjectSection(SolutionItems) = preProject + TeamHobby.HobbyProjectGenerator.csproj = TeamHobby.HobbyProjectGenerator.csproj + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -39,14 +46,6 @@ Global {5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|Any CPU.Build.0 = Release|Any CPU {5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|x86.ActiveCfg = Release|Any CPU {5C5A44B4-EC3C-44F2-8F39-F917F8ED932F}.Release|x86.Build.0 = Release|Any CPU - {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Debug|Any CPU.Build.0 = Debug|Any CPU - {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Debug|x86.ActiveCfg = Debug|Any CPU - {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Debug|x86.Build.0 = Debug|Any CPU - {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|Any CPU.ActiveCfg = Release|Any CPU - {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|Any CPU.Build.0 = Release|Any CPU - {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|x86.ActiveCfg = Release|Any CPU - {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|x86.Build.0 = Release|Any CPU {30C7EBF3-3957-46E5-86C1-C13356841ECA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {30C7EBF3-3957-46E5-86C1-C13356841ECA}.Debug|Any CPU.Build.0 = Debug|Any CPU {30C7EBF3-3957-46E5-86C1-C13356841ECA}.Debug|x86.ActiveCfg = Debug|Any CPU @@ -107,7 +106,6 @@ Global {C5EBD1F8-C806-4BF9-B2D7-8876072630FD}.Release|x86.ActiveCfg = Release|Any CPU {C5EBD1F8-C806-4BF9-B2D7-8876072630FD}.Release|x86.Build.0 = Release|Any CPU {6D575AF1-C138-44C5-B701-5AEC4ACEAA7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6D575AF1-C138-44C5-B701-5AEC4ACEAA7A}.Debug|Any CPU.Build.0 = Debug|Any CPU {6D575AF1-C138-44C5-B701-5AEC4ACEAA7A}.Debug|x86.ActiveCfg = Debug|Any CPU {6D575AF1-C138-44C5-B701-5AEC4ACEAA7A}.Debug|x86.Build.0 = Debug|Any CPU {6D575AF1-C138-44C5-B701-5AEC4ACEAA7A}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/Source Code/main/Controller.cs b/Source Code/main/Controller.cs index da78001..f65ab47 100644 --- a/Source Code/main/Controller.cs +++ b/Source Code/main/Controller.cs @@ -45,12 +45,21 @@ namespace TeamHobby.HobbyProjectGenerator.Main { // Admin Sign in GetCredentials credentials = new GetCredentials(); - Console.WriteLine("\nPlease Enter Admin Credentials.\n"); + Console.WriteLine("\nPlease Enter Admin Credentials " + + "or enter 0 to exit the machine\n"); string? username = credentials.GetUserName(); + //int menuExit = Convert.ToInt32(username); + // Exit Infinite Menu + if (username == "0") + { + break; + } string? password = credentials.GetPassword(); // Get time of login attempt DateTime TimeStamp = DateTime.UtcNow; + + // String for checking query return type string dbType = "sql"; @@ -77,7 +86,8 @@ namespace TeamHobby.HobbyProjectGenerator.Main if (isLogin != "Access Denied: Unauthorized\n") { - mainMenu = false; + Console.WriteLine("Returning to login...\n"); + Console.WriteLine("-------------------------------------\n"); } else { diff --git a/Source Code/main/SqlDAO.cs b/Source Code/main/SqlDAO.cs deleted file mode 100644 index 8e331a7..0000000 --- a/Source Code/main/SqlDAO.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Microsoft.Data.SqlClient; -using TeamHobby.HobbyProjectGenerator.Models; - -namespace TeamHobby.HobbyProjectGenerator.DAL -{ - public class SqlDAO - { - public IList GetUserData(string username) - { - // Sql server connection string, needs to be changed accordingly to connect - var connString = "server=localhost;userid=root;password=Plop20;database=users"; // Using @" " makes the string literal - - // ADO.NET - ODBC - using (var conn = new SqlConnection(connString)) - { - // More complex sql commands are done in this method instead - var sql = "Select * from roles"; - using (var command = new SqlCommand(sql, conn)) - { - // Get the results from the query - SqlDataReader r = command.ExecuteReader(); - - // If you wanted to get a singular value back such as a count of a certain item - //command.ExecuteScalar(); - - // To execute something that doesn't expect results to come back - // Use this method instead, IE. Update command - //command.ExecuteNonQuery(); - - // Read data from query - while (r.Read()) - { - Console.WriteLine(r.ToString()); - } - return null; - } - - /*// this is meant for specific basic sql commands - using (var adapter = new SqlDataAdapter()) - { - adapter.UpdateCommand - adapter.DeleteCommand - adapter.InsertCommand - adapter.SelectCommand - }*/ - - } - } - } -} diff --git a/Source Code/main/main.csproj b/Source Code/main/main.csproj index 18aba0a..9c91e92 100644 --- a/Source Code/main/main.csproj +++ b/Source Code/main/main.csproj @@ -16,7 +16,6 @@ -