Создание DataModels и Contracts.

This commit is contained in:
Anastasia 2023-04-04 20:57:06 +04:00
parent 972b6517e0
commit 63588ee557
40 changed files with 825 additions and 1 deletions

View File

@ -3,7 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32819.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hospital", "Hospital\Hospital.csproj", "{AFB79BC5-47CC-4DC9-B090-2190ECC6165E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hospital", "Hospital\Hospital.csproj", "{AFB79BC5-47CC-4DC9-B090-2190ECC6165E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HospitalDataModels", "HospitalDataModels\HospitalDataModels.csproj", "{84B572A0-F8F5-40D2-9D9E-ACAEC7A91859}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HospitalContracts", "HospitalContracts\HospitalContracts.csproj", "{0A3FDB59-29E9-459A-8D17-62CA88D1C56E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -15,6 +19,14 @@ Global
{AFB79BC5-47CC-4DC9-B090-2190ECC6165E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AFB79BC5-47CC-4DC9-B090-2190ECC6165E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AFB79BC5-47CC-4DC9-B090-2190ECC6165E}.Release|Any CPU.Build.0 = Release|Any CPU
{84B572A0-F8F5-40D2-9D9E-ACAEC7A91859}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{84B572A0-F8F5-40D2-9D9E-ACAEC7A91859}.Debug|Any CPU.Build.0 = Debug|Any CPU
{84B572A0-F8F5-40D2-9D9E-ACAEC7A91859}.Release|Any CPU.ActiveCfg = Release|Any CPU
{84B572A0-F8F5-40D2-9D9E-ACAEC7A91859}.Release|Any CPU.Build.0 = Release|Any CPU
{0A3FDB59-29E9-459A-8D17-62CA88D1C56E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A3FDB59-29E9-459A-8D17-62CA88D1C56E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A3FDB59-29E9-459A-8D17-62CA88D1C56E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A3FDB59-29E9-459A-8D17-62CA88D1C56E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,20 @@
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.BindingModels
{
public class DiseaseBindingModel : IDiseaseModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Symptoms { get; set; } = string.Empty;
public int DoctorId { get; set; }
}
}

View File

@ -0,0 +1,20 @@
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.BindingModels
{
public class DoctorBindingModel : IDoctorModel
{
public int Id { get; set; }
public string Login { get; set; } = string.Empty;
public string PhoneNumber { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,18 @@
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.BindingModels
{
public class MedicineBindingModel : IMedicineModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Form { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,28 @@
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.BindingModels
{
public class PatientBindingModel : IPatientModel
{
public int Id { get; set; }
public string Surname { get; set; } = string.Empty;
public string Name { get; set; } = string.Empty;
public string Patronymic { get; set; } = string.Empty;
public int Age { get; set; }
public int DoctorId { get; set; }
public Dictionary<int, IProcedureModel> PatientProcedures { get; set; } = new();
public Dictionary<int, IRecipeModel> PatientRecipes { get; set; } = new();
}
}

View File

@ -0,0 +1,18 @@
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.BindingModels
{
public class ProcedureBindingModel : IProcedureModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public Dictionary<int, IMedicineModel> ProcedureMedicines { get; set; } = new();
}
}

View File

@ -0,0 +1,22 @@
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.BindingModels
{
public class RecipeBindingModel : IRecipeModel
{
public int Id { get; set; }
public DateTime IssueDate { get; set; } = DateTime.Now;
public int DiseaseId { get; set; }
public int DoctorId { get; set; }
public Dictionary<int, IMedicineModel> RecipeMedicines { get; set; } = new();
}
}

View File

@ -0,0 +1,24 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.BusinessLogicsContracts
{
public interface IDiseaseLogic
{
List<DiseaseViewModel>? ReadList(DiseaseSearchModel? model);
DiseaseViewModel? ReadElement(DiseaseSearchModel model);
bool Create(DiseaseBindingModel model);
bool Update(DiseaseBindingModel model);
bool Delete(DiseaseBindingModel model);
}
}

View File

@ -0,0 +1,24 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.BusinessLogicsContracts
{
public interface IDoctorLogic
{
List<DoctorViewModel>? ReadList(DoctorSearchModel? model);
DoctorViewModel? ReadElement(DoctorSearchModel model);
bool Create(DoctorBindingModel model);
bool Update(DoctorBindingModel model);
bool Delete(DoctorBindingModel model);
}
}

View File

@ -0,0 +1,24 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.BusinessLogicsContracts
{
public interface IMedicineLogic
{
List<MedicineViewModel>? ReadList(MedicineSearchModel? model);
MedicineViewModel? ReadElement(MedicineSearchModel model);
bool Create(MedicineBindingModel model);
bool Update(MedicineBindingModel model);
bool Delete(MedicineBindingModel model);
}
}

View File

@ -0,0 +1,24 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.BusinessLogicsContracts
{
public interface IPatientLogic
{
List<PatientViewModel>? ReadList(PatientSearchModel? model);
PatientViewModel? ReadElement(PatientSearchModel model);
bool Create(PatientBindingModel model);
bool Update(PatientBindingModel model);
bool Delete(PatientBindingModel model);
}
}

View File

@ -0,0 +1,24 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.BusinessLogicsContracts
{
public interface IProcedureLogic
{
List<ProcedureViewModel>? ReadList(ProcedureSearchModel? model);
ProcedureViewModel? ReadElement(ProcedureSearchModel model);
bool Create(ProcedureBindingModel model);
bool Update(ProcedureBindingModel model);
bool Delete(ProcedureBindingModel model);
}
}

View File

@ -0,0 +1,24 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.BusinessLogicsContracts
{
public interface IRecipeLogic
{
List<RecipeViewModel>? ReadList(RecipeSearchModel? model);
RecipeViewModel? ReadElement(RecipeSearchModel model);
bool Create(RecipeBindingModel model);
bool Update(RecipeBindingModel model);
bool Delete(RecipeBindingModel model);
}
}

View File

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

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.SearchModels
{
public class DiseaseSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.SearchModels
{
public class DoctorSearchModel
{
public int? Id { get; set; }
public string? Login { get; set; }
public string? PhoneNumber { get; set; }
public string? Password { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.SearchModels
{
public class MedicineSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.SearchModels
{
public class PatientSearchModel
{
public int? Id { get; set; }
public string? Surname { get; set; }
public string? Name { get; set; }
public string? Patronymic { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.SearchModels
{
public class ProcedureSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.SearchModels
{
public class RecipeSearchModel
{
public int? Id { get; set; }
}
}

View File

@ -0,0 +1,26 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.StoragesContracts
{
public interface IDiseaseStorage
{
List<DiseaseViewModel> GetFullList();
List<DiseaseViewModel> GetFilteredList(DiseaseSearchModel model);
DiseaseViewModel? GetElement(DiseaseSearchModel model);
DiseaseViewModel? Insert(DiseaseBindingModel model);
DiseaseViewModel? Update(DiseaseBindingModel model);
DiseaseViewModel? Delete(DiseaseBindingModel model);
}
}

View File

@ -0,0 +1,26 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.StoragesContracts
{
public interface IDoctorStorage
{
List<DoctorViewModel> GetFullList();
List<DoctorViewModel> GetFilteredList(DoctorSearchModel model);
DoctorViewModel? GetElement(DoctorSearchModel model);
DoctorViewModel? Insert(DoctorBindingModel model);
DoctorViewModel? Update(DoctorBindingModel model);
DoctorViewModel? Delete(DoctorBindingModel model);
}
}

View File

@ -0,0 +1,26 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.StoragesContracts
{
public interface IMedicineStorage
{
List<MedicineViewModel> GetFullList();
List<MedicineViewModel> GetFilteredList(MedicineSearchModel model);
MedicineViewModel? GetElement(MedicineSearchModel model);
MedicineViewModel? Insert(MedicineBindingModel model);
MedicineViewModel? Update(MedicineBindingModel model);
MedicineViewModel? Delete(MedicineBindingModel model);
}
}

View File

@ -0,0 +1,26 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.StoragesContracts
{
public interface IPatientStorage
{
List<PatientViewModel> GetFullList();
List<PatientViewModel> GetFilteredList(PatientSearchModel model);
PatientViewModel? GetElement(PatientSearchModel model);
PatientViewModel? Insert(PatientBindingModel model);
PatientViewModel? Update(PatientBindingModel model);
PatientViewModel? Delete(PatientBindingModel model);
}
}

View File

@ -0,0 +1,26 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.StoragesContracts
{
public interface IProcedureStorage
{
List<ProcedureViewModel> GetFullList();
List<ProcedureViewModel> GetFilteredList(ProcedureSearchModel model);
ProcedureViewModel? GetElement(ProcedureSearchModel model);
ProcedureViewModel? Insert(ProcedureBindingModel model);
ProcedureViewModel? Update(ProcedureBindingModel model);
ProcedureViewModel? Delete(ProcedureBindingModel model);
}
}

View File

@ -0,0 +1,26 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.StoragesContracts
{
public interface IRecipeStorage
{
List<RecipeViewModel> GetFullList();
List<RecipeViewModel> GetFilteredList(RecipeSearchModel model);
RecipeViewModel? GetElement(RecipeSearchModel model);
RecipeViewModel? Insert(RecipeBindingModel model);
RecipeViewModel? Update(RecipeBindingModel model);
RecipeViewModel? Delete(RecipeBindingModel model);
}
}

View File

@ -0,0 +1,23 @@
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.ViewModels
{
public class DiseaseViewModel : IDiseaseModel
{
public int Id { get; set; }
[DisplayName("Название болезни")]
public string Name { get; set; } = string.Empty;
[DisplayName("Симптомы болезни")]
public string Symptoms { get; set; } = string.Empty;
public int DoctorId { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.ViewModels
{
public class DoctorViewModel : IDoctorModel
{
public int Id { get; set; }
[DisplayName("Логин врача")]
public string Login { get; set; } = string.Empty;
[DisplayName("Номер телефона врача")]
public string PhoneNumber { get; set; } = string.Empty;
[DisplayName("Пароль врача")]
public string Password { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,21 @@
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.ViewModels
{
public class MedicineViewModel : IMedicineModel
{
public int Id { get; set; }
[DisplayName("Название лекарства")]
public string Name { get; set; } = string.Empty;
[DisplayName("Форма выпуска лекарства")]
public string Form { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,33 @@
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.ViewModels
{
public class PatientViewModel : IPatientModel
{
public int Id { get; set; }
[DisplayName("Фамилия пациента")]
public string Surname { get; set; } = string.Empty;
[DisplayName("Имя пациента")]
public string Name { get; set; } = string.Empty;
[DisplayName("Отчество пациента")]
public string Patronymic { get; set; } = string.Empty;
[DisplayName("Возраст пациента")]
public int Age { get; set; }
public int DoctorId { get; set; }
public Dictionary<int, IProcedureModel> PatientProcedures { get; set; } = new();
public Dictionary<int, IRecipeModel> PatientRecipes { get; set; } = new();
}
}

View File

@ -0,0 +1,20 @@
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.ViewModels
{
public class ProcedureViewModel : IProcedureModel
{
public int Id { get; set; }
[DisplayName("Название процедуры")]
public string Name { get; set; } = string.Empty;
public Dictionary<int, IMedicineModel> ProcedureMedicines { get; set; } = new();
}
}

View File

@ -0,0 +1,25 @@
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.ViewModels
{
public class RecipeViewModel : IRecipeModel
{
[DisplayName("Номер рецепта")]
public int Id { get; set; }
[DisplayName("Дата выдачи")]
public DateTime IssueDate { get; set; } = DateTime.Now;
public int DiseaseId { get; set; }
public int DoctorId { get; set; }
public Dictionary<int, IMedicineModel> RecipeMedicines { get; set; } = new();
}
}

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalDataModels
{
public interface IId
{
int Id { get; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalDataModels.Models
{
public interface IDiseaseModel : IId
{
string Name { get; }
string Symptoms { get; }
int DoctorId { get; }
}
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalDataModels.Models
{
public interface IDoctorModel : IId
{
string Login { get; }
string PhoneNumber { get; }
string Password { get; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalDataModels.Models
{
public interface IMedicineModel : IId
{
string Name { get; }
string Form { get; }
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalDataModels.Models
{
public interface IPatientModel : IId
{
string Surname { get; }
string Name { get; }
string Patronymic { get; }
int Age { get; }
int DoctorId { get; }
Dictionary<int, IProcedureModel> PatientProcedures { get; }
Dictionary<int, IRecipeModel> PatientRecipes { get; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalDataModels.Models
{
public interface IProcedureModel : IId
{
string Name { get; }
Dictionary<int, IMedicineModel> ProcedureMedicines { get; }
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalDataModels.Models
{
public interface IRecipeModel : IId
{
DateTime IssueDate { get; }
int DiseaseId { get; }
int DoctorId { get; }
Dictionary<int, IMedicineModel> RecipeMedicines { get; }
}
}