diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.DAL/SqlDAO.cs b/Source Code/TeamHobby.HobbyProjectGenerator.DAL/SqlDAO.cs
index b2ef1fe..8e331a7 100644
--- a/Source Code/TeamHobby.HobbyProjectGenerator.DAL/SqlDAO.cs
+++ b/Source Code/TeamHobby.HobbyProjectGenerator.DAL/SqlDAO.cs
@@ -32,17 +32,19 @@ namespace TeamHobby.HobbyProjectGenerator.DAL
{
Console.WriteLine(r.ToString());
}
-
+ return null;
}
- /*
- * this is meant for specific basic sql commands
+ /*// this is meant for specific basic sql commands
using (var adapter = new SqlDataAdapter())
- {
- adapter.SelectCommand
- }
- */
- }
+ {
+ adapter.UpdateCommand
+ adapter.DeleteCommand
+ adapter.InsertCommand
+ adapter.SelectCommand
+ }*/
+
+ }
}
}
}
diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Main/ExampleDAO.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Main/ExampleDAO.cs
index d51ed9b..4e6b14b 100644
--- a/Source Code/TeamHobby.HobbyProjectGenerator.Main/ExampleDAO.cs
+++ b/Source Code/TeamHobby.HobbyProjectGenerator.Main/ExampleDAO.cs
@@ -1,10 +1,55 @@
-using TeamHobby.HobbyProjectGenerator;
+using System;
+using Microsoft.Data.SqlClient;
+using TeamHobby.HobbyProjectGenerator;
using TeamHobby.HobbyProjectGenerator.DAL;
+using TeamHobby.HobbyProjectGenerator.Models;
namespace TeamHobby.HobbyProjectGenerator.Main
{
- public class ExampleDAO : SqlDAO
+ public class ExampleDAO
{
+
+ public void UserData(string username)
+ {
+ // Sql server connection string, needs to be changed accordingly to connect
+ var connString = "server=localhost,3316;user=root;database=users;password=Plop20"; // 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))
+ {
+ conn.Open();
+ // 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());
+ }
+ conn.Close();
+
+ }
+ // Console.Read();
+ /*
+ * this is meant for specific basic sql commands
+ using (var adapter = new SqlDataAdapter())
+ {
+ adapter.SelectCommand
+ }
+ */
+ //return null;
+ }
+ }
}
}
diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Main/Program.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Main/Program.cs
index 9fc90ff..0520277 100644
--- a/Source Code/TeamHobby.HobbyProjectGenerator.Main/Program.cs
+++ b/Source Code/TeamHobby.HobbyProjectGenerator.Main/Program.cs
@@ -1,4 +1,4 @@
-
+/*
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
@@ -27,3 +27,4 @@ app.MapControllerRoute(
app.Run();
+*/
\ No newline at end of file
diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Main/TeamHobby.HobbyProjectGenerator.Main.csproj b/Source Code/TeamHobby.HobbyProjectGenerator.Main/TeamHobby.HobbyProjectGenerator.Main.csproj
index 547419a..4d2a6e4 100644
--- a/Source Code/TeamHobby.HobbyProjectGenerator.Main/TeamHobby.HobbyProjectGenerator.Main.csproj
+++ b/Source Code/TeamHobby.HobbyProjectGenerator.Main/TeamHobby.HobbyProjectGenerator.Main.csproj
@@ -4,6 +4,8 @@
net6.0
enable
enable
+ Exe
+
diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln
new file mode 100644
index 0000000..a3fe6d3
--- /dev/null
+++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln
@@ -0,0 +1,49 @@
+
+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.DAL", "..\TeamHobby.HobbyProjectGenerator.DAL\TeamHobby.HobbyProjectGenerator.DAL.csproj", "{DCB0E160-1F6D-406E-8633-489CD564479B}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.Models", "..\TeamHobby.HobbyProjectGenerator.Models\TeamHobby.HobbyProjectGenerator.Models.csproj", "{75DED6C2-D404-4E71-A58B-0F616DB5C062}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "main", "..\main\main.csproj", "{30C7EBF3-3957-46E5-86C1-C13356841ECA}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ 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}.Debug|Any CPU.Build.0 = 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
+ {DCB0E160-1F6D-406E-8633-489CD564479B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DCB0E160-1F6D-406E-8633-489CD564479B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DCB0E160-1F6D-406E-8633-489CD564479B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DCB0E160-1F6D-406E-8633-489CD564479B}.Release|Any CPU.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}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {75DED6C2-D404-4E71-A58B-0F616DB5C062}.Release|Any CPU.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}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {B2517200-A9F9-468C-B0EB-280FF9B9FBC9}
+ EndGlobalSection
+EndGlobal
diff --git a/Source Code/main/Controller.cs b/Source Code/main/Controller.cs
new file mode 100644
index 0000000..c2d2936
--- /dev/null
+++ b/Source Code/main/Controller.cs
@@ -0,0 +1,145 @@
+using main;
+using System;
+
+
+namespace TeamHobby.HobbyProjectGenerator.Main
+{
+ public class Controller
+ {
+ public bool newAccount()
+ {
+ // Get username
+ Console.WriteLine("Please enter a username:");
+ string userName = Console.ReadLine();
+
+ // Get Password
+ Console.WriteLine("Please enter a password:");
+ string userPassword = Console.ReadLine();
+
+ // Create bool value for password confirm loop
+ bool conPsswrd = true;
+ // Loop until password is confirmed
+ while (conPsswrd == true)
+ {
+ // Confirm Password
+ Console.WriteLine("Please re-enter the password:");
+ string checkPsswd = Console.ReadLine();
+ // Check if passwords match
+ if (userPassword == checkPsswd)
+ {
+ // Get Security question for password reset
+ Console.WriteLine("Please enter a security question.\n" +
+ "(EX: What is your favorite food?");
+ string SecQuest = Console.ReadLine();
+ // Get Security question answer
+ Console.WriteLine("Please enter the answer for your security question:");
+ String SecAnswer = Console.ReadLine();
+
+ // Call user manager method to create the new user
+ //int userCreateConfirm = new CreateUser(userName,userPassword,SecQuest,SecAnswer);
+
+ // Check if user creation was successful
+ /* if (userCreateConfirm = 1)
+ {
+
+ // Confirm to user that the account has been created
+ Console.WriteLine("Account created succesfully with the username of" + userName);
+ }
+ else
+ {
+
+ }*/
+ conPsswrd = false;
+ }
+ else
+ {
+ Console.WriteLine("Passwords did not match, please try again.");
+ }
+ }
+ return true;
+ }
+ static void Main(string[] args)
+ {
+ /* ExampleDAO z = new ExampleDAO();
+ z.UserData("Tomato");
+ Console.Read();*/
+ bool MainMenu = true;
+
+ // Set up menu loop
+ while (MainMenu == true)
+ {
+ // 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;
+
+
+ // Create class objects
+ UiPrint menu = new UiPrint();
+ UserAccount user = new UserAccount();
+
+
+ // Print main menu
+ menu.InitialMenu();
+
+ // Set up try-catch for invalid inputs
+ try
+ {
+ // Get user choice
+ string initialChoice = Console.ReadLine();
+ // Convert to integer
+ int Choice = Convert.ToInt32(initialChoice);
+
+ switch (Choice)
+ {
+ case 0:
+ MainMenu = false;
+ break;
+ // Create a new account
+ case 1:
+ user.newUser();
+ break;
+ // Access Admin features
+ case 2:
+ // Ask for Admin login credentials
+ Console.WriteLine("Please enter a username:");
+ string AdminUser = Console.ReadLine();
+ Console.WriteLine("Please enter the password for" + AdminUser);
+ string AdminPsswrd = Console.ReadLine();
+
+ // Check if the username and password match a record within the administrators
+
+
+ // Show new administrator menu
+ int AdminNum = 0;
+ Console.WriteLine("Welcome" + AdminUser);
+ Console.WriteLine("What would you like to do?");
+ Console.WriteLine("1.View normal user records.");
+ Console.WriteLine("2.View Administrator user records.");
+ Console.WriteLine("3.View log files.");
+ Console.WriteLine("");
+ Console.WriteLine("");
+ Console.WriteLine("");
+ Console.WriteLine("");
+ Console.WriteLine("");
+
+
+ break;
+ default:
+ Console.WriteLine("Invalid choice, please enter a valid number.");
+ break;
+ };
+ }
+ // Catch invalid keys such as spamming enter
+ catch
+ {
+ MainMenu = false;
+ };
+ }
+
+ }
+ }
+}
diff --git a/Source Code/main/ExampleDAO.cs b/Source Code/main/ExampleDAO.cs
new file mode 100644
index 0000000..4e6b14b
--- /dev/null
+++ b/Source Code/main/ExampleDAO.cs
@@ -0,0 +1,55 @@
+using System;
+using Microsoft.Data.SqlClient;
+using TeamHobby.HobbyProjectGenerator;
+using TeamHobby.HobbyProjectGenerator.DAL;
+using TeamHobby.HobbyProjectGenerator.Models;
+
+namespace TeamHobby.HobbyProjectGenerator.Main
+{
+ public class ExampleDAO
+ {
+
+ public void UserData(string username)
+ {
+ // Sql server connection string, needs to be changed accordingly to connect
+ var connString = "server=localhost,3316;user=root;database=users;password=Plop20"; // 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))
+ {
+ conn.Open();
+ // 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());
+ }
+ conn.Close();
+
+ }
+ // Console.Read();
+ /*
+ * this is meant for specific basic sql commands
+ using (var adapter = new SqlDataAdapter())
+ {
+ adapter.SelectCommand
+ }
+ */
+ //return null;
+ }
+ }
+ }
+}
diff --git a/Source Code/main/MainMenu.cs b/Source Code/main/MainMenu.cs
new file mode 100644
index 0000000..962569e
--- /dev/null
+++ b/Source Code/main/MainMenu.cs
@@ -0,0 +1,134 @@
+using System;
+
+namespace TeamHobby.HobbyProjectGenerator.Main
+{
+ public class MainMenu
+ {
+ static void Main(string[] args)
+ {
+ /* ExampleDAO z = new ExampleDAO();
+ z.UserData("Tomato");
+ Console.Read();*/
+ bool menu = true;
+
+ // Set up menu loop
+ while (menu == true)
+ {
+ // 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;
+
+
+ // Create intial menu
+ Console.WriteLine("What would you like to do?");
+ int num = 1;
+ Console.WriteLine(num + ".Create a new user account.");
+ num += 1;
+ Console.WriteLine(num + ".Acess Admin Features.");
+
+ // Set up try-catch for invalid inputs
+ try
+ {
+ // Get user choice
+ string initialChoice = Console.ReadLine();
+ // Convert to integer
+ int Choice = Convert.ToInt32(initialChoice);
+
+ switch (Choice)
+ {
+ // Create a new account
+ case 1:
+ // Get username
+ Console.WriteLine("Please enter a username:");
+ string userName = Console.ReadLine();
+
+ // Get Password
+ Console.WriteLine("Please enter a password:");
+ string userPassword = Console.ReadLine();
+
+ // Create bool value for password confirm loop
+ bool conPsswrd = true;
+ // Loop until password is confirmed
+ while (conPsswrd == true)
+ {
+ // Confirm Password
+ Console.WriteLine("Please re-enter the password:");
+ string checkPsswd = Console.ReadLine();
+ // Check if passwords match
+ if (userPassword == checkPsswd)
+ {
+ // Get Security question for password reset
+ Console.WriteLine("Please enter a security question.\n" +
+ "(EX: What is your favorite food?");
+ string SecQuest = Console.ReadLine();
+ // Get Security question answer
+ Console.WriteLine("Please enter the answer for your security question:");
+ String SecAnswer = Console.ReadLine();
+
+ // Call user manager method to create the new user
+ //int userCreateConfirm = new CreateUser(userName,userPassword,SecQuest,SecAnswer);
+
+ // Check if user creation was successful
+ /* if (userCreateConfirm = 1)
+ {
+
+ // Confirm to user that the account has been created
+ Console.WriteLine("Account created succesfully with the username of" + userName);
+ }
+ else
+ {
+
+ }*/
+ conPsswrd = false;
+ }
+ else
+ {
+ Console.WriteLine("Passwords did not match, please try again.");
+ }
+ }
+ break;
+ // Access Admin features
+ case 2:
+ // Ask for Admin login credentials
+ Console.WriteLine("Please enter a username:");
+ string AdminUser = Console.ReadLine();
+ Console.WriteLine("Please enter the password for" + AdminUser);
+ string AdminPsswrd = Console.ReadLine();
+
+ // Check if the username and password match a record within the administrators
+
+
+ // Show new administrator menu
+ int AdminNum = 0;
+ Console.WriteLine("Welcome" + AdminUser);
+ Console.WriteLine("What would you like to do?");
+ Console.WriteLine("1.View normal user records.");
+ Console.WriteLine("2.View Administrator user records.");
+ Console.WriteLine("3.");
+ Console.WriteLine("");
+ Console.WriteLine("");
+ Console.WriteLine("");
+ Console.WriteLine("");
+ Console.WriteLine("");
+
+
+ break;
+ default:
+ menu = false;
+ break;
+ };
+ }
+ // Catch invalid keys such as spamming enter
+ catch
+ {
+ menu = false;
+ };
+ }
+
+ }
+ }
+}
diff --git a/Source Code/main/SystemAccountManager.cs b/Source Code/main/SystemAccountManager.cs
new file mode 100644
index 0000000..908f1d5
--- /dev/null
+++ b/Source Code/main/SystemAccountManager.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace main
+{
+ internal class SystemAccountManager
+ {
+ public void AccountController()
+ {
+ // Create objects
+ UserAccount user = new UserAccount();
+ UiPrint ui = new UiPrint();
+
+ bool foo = true;
+
+ while (foo == true)
+ {
+ // sub menu
+ ui.SystemAccountMenu();
+ //
+
+ }
+
+ }
+ }
+}
diff --git a/Source Code/main/UiPrint.cs b/Source Code/main/UiPrint.cs
new file mode 100644
index 0000000..98378f8
--- /dev/null
+++ b/Source Code/main/UiPrint.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+// Print Statements used throughout the program.
+
+namespace main
+{
+ internal 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 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");
+ }
+ }
+}
diff --git a/Source Code/main/UserAccount.cs b/Source Code/main/UserAccount.cs
new file mode 100644
index 0000000..271d055
--- /dev/null
+++ b/Source Code/main/UserAccount.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace main
+{
+ public class UserAccount
+ {
+ private string username;
+ private string password;
+ private string role;
+
+ public UserAccount(string un,string pwd,string rol)
+ {
+ username = un;
+ password = pwd;
+ role = rol;
+
+ }
+
+ public UserAccount()
+ {
+ password = "1234";
+ role = "Regular";
+ }
+
+ public void newUser()
+ {
+
+ }
+ }
+}
diff --git a/Source Code/main/main.csproj b/Source Code/main/main.csproj
new file mode 100644
index 0000000..74abf5c
--- /dev/null
+++ b/Source Code/main/main.csproj
@@ -0,0 +1,10 @@
+
+
+
+ Exe
+ net6.0
+ enable
+ enable
+
+
+