Rearranged items and removed dummy DAO
This commit is contained in:
parent
698aa45318
commit
8999a71a97
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace TeamHobby.HobbyProjectGenerator.UserManagement
|
||||||
|
{
|
||||||
|
internal class AccountService
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator
|
|
||||||
{
|
|
||||||
public interface IUserService
|
|
||||||
{
|
|
||||||
// Public methods shouldn't be void so it can be tested
|
|
||||||
bool User(string username);
|
|
||||||
IList<string> GetAllUsers();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -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.UserManagement", "..\TeamHobby.HobbyProjectGenerator.UserManagement\TeamHobby.HobbyProjectGenerator.UserManagement.csproj", "{2E7193B8-86B6-48DA-9671-CD84615A5F5D}"
|
||||||
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
|
||||||
|
{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}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{2E7193B8-86B6-48DA-9671-CD84615A5F5D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@ -26,14 +26,14 @@ namespace TeamHobby.HobbyProjectGenerator.Main
|
|||||||
|
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
//GetCredentials credentials = new GetCredentials();
|
GetCredentials credentials = new GetCredentials();
|
||||||
//string? username = credentials.GetUserName();
|
string? username = credentials.GetUserName();
|
||||||
//string? password = credentials.GetPassword();
|
string? password = credentials.GetPassword();
|
||||||
|
|
||||||
|
|
||||||
//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();
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ namespace TeamHobby.HobbyProjectGenerator.Main
|
|||||||
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 " +
|
||||||
|
|||||||
@ -1,23 +1,22 @@
|
|||||||
using Microsoft.Data.SqlClient;
|
using Microsoft.Data.SqlClient;
|
||||||
|
using TeamHobby.HobbyProjectGenerator.Models;
|
||||||
|
|
||||||
namespace TeamHobby.HobbyProjectGenerator.Main
|
namespace TeamHobby.HobbyProjectGenerator.DAL
|
||||||
{
|
{
|
||||||
public class ExampleDAO
|
public class SqlDAO
|
||||||
{
|
{
|
||||||
|
public IList<Credentials> GetUserData(string username)
|
||||||
public void UserData(string username)
|
|
||||||
{
|
{
|
||||||
// Sql server connection string, needs to be changed accordingly to connect
|
// Sql server connection string, needs to be changed accordingly to connect
|
||||||
var connString = "server=localhost,3316;user=root;database=users;password=Plop20"; // Using @" " makes the string literal
|
var connString = "server=localhost;userid=root;password=Plop20;database=users"; // Using @" " makes the string literal
|
||||||
|
|
||||||
// ADO.NET - ODBC
|
// ADO.NET - ODBC
|
||||||
using var conn = new SqlConnection(connString);
|
using (var conn = new SqlConnection(connString))
|
||||||
{
|
{
|
||||||
// More complex sql commands are done in this method instead
|
// More complex sql commands are done in this method instead
|
||||||
var sql = "Select * from roles";
|
var sql = "Select * from roles";
|
||||||
using (var command = new SqlCommand(sql, conn))
|
using (var command = new SqlCommand(sql, conn))
|
||||||
{
|
{
|
||||||
conn.Open();
|
|
||||||
// Get the results from the query
|
// Get the results from the query
|
||||||
SqlDataReader r = command.ExecuteReader();
|
SqlDataReader r = command.ExecuteReader();
|
||||||
|
|
||||||
@ -33,18 +32,18 @@ namespace TeamHobby.HobbyProjectGenerator.Main
|
|||||||
{
|
{
|
||||||
Console.WriteLine(r.ToString());
|
Console.WriteLine(r.ToString());
|
||||||
}
|
}
|
||||||
conn.Close();
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
// Console.Read();
|
|
||||||
/*
|
/*// this is meant for specific basic sql commands
|
||||||
* this is meant for specific basic sql commands
|
using (var adapter = new SqlDataAdapter())
|
||||||
using (var adapter = new SqlDataAdapter())
|
{
|
||||||
{
|
adapter.UpdateCommand
|
||||||
adapter.SelectCommand
|
adapter.DeleteCommand
|
||||||
}
|
adapter.InsertCommand
|
||||||
*/
|
adapter.SelectCommand
|
||||||
//return null;
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user