Created Logging Library
This commit is contained in:
parent
5e24218d94
commit
121dace628
2
.gitignore
vendored
2
.gitignore
vendored
@ -423,3 +423,5 @@ healthchecksdb
|
|||||||
|
|
||||||
.vscode/launch.json
|
.vscode/launch.json
|
||||||
.vscode/tasks.json
|
.vscode/tasks.json
|
||||||
|
Source Code/.vscode/tasks.json
|
||||||
|
Source Code/.vscode/launch.json
|
||||||
|
|||||||
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
namespace TeamHobby.HobbyProjectGenerator.Logging
|
||||||
|
{
|
||||||
|
public class Logger
|
||||||
|
{
|
||||||
|
public static void PrintTest()
|
||||||
|
{
|
||||||
|
Console.WriteLine("testing");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -15,7 +15,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGener
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.Main", "..\TeamHobby.Main\TeamHobby.Main.csproj", "{ED126EFB-B337-42F9-BE4B-65A5AE90503B}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.Main", "..\TeamHobby.Main\TeamHobby.Main.csproj", "{ED126EFB-B337-42F9-BE4B-65A5AE90503B}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamHobby.HobbyProjectGenerator.DataAccess", "..\TeamHobby.HobbyProjectGenerator.DataAccess\TeamHobby.HobbyProjectGenerator.DataAccess.csproj", "{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TeamHobby.HobbyProjectGenerator.DataAccess", "..\TeamHobby.HobbyProjectGenerator.DataAccess\TeamHobby.HobbyProjectGenerator.DataAccess.csproj", "{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamHobby.HobbyProjectGenerator.Logging", "..\TeamHobby.HobbyProjectGenerator.Logging\TeamHobby.HobbyProjectGenerator.Logging.csproj", "{C0494115-838E-43A3-8896-133E5D1E874A}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -48,6 +50,10 @@ Global
|
|||||||
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Debug|Any CPU.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.ActiveCfg = Release|Any CPU
|
||||||
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|Any CPU.Build.0 = Release|Any CPU
|
{AA48A66C-FA36-4AF9-A782-CEC22838EB8F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{C0494115-838E-43A3-8896-133E5D1E874A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C0494115-838E-43A3-8896-133E5D1E874A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C0494115-838E-43A3-8896-133E5D1E874A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C0494115-838E-43A3-8896-133E5D1E874A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Data.Odbc;
|
using System.Data.Odbc;
|
||||||
using TeamHobby.HobbyProjectGenerator.DataAccess;
|
using TeamHobby.HobbyProjectGenerator.DataAccess;
|
||||||
|
using TeamHobby.HobbyProjectGenerator.Logging;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Main
|
namespace TeamHobby.HobbyProjectGenerator.Main
|
||||||
{
|
{
|
||||||
@ -26,6 +26,8 @@ namespace TeamHobby.HobbyProjectGenerator.Main
|
|||||||
|
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
// Logger log = new Logger();
|
||||||
|
Logger.PrintTest();
|
||||||
//GetCredentials credentials = new GetCredentials();
|
//GetCredentials credentials = new GetCredentials();
|
||||||
//string? username = credentials.GetUserName();
|
//string? username = credentials.GetUserName();
|
||||||
//string? password = credentials.GetPassword();
|
//string? password = credentials.GetPassword();
|
||||||
@ -34,38 +36,38 @@ namespace TeamHobby.HobbyProjectGenerator.Main
|
|||||||
//Console.WriteLine(value: $"username is {username}\npassword is {password}");
|
//Console.WriteLine(value: $"username is {username}\npassword is {password}");
|
||||||
|
|
||||||
// Creating the Factory class
|
// Creating the Factory class
|
||||||
string dbType = "sql";
|
//string dbType = "sql";
|
||||||
RelationalDataSourceFactory dbFactory = new RelationalDataSourceFactory();
|
//RelationalDataSourceFactory dbFactory = new RelationalDataSourceFactory();
|
||||||
|
|
||||||
// Testing Data Access Layer
|
//// Testing Data Access Layer
|
||||||
string dbInfo = "DRIVER={MariaDB ODBC 3.1 Driver};" +
|
//string dbInfo = "DRIVER={MariaDB ODBC 3.1 Driver};" +
|
||||||
"SERVER=localhost;" +
|
// "SERVER=localhost;" +
|
||||||
"DATABASE=hobby;" +
|
// "DATABASE=hobby;" +
|
||||||
"UID=root;" +
|
// "UID=root;" +
|
||||||
"PASSWORD=Teamhobby;" +
|
// "PASSWORD=Teamhobby;" +
|
||||||
"OPTION=3";
|
// "OPTION=3";
|
||||||
IDataSource<string> datasource = dbFactory.getDataSource(dbType,dbInfo);
|
//IDataSource<string> datasource = dbFactory.getDataSource(dbType,dbInfo);
|
||||||
|
|
||||||
string sqlQuery = "Select * from log;";
|
//string sqlQuery = "Select * from log;";
|
||||||
Object result = datasource.ReadData(sqlQuery);
|
//Object result = datasource.ReadData(sqlQuery);
|
||||||
Console.WriteLine("type of Result: " + result.GetType());
|
//Console.WriteLine("type of Result: " + result.GetType());
|
||||||
OdbcDataReader reader = null;
|
//OdbcDataReader reader = null;
|
||||||
|
|
||||||
if (result.GetType() == typeof(OdbcDataReader))
|
//if (result.GetType() == typeof(OdbcDataReader))
|
||||||
{
|
//{
|
||||||
reader = (OdbcDataReader)result;
|
// reader = (OdbcDataReader)result;
|
||||||
|
|
||||||
}
|
//}
|
||||||
|
|
||||||
Console.WriteLine("Reading from the database");
|
//Console.WriteLine("Reading from the database");
|
||||||
while (reader.Read())
|
//while (reader.Read())
|
||||||
{
|
//{
|
||||||
Console.WriteLine("Date={0} {1} {2} {3} {4} {5}", reader[0], reader[1], reader[2], reader[3], reader[4], reader[5]);
|
// Console.WriteLine("Date={0} {1} {2} {3} {4} {5}", reader[0], reader[1], reader[2], reader[3], reader[4], reader[5]);
|
||||||
}
|
//}
|
||||||
SqlDAO sqlDS = (SqlDAO)datasource;
|
//SqlDAO sqlDS = (SqlDAO)datasource;
|
||||||
|
|
||||||
// Closing the connection
|
//// Closing the connection
|
||||||
sqlDS.getConnection().Close();
|
//sqlDS.getConnection().Close();
|
||||||
|
|
||||||
// 2.Inserting Data into the database:
|
// 2.Inserting Data into the database:
|
||||||
//string sqlWrite = "INSERT into log(lvname, catname, userop, logmessage) values " +
|
//string sqlWrite = "INSERT into log(lvname, catname, userop, logmessage) values " +
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccess\TeamHobby.HobbyProjectGenerator.DataAccess.csproj" />
|
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.DataAccess\TeamHobby.HobbyProjectGenerator.DataAccess.csproj" />
|
||||||
|
<ProjectReference Include="..\TeamHobby.HobbyProjectGenerator.Logging\TeamHobby.HobbyProjectGenerator.Logging.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user