Merge branch 'newMain'
This commit is contained in:
commit
3bf30af52f
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccess;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Archive
|
namespace TeamHobby.HobbyProjectGenerator.Archive
|
||||||
{
|
{
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccess\TeamHobby.HobbyProjectGenerator.DataAccess.csproj" />
|
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccessLayer\TeamHobby.HobbyProjectGenerator.DataAccessLayer.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.DataAccess
|
namespace TeamHobby.HobbyProjectGenerator.DataAccessLayer
|
||||||
{
|
{
|
||||||
public interface IDataSource<T>
|
public interface IDataSource<T>
|
||||||
{
|
{
|
||||||
@ -8,7 +8,7 @@ using System.Threading.Tasks;
|
|||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Data.Odbc;
|
using System.Data.Odbc;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.DataAccess
|
namespace TeamHobby.HobbyProjectGenerator.DataAccessLayer
|
||||||
{
|
{
|
||||||
public class SqlDAO : IDataSource<string>
|
public class SqlDAO : IDataSource<string>
|
||||||
{
|
{
|
||||||
@ -1,6 +1,6 @@
|
|||||||
// Print Statements used throughout the program.
|
// Print Statements used throughout the program.
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.DataAccess
|
namespace TeamHobby.HobbyProjectGenerator.DataAccessLayer
|
||||||
{
|
{
|
||||||
public class UiPrint
|
public class UiPrint
|
||||||
{
|
{
|
||||||
@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccess;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.DataAccess
|
namespace TeamHobby.HobbyProjectGenerator.DataAccessLayer
|
||||||
{
|
{
|
||||||
public class RDSFactory
|
public class RDSFactory
|
||||||
{
|
{
|
||||||
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccess;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
using TeamHobby.HobbyProjectGenerator.Logging.Contracts;
|
using TeamHobby.HobbyProjectGenerator.Logging.Contracts;
|
||||||
using TeamHobby.HobbyProjectGenerator.Logging.Implementations;
|
using TeamHobby.HobbyProjectGenerator.Logging.Implementations;
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj" />
|
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj" />
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccess\TeamHobby.HobbyProjectGenerator.DataAccess.csproj" />
|
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccessLayer\TeamHobby.HobbyProjectGenerator.DataAccessLayer.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Data.Odbc;
|
using System.Data.Odbc;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccess;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.UserManagement
|
namespace TeamHobby.HobbyProjectGenerator.UserManagement
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Data.Odbc;
|
using System.Data.Odbc;
|
||||||
using TeamHobby.HobbyProjectGenerator.UserManagement;
|
using TeamHobby.HobbyProjectGenerator.UserManagement;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccess;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.UserManagement
|
namespace TeamHobby.HobbyProjectGenerator.UserManagement
|
||||||
{
|
{
|
||||||
|
|||||||
@ -8,8 +8,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj" />
|
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj" />
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccess\TeamHobby.HobbyProjectGenerator.DataAccess.csproj" />
|
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccessLayer\TeamHobby.HobbyProjectGenerator.DataAccessLayer.csproj" />
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Logging\TeamHobby.HobbyProjectGenerator.Logging.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -0,0 +1,13 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,170 @@
|
|||||||
|
|
||||||
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
|
|
||||||
|
namespace TeamHobby.HobbyProjectGenerator.Archive
|
||||||
|
{
|
||||||
|
public class ArchiveManager
|
||||||
|
{
|
||||||
|
private IDataSource<string> _conn;
|
||||||
|
|
||||||
|
// Constructor to take in the connection.
|
||||||
|
public ArchiveManager(IDataSource<string> dataSource) {
|
||||||
|
_conn = dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
//public IDataSource<string> 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"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
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<string> GetAllLogs();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace TeamHobby.HobbyProjectGenerator.Logging
|
||||||
|
{
|
||||||
|
public class DBLogger : ILogger
|
||||||
|
{
|
||||||
|
public DBLogger()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public IList<string> GetAllLogs()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Log(LogEntry log)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using TeamHobby.HobbyProjectGenerator.Logging.Contracts;
|
||||||
|
|
||||||
|
namespace TeamHobby.HobbyProjectGenerator.Logging
|
||||||
|
{
|
||||||
|
public class FileLogger : ILogger
|
||||||
|
{
|
||||||
|
public FileLogger()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public IList<string> GetAllLogs()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Log(LogEntry log)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
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<string> _logStore;
|
||||||
|
|
||||||
|
public InMemoryLogger()
|
||||||
|
{
|
||||||
|
// list of current logs
|
||||||
|
_logStore = new List<string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public InMemoryLogger(IList<string> 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<string> GetAllLogs()
|
||||||
|
{
|
||||||
|
return _logStore;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override bool Equals(object? obj)
|
||||||
|
{
|
||||||
|
return obj is InMemoryLogger logger &&
|
||||||
|
EqualityComparer<IList<string>>.Default.Equals(_logStore, logger._logStore);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(_logStore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
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<string> _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<string> dataSource)
|
||||||
|
{
|
||||||
|
_conn = dataSource;
|
||||||
|
_factory = new DBLoggerFactory();
|
||||||
|
_logger = _factory.CreateLogger();
|
||||||
|
}
|
||||||
|
// second constructor takes an additional ILoggerFactory arg - allows for extensible logger types
|
||||||
|
public LoggingManager(IDataSource<string> dataSource, ILoggerFactory factory)
|
||||||
|
{
|
||||||
|
_conn = dataSource;
|
||||||
|
_factory = factory;
|
||||||
|
_logger = _factory.CreateLogger();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Process()
|
||||||
|
{
|
||||||
|
_logger.Log(_logEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="UserManagement\Contracts\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\TeamHobby.HobbyProjectGenerator.DataAccessLayer\TeamHobby.HobbyProjectGenerator.DataAccessLayer.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -0,0 +1,301 @@
|
|||||||
|
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<string> 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<string> 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<string> 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<string> 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<string> 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<string> 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<string> ops = new List<string> {"Create Account", "Edit Account",
|
||||||
|
"Delete Account", "Disable Account", "Enable Account"};
|
||||||
|
|
||||||
|
// List to hold file operation and credentials
|
||||||
|
List<string> fileList = new List<string>();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,367 @@
|
|||||||
|
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<string> 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<string> 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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,150 @@
|
|||||||
|
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<string> roles = new List<string> {"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; } }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,7 +4,7 @@ using System.Diagnostics;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using TeamHobby.HobbyProjectGenerator.Archive;
|
using TeamHobby.HobbyProjectGenerator.Archive;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccess;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
|
|||||||
@ -23,8 +23,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\main\TeamHobby.HobbyProjectGenerator.Main.csproj" />
|
<ProjectReference Include="..\..\main\TeamHobby.HobbyProjectGenerator.Main.csproj" />
|
||||||
<ProjectReference Include="..\..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj" />
|
<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.UserManagement\TeamHobby.HobbyProjectGenerator.UserManagement.csproj" />
|
<ProjectReference Include="..\..\TeamHobby.HobbyProjectGenerator.UserManagement\TeamHobby.HobbyProjectGenerator.UserManagement.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ using Xunit;
|
|||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using TeamHobby.HobbyProjectGenerator.UserManagement;
|
using TeamHobby.HobbyProjectGenerator.UserManagement;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccess;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace TeamHobby.UserManagement.xTests
|
namespace TeamHobby.UserManagement.xTests
|
||||||
|
|||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace TeamHobby.HobbyProjectGenerator.View
|
||||||
|
{
|
||||||
|
public class Class1
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace TeamHobby.HobbyProjectGenerator.ViewModel
|
||||||
|
{
|
||||||
|
public class Class1
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGener
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.Archive", "..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj", "{B88ED0D9-72E2-4245-BD8F-856FF42E500C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.Archive", "..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj", "{B88ED0D9-72E2-4245-BD8F-856FF42E500C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.DataAccess", "..\TeamHobby.HobbyProjectGenerator.DataAccess\TeamHobby.HobbyProjectGenerator.DataAccess.csproj", "{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.UserManagement", "..\TeamHobby.HobbyProjectGenerator.UserManagement\TeamHobby.HobbyProjectGenerator.UserManagement.csproj", "{2E7193B8-86B6-48DA-9671-CD84615A5F5D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.UserManagement", "..\TeamHobby.HobbyProjectGenerator.UserManagement\TeamHobby.HobbyProjectGenerator.UserManagement.csproj", "{2E7193B8-86B6-48DA-9671-CD84615A5F5D}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D29D9225-3748-4067-AF07-E677A525EF39}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D29D9225-3748-4067-AF07-E677A525EF39}"
|
||||||
@ -16,9 +14,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||||||
TeamHobby.HobbyProjectGenerator.csproj = TeamHobby.HobbyProjectGenerator.csproj
|
TeamHobby.HobbyProjectGenerator.csproj = TeamHobby.HobbyProjectGenerator.csproj
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.Logging", "..\TeamHobby.HobbyProjectGenerator.Logging\TeamHobby.HobbyProjectGenerator.Logging.csproj", "{CA539CBE-A043-4ED8-9E1F-3E949F0A482D}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.Tests", "TeamHobby.HobbyProjectGenerator.Tests\TeamHobby.HobbyProjectGenerator.Tests.csproj", "{2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamHobby.HobbyProjectGenerator.Tests", "TeamHobby.HobbyProjectGenerator.Tests\TeamHobby.HobbyProjectGenerator.Tests.csproj", "{2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.ServiceLayer", "TeamHobby.HobbyProjectGenerator.ServiceLayer\TeamHobby.HobbyProjectGenerator.ServiceLayer.csproj", "{EF90CC6C-0C44-4E39-AAB6-96F9F34F0784}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.DataAccessLayer", "..\TeamHobby.HobbyProjectGenerator.DataAccessLayer\TeamHobby.HobbyProjectGenerator.DataAccessLayer.csproj", "{6DBAC411-AC0E-4129-AE57-C8D1DA1DF9B2}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamHobby.HobbyProjectGenerator.ViewModel", "TeamHobby.HobbyProjectGenerator.ViewModel\TeamHobby.HobbyProjectGenerator.ViewModel.csproj", "{092F7372-3CBA-49A2-A7A8-EC3FF97E3082}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamHobby.HobbyProjectGenerator.View", "TeamHobby.HobbyProjectGenerator.View\TeamHobby.HobbyProjectGenerator.View.csproj", "{2E401E9D-731B-425D-B0BD-FF1E72D5D23C}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -44,14 +48,6 @@ Global
|
|||||||
{B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|Any CPU.Build.0 = 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.ActiveCfg = Release|x86
|
||||||
{B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|x86.Build.0 = Release|x86
|
{B88ED0D9-72E2-4245-BD8F-856FF42E500C}.Release|x86.Build.0 = Release|x86
|
||||||
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{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|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.ActiveCfg = Debug|Any CPU
|
||||||
@ -60,14 +56,6 @@ Global
|
|||||||
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|Any CPU.Build.0 = 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.ActiveCfg = Release|Any CPU
|
||||||
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|x86.Build.0 = Release|Any CPU
|
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{CA539CBE-A043-4ED8-9E1F-3E949F0A482D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{CA539CBE-A043-4ED8-9E1F-3E949F0A482D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{CA539CBE-A043-4ED8-9E1F-3E949F0A482D}.Debug|x86.ActiveCfg = Debug|x86
|
|
||||||
{CA539CBE-A043-4ED8-9E1F-3E949F0A482D}.Debug|x86.Build.0 = Debug|x86
|
|
||||||
{CA539CBE-A043-4ED8-9E1F-3E949F0A482D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{CA539CBE-A043-4ED8-9E1F-3E949F0A482D}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{CA539CBE-A043-4ED8-9E1F-3E949F0A482D}.Release|x86.ActiveCfg = Release|x86
|
|
||||||
{CA539CBE-A043-4ED8-9E1F-3E949F0A482D}.Release|x86.Build.0 = Release|x86
|
|
||||||
{2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}.Debug|Any CPU.ActiveCfg = Debug|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|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}.Debug|x86.ActiveCfg = Debug|Any CPU
|
{2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
@ -76,6 +64,38 @@ Global
|
|||||||
{2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}.Release|x86.ActiveCfg = Release|Any CPU
|
{2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}.Release|x86.Build.0 = Release|Any CPU
|
{2E9DC0A0-D9A1-40A5-9684-ECC8EDCD8DAD}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{EF90CC6C-0C44-4E39-AAB6-96F9F34F0784}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{EF90CC6C-0C44-4E39-AAB6-96F9F34F0784}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{EF90CC6C-0C44-4E39-AAB6-96F9F34F0784}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{EF90CC6C-0C44-4E39-AAB6-96F9F34F0784}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{EF90CC6C-0C44-4E39-AAB6-96F9F34F0784}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{EF90CC6C-0C44-4E39-AAB6-96F9F34F0784}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{EF90CC6C-0C44-4E39-AAB6-96F9F34F0784}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{EF90CC6C-0C44-4E39-AAB6-96F9F34F0784}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{6DBAC411-AC0E-4129-AE57-C8D1DA1DF9B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{6DBAC411-AC0E-4129-AE57-C8D1DA1DF9B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{6DBAC411-AC0E-4129-AE57-C8D1DA1DF9B2}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{6DBAC411-AC0E-4129-AE57-C8D1DA1DF9B2}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{6DBAC411-AC0E-4129-AE57-C8D1DA1DF9B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{6DBAC411-AC0E-4129-AE57-C8D1DA1DF9B2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{6DBAC411-AC0E-4129-AE57-C8D1DA1DF9B2}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{6DBAC411-AC0E-4129-AE57-C8D1DA1DF9B2}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{092F7372-3CBA-49A2-A7A8-EC3FF97E3082}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{092F7372-3CBA-49A2-A7A8-EC3FF97E3082}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{092F7372-3CBA-49A2-A7A8-EC3FF97E3082}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{092F7372-3CBA-49A2-A7A8-EC3FF97E3082}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{092F7372-3CBA-49A2-A7A8-EC3FF97E3082}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{092F7372-3CBA-49A2-A7A8-EC3FF97E3082}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{092F7372-3CBA-49A2-A7A8-EC3FF97E3082}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{092F7372-3CBA-49A2-A7A8-EC3FF97E3082}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{2E401E9D-731B-425D-B0BD-FF1E72D5D23C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{2E401E9D-731B-425D-B0BD-FF1E72D5D23C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{2E401E9D-731B-425D-B0BD-FF1E72D5D23C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{2E401E9D-731B-425D-B0BD-FF1E72D5D23C}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{2E401E9D-731B-425D-B0BD-FF1E72D5D23C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{2E401E9D-731B-425D-B0BD-FF1E72D5D23C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{2E401E9D-731B-425D-B0BD-FF1E72D5D23C}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{2E401E9D-731B-425D-B0BD-FF1E72D5D23C}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Data.Odbc;
|
using System.Data.Odbc;
|
||||||
using TeamHobby.HobbyProjectGenerator.Archive;
|
using TeamHobby.HobbyProjectGenerator.Archive;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccess;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
using TeamHobby.HobbyProjectGenerator.UserManagement;
|
using TeamHobby.HobbyProjectGenerator.UserManagement;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Main
|
namespace TeamHobby.HobbyProjectGenerator.Main
|
||||||
|
|||||||
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccess;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
using TeamHobby.HobbyProjectGenerator.UserManagement;
|
using TeamHobby.HobbyProjectGenerator.UserManagement;
|
||||||
|
|
||||||
namespace main
|
namespace main
|
||||||
|
|||||||
@ -15,8 +15,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj" />
|
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj" />
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccess\TeamHobby.HobbyProjectGenerator.DataAccess.csproj" />
|
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccessLayer\TeamHobby.HobbyProjectGenerator.DataAccessLayer.csproj" />
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Logging\TeamHobby.HobbyProjectGenerator.Logging.csproj" />
|
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.UserManagement\TeamHobby.HobbyProjectGenerator.UserManagement.csproj" />
|
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.UserManagement\TeamHobby.HobbyProjectGenerator.UserManagement.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user