From 8cda716487bf7a35f3fbc52198a7f31b3030a666 Mon Sep 17 00:00:00 2001 From: Im_Alpha Date: Tue, 4 Jan 2022 13:38:02 -0800 Subject: [PATCH] Fixed namespace --- .../ArchiveManager.cs | 170 -------- .../Contracts/IRelationArchivable.cs | 13 - ...ackup.HobbyProjectGenerator.Archive.csproj | 25 -- ...Hobby.HobbyProjectGenerator.Archive.csproj | 25 -- .../Contracts/ILogger.cs | 16 - .../Contracts/ILoggerFactory.cs | 16 - .../Implementations/ConsoleLogger.cs | 16 - .../Implementations/DBLogger.cs | 24 -- .../Implementations/DBLoggerFactory.cs | 20 - .../Implementations/FileLogger.cs | 24 -- .../Implementations/InMemoryLogger.cs | 58 --- .../LogEntry.cs | 53 --- .../LoggingManager.cs | 45 --- ...ackup.HobbyProjectGenerator.Logging.csproj | 20 - ...Hobby.HobbyProjectGenerator.Logging.csproj | 15 - .../AccountService.cs | 301 -------------- .../SystemAccountManager.cs | 367 ------------------ ...obbyProjectGenerator.UserManagement.csproj | 14 - .../UserAccount.cs | 150 ------- .../Contracts/IRelationArchivable.cs | 2 +- .../Implementations/ArchiveManager.cs | 2 +- .../Logging/Contracts/ILogger.cs | 2 +- .../Logging/Contracts/ILoggerFactory.cs | 2 +- .../Logging/Implementations/ConsoleLogger.cs | 2 +- .../Logging/Implementations/DBLogger.cs | 2 +- .../Implementations/DBLoggerFactory.cs | 4 +- .../Logging/Implementations/FileLogger.cs | 4 +- .../Logging/Implementations/InMemoryLogger.cs | 3 +- .../Logging/Implementations/LogEntry.cs | 2 +- .../Logging/Implementations/LoggingManager.cs | 6 +- .../Implementations/AccountService.cs | 4 +- .../Implementations/SystemAccountManager.cs | 3 +- .../Implementations/UserAccount.cs | 2 +- .../ArchivingXUnitTest.cs | 2 +- ...amHobby.HobbyProjectGenerator.Tests.csproj | 2 - .../UseerManagementTests.cs | 2 +- .../TeamHobby.HobbyProjectGenerator.sln | 20 - Source Code/main/Controller.cs | 3 +- Source Code/main/GenerateOpFile.cs | 2 +- ...eamHobby.HobbyProjectGenerator.Main.csproj | 3 +- 40 files changed, 25 insertions(+), 1421 deletions(-) delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Archive/ArchiveManager.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Archive/Contracts/IRelationArchivable.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Archive/TeamHobby - Backup.HobbyProjectGenerator.Archive.csproj delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Archive/TeamHobby.HobbyProjectGenerator.Archive.csproj delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Logging/Contracts/ILogger.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Logging/Contracts/ILoggerFactory.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/ConsoleLogger.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/DBLogger.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/DBLoggerFactory.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/FileLogger.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/InMemoryLogger.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Logging/LogEntry.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Logging/LoggingManager.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Logging/TeamHobby - Backup.HobbyProjectGenerator.Logging.csproj delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.Logging/TeamHobby.HobbyProjectGenerator.Logging.csproj delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/AccountService.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/SystemAccountManager.cs delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/TeamHobby.HobbyProjectGenerator.UserManagement.csproj delete mode 100644 Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/UserAccount.cs diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Archive/ArchiveManager.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Archive/ArchiveManager.cs deleted file mode 100644 index 874db08..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Archive/ArchiveManager.cs +++ /dev/null @@ -1,170 +0,0 @@ - -using TeamHobby.HobbyProjectGenerator.DataAccessLayer; - -namespace TeamHobby.HobbyProjectGenerator.Archive -{ - public class ArchiveManager - { - private IDataSource _conn; - - // Constructor to take in the connection. - public ArchiveManager(IDataSource dataSource) { - _conn = dataSource; - } - - //public IDataSource GetConnection() - //{ - // return _conn; - //} - - // Create the folder where the compress file will be stored - public bool CreateArchiveFolder(){ - //string curPath = Directory.GetCurrentDirectory(); - string curPath = @"C:\"; - string folderName = "\\HobbyArchive"; - - // Find the root drive of the program - string drive = Path.GetPathRoot(path: curPath); - // Check if Drive exists or not - try { - if (!Directory.Exists(drive)) - { - Console.WriteLine("Drive {0} not found", drive); - return false; - } - - string archiveFolder = curPath + folderName; - //Console.WriteLine("Creating a new folder at: {0}", archiveFolder); - if (!Directory.Exists(archiveFolder)) - { - Console.WriteLine("Creating a new folder at: {0}", archiveFolder); - Directory.CreateDirectory(archiveFolder); - //return true; - } - } - catch (Exception ex){ - // If the creating a folder failed, return false - return false; - } - return true; - } - - - // Return the name of the new output file with Path - public string CreateOutFileName() { - try { - // Creating a file name: - string path = @"C:\HobbyArchive"; - //string path = Directory.GetCurrentDirectory() + "\\HobbyArchive"; - Console.WriteLine("The current directory is {0}", path); - string date = DateTime.Now.ToString("M_d_yyyy"); - string fileName = date + "_archive.csv"; - string filePath = System.IO.Path.Combine(path, fileName); - - Console.WriteLine("Date: {0}", date); - Console.WriteLine("Filepath: {0}", filePath); - return filePath; - } - catch - { - Console.WriteLine("ArchiveCon: Creating a file name failed. "); - return ""; - } - } - - // put everything toget here - public bool Controller(){ - - SqlDAO sqlDS = null; - if (_conn.GetType() == typeof(SqlDAO)) - { - sqlDS = (SqlDAO)_conn; - } - - // Check to make sure that Sql Data source connection is not null - if (sqlDS == null){ - return false; - } - // TODO: Remember to add try catch block here to make sure it is completed. - - //Creating the folder Archive - Console.WriteLine("Creating a new folder ..."); - CreateArchiveFolder(); - Console.WriteLine("Creating a new folder completed ..."); - Console.WriteLine("----------------"); - Console.WriteLine(""); - - // Creating a file name: - //string filePath = @"C:\HobbyArchive"; - //Console.WriteLine("Creating file name ... "); - //string curPath = archive.CreateOutFileName(); - Console.WriteLine("Creating Output file name ..."); - string outPath = CreateOutFileName(); - Console.WriteLine("Output file name created ..."); - Console.WriteLine("----------------"); - Console.WriteLine(""); - - //string pathForward = @"C:\Users\Chunchunmaru\Documents\csulbFall2021\HobbyProject\Source Code\main\bin\Debug\net6.0\HobbyArchive"; - //string pathTemp = "C:/Temp/oldlogs10.txt"; - //string pathTempBack = @"C:\Temp\oldlogs10.txt"; - - // Try catch block to delete abort the compressing process - try{ - //Output SQL to a text file - Console.WriteLine("Copying to a text file ..."); - sqlDS.CopyToFile(outPath); - Console.WriteLine("Copying completed ..."); - Console.WriteLine("----------------"); - Console.WriteLine(""); - - // Compress the file - Console.WriteLine("Copressing the text file ..."); - sqlDS.CompressFile(outPath); - Console.WriteLine("Copression completed ..."); - Console.WriteLine("----------------"); - Console.WriteLine(""); - - //Remove output file - Console.WriteLine("Removing the text file ..."); - sqlDS.RemoveOutputFile(outPath); - Console.WriteLine("Text File removal completed ..."); - Console.WriteLine("----------------"); - Console.WriteLine(""); - - // Remove entries fromt the database - Console.WriteLine("Removing the text file ..."); - sqlDS.RemoveEntries(); - Console.WriteLine("Entries removal completed ..."); - Console.WriteLine("----------------"); - Console.WriteLine(""); - - // Return true if compressing sequence is successful - return true; - } - catch (Exception e){ - // Abort the compressing sequence and clean up uneccesary files. - Console.WriteLine("Archiving Sequenced failed. Cleaning up resources."); - - // Delete the text output file if any of the process failed - if (File.Exists(outPath)){ - File.Delete(outPath); - } - - // Delete the compressed file if Removing entries and removing text file output failed - string compFile = outPath + ".gz"; - if (File.Exists(compFile)){ - File.Delete(compFile); - } - - return false; - - } - - // Testing date time patters - //string date = DateTime.Now.ToString("d"); - //Console.WriteLine(date); - //Console.WriteLine(DateTime.Now.ToString("M_d_yyyy_H:mm:ss")); - } - - } -} \ No newline at end of file diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Archive/Contracts/IRelationArchivable.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Archive/Contracts/IRelationArchivable.cs deleted file mode 100644 index 96cabb9..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Archive/Contracts/IRelationArchivable.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace TeamHobby.HobbyProjectGenerator.Archive -{ - public interface IRelationArchivable - { - bool CreateArchived(string fileName); - } -} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Archive/TeamHobby - Backup.HobbyProjectGenerator.Archive.csproj b/Source Code/TeamHobby.HobbyProjectGenerator.Archive/TeamHobby - Backup.HobbyProjectGenerator.Archive.csproj deleted file mode 100644 index 65fcde5..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Archive/TeamHobby - Backup.HobbyProjectGenerator.Archive.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - net6.0 - enable - enable - AnyCPU;x86 - - - - - - - - - - - - - - - - - - diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Archive/TeamHobby.HobbyProjectGenerator.Archive.csproj b/Source Code/TeamHobby.HobbyProjectGenerator.Archive/TeamHobby.HobbyProjectGenerator.Archive.csproj deleted file mode 100644 index f938aec..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Archive/TeamHobby.HobbyProjectGenerator.Archive.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - net6.0 - enable - enable - AnyCPU;x86 - - - - - - - - - - - - - - - - - - diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Contracts/ILogger.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Contracts/ILogger.cs deleted file mode 100644 index 9aee5ba..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Contracts/ILogger.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace TeamHobby.HobbyProjectGenerator.Logging -{ - public interface ILogger - { - bool Log(LogEntry log); - - // IList GetAllLogs(); - - } -} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Contracts/ILoggerFactory.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Contracts/ILoggerFactory.cs deleted file mode 100644 index cf0d199..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Contracts/ILoggerFactory.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace TeamHobby.HobbyProjectGenerator.Logging.Contracts -{ - public interface ILoggerFactory - { - ILogger CreateLogger() - { - return new DBLogger(); - } - } -} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/ConsoleLogger.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/ConsoleLogger.cs deleted file mode 100644 index 19d2377..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/ConsoleLogger.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace TeamHobby.HobbyProjectGenerator.Logging -{ - public class ConsoleLogger : ILogger - { - public bool Log(LogEntry log) - { - return true; - } - } -} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/DBLogger.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/DBLogger.cs deleted file mode 100644 index 132ee82..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/DBLogger.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace TeamHobby.HobbyProjectGenerator.Logging -{ - public class DBLogger : ILogger - { - public DBLogger() - { - } - - public IList GetAllLogs() - { - throw new NotImplementedException(); - } - - public bool Log(LogEntry log) - { - throw new NotImplementedException(); - } - - - } - -} \ No newline at end of file diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/DBLoggerFactory.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/DBLoggerFactory.cs deleted file mode 100644 index f790cbb..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/DBLoggerFactory.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeamHobby.HobbyProjectGenerator.Logging.Contracts; - -namespace TeamHobby.HobbyProjectGenerator.Logging.Implementations -{ - public class DBLoggerFactory : ILoggerFactory - { - public DBLoggerFactory() - { - } - public ILogger CreateLogger() - { - return new DBLogger(); - } - } -} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/FileLogger.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/FileLogger.cs deleted file mode 100644 index 6c561b1..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/FileLogger.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using TeamHobby.HobbyProjectGenerator.Logging.Contracts; - -namespace TeamHobby.HobbyProjectGenerator.Logging -{ - public class FileLogger : ILogger - { - public FileLogger() - { - } - - public IList GetAllLogs() - { - throw new NotImplementedException(); - } - - public bool Log(LogEntry log) - { - throw new NotImplementedException(); - } - - } - -} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/InMemoryLogger.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/InMemoryLogger.cs deleted file mode 100644 index 10cbf74..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/Implementations/InMemoryLogger.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -namespace TeamHobby.HobbyProjectGenerator.Logging -{ - // implementation of ILogger that stores logs as they initialize - public class InMemoryLogger : ILogger - { - // make readonly to prevent it from being changed somewhere other than in the constructor - private readonly IList _logStore; - - public InMemoryLogger() - { - // list of current logs - _logStore = new List(); - } - - public InMemoryLogger(IList logStore) - { - _logStore = logStore; - } - - public bool Log(LogEntry entry) - { - if (entry is null) - { - throw new ArgumentNullException(nameof(entry)); - } - - try - { - // string interpolation to add UTC timestamp to log description - //_logStore.Add($"{DateTime.UtcNow}-> {description}"); - return true; - } - catch - { - return false; - } - } - public IList GetAllLogs() - { - return _logStore; - } - - - public override bool Equals(object? obj) - { - return obj is InMemoryLogger logger && - EqualityComparer>.Default.Equals(_logStore, logger._logStore); - } - - public override int GetHashCode() - { - return HashCode.Combine(_logStore); - } - } - -} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/LogEntry.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Logging/LogEntry.cs deleted file mode 100644 index 6fa0966..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/LogEntry.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.Logging -{ - public enum LogLevel - { - Info, Debug, Warning, Error - } - - public enum LogCategory - { - View, Business, Server, Data, Datastore - } - - // LogEntry is a record type with init properties for each field - // ensures that log entries are immutable after initialization - public record LogEntry - { - public LogLevel level { get; init; } - public LogCategory category { get; init; } - public string user { get; init; } - public string description { get; init; } - public DateTime timestamp { get; init; } - - - // Constructor requireing only the description as an arg - // Assigns default values for LogLevel (Info), LogCategory (Server), user ("System"), and the UTC time at initialization for timestamp - public LogEntry(string description) - { - this.level = LogLevel.Info; - this.category = LogCategory.Server; - this.user = "System"; - this.description = description; - this.timestamp = DateTime.UtcNow; - } - // Constructor with args for all fields except timestamp - // timestamp is always set to the UTC time at the time of initialization - public LogEntry(LogLevel level, string user, LogCategory category, string description) - { - this.level = level; - this.category = category; - this.user = user; - this.description = description; - this.timestamp = DateTime.UtcNow; - } - - - } -} \ No newline at end of file diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/LoggingManager.cs b/Source Code/TeamHobby.HobbyProjectGenerator.Logging/LoggingManager.cs deleted file mode 100644 index 2f45c93..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/LoggingManager.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using TeamHobby.HobbyProjectGenerator.DataAccessLayer; -using TeamHobby.HobbyProjectGenerator.Logging.Contracts; -using TeamHobby.HobbyProjectGenerator.Logging.Implementations; - - -namespace TeamHobby.HobbyProjectGenerator.Logging -{ - internal class LoggingManager - { - private readonly IDataSource _conn; - private readonly ILogger _logger; - private readonly ILoggerFactory _factory; - private readonly LogEntry _logEntry; - - // Both Constructors take an IDataSource arg to make logging extensible to future data sources - // first constructor has no additional args - defaults to using the DBFactiry implementation - public LoggingManager(IDataSource dataSource) - { - _conn = dataSource; - _factory = new DBLoggerFactory(); - _logger = _factory.CreateLogger(); - } - // second constructor takes an additional ILoggerFactory arg - allows for extensible logger types - public LoggingManager(IDataSource dataSource, ILoggerFactory factory) - { - _conn = dataSource; - _factory = factory; - _logger = _factory.CreateLogger(); - - } - - public void Process() - { - _logger.Log(_logEntry); - } - - - - } -} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/TeamHobby - Backup.HobbyProjectGenerator.Logging.csproj b/Source Code/TeamHobby.HobbyProjectGenerator.Logging/TeamHobby - Backup.HobbyProjectGenerator.Logging.csproj deleted file mode 100644 index 97db0f1..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/TeamHobby - Backup.HobbyProjectGenerator.Logging.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - net6.0 - enable - enable - Library - AnyCPU - AnyCPU;x86 - - - - True - - - - True - - - diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/TeamHobby.HobbyProjectGenerator.Logging.csproj b/Source Code/TeamHobby.HobbyProjectGenerator.Logging/TeamHobby.HobbyProjectGenerator.Logging.csproj deleted file mode 100644 index 94d4556..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.Logging/TeamHobby.HobbyProjectGenerator.Logging.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - net6.0 - enable - enable - AnyCPU;x86 - - - - - - - - diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/AccountService.cs b/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/AccountService.cs deleted file mode 100644 index 7802386..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/AccountService.cs +++ /dev/null @@ -1,301 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Data.Odbc; -using TeamHobby.HobbyProjectGenerator.DataAccessLayer; - -namespace TeamHobby.HobbyProjectGenerator.UserManagement -{ - public class AccountService - { - public bool CreateUserRecord(UserAccount newUser, string CreatedBy, IDataSource dbSource) - { - try - { - // Insert into users table - if (newUser.email == null || newUser.email == "NULL") - { - string sqlUser = $"INSERT INTO users (UserName, Password, Role, IsActive," + - $"CreatedBy, CreatedDate, Email) VALUES ('{newUser.username}', " + - $"'{newUser.password}','{newUser.role}', 1," + - $"'{CreatedBy}', NOW(),{newUser.email});"; - - bool insertNewUser = dbSource.WriteData(sqlUser); - return insertNewUser; - } - else - { - string sqlUser = $"INSERT INTO users (UserName, Password, Role, IsActive," + - $"CreatedBy, CreatedDate, Email) VALUES ('{newUser.username}', " + - $"'{newUser.password}','{newUser.role}', 1," + - $"'{CreatedBy}', NOW(),'{newUser.email}');"; - - bool insertNewUser = dbSource.WriteData(sqlUser); - return insertNewUser; - } - } - catch (Exception ex) - { - return false; - } - } - public bool EditUserRecord(UserAccount editUser, string CreatedBy, IDataSource dbSource) - { - try - { - // Insert into users table - if (editUser.email == null || editUser.email == "NULL") - { - string sqlUser = $"UPDATE users t SET t.Password = '{editUser.password}', " + - $"t.Role = '{editUser.role}',t.Email = '{editUser.email}' " + - $"WHERE t.UserName = {editUser.username};"; - - bool updateNewUser = dbSource.UpdateData(sqlUser); - return updateNewUser; - } - else - { - string sqlUser = $"UPDATE users t SET t.Password = '{editUser.password}', " + - $"t.Role = '{editUser.role}',t.Email = '{editUser.email}' " + - $"WHERE t.UserName = '{editUser.username}';"; - - bool updateNewUser = dbSource.UpdateData(sqlUser); - return updateNewUser; - } - } - catch (Exception ex) - { - return false; - } - } - public bool DeleteUserRecord(UserAccount deleteUser, string CreatedBy, IDataSource dbSource) - { - try - { - // Insert into users table - string sqlUser = $"DELETE from users WHERE UserName = '{deleteUser.username}' " + - $"and Password = '{deleteUser.password}';"; - - bool deleteNewUser = dbSource.DeleteData(sqlUser); - return deleteNewUser; - - } - catch (Exception ex) - { - return false; - } - } - public bool DisableUser(UserAccount disableUser, string CreatedBy, IDataSource dbSource) - { - try - { - // Insert into users table - string sqlUser = $"UPDATE users u SET u.IsActive = 0 WHERE u.UserName = '{disableUser.username}'" + - $"and u.Role = '{disableUser.role}';"; - - bool disableNewUser = dbSource.UpdateData(sqlUser); - return disableNewUser; - - } - catch (Exception ex) - { - return false; - } - } - public bool EnableUser(UserAccount enableUser, string CreatedBy, IDataSource dbSource) - { - try - { - // Insert into users table - string sqlUser = $"UPDATE users u SET u.IsActive = 1 WHERE u.UserName = '{enableUser.username}'" + - $"and u.Role = '{enableUser.role}';"; - - bool disableNewUser = dbSource.UpdateData(sqlUser); - return disableNewUser; - - } - catch (Exception ex) - { - return false; - } - } - public bool BulkOperation(string signedUser, string path, IDataSource dbSource) - { - try - { - // Get the current directory. - //string path = Directory.GetCurrentDirectory(); - // Open file reader stream - using StreamReader fileRead = new(path); // path + + "\\BulkOps\\Bulk.txt" - // Show location of the file being written - //Console.WriteLine(path); - - // List choices of operations - List ops = new List {"Create Account", "Edit Account", - "Delete Account", "Disable Account", "Enable Account"}; - - // List to hold file operation and credentials - List fileList = new List(); - string operation = ""; - string UN = ""; - string PWD = ""; - string Role = ""; - string Email = ""; - - // Loop through file rows - while (!fileRead.EndOfStream) - { - // Create variable to hold current line - string line = fileRead.ReadLine(); - - // Check if line is not empty and contains the separator - if (line != null && line.Contains(":")) - { - // Assign value to hold current line parameter - string value = line.Split(':')[1].Trim(); - - // Check what operation is being called - if (ops.Contains(value)) - { - // Add operation into temp - //Console.WriteLine("Found operation"); - //Console.WriteLine(value); - operation = value; - } - else - { - string checkCredential = line.Split(':')[0].Trim(); - //Console.WriteLine("Found credential"); - switch (checkCredential) - { - case "Username": - UN = value; - break; - case "Password": - PWD = value; - break; - case "Role": - Role = value; - break; - case "Email": - Email = value; - break; - default: - break; - } - } - } - else if(line != null) - { - switch (operation) - { - case "Create Account": - //Console.WriteLine(operation); - if (!String.IsNullOrEmpty(UN)) - { - // Create UserAccount object - UserAccount user = new UserAccount(UN, PWD, Email, DateTime.UtcNow); - // Create Account service object - AccountService serviceTest = new AccountService(); - serviceTest.CreateUserRecord(user, signedUser, dbSource); - } - break; - case "Edit Account": - //Console.WriteLine(operation); - //Console.WriteLine(operation); - if (String.IsNullOrEmpty(UN)) - { - // Create UserAccount object - UserAccount user = new UserAccount(UN, PWD, Email, DateTime.UtcNow); - // Create Account service object - AccountService serviceTest = new AccountService(); - serviceTest.CreateUserRecord(user, signedUser, dbSource); - } - break; - case "Delete Account": - //Console.WriteLine(operation); - //Console.WriteLine(operation); - if (String.IsNullOrEmpty(UN)) - { - // Create UserAccount object - UserAccount user = new UserAccount(UN, PWD, Email, DateTime.UtcNow); - // Create Account service object - AccountService serviceTest = new AccountService(); - serviceTest.CreateUserRecord(user, signedUser, dbSource); - } - break; - case "Disable Account": - //Console.WriteLine(operation); - //Console.WriteLine(operation); - if (String.IsNullOrEmpty(Role) && UN != null) - { - // Create UserAccount object - UserAccount user = new UserAccount(UN, PWD, Email, DateTime.UtcNow); - // Create Account service object - AccountService serviceTest = new AccountService(); - serviceTest.CreateUserRecord(user, signedUser, dbSource); - } - else if (String.IsNullOrEmpty(Email) && UN != null) - { - // Create UserAccount object - UserAccount user = new UserAccount(UN, PWD, Role); - // Create Account service object - AccountService serviceTest = new AccountService(); - serviceTest.CreateUserRecord(user, signedUser, dbSource); - } - else if (String.IsNullOrEmpty(Role) && String.IsNullOrEmpty(Email) && UN != null) - { - // Create UserAccount object - UserAccount user = new UserAccount(UN, PWD, DateTime.UtcNow); - // Create Account service object - AccountService serviceTest = new AccountService(); - serviceTest.CreateUserRecord(user, signedUser, dbSource); - } - break; - case "Enable Account": - //Console.WriteLine(operation); - //Console.WriteLine(operation); - if (String.IsNullOrEmpty(Role) && UN != null) - { - // Create UserAccount object - UserAccount user = new UserAccount(UN, PWD, Email, DateTime.UtcNow); - // Create Account service object - AccountService serviceTest = new AccountService(); - serviceTest.CreateUserRecord(user, signedUser, dbSource); - } - else if (String.IsNullOrEmpty(Email) && UN != null) - { - // Create UserAccount object - UserAccount user = new UserAccount(UN, PWD, Role); - // Create Account service object - AccountService serviceTest = new AccountService(); - serviceTest.CreateUserRecord(user, signedUser, dbSource); - } - else if (String.IsNullOrEmpty(Role) && String.IsNullOrEmpty(Email) && UN != null) - { - // Create UserAccount object - UserAccount user = new UserAccount(UN, PWD, DateTime.UtcNow); - // Create Account service object - AccountService serviceTest = new AccountService(); - serviceTest.CreateUserRecord(user, signedUser, dbSource); - } - break; - default: - break; - } - } - } - fileRead.Close(); - return true; - } - catch (Exception e) - { - Console.WriteLine("Error reading file"); - Console.WriteLine(e.Message); - return false; - } - } - } -} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/SystemAccountManager.cs b/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/SystemAccountManager.cs deleted file mode 100644 index ba4cedd..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/SystemAccountManager.cs +++ /dev/null @@ -1,367 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Data.Odbc; -using TeamHobby.HobbyProjectGenerator.UserManagement; -using TeamHobby.HobbyProjectGenerator.DataAccessLayer; - -namespace TeamHobby.HobbyProjectGenerator.UserManagement -{ - public class SystemAccountManager - { - public string IsInputValid(string checkUN, string checkPWD) - { - // Create bool variables to check if username and password are valid - bool validUN = checkUN.All(un=>Char.IsLetterOrDigit(un) || un=='@' - || un == '.' || un == ',' || un == '!'); - - bool validPwd = checkPWD.All(Char.IsLetterOrDigit); - - - // Check if any are empty - if (checkUN == null || checkPWD == null) - { - return "Invalid input\n"; - } - // Check if username is within the restricted length - else if (checkUN.Length > 15 || checkUN.Length <= 0 - || validUN is false) - { - return "Invalid Username\n"; - } - // Check if password is within the restricted length - else if (checkPWD.Length > 18 || checkPWD.Length <= 0 - || validPwd is false) - { - return "Invalid Password\n"; - } - // Check if username and password are valid - else if (checkUN.Length <= 15 && checkUN.Length > 0 - && validUN is true && checkPWD.Length <= 18 - && checkPWD.Length > 0 && validPwd is true) - { - return "Username and password is valid.\n"; - } - // Check if username and password and email are valid - else if (checkUN.Length <= 15 && checkUN.Length > 0 - && validUN is true && checkPWD.Length <= 18 - && checkPWD.Length > 0 && validPwd is true) - { - return "Username and password is valid.\n"; - } - // For testing to make sure username is valid - else if (checkUN.Length <= 15 && checkUN.Length > 0 - && validUN is true) - { - return "Valid Username\n"; - } - // For testing to make sure password is valid - else if (checkPWD.Length <= 18 && checkPWD.Length > 0 - && validPwd is true) - { - return "Valid Password\n"; - } - else - { - return "Invalid input\n"; - } - } - public string IsInputValid(string checkUN, string checkPWD, string email, string role) - { - // Create bool variables to check if username and password and email are valid - bool validUN = checkUN.All(un => Char.IsLetterOrDigit(un) || un == '@' - || un == '.' || un == ',' || un == '!'); - - bool validPwd = checkPWD.All(Char.IsLetterOrDigit); - - bool validEmail = email.All(email => Char.IsLetterOrDigit(email) && email == '@' - && email == '.'); - - bool validRole = role.All(role => Char.IsLetter(role)); - - // Check if any are empty - if (checkUN == null || checkPWD == null || email == null) - { - return "Invalid input\n"; - } - // Check if username is within the restricted length - else if (checkUN.Length > 15 || checkUN.Length <= 0 - || validUN is false) - { - return "Invalid Username\n"; - } - // Check if password is within the restricted length - else if (checkPWD.Length > 18 || checkPWD.Length <= 0 - || validPwd is false) - { - return "Invalid Password\n"; - } - // Check if email is within the restricted length - else if (email.Length > 18 || email.Length <= 0 - || validEmail is false) - { - return "Invalid Email.\n"; - } - // Check if username and password are valid - else if (checkUN.Length <= 15 && checkUN.Length > 0 - && validUN is true && checkPWD.Length <= 18 - && checkPWD.Length > 0 && validPwd is true) - { - return "Username and password is valid.\n"; - } - // Check if username and password and email are valid - else if (checkUN.Length <= 15 && checkUN.Length > 0 - && validUN is true && checkPWD.Length <= 18 - && checkPWD.Length > 0 && validPwd is true - && email.Length > 18 && email.Length <= 0 - && validEmail is true) - { - return "Username and password is valid.\n"; - } - // For testing to make sure username is valid - else if (checkUN.Length <= 15 && checkUN.Length > 0 - && validUN is true) - { - return "Valid Username\n"; - } - // For testing to make sure password is valid - else if (checkPWD.Length <= 18 && checkPWD.Length > 0 - && validPwd is true) - { - return "Valid Password\n"; - } - // For testing to make sure email is valid - else if (email.Length > 18 && email.Length <= 0 - && validEmail is true) - { - return "Valid Password\n"; - } - else - { - return "Invalid input\n"; - } - } - // Check with database if user is an admin - public bool isAdmin(UserAccount user, IDataSource dbSource) - { - // string checkAdmin = $"Select * from users where username = {user.username} and password = {user.password};"; - string checkAdmin = $"select r.Role from roles r, users u where " + - $"UserName = '{user.username}' and Password = '{user.password}' and r.Role = u.Role;"; - Object confirmAdmin = dbSource.ReadData(checkAdmin); - //Console.WriteLine("type of Reesult:" + confirmAdmin.GetType()); - OdbcDataReader reader = null; - - if (confirmAdmin.GetType() == typeof(OdbcDataReader)) - { - reader = (OdbcDataReader)confirmAdmin; - } - - // Create String to hold sql output - string checkSql = ""; - - // Read Sql query results - while (reader.Read()) - { - checkSql = reader.GetString(0); - } - - SqlDAO sqlDS = (SqlDAO)dbSource; - Console.WriteLine(""); - - // Closing the connection - sqlDS.GetConnection().Close(); - - if (checkSql == "Admin") - { - Console.WriteLine("-- Logged in successfully."); - return true; - } - else - { - return false; - } - } - public string CreateUserRecord(UserAccount user, IDataSource dbSource) - { - // Check Login inputs - IsInputValid(user.username, user.password); - - bool Admin = isAdmin(user, dbSource); - - // Give access if the user is and Admin - if (Admin is false) - { - return "Access Denied: Unauthorized\n"; - } - else - { - // db.users layout (UserName, Password, RoleID, IsActive, CreatedBy, CreatedDate) - // db.roles layout (RoleID(AutoGen), Role, CreatedBy, CreatedDate) - // Create UiPrint Object - UiPrint ui = new UiPrint(); - // Create Account Service object - AccountService accountService = new AccountService(); - // Create credentials object for new inptus - GetCredentials newCredentials = new GetCredentials(); - // Create bool object for menu loop - bool menuLoop = true; - // Create loop for menu - while (menuLoop is true) { - // Print User Management menu - ui.UserManagementMenu(user.username); - // Get user choice - int menuChoice = Convert.ToInt32(Console.ReadLine()); - // Complete the appropriate action - switch (menuChoice) - { - // Exit menu - case 0: - return "Back to Login"; - // Create account - case 1: - // Get all credentials and create newUser - UserAccount newUser = new UserAccount(newCredentials.GetUserName(), - newCredentials.ConfirmPassword(), newCredentials.GetEmail(), - newCredentials.GetRole(), DateTime.UtcNow); - bool accountValid = accountService.CreateUserRecord(newUser, user.username, dbSource); - if (accountValid is true) - { - Console.WriteLine("\nAccount created Successfully"); - break; - } - else - { - return "Database Timed out"; - } - // Edit account - case 2: - // State what account is being edited - string userName = newCredentials.GetUserName(); - - // Notify the user of what can be edited - Console.WriteLine($"\n****The following information will be used to update {userName}"); - - // Get updated parameters - UserAccount newEditUser = new UserAccount(userName, - newCredentials.GetPassword(), newCredentials.GetEmail(), - newCredentials.GetRole(), DateTime.UtcNow); - bool editValid = accountService.EditUserRecord(newEditUser, user.username, dbSource); - if (editValid is true) - { - Console.WriteLine("\nAccount updated Successfully"); - break; - } - else - { - return "Database Timed out"; - } - break; - // Delete account - case 3: - UserAccount newDeleteUser = new UserAccount(newCredentials.GetUserName(), - newCredentials.GetPassword(), DateTime.UtcNow); - bool deleteValid = accountService.DeleteUserRecord(newDeleteUser, user.username , dbSource); - if (deleteValid is true) - { - Console.WriteLine("\nAccount deleted Successfully"); - break; - } - else - { - return "User does not exist"; - } - break; - // Disable account - case 4: - UserAccount newDisableUser = new UserAccount(newCredentials.GetUserName(), - newCredentials.GetRole()); - bool disableValid = accountService.DisableUser(newDisableUser, user.username , dbSource); - if (disableValid is true) - { - Console.WriteLine("\nAccount disabled Successfully"); - break; - } - else - { - return "User does not exist"; - } - break; - // Enable account - case 5: - UserAccount newEnableUser = new UserAccount(newCredentials.GetUserName(), - newCredentials.GetRole()); - bool enableValid = accountService.EnableUser(newEnableUser, user.username , dbSource); - if (enableValid is true) - { - Console.WriteLine("\nAccount enabled Successfully"); - break; - } - else - { - return "User does not exist"; - } - break; - // Bulk operation through file - case 6: - AccountService bulkOP = new AccountService(); - // Get path to defualt bin location - string path = Directory.GetCurrentDirectory(); - while (true) - { - // Get name of file and update path to correct folder - Console.WriteLine("Please input the name of the file:(Example.txt)"); - string filename = $"{path}\\{Console.ReadLine()}"; - //Console.WriteLine(filename) - - // Get filesize - long fileSize = filename.Length; - long fileSizeGB = fileSize / (1024 * 1024); - //Console.WriteLine($"File size is {fileSize}kb"); - - // Check if input is empty - if (filename == null) - { - Console.WriteLine("Invalid file name.\n"); - } - // Check if file is over 2GB - else if (fileSizeGB > 2) - { - Console.WriteLine($"File size is {fileSizeGB}GB\n"); - Console.WriteLine("File is too large, please enter a smaller file.\n"); - } - else - { - // Begin bulk operation - Console.WriteLine("Running bulk operation..."); - bool bulkReq = bulkOP.BulkOperation(user.username, filename, dbSource); - if (bulkReq is true) - { - Console.WriteLine("\nBulk operation complete"); - break; - } - else - { - return "Bulk operation failed"; - } - } - } - break; - // View logs - case 7: - break; - // View archive - case 8: - Console.WriteLine("C:/HobbyArchive"); - break; - default: - Console.WriteLine("Invalid input.\nPlease enter a valid option.\n"); - break; - } - } - return "Back to Login"; - } - } - } -} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/TeamHobby.HobbyProjectGenerator.UserManagement.csproj b/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/TeamHobby.HobbyProjectGenerator.UserManagement.csproj deleted file mode 100644 index dc3fd33..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/TeamHobby.HobbyProjectGenerator.UserManagement.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - - diff --git a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/UserAccount.cs b/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/UserAccount.cs deleted file mode 100644 index e048653..0000000 --- a/Source Code/TeamHobby.HobbyProjectGenerator.UserManagement/UserAccount.cs +++ /dev/null @@ -1,150 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace TeamHobby.HobbyProjectGenerator.UserManagement -{ // Class for getting user credentials - public class GetCredentials - { - public string? GetUserName() - { - Console.WriteLine("Please enter a username:"); - string? userName = Console.ReadLine(); - return userName; - } - public string? GetPassword() - { - Console.WriteLine("Please enter a password:"); - string? userPassword = Console.ReadLine(); - return userPassword; - } - public string ConfirmPassword() - { - while (true) - { - Console.WriteLine("Please enter a password:"); - string? userPassword = Console.ReadLine(); - // Confirm Password - Console.WriteLine("Please re-enter the password:"); - string checkPsswd = Console.ReadLine(); - // Check if passwords match - if (userPassword == checkPsswd) - { - return userPassword; - } - else - { - Console.WriteLine("Passwords do not match.\n"); - } - } - } - public string GetEmail() - { - Console.WriteLine("Please enter an email:"); - return Console.ReadLine(); - } - public string GetRole() - { - while (true) - { - // List of possible roles - List roles = new List {"Admin", "regular" }; - // Get role - Console.WriteLine("Please enter the role of the user:(Admin or regular)"); - string? userRole = Console.ReadLine(); - // Check if passwords match - if (roles.Contains(userRole)) - { - return userRole; - } - else - { - Console.WriteLine("Not an available role.\n"); - } - } - - - return Console.ReadLine(); - } - } - public class UserAccount - { - // Admin Credentials - private string _userName; - private string _password; - private DateTime _Time; - // New User Credentials - private string _Email; - private string _Role; - - public UserAccount(string un, string pwd, DateTime TimeStamp) - { - _userName = un; - _password = pwd; - _Role = "regular"; - _Email = "NULL"; - _Time = TimeStamp; - } - public UserAccount(string un, string pwd, string role) - { - if (String.IsNullOrEmpty(role)) - { - _Role = "regular"; - } - else { _Role = role; } - _userName = un; - _password = pwd; - _Email = "NULL"; - _Time = DateTime.UtcNow; - } - public UserAccount(string un, string role) - { - _userName = un; - _Role = role; - _Email = "NULL"; - _Time = DateTime.UtcNow; - } - public UserAccount(string un, string pwd, string Email, DateTime TimeStamp) - { - if (String.IsNullOrEmpty(Email)) - { - _Email = "NULL"; - } - else { _Email = Email; } - _userName = un; - _password = pwd; - _Role = "regular"; - _Time = TimeStamp; - } - public UserAccount(string newUN, string newPWD, string Email, string role, DateTime newTime) - { - if (String.IsNullOrEmpty(role)) - { - _Role = "regular"; - } - else { _Role = role; } - if (String.IsNullOrEmpty(Email)) - { - _Email = "NULL"; - } - else { _Email = Email; } - _userName = newUN; - _password = newPWD; - _Time = newTime; - } - public UserAccount() - { - _Role = "regular"; - _Email = "NULL"; - _Time = DateTime.Now; - } - - public string username { get { return _userName; } } - public string password { get { return _password; } } - public string email { get { return _Email; } } - public string role { get { return _Role; } } - public DateTime Time { get { return _Time; } } - } -} diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Archiving/Contracts/IRelationArchivable.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Archiving/Contracts/IRelationArchivable.cs index 96cabb9..3adb010 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Archiving/Contracts/IRelationArchivable.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Archiving/Contracts/IRelationArchivable.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace TeamHobby.HobbyProjectGenerator.Archive +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer { public interface IRelationArchivable { diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Archiving/Implementations/ArchiveManager.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Archiving/Implementations/ArchiveManager.cs index 874db08..af1477f 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Archiving/Implementations/ArchiveManager.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Archiving/Implementations/ArchiveManager.cs @@ -1,7 +1,7 @@  using TeamHobby.HobbyProjectGenerator.DataAccessLayer; -namespace TeamHobby.HobbyProjectGenerator.Archive +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer { public class ArchiveManager { diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Contracts/ILogger.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Contracts/ILogger.cs index 9aee5ba..61c3b2e 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Contracts/ILogger.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Contracts/ILogger.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace TeamHobby.HobbyProjectGenerator.Logging +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer { public interface ILogger { diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Contracts/ILoggerFactory.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Contracts/ILoggerFactory.cs index cf0d199..7adf72e 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Contracts/ILoggerFactory.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Contracts/ILoggerFactory.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace TeamHobby.HobbyProjectGenerator.Logging.Contracts +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer.Contracts { public interface ILoggerFactory { diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/ConsoleLogger.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/ConsoleLogger.cs index 19d2377..82df9b7 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/ConsoleLogger.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/ConsoleLogger.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace TeamHobby.HobbyProjectGenerator.Logging +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer { public class ConsoleLogger : ILogger { diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/DBLogger.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/DBLogger.cs index 132ee82..9764913 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/DBLogger.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/DBLogger.cs @@ -1,6 +1,6 @@ using System; -namespace TeamHobby.HobbyProjectGenerator.Logging +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer { public class DBLogger : ILogger { diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/DBLoggerFactory.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/DBLoggerFactory.cs index f790cbb..946075f 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/DBLoggerFactory.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/DBLoggerFactory.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using TeamHobby.HobbyProjectGenerator.Logging.Contracts; +using TeamHobby.HobbyProjectGenerator.ServiceLayer.Contracts; -namespace TeamHobby.HobbyProjectGenerator.Logging.Implementations +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer.Implementations { public class DBLoggerFactory : ILoggerFactory { diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/FileLogger.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/FileLogger.cs index 6c561b1..cb918f0 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/FileLogger.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/FileLogger.cs @@ -1,7 +1,7 @@ using System; -using TeamHobby.HobbyProjectGenerator.Logging.Contracts; +using TeamHobby.HobbyProjectGenerator.ServiceLayer.Contracts; -namespace TeamHobby.HobbyProjectGenerator.Logging +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer { public class FileLogger : ILogger { diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/InMemoryLogger.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/InMemoryLogger.cs index 10cbf74..8e82b5d 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/InMemoryLogger.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/InMemoryLogger.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; -namespace TeamHobby.HobbyProjectGenerator.Logging + +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer { // implementation of ILogger that stores logs as they initialize public class InMemoryLogger : ILogger diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/LogEntry.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/LogEntry.cs index 6fa0966..79e8a8c 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/LogEntry.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/LogEntry.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace TeamHobby.HobbyProjectGenerator.Logging +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer { public enum LogLevel { diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/LoggingManager.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/LoggingManager.cs index 2f45c93..d74aa53 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/LoggingManager.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/Logging/Implementations/LoggingManager.cs @@ -4,11 +4,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using TeamHobby.HobbyProjectGenerator.DataAccessLayer; -using TeamHobby.HobbyProjectGenerator.Logging.Contracts; -using TeamHobby.HobbyProjectGenerator.Logging.Implementations; +using TeamHobby.HobbyProjectGenerator.ServiceLayer.Contracts; +using TeamHobby.HobbyProjectGenerator.ServiceLayer.Implementations; -namespace TeamHobby.HobbyProjectGenerator.Logging +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer { internal class LoggingManager { diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/UserManagement/Implementations/AccountService.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/UserManagement/Implementations/AccountService.cs index 7802386..3093119 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/UserManagement/Implementations/AccountService.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/UserManagement/Implementations/AccountService.cs @@ -6,8 +6,8 @@ using System.Threading.Tasks; using System.Data.Odbc; using TeamHobby.HobbyProjectGenerator.DataAccessLayer; -namespace TeamHobby.HobbyProjectGenerator.UserManagement -{ +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer +{ public class AccountService { public bool CreateUserRecord(UserAccount newUser, string CreatedBy, IDataSource dbSource) diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/UserManagement/Implementations/SystemAccountManager.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/UserManagement/Implementations/SystemAccountManager.cs index ba4cedd..2d201da 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/UserManagement/Implementations/SystemAccountManager.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/UserManagement/Implementations/SystemAccountManager.cs @@ -4,10 +4,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data.Odbc; -using TeamHobby.HobbyProjectGenerator.UserManagement; using TeamHobby.HobbyProjectGenerator.DataAccessLayer; -namespace TeamHobby.HobbyProjectGenerator.UserManagement +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer { public class SystemAccountManager { diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/UserManagement/Implementations/UserAccount.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/UserManagement/Implementations/UserAccount.cs index e048653..6c566c8 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/UserManagement/Implementations/UserAccount.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.ServiceLayer/UserManagement/Implementations/UserAccount.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace TeamHobby.HobbyProjectGenerator.UserManagement +namespace TeamHobby.HobbyProjectGenerator.ServiceLayer { // Class for getting user credentials public class GetCredentials { diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.Tests/ArchivingXUnitTest.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.Tests/ArchivingXUnitTest.cs index e127066..ee87696 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.Tests/ArchivingXUnitTest.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.Tests/ArchivingXUnitTest.cs @@ -3,7 +3,7 @@ using System.Data.Odbc; using System.Diagnostics; using System.IO; using System.Threading; -using TeamHobby.HobbyProjectGenerator.Archive; +using TeamHobby.HobbyProjectGenerator.ServiceLayer; using TeamHobby.HobbyProjectGenerator.DataAccessLayer; using Xunit; using Xunit.Abstractions; diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.Tests/TeamHobby.HobbyProjectGenerator.Tests.csproj b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.Tests/TeamHobby.HobbyProjectGenerator.Tests.csproj index 9d6d852..ec61cac 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.Tests/TeamHobby.HobbyProjectGenerator.Tests.csproj +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.Tests/TeamHobby.HobbyProjectGenerator.Tests.csproj @@ -22,8 +22,6 @@ - - diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.Tests/UseerManagementTests.cs b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.Tests/UseerManagementTests.cs index 57d66da..fbddbe9 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.Tests/UseerManagementTests.cs +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.Tests/UseerManagementTests.cs @@ -2,7 +2,7 @@ using System; using Xunit; using Xunit.Abstractions; using System.Threading; -using TeamHobby.HobbyProjectGenerator.UserManagement; +using TeamHobby.HobbyProjectGenerator.ServiceLayer; using TeamHobby.HobbyProjectGenerator.DataAccessLayer; using System.IO; diff --git a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln index 2d732f1..f983ba9 100644 --- a/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln +++ b/Source Code/TeamHobby.HobbyProjectGenerator/TeamHobby.HobbyProjectGenerator.sln @@ -5,10 +5,6 @@ VisualStudioVersion = 17.0.31919.166 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.Main", "..\main\TeamHobby.HobbyProjectGenerator.Main.csproj", "{30C7EBF3-3957-46E5-86C1-C13356841ECA}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.Archive", "..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj", "{B88ED0D9-72E2-4245-BD8F-856FF42E500C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.UserManagement", "..\TeamHobby.HobbyProjectGenerator.UserManagement\TeamHobby.HobbyProjectGenerator.UserManagement.csproj", "{2E7193B8-86B6-48DA-9671-CD84615A5F5D}" -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 @@ -40,22 +36,6 @@ Global {30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|Any CPU.Build.0 = Release|Any CPU {30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|x86.ActiveCfg = Release|Any CPU {30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|x86.Build.0 = Release|Any CPU - {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Debug|x86.ActiveCfg = Debug|x86 - {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Debug|x86.Build.0 = Debug|x86 - {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|Any CPU.Build.0 = Release|Any CPU - {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|x86.ActiveCfg = Release|x86 - {B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|x86.Build.0 = Release|x86 - {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Debug|x86.ActiveCfg = Debug|Any CPU - {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Debug|x86.Build.0 = Debug|Any CPU - {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|Any CPU.Build.0 = Release|Any CPU - {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|x86.ActiveCfg = Release|Any CPU - {2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|x86.Build.0 = Release|Any CPU {2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}.Debug|Any CPU.Build.0 = Debug|Any CPU {2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}.Debug|x86.ActiveCfg = Debug|Any CPU diff --git a/Source Code/main/Controller.cs b/Source Code/main/Controller.cs index c1ca0d6..4450fc8 100644 --- a/Source Code/main/Controller.cs +++ b/Source Code/main/Controller.cs @@ -1,8 +1,7 @@ using System; using System.Data.Odbc; -using TeamHobby.HobbyProjectGenerator.Archive; +using TeamHobby.HobbyProjectGenerator.ServiceLayer; using TeamHobby.HobbyProjectGenerator.DataAccessLayer; -using TeamHobby.HobbyProjectGenerator.UserManagement; namespace TeamHobby.HobbyProjectGenerator.Main { diff --git a/Source Code/main/GenerateOpFile.cs b/Source Code/main/GenerateOpFile.cs index ec55c4b..0a613c5 100644 --- a/Source Code/main/GenerateOpFile.cs +++ b/Source Code/main/GenerateOpFile.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using TeamHobby.HobbyProjectGenerator.DataAccessLayer; -using TeamHobby.HobbyProjectGenerator.UserManagement; +using TeamHobby.HobbyProjectGenerator.ServiceLayer; namespace main { diff --git a/Source Code/main/TeamHobby.HobbyProjectGenerator.Main.csproj b/Source Code/main/TeamHobby.HobbyProjectGenerator.Main.csproj index a92a66b..dda8e41 100644 --- a/Source Code/main/TeamHobby.HobbyProjectGenerator.Main.csproj +++ b/Source Code/main/TeamHobby.HobbyProjectGenerator.Main.csproj @@ -14,9 +14,8 @@ - - +