Этап 2. Контракты

This commit is contained in:
prodigygirl 2023-04-05 11:46:14 +04:00
parent 1751f87357
commit 52829f9e46
38 changed files with 554 additions and 1 deletions

View File

@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HospitalWeb", "HospitalWeb\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HospitalDataModels", "HospitalDataModels\HospitalDataModels.csproj", "{0CB78C46-D21B-4BF8-BA79-CF2A2F4D5452}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HospitalContracts", "HospitalContracts\HospitalContracts.csproj", "{F24FE3B9-EA65-4793-A950-68857BCC7DB2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -21,6 +23,10 @@ Global
{0CB78C46-D21B-4BF8-BA79-CF2A2F4D5452}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0CB78C46-D21B-4BF8-BA79-CF2A2F4D5452}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0CB78C46-D21B-4BF8-BA79-CF2A2F4D5452}.Release|Any CPU.Build.0 = Release|Any CPU
{F24FE3B9-EA65-4793-A950-68857BCC7DB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F24FE3B9-EA65-4793-A950-68857BCC7DB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F24FE3B9-EA65-4793-A950-68857BCC7DB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F24FE3B9-EA65-4793-A950-68857BCC7DB2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,11 @@
using HospitalDataModels.Models;
namespace HospitalContracts.BindingModels
{
public class ApothecaryBindingModel : IApothecaryModel
{
public int Id { get; set; }
public string Login { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,16 @@
using HospitalDataModels.Models;
namespace HospitalContracts.BindingModels
{
public class MedicineBindingModel : IMedicineModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public double Cost { get; set; }
public string Dose { get; set; } = string.Empty;
public int ApothecaryId { get; set; }
}
}

View File

@ -0,0 +1,19 @@
using HospitalDataModels.Models;
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 DateTime BirthDate { get; set; }
public int TreatmentId { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using HospitalDataModels.Models;
namespace HospitalContracts.BindingModels
{
public class PrescriptionBindingModel : IPrescriptionModel
{
public int Id { get; set; }
public DateTime Date { get; set; } = DateTime.Now;
public int Number { get; set; }
public int MedicineId { get; set; }
public int ApothecaryId { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using HospitalDataModels.Models;
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,19 @@
using HospitalDataModels.Models;
namespace HospitalContracts.BindingModels
{
public class RecipeBindingModel : IRecipeModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public DateTime Date { get; set; } = DateTime.Now;
public int ApothecaryId { get; set; }
public Dictionary<int, IMedicineModel> RecipeMedicines { get; set; } = new();
public Dictionary<int, ITreatmentModel> RecipeTreatments { 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 TreatmentBindingModel : ITreatmentModel
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public Dictionary<int, IProcedureModel> TreatmentProcedures { get; set; } = new();
}
}

View File

@ -0,0 +1,15 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
namespace HospitalContracts.BusinessLogicContracts
{
public interface IApothecaryLogic
{
List<ApothecaryViewModel>? ReadList(ApothecarySearchModel? model);
ApothecaryViewModel? ReadElement(ApothecarySearchModel model);
bool Create(ApothecaryBindingModel model);
bool Update(ApothecaryBindingModel model);
bool Delete(ApothecaryBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
namespace HospitalContracts.BusinessLogicContracts
{
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,15 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
namespace HospitalContracts.BusinessLogicContracts
{
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,15 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
namespace HospitalContracts.BusinessLogicContracts
{
public interface IPrescriptionLogic
{
List<PrescriptionViewModel>? ReadList(PrescriptionSearchModel? model);
PrescriptionViewModel? ReadElement(PrescriptionSearchModel model);
bool Create(PrescriptionBindingModel model);
bool Update(PrescriptionBindingModel model);
bool Delete(PrescriptionBindingModel model);
}
}

View File

@ -0,0 +1,15 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
namespace HospitalContracts.BusinessLogicContracts
{
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,15 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
namespace HospitalContracts.BusinessLogicContracts
{
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,15 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
namespace HospitalContracts.BusinessLogicContracts
{
public interface ITreatmentLogic
{
List<TreatmentViewModel>? ReadList(TreatmentSearchModel? model);
TreatmentViewModel? ReadElement(TreatmentSearchModel model);
bool Create(TreatmentBindingModel model);
bool Update(TreatmentBindingModel model);
bool Delete(TreatmentBindingModel 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,9 @@
namespace HospitalContracts.SearchModels
{
public class ApothecarySearchModel
{
public int? Id { get; set; }
public string? Login { get; set; }
public string? Password { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace HospitalContracts.SearchModels
{
public class MedicineSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
public int? ApothecaryId { get; set; }
}
}

View File

@ -0,0 +1,14 @@
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 int? TreatmentId { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace HospitalContracts.SearchModels
{
public class PrescriptionSearchModel
{
public int? Id { get; set; }
public int? ApothecaryId { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace HospitalContracts.SearchModels
{
public class ProcedureSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
}
}

View File

@ -0,0 +1,9 @@
namespace HospitalContracts.SearchModels
{
public class RecipeSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
public int? ApothecaryId { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace HospitalContracts.SearchModels
{
public class TreatmentSearchModel
{
public int? Id { get; set; }
public string? Name { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
namespace HospitalContracts.StorageContracts
{
public interface IApothecaryStorage
{
List<ApothecaryViewModel> GetFullList();
List<ApothecaryViewModel> GetFilteredList(ApothecarySearchModel model);
ApothecaryViewModel? GetElement(ApothecarySearchModel model);
ApothecaryViewModel? Insert(ApothecaryBindingModel model);
ApothecaryViewModel? Update(ApothecaryBindingModel model);
ApothecaryViewModel? Delete(ApothecaryBindingModel model);
}
}

View File

@ -0,0 +1,21 @@
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.StorageContracts
{
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,16 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
namespace HospitalContracts.StorageContracts
{
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,16 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
namespace HospitalContracts.StorageContracts
{
public interface IPrescriptionStorage
{
List<PrescriptionViewModel> GetFullList();
List<PrescriptionViewModel> GetFilteredList(PrescriptionSearchModel model);
PrescriptionViewModel? GetElement(PrescriptionSearchModel model);
PrescriptionViewModel? Insert(PrescriptionBindingModel model);
PrescriptionViewModel? Update(PrescriptionBindingModel model);
PrescriptionViewModel? Delete(PrescriptionBindingModel model);
}
}

View File

@ -0,0 +1,16 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
namespace HospitalContracts.StorageContracts
{
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,16 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
namespace HospitalContracts.StorageContracts
{
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,16 @@
using HospitalContracts.BindingModels;
using HospitalContracts.SearchModels;
using HospitalContracts.ViewModels;
namespace HospitalContracts.StorageContracts
{
public interface ITreatmentStorage
{
List<TreatmentViewModel> GetFullList();
List<TreatmentViewModel> GetFilteredList(TreatmentSearchModel model);
TreatmentViewModel? GetElement(TreatmentSearchModel model);
TreatmentViewModel? Insert(TreatmentBindingModel model);
TreatmentViewModel? Update(TreatmentBindingModel model);
TreatmentViewModel? Delete(TreatmentBindingModel model);
}
}

View File

@ -0,0 +1,14 @@
using HospitalDataModels.Models;
using System.ComponentModel;
namespace HospitalContracts.ViewModels
{
public class ApothecaryViewModel : IApothecaryModel
{
public int Id { get; set; }
[DisplayName("Логин")]
public string Login { get; set; } = string.Empty;
[DisplayName("Пароль")]
public string Password { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,21 @@
using HospitalDataModels.Models;
using System.ComponentModel;
namespace HospitalContracts.ViewModels
{
public class MedicineViewModel : IMedicineModel
{
public int Id { get; set; }
[DisplayName("Название")]
public string Name { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Cost { get; set; }
[DisplayName("Дозировка")]
public string Dose { get; set; } = string.Empty;
public int ApothecaryId { get; set; }
[DisplayName("Автор записи")]
public string ApothecaryLogin { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,25 @@
using HospitalDataModels.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HospitalContracts.ViewModels
{
public class PatientViewModel : 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 DateTime BirthDate { get; set; }
public int TreatmentId { get; set; }
public string TreatmentName { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,22 @@
using HospitalDataModels.Models;
using System.ComponentModel;
namespace HospitalContracts.ViewModels
{
public class PrescriptionViewModel : IPrescriptionModel
{
public int Id { get; set; }
[DisplayName("Дата поставки")]
public DateTime Date { get; set; } = DateTime.Now;
public int MedicineId { get; set; }
[DisplayName("Лекарство")]
public string MedicineName { get; set; } = string.Empty;
[DisplayName("Количество")]
public int Number { get; set; }
public int ApothecaryId { get; set; }
[DisplayName("Автор записи")]
public string ApothecaryLogin { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,14 @@
using HospitalDataModels.Models;
using System.ComponentModel;
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
{
public int Id { get; set; }
[DisplayName("Название")]
public string Name { get; set; } = string.Empty;
[DisplayName("Дата создания")]
public DateTime Date { get; set; } = DateTime.Now;
public int ApothecaryId { get; set; }
[DisplayName("Автор записи")]
public string ApothecaryLogin { get; set; } = string.Empty;
public Dictionary<int, IMedicineModel> RecipeMedicines { get; set; } = new();
public Dictionary<int, ITreatmentModel> RecipeTreatments { get; set; } = new();
}
}

View File

@ -0,0 +1,14 @@
using HospitalDataModels.Models;
using System.ComponentModel;
namespace HospitalContracts.ViewModels
{
public class TreatmentViewModel : ITreatmentModel
{
public int Id { get; set; }
[DisplayName("Название")]
public string Name { get; set; } = string.Empty;
public Dictionary<int, IProcedureModel> TreatmentProcedures { get; set; } = new();
}
}

View File

@ -2,7 +2,7 @@
{
public interface IPrescriptionModel : IId
{
DateTime date { get; }
DateTime Date { get; }
int Number { get; }
int MedicineId { get; }
int ApothecaryId { get; }