From 575e573a38f9e5f116df309707c48ec249cdc4d1 Mon Sep 17 00:00:00 2001 From: ValAnn Date: Sat, 27 Apr 2024 21:51:26 +0400 Subject: [PATCH] =?UTF-8?q?=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=BE=D0=B4=D0=BD=D0=BE=D0=BD=D0=B0=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BD=D1=8B=D0=B5=20=D1=81=D0=B2=D1=8F=D0=B7?= =?UTF-8?q?=D0=B8=20+=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=B0=D0=BA=D1=82=D1=8B?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BD=D0=B8=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogics/DiseaseLogic.cs | 115 ++++++++++++++++++ Hospital/HospitalBusinessLogic/Class1.cs | 7 -- .../BindingModels/DiseaseBindingModel.cs | 17 +++ .../BindingModels/DoctorBindingModel.cs | 19 +++ .../BindingModels/PatientBindingModel.cs | 26 ++++ .../BindingModels/RecipeBindingModel.cs | 23 ++++ .../BusinessLogicContracts/IDiseaseLogic.cs | 24 ++++ .../BusinessLogicContracts/IDoctorLogic.cs | 24 ++++ .../BusinessLogicContracts/IPatientLogic.cs | 24 ++++ .../BusinessLogicContracts/IRecipeLogic.cs | 24 ++++ .../SearchModels/DiseaseSearchModel.cs | 18 +++ .../SearchModels/DoctorSearchModel.cs | 18 +++ .../SearchModels/PatientSearchModel.cs | 23 ++++ .../SearchModels/RecipeSearchModel.cs | 15 +++ .../StoragesContracts/IDiseaseStorage.cs | 26 ++++ .../StoragesContracts/IDoctorStorage.cs | 26 ++++ .../StoragesContracts/IPatientStorage.cs | 26 ++++ .../StoragesContracts/IRecipeStorage.cs | 27 ++++ .../ViewModels/DiseaseViewModel.cs | 14 ++- .../ViewModels/DoctorViewModel.cs | 15 +-- .../ViewModels/PatientViewModel.cs | 8 +- .../ViewModels/RecipeViewModel.cs | 16 ++- .../HospitalDataModels.csproj | 4 +- .../HospitalDataModels/Models/IDoctorModel.cs | 2 +- .../Models/IMedicineModel.cs | 4 +- .../Models/IProcedureModel.cs | 4 +- Hospital/HospitalDatabaseImplement/Class1.cs | 7 -- 27 files changed, 521 insertions(+), 35 deletions(-) create mode 100644 Hospital/HospitalBusinessLogic/BusinessLogics/DiseaseLogic.cs delete mode 100644 Hospital/HospitalBusinessLogic/Class1.cs create mode 100644 Hospital/HospitalContracts/BindingModels/DiseaseBindingModel.cs create mode 100644 Hospital/HospitalContracts/BindingModels/DoctorBindingModel.cs create mode 100644 Hospital/HospitalContracts/BindingModels/PatientBindingModel.cs create mode 100644 Hospital/HospitalContracts/BindingModels/RecipeBindingModel.cs create mode 100644 Hospital/HospitalContracts/BusinessLogicContracts/IDiseaseLogic.cs create mode 100644 Hospital/HospitalContracts/BusinessLogicContracts/IDoctorLogic.cs create mode 100644 Hospital/HospitalContracts/BusinessLogicContracts/IPatientLogic.cs create mode 100644 Hospital/HospitalContracts/BusinessLogicContracts/IRecipeLogic.cs create mode 100644 Hospital/HospitalContracts/SearchModels/DiseaseSearchModel.cs create mode 100644 Hospital/HospitalContracts/SearchModels/DoctorSearchModel.cs create mode 100644 Hospital/HospitalContracts/SearchModels/PatientSearchModel.cs create mode 100644 Hospital/HospitalContracts/SearchModels/RecipeSearchModel.cs create mode 100644 Hospital/HospitalContracts/StoragesContracts/IDiseaseStorage.cs create mode 100644 Hospital/HospitalContracts/StoragesContracts/IDoctorStorage.cs create mode 100644 Hospital/HospitalContracts/StoragesContracts/IPatientStorage.cs create mode 100644 Hospital/HospitalContracts/StoragesContracts/IRecipeStorage.cs delete mode 100644 Hospital/HospitalDatabaseImplement/Class1.cs diff --git a/Hospital/HospitalBusinessLogic/BusinessLogics/DiseaseLogic.cs b/Hospital/HospitalBusinessLogic/BusinessLogics/DiseaseLogic.cs new file mode 100644 index 0000000..75cfd65 --- /dev/null +++ b/Hospital/HospitalBusinessLogic/BusinessLogics/DiseaseLogic.cs @@ -0,0 +1,115 @@ +using HospitalContracts.BindingModels; +using HospitalContracts.BusinessLogicContracts; +using HospitalContracts.SearchModels; +using HospitalContracts.StoragesContracts; +using HospitalContracts.ViewModels; +using Microsoft.Extensions.Logging; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HospitalBusinessLogic.BusinessLogics +{ + public class DiseaseLogic : IDiseaseLogic + { + private readonly ILogger _logger; + private readonly IDiseaseStorage _diseaseStorage; + + public DiseaseLogic(ILogger logger, IDiseaseStorage diseaseStorage) + { + _logger = logger; + _diseaseStorage = diseaseStorage; + } + + public bool Create(DiseaseBindingModel model) + { + CheckModel(model); + if (_diseaseStorage.Insert(model) == null) + { + _logger.LogWarning("Insert operation failed"); + return false; + } + return true; + } + + public bool Update(DiseaseBindingModel model) + { + CheckModel(model); + if (_diseaseStorage.Update(model) == null) + { + _logger.LogWarning("Update operation failed"); + return false; + } + return true; + } + + public bool Delete(DiseaseBindingModel model) + { + CheckModel(model, false); + _logger.LogInformation("Delete. Id:{Id}", model.Id); + if (_diseaseStorage.Delete(model) == null) + { + _logger.LogWarning("Delete operation failed"); + return false; + } + return true; + } + + public DiseaseViewModel? ReadElement(DiseaseSearchModel model) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + _logger.LogInformation("ReadElement. Name:{Name}. Id:{ Id}", model.Name, model.Id); + var element = _diseaseStorage.GetElement(model); + if (element == null) + { + _logger.LogWarning("ReadElement element not found"); + return null; + } + _logger.LogInformation("ReadElement find. Id:{Id}", element.Id); + return element; + } + + public List? ReadList(DiseaseSearchModel? model) + { + _logger.LogInformation("ReadList. DiseaseId:{Id}", model?.Id); + var list = model == null ? _diseaseStorage.GetFullList() : _diseaseStorage.GetFilteredList(model); + if (list == null) + { + _logger.LogWarning("ReadList return null list"); + return null; + } + _logger.LogInformation("ReadList. Count:{Count}", list.Count); + return list; + } + + private void CheckModel(DiseaseBindingModel model, bool withParams = true) + { + if (model == null) + { + throw new ArgumentNullException(nameof(model)); + } + if (!withParams) + { + return; + } + if (string.IsNullOrEmpty(model.Name)) + { + throw new ArgumentNullException("Нет названия болезни", nameof(model.Name)); + } + _logger.LogInformation("Disease. Name:{Name}. Description:{Description}. DoctorId:{DoctorId}. Id:{ Id}", model.Name, model.Description, model.DoctorId, model.Id); + var element = _diseaseStorage.GetElement(new DiseaseSearchModel + { + Name = model.Name, + }); + if (element != null && element.Id != model.Id) + { + throw new InvalidOperationException("Болезнь с такими данными уже есть"); + } + } + } +} diff --git a/Hospital/HospitalBusinessLogic/Class1.cs b/Hospital/HospitalBusinessLogic/Class1.cs deleted file mode 100644 index e06246c..0000000 --- a/Hospital/HospitalBusinessLogic/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace HospitalBusinessLogic -{ - public class Class1 - { - - } -} diff --git a/Hospital/HospitalContracts/BindingModels/DiseaseBindingModel.cs b/Hospital/HospitalContracts/BindingModels/DiseaseBindingModel.cs new file mode 100644 index 0000000..f0baa5b --- /dev/null +++ b/Hospital/HospitalContracts/BindingModels/DiseaseBindingModel.cs @@ -0,0 +1,17 @@ +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 Description { get; set; } = string.Empty; + public int DoctorId { get; set; } + } +} diff --git a/Hospital/HospitalContracts/BindingModels/DoctorBindingModel.cs b/Hospital/HospitalContracts/BindingModels/DoctorBindingModel.cs new file mode 100644 index 0000000..cb4be9d --- /dev/null +++ b/Hospital/HospitalContracts/BindingModels/DoctorBindingModel.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using HospitalDataModels.Models; + +namespace HospitalContracts.BindingModels +{ + public class DoctorBindingModel : IDoctorModel + { + public int Id { get; set; } + public string FIO { get; set; } = string.Empty; + public string Login { get; set; } = string.Empty; + public string Password { get; set; } = string.Empty; + public string MailAddress { get; set; } = string.Empty; + public string PhoneNumber { get; set; } = string.Empty; + } +} diff --git a/Hospital/HospitalContracts/BindingModels/PatientBindingModel.cs b/Hospital/HospitalContracts/BindingModels/PatientBindingModel.cs new file mode 100644 index 0000000..3a8dd06 --- /dev/null +++ b/Hospital/HospitalContracts/BindingModels/PatientBindingModel.cs @@ -0,0 +1,26 @@ +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 FIO { get; set; } = string.Empty; + + public string Adress { get; set; } = string.Empty; + + public DateOnly BirthDate { get; set; } + + public int DoctorId { get; set; } + + public Dictionary PatientProcedures { get; set; } = new(); + + public Dictionary PatientRecipes { get; set; } = new(); + } +} diff --git a/Hospital/HospitalContracts/BindingModels/RecipeBindingModel.cs b/Hospital/HospitalContracts/BindingModels/RecipeBindingModel.cs new file mode 100644 index 0000000..a7243d9 --- /dev/null +++ b/Hospital/HospitalContracts/BindingModels/RecipeBindingModel.cs @@ -0,0 +1,23 @@ +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 string Description { get; set; } = string.Empty; + + public DateTime IssueDate { get; set; } = DateTime.Now; + + public int DiseaseId { get; set; } + + public int DoctorId { get; set; } + + public Dictionary RecipeMedicines { get; set; } = new(); + } +} diff --git a/Hospital/HospitalContracts/BusinessLogicContracts/IDiseaseLogic.cs b/Hospital/HospitalContracts/BusinessLogicContracts/IDiseaseLogic.cs new file mode 100644 index 0000000..a037dd3 --- /dev/null +++ b/Hospital/HospitalContracts/BusinessLogicContracts/IDiseaseLogic.cs @@ -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.BusinessLogicContracts +{ + public interface IDiseaseLogic + { + List? ReadList(DiseaseSearchModel? model); + + DiseaseViewModel? ReadElement(DiseaseSearchModel model); + + bool Create(DiseaseBindingModel model); + + bool Update(DiseaseBindingModel model); + + bool Delete(DiseaseBindingModel model); + } +} diff --git a/Hospital/HospitalContracts/BusinessLogicContracts/IDoctorLogic.cs b/Hospital/HospitalContracts/BusinessLogicContracts/IDoctorLogic.cs new file mode 100644 index 0000000..af243fb --- /dev/null +++ b/Hospital/HospitalContracts/BusinessLogicContracts/IDoctorLogic.cs @@ -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.BusinessLogicContracts +{ + public interface IDoctorLogic + { + List? ReadList(DoctorSearchModel? model); + + DoctorViewModel? ReadElement(DoctorSearchModel model); + + bool Create(DoctorBindingModel model); + + bool Update(DoctorBindingModel model); + + bool Delete(DoctorBindingModel model); + } +} diff --git a/Hospital/HospitalContracts/BusinessLogicContracts/IPatientLogic.cs b/Hospital/HospitalContracts/BusinessLogicContracts/IPatientLogic.cs new file mode 100644 index 0000000..5e29c65 --- /dev/null +++ b/Hospital/HospitalContracts/BusinessLogicContracts/IPatientLogic.cs @@ -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.BusinessLogicContracts +{ + public interface IPatientLogic + { + List? ReadList(PatientSearchModel? model); + + PatientViewModel? ReadElement(PatientSearchModel model); + + bool Create(PatientBindingModel model); + + bool Update(PatientBindingModel model); + + bool Delete(PatientBindingModel model); + } +} diff --git a/Hospital/HospitalContracts/BusinessLogicContracts/IRecipeLogic.cs b/Hospital/HospitalContracts/BusinessLogicContracts/IRecipeLogic.cs new file mode 100644 index 0000000..cc8e965 --- /dev/null +++ b/Hospital/HospitalContracts/BusinessLogicContracts/IRecipeLogic.cs @@ -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.BusinessLogicContracts +{ + public interface IRecipeLogic + { + List? ReadList(RecipeSearchModel? model); + + RecipeViewModel? ReadElement(RecipeSearchModel model); + + bool Create(RecipeBindingModel model); + + bool Update(RecipeBindingModel model); + + bool Delete(RecipeBindingModel model); + } +} diff --git a/Hospital/HospitalContracts/SearchModels/DiseaseSearchModel.cs b/Hospital/HospitalContracts/SearchModels/DiseaseSearchModel.cs new file mode 100644 index 0000000..78a7be5 --- /dev/null +++ b/Hospital/HospitalContracts/SearchModels/DiseaseSearchModel.cs @@ -0,0 +1,18 @@ +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; } + public string? Description { get; set; } + + public int? DoctorId { get; set; } + } +} diff --git a/Hospital/HospitalContracts/SearchModels/DoctorSearchModel.cs b/Hospital/HospitalContracts/SearchModels/DoctorSearchModel.cs new file mode 100644 index 0000000..afd35e0 --- /dev/null +++ b/Hospital/HospitalContracts/SearchModels/DoctorSearchModel.cs @@ -0,0 +1,18 @@ +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? FIO { get; set; } + public string? Login { get; set; } + public string? Password { get; set; } + public string? MailAddress { get; set; } + public string? PhoneNumber { get; set; } + } +} diff --git a/Hospital/HospitalContracts/SearchModels/PatientSearchModel.cs b/Hospital/HospitalContracts/SearchModels/PatientSearchModel.cs new file mode 100644 index 0000000..e7c2dff --- /dev/null +++ b/Hospital/HospitalContracts/SearchModels/PatientSearchModel.cs @@ -0,0 +1,23 @@ +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? FIO { get; set; } + + public string? Adress { get; set; } + + public DateOnly? BirthDate { get; set; } + + public int? DoctorId { get; set; } + public DateTime? DateFrom { get; set; } + public DateTime? DateTo { get; set; } + } +} diff --git a/Hospital/HospitalContracts/SearchModels/RecipeSearchModel.cs b/Hospital/HospitalContracts/SearchModels/RecipeSearchModel.cs new file mode 100644 index 0000000..578c0fb --- /dev/null +++ b/Hospital/HospitalContracts/SearchModels/RecipeSearchModel.cs @@ -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 RecipeSearchModel + { + public int? Id { get; set; } + + public int? DoctorId { get; set; } + } +} diff --git a/Hospital/HospitalContracts/StoragesContracts/IDiseaseStorage.cs b/Hospital/HospitalContracts/StoragesContracts/IDiseaseStorage.cs new file mode 100644 index 0000000..448768f --- /dev/null +++ b/Hospital/HospitalContracts/StoragesContracts/IDiseaseStorage.cs @@ -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 GetFullList(); + + List GetFilteredList(DiseaseSearchModel model); + + DiseaseViewModel? GetElement(DiseaseSearchModel model); + + DiseaseViewModel? Insert(DiseaseBindingModel model); + + DiseaseViewModel? Update(DiseaseBindingModel model); + + DiseaseViewModel? Delete(DiseaseBindingModel model); + } +} diff --git a/Hospital/HospitalContracts/StoragesContracts/IDoctorStorage.cs b/Hospital/HospitalContracts/StoragesContracts/IDoctorStorage.cs new file mode 100644 index 0000000..4a5494a --- /dev/null +++ b/Hospital/HospitalContracts/StoragesContracts/IDoctorStorage.cs @@ -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 GetFullList(); + + List GetFilteredList(DoctorSearchModel model); + + DoctorViewModel? GetElement(DoctorSearchModel model); + + DoctorViewModel? Insert(DoctorBindingModel model); + + DoctorViewModel? Update(DoctorBindingModel model); + + DoctorViewModel? Delete(DoctorBindingModel model); + } +} diff --git a/Hospital/HospitalContracts/StoragesContracts/IPatientStorage.cs b/Hospital/HospitalContracts/StoragesContracts/IPatientStorage.cs new file mode 100644 index 0000000..a003172 --- /dev/null +++ b/Hospital/HospitalContracts/StoragesContracts/IPatientStorage.cs @@ -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 GetFullList(); + + List GetFilteredList(PatientSearchModel model); + + PatientViewModel? GetElement(PatientSearchModel model); + + PatientViewModel? Insert(PatientBindingModel model); + + PatientViewModel? Update(PatientBindingModel model); + + PatientViewModel? Delete(PatientBindingModel model); + } +} diff --git a/Hospital/HospitalContracts/StoragesContracts/IRecipeStorage.cs b/Hospital/HospitalContracts/StoragesContracts/IRecipeStorage.cs new file mode 100644 index 0000000..d6f0c18 --- /dev/null +++ b/Hospital/HospitalContracts/StoragesContracts/IRecipeStorage.cs @@ -0,0 +1,27 @@ +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 GetFullList(); + + List GetFilteredList(RecipeSearchModel model); + + RecipeViewModel? GetElement(RecipeSearchModel model); + + RecipeViewModel? Insert(RecipeBindingModel model); + + RecipeViewModel? Update(RecipeBindingModel model); + + RecipeViewModel? Delete(RecipeBindingModel model); + } +} + diff --git a/Hospital/HospitalContracts/ViewModels/DiseaseViewModel.cs b/Hospital/HospitalContracts/ViewModels/DiseaseViewModel.cs index ac504f4..be9e80c 100644 --- a/Hospital/HospitalContracts/ViewModels/DiseaseViewModel.cs +++ b/Hospital/HospitalContracts/ViewModels/DiseaseViewModel.cs @@ -1,12 +1,22 @@ -using System; +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 { - internal class DiseaseViewModel + public class DiseaseViewModel : IDiseaseModel { + public int Id { get; set; } + [DisplayName("Название болезни")] + public string Name { get; set; } = string.Empty; + + [DisplayName("Описание болезни")] + public string Description { get; set; } = string.Empty; + + public int DoctorId { get; set; } } } diff --git a/Hospital/HospitalContracts/ViewModels/DoctorViewModel.cs b/Hospital/HospitalContracts/ViewModels/DoctorViewModel.cs index d895a23..674cc6b 100644 --- a/Hospital/HospitalContracts/ViewModels/DoctorViewModel.cs +++ b/Hospital/HospitalContracts/ViewModels/DoctorViewModel.cs @@ -1,4 +1,5 @@ -using System; +using HospitalDataModels.Models; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; @@ -7,23 +8,23 @@ using System.Threading.Tasks; namespace HospitalContracts.ViewModels { - public class DoctorViewModel + public class DoctorViewModel : IDoctorModel { public int Id { get; set; } [DisplayName("ФИО")] - string FIO { get; } + public string FIO { get; set; } = string.Empty; [DisplayName("Логин")] - string Login { get; } + public string Login { get; set; } = string.Empty; [DisplayName("Пароль")] - string Password { get; } + public string Password { get; set; } = string.Empty; [DisplayName("Электронная почта")] - string MailAddress { get; } + public string MailAddress { get; set; } = string.Empty; [DisplayName("Номер телефона")] - string PhoneNumber { get; } + public string PhoneNumber { get; set; } = string.Empty; } } diff --git a/Hospital/HospitalContracts/ViewModels/PatientViewModel.cs b/Hospital/HospitalContracts/ViewModels/PatientViewModel.cs index 4e8db23..073890c 100644 --- a/Hospital/HospitalContracts/ViewModels/PatientViewModel.cs +++ b/Hospital/HospitalContracts/ViewModels/PatientViewModel.cs @@ -8,18 +8,18 @@ using HospitalDataModels.Models; namespace HospitalContracts.ViewModels { - public class PatientViewModel + public class PatientViewModel : IPatientModel { public int Id { get; set; } [DisplayName("ФИО")] - string FIO { get; } + public string FIO { get; } [DisplayName("Дата рождения")] - DateOnly BirthDate { get; } + public DateOnly BirthDate { get; } [DisplayName("Адрес")] - string Adress { get; } + public string Adress { get; } public int DoctorId { get; set; } diff --git a/Hospital/HospitalContracts/ViewModels/RecipeViewModel.cs b/Hospital/HospitalContracts/ViewModels/RecipeViewModel.cs index 555b4ea..be4e2c5 100644 --- a/Hospital/HospitalContracts/ViewModels/RecipeViewModel.cs +++ b/Hospital/HospitalContracts/ViewModels/RecipeViewModel.cs @@ -1,4 +1,5 @@ -using System; +using HospitalDataModels.Models; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +7,18 @@ using System.Threading.Tasks; namespace HospitalContracts.ViewModels { - internal class RecipeViewModel + public class RecipeViewModel : IRecipeModel { + public string Description { get; set; } = string.Empty; + + public DateTime IssueDate { get; set; } = DateTime.Now; + + public int DiseaseId { get; set; } + + public int DoctorId { get; set; } + + public Dictionary RecipeMedicines { get; set; } = new(); + + public int Id { get; set; } } } diff --git a/Hospital/HospitalDataModels/HospitalDataModels.csproj b/Hospital/HospitalDataModels/HospitalDataModels.csproj index b6a7529..68e3101 100644 --- a/Hospital/HospitalDataModels/HospitalDataModels.csproj +++ b/Hospital/HospitalDataModels/HospitalDataModels.csproj @@ -7,7 +7,9 @@ - + + + diff --git a/Hospital/HospitalDataModels/Models/IDoctorModel.cs b/Hospital/HospitalDataModels/Models/IDoctorModel.cs index cbaf64a..d9004b7 100644 --- a/Hospital/HospitalDataModels/Models/IDoctorModel.cs +++ b/Hospital/HospitalDataModels/Models/IDoctorModel.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace HospitalDataModels.Models { - internal interface IDoctorModel : IId + public interface IDoctorModel : IId { string FIO { get; } string Login { get; } diff --git a/Hospital/HospitalDataModels/Models/IMedicineModel.cs b/Hospital/HospitalDataModels/Models/IMedicineModel.cs index a1bb98b..438ba57 100644 --- a/Hospital/HospitalDataModels/Models/IMedicineModel.cs +++ b/Hospital/HospitalDataModels/Models/IMedicineModel.cs @@ -12,7 +12,7 @@ namespace HospitalDataModels.Models string CountryOrigin { get; } double Price { get; } int PharmacistId { get; } - Dictionary MedicineProcedures { get; } - Dictionary MedicineRecipes { get; } //во всех сущностях проверить связи + /*Dictionary MedicineProcedures { get; }*/ + Dictionary MedicineRecipes { get; } //во всех сущностях проверить связи*/ } } diff --git a/Hospital/HospitalDataModels/Models/IProcedureModel.cs b/Hospital/HospitalDataModels/Models/IProcedureModel.cs index b8308b1..38d13cf 100644 --- a/Hospital/HospitalDataModels/Models/IProcedureModel.cs +++ b/Hospital/HospitalDataModels/Models/IProcedureModel.cs @@ -12,9 +12,9 @@ namespace HospitalDataModels.Models DateTime Date { get; } int DescriptionOfTheProcedureId { get; } int PharmacistId { get; } - Dictionary MedicineProcedures { get; } + Dictionary ProcedureMedicines { get; } - Dictionary PatientProcedures { get; }//проверка коммита + //Dictionary PatientProcedures { get; }//проверка коммита } } diff --git a/Hospital/HospitalDatabaseImplement/Class1.cs b/Hospital/HospitalDatabaseImplement/Class1.cs deleted file mode 100644 index fdb7bb4..0000000 --- a/Hospital/HospitalDatabaseImplement/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace HospitalDatabaseImplement -{ - public class Class1 - { - - } -}