Infinite menu completed
both main menu and sub menu will run forever unless user enters a specified input
This commit is contained in:
parent
a4a133b0cd
commit
484c725ba8
@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using TeamHobby.HobbyProjectGenerator.Models;
|
||||
|
||||
namespace TeamHobby.HobbyProjectGenerator.DAL
|
||||
{
|
||||
public class SqlDAO
|
||||
{
|
||||
public IList<Credentials> 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
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,6 @@
|
||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj" />
|
||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccess\TeamHobby.HobbyProjectGenerator.DataAccess.csproj" />
|
||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Logging\TeamHobby.HobbyProjectGenerator.Logging.csproj" />
|
||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Models\TeamHobby.HobbyProjectGenerator.Models.csproj" />
|
||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.UserManagement\TeamHobby.HobbyProjectGenerator.UserManagement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user