Merge branch 'newMain'
This commit is contained in:
commit
27c322d759
@ -1,170 +0,0 @@
|
|||||||
|
|
||||||
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"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<Platforms>AnyCPU;x86</Platforms>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.0.0" />
|
|
||||||
<PackageReference Include="MySql.Data" Version="8.0.27" />
|
|
||||||
<PackageReference Include="System.Data.Odbc" Version="6.0.0" />
|
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Implementations\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccess\TeamHobby.HobbyProjectGenerator.DataAccess.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<Platforms>AnyCPU;x86</Platforms>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.0.0" />
|
|
||||||
<PackageReference Include="MySql.Data" Version="8.0.27" />
|
|
||||||
<PackageReference Include="System.Data.Odbc" Version="6.0.0" />
|
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Implementations\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccessLayer\TeamHobby.HobbyProjectGenerator.DataAccessLayer.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -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<string> GetAllLogs();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -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<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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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<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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<OutputType>Library</OutputType>
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<Platforms>AnyCPU;x86</Platforms>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
|
||||||
<Optimize>True</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
|
|
||||||
<Optimize>True</Optimize>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
<Platforms>AnyCPU;x86</Platforms>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj" />
|
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccessLayer\TeamHobby.HobbyProjectGenerator.DataAccessLayer.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -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<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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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<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";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj" />
|
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccessLayer\TeamHobby.HobbyProjectGenerator.DataAccessLayer.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@ -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<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.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Archive
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer
|
||||||
{
|
{
|
||||||
public interface IRelationArchivable
|
public interface IRelationArchivable
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Archive
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer
|
||||||
{
|
{
|
||||||
public class ArchiveManager
|
public class ArchiveManager
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Logging
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer
|
||||||
{
|
{
|
||||||
public interface ILogger
|
public interface ILogger
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Logging.Contracts
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer.Contracts
|
||||||
{
|
{
|
||||||
public interface ILoggerFactory
|
public interface ILoggerFactory
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Logging
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer
|
||||||
{
|
{
|
||||||
public class ConsoleLogger : ILogger
|
public class ConsoleLogger : ILogger
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Logging
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer
|
||||||
{
|
{
|
||||||
public class DBLogger : ILogger
|
public class DBLogger : ILogger
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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.Logging.Contracts;
|
using TeamHobby.HobbyProjectGenerator.ServiceLayer.Contracts;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Logging.Implementations
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer.Implementations
|
||||||
{
|
{
|
||||||
public class DBLoggerFactory : ILoggerFactory
|
public class DBLoggerFactory : ILoggerFactory
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using TeamHobby.HobbyProjectGenerator.Logging.Contracts;
|
using TeamHobby.HobbyProjectGenerator.ServiceLayer.Contracts;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Logging
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer
|
||||||
{
|
{
|
||||||
public class FileLogger : ILogger
|
public class FileLogger : ILogger
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Logging
|
|
||||||
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer
|
||||||
{
|
{
|
||||||
// implementation of ILogger that stores logs as they initialize
|
// implementation of ILogger that stores logs as they initialize
|
||||||
public class InMemoryLogger : ILogger
|
public class InMemoryLogger : ILogger
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Logging
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer
|
||||||
{
|
{
|
||||||
public enum LogLevel
|
public enum LogLevel
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,11 +4,11 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
using TeamHobby.HobbyProjectGenerator.Logging.Contracts;
|
using TeamHobby.HobbyProjectGenerator.ServiceLayer.Contracts;
|
||||||
using TeamHobby.HobbyProjectGenerator.Logging.Implementations;
|
using TeamHobby.HobbyProjectGenerator.ServiceLayer.Implementations;
|
||||||
|
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Logging
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer
|
||||||
{
|
{
|
||||||
internal class LoggingManager
|
internal class LoggingManager
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Data.Odbc;
|
using System.Data.Odbc;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.UserManagement
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer
|
||||||
{
|
{
|
||||||
public class AccountService
|
public class AccountService
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,10 +4,9 @@ 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.UserManagement;
|
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.UserManagement
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer
|
||||||
{
|
{
|
||||||
public class SystemAccountManager
|
public class SystemAccountManager
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.UserManagement
|
namespace TeamHobby.HobbyProjectGenerator.ServiceLayer
|
||||||
{ // Class for getting user credentials
|
{ // Class for getting user credentials
|
||||||
public class GetCredentials
|
public class GetCredentials
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@ using System.Data.Odbc;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using TeamHobby.HobbyProjectGenerator.Archive;
|
using TeamHobby.HobbyProjectGenerator.ServiceLayer;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|||||||
@ -22,8 +22,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.UserManagement\TeamHobby.HobbyProjectGenerator.UserManagement.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -2,7 +2,7 @@ using System;
|
|||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using TeamHobby.HobbyProjectGenerator.UserManagement;
|
using TeamHobby.HobbyProjectGenerator.ServiceLayer;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,6 @@ VisualStudioVersion = 17.0.31919.166
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.Main", "..\main\TeamHobby.HobbyProjectGenerator.Main.csproj", "{30C7EBF3-3957-46E5-86C1-C13356841ECA}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.Main", "..\main\TeamHobby.HobbyProjectGenerator.Main.csproj", "{30C7EBF3-3957-46E5-86C1-C13356841ECA}"
|
||||||
EndProject
|
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}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D29D9225-3748-4067-AF07-E677A525EF39}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
TeamHobby.HobbyProjectGenerator.csproj = TeamHobby.HobbyProjectGenerator.csproj
|
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|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.ActiveCfg = Release|Any CPU
|
||||||
{30C7EBF3-3957-46E5-86C1-C13356841ECA}.Release|x86.Build.0 = 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.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
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Data.Odbc;
|
using System.Data.Odbc;
|
||||||
using TeamHobby.HobbyProjectGenerator.Archive;
|
using TeamHobby.HobbyProjectGenerator.ServiceLayer;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
using TeamHobby.HobbyProjectGenerator.UserManagement;
|
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Main
|
namespace TeamHobby.HobbyProjectGenerator.Main
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
using TeamHobby.HobbyProjectGenerator.DataAccessLayer;
|
||||||
using TeamHobby.HobbyProjectGenerator.UserManagement;
|
using TeamHobby.HobbyProjectGenerator.ServiceLayer;
|
||||||
|
|
||||||
namespace main
|
namespace main
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,9 +14,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Archive\TeamHobby.HobbyProjectGenerator.Archive.csproj" />
|
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccessLayer\TeamHobby.HobbyProjectGenerator.DataAccessLayer.csproj" />
|
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccessLayer\TeamHobby.HobbyProjectGenerator.DataAccessLayer.csproj" />
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.UserManagement\TeamHobby.HobbyProjectGenerator.UserManagement.csproj" />
|
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator\TeamHobby.HobbyProjectGenerator.ServiceLayer\TeamHobby.HobbyProjectGenerator.ServiceLayer.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user