Почистил проект

This commit is contained in:
Никита Потапов 2024-05-07 23:11:55 +04:00
parent 8e16f7ad6c
commit 7b57d9defd
11 changed files with 0 additions and 214 deletions

View File

@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="BindingModels\" />
<Folder Include="SearchModels\" />
<Folder Include="ViewModels\" />
<Folder Include="StoragesContracts\" />
<Folder Include="BusinessLogicsContracts\" />
</ItemGroup>
</Project>

View File

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MedicalDataModels
{
internal interface IId
{
}
}

View File

@ -1,13 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="Models\" />
</ItemGroup>
</Project>

View File

@ -1,9 +0,0 @@
using Npgsql;
namespace MedicalDatabaseContracts
{
public interface IModel<T>
{
T CreateFromDataReader(NpgsqlDataReader reader);
}
}

View File

@ -1,11 +0,0 @@
namespace MedicalDatabaseContracts
{
public interface IStorage<T>
{
T Get(long id);
List<T> GetAll();
T Create(T entity);
T Update(long id, T entity);
T Delete(long id);
}
}

View File

@ -1,13 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Npgsql" Version="8.0.2" />
</ItemGroup>
</Project>

View File

@ -1,19 +0,0 @@
using Npgsql;
namespace MedicalDatabaseContracts.Models
{
public class DiagnoseModel : IModel<DiagnoseModel>
{
public long? DiagnoseId { get; set; }
public string Name { get; set;} = string.Empty;
public static DiagnoseModel CreateFromDataReader(NpgsqlDataReader reader)
{
return new DiagnoseModel
{
DiagnoseId = Convert.ToInt32(reader["diagnose_id"]),
Name = Convert.ToString(reader["name"])
};
}
}
}

View File

@ -1,42 +0,0 @@
using MedicalDatabaseContracts;
using MedicalDatabaseContracts.Models;
using Npgsql;
namespace MedicalPostgresDatabase
{
public class DiagnosesStorage : IStorage<DiagnoseModel>
{
private MedicalDatabaseSingleton _database;
public DiagnosesStorage()
{
_database = MedicalDatabaseSingleton.GetInstance();
}
public DiagnoseModel Create(DiagnoseModel entity)
{
throw new NotImplementedException();
}
public DiagnoseModel Delete(long id)
{
throw new NotImplementedException();
}
public DiagnoseModel Get(long id)
{
using var cmd = new NpgsqlCommand();
cmd.Connection = dbconnection;
cmd.CommandText = "";
}
public List<DiagnoseModel> GetAll()
{
throw new NotImplementedException();
}
public DiagnoseModel Update(long id, DiagnoseModel entity)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,47 +0,0 @@
using MedicalDatabaseContracts;
using Npgsql;
namespace MedicalPostgresDatabase
{
public class MedicalDatabaseSingleton
{
private static MedicalDatabaseSingleton? instance;
private NpgsqlConnection _connection;
public static MedicalDatabaseSingleton GetInstance()
{
if (instance == null)
{
instance = new MedicalDatabaseSingleton();
}
return instance;
}
private MedicalDatabaseSingleton()
{
_connection = new NpgsqlConnection(
connectionString: "Server=localhost;Port=5555;User Id=postgres;Password=postgres;Database=medicalbase;"
);
_connection.Open();
}
public List<T> ExecuteQuerySelect<T>(string query) where T : IModel
{
using var command = new NpgsqlCommand();
command.Connection = _connection;
command.CommandText = query;
NpgsqlDataReader reader = command.ExecuteReader();
var list = new List<T>();
while (reader.Read())
{
list.Add(T.CreateFromDataReader());
}
}
public int ExecuteQuery(string query)
{
using var command = new NpgsqlCommand();
command.Connection = _connection;
command.CommandText = query;
return command.ExecuteNonQuery();
}
}
}

View File

@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Npgsql" Version="8.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MedicalDatabaseContracts\MedicalDatabaseContracts.csproj" />
</ItemGroup>
</Project>

View File

@ -1,14 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="Implements\" />
<Folder Include="Models\" />
</ItemGroup>
</Project>