From 4bfeda8f0d75af30d1441fcda1e9f6d88f3079c8 Mon Sep 17 00:00:00 2001 From: Yunusov_Niyaz Date: Tue, 23 Apr 2024 21:04:55 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D1=8C:=20=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0?= =?UTF-8?q?=D0=BB=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=B0=D0=BA=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BindingModels/OwnerBindingModel.cs | 12 +++++++++++ .../BindingModels/PetBindingModel.cs | 15 ++++++++++++++ .../BindingModels/PurchaseBindingModel.cs | 14 +++++++++++++ .../BindingModels/VisitBindingModel.cs | 13 ++++++++++++ .../BusinessLogicContracts/IOwnerLogic.cs | 16 +++++++++++++++ .../BusinessLogicContracts/IPetLogic.cs | 15 ++++++++++++++ .../BusinessLogicContracts/IPurchaseLogic.cs | 13 ++++++++++++ .../BusinessLogicContracts/IVisitLogic.cs | 13 ++++++++++++ .../SearchModels/OwnerSearchModel.cs | 10 ++++++++++ .../SearchModels/PetSearchModel.cs | 8 ++++++++ .../SearchModels/PurchaseSearchModel.cs | 10 ++++++++++ .../SearchModels/VisitSearchModel.cs | 10 ++++++++++ .../StorageContracts/IOwnerStorage.cs | 16 +++++++++++++++ .../StorageContracts/IPetStorage.cs | 16 +++++++++++++++ .../StorageContracts/IPurchaseStorage.cs | 16 +++++++++++++++ .../StorageContracts/IVisitStorage.cs | 16 +++++++++++++++ .../VeterinaryContracts.csproj | 8 -------- .../ViewModels/OwnerViewModel.cs | 16 +++++++++++++++ .../ViewModels/PetViewModel.cs | 20 +++++++++++++++++++ .../ViewModels/PurchaseViewModel.cs | 19 ++++++++++++++++++ .../ViewModels/VisitViewModel.cs | 17 ++++++++++++++++ .../VeterinaryDataModels/IPurchaseModel.cs | 3 ++- .../VeterinaryDataModels/IVisitModel.cs | 3 ++- 23 files changed, 289 insertions(+), 10 deletions(-) create mode 100644 VeterinaryView/VeterinaryContracts/BindingModels/OwnerBindingModel.cs create mode 100644 VeterinaryView/VeterinaryContracts/BindingModels/PetBindingModel.cs create mode 100644 VeterinaryView/VeterinaryContracts/BindingModels/PurchaseBindingModel.cs create mode 100644 VeterinaryView/VeterinaryContracts/BindingModels/VisitBindingModel.cs create mode 100644 VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IOwnerLogic.cs create mode 100644 VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IPetLogic.cs create mode 100644 VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IPurchaseLogic.cs create mode 100644 VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IVisitLogic.cs create mode 100644 VeterinaryView/VeterinaryContracts/SearchModels/OwnerSearchModel.cs create mode 100644 VeterinaryView/VeterinaryContracts/SearchModels/PetSearchModel.cs create mode 100644 VeterinaryView/VeterinaryContracts/SearchModels/PurchaseSearchModel.cs create mode 100644 VeterinaryView/VeterinaryContracts/SearchModels/VisitSearchModel.cs create mode 100644 VeterinaryView/VeterinaryContracts/StorageContracts/IOwnerStorage.cs create mode 100644 VeterinaryView/VeterinaryContracts/StorageContracts/IPetStorage.cs create mode 100644 VeterinaryView/VeterinaryContracts/StorageContracts/IPurchaseStorage.cs create mode 100644 VeterinaryView/VeterinaryContracts/StorageContracts/IVisitStorage.cs create mode 100644 VeterinaryView/VeterinaryContracts/ViewModels/OwnerViewModel.cs create mode 100644 VeterinaryView/VeterinaryContracts/ViewModels/PetViewModel.cs create mode 100644 VeterinaryView/VeterinaryContracts/ViewModels/PurchaseViewModel.cs create mode 100644 VeterinaryView/VeterinaryContracts/ViewModels/VisitViewModel.cs diff --git a/VeterinaryView/VeterinaryContracts/BindingModels/OwnerBindingModel.cs b/VeterinaryView/VeterinaryContracts/BindingModels/OwnerBindingModel.cs new file mode 100644 index 0000000..046422e --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/BindingModels/OwnerBindingModel.cs @@ -0,0 +1,12 @@ +using VeterinaryDataModels; + +namespace VeterinaryContracts.BindingModels +{ + public class OwnerBindingModel : IOwnerModel + { + public int Id { get; set; } + public string OwnerFIO { get; set; } = string.Empty; + public string Login { get; set; } = string.Empty; + public string Password { get; set; } = string.Empty; + } +} diff --git a/VeterinaryView/VeterinaryContracts/BindingModels/PetBindingModel.cs b/VeterinaryView/VeterinaryContracts/BindingModels/PetBindingModel.cs new file mode 100644 index 0000000..a4cb97c --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/BindingModels/PetBindingModel.cs @@ -0,0 +1,15 @@ +using VeterinaryDataModels; + +namespace VeterinaryContracts.BindingModels +{ + public class PetBindingModel : IPetModel + { + public int Id { get; set; } + public int OwnerId { get; set; } + public string PetName { get; set; } = string.Empty; + public string PetType { get; set;} = string.Empty; + public string PetBreed { get; set; } = string.Empty; + public string PetGender { get; set; } = string.Empty; + + } +} diff --git a/VeterinaryView/VeterinaryContracts/BindingModels/PurchaseBindingModel.cs b/VeterinaryView/VeterinaryContracts/BindingModels/PurchaseBindingModel.cs new file mode 100644 index 0000000..e3ca567 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/BindingModels/PurchaseBindingModel.cs @@ -0,0 +1,14 @@ +using VeterinaryDataModels; + +namespace VeterinaryContracts.BindingModels +{ + public class PurchaseBindingModel : IPurchaseModel + { + public int Id { get; set; } + public int OwnerId { get; set; } + public int DrugId { get; set; } + public int Count { get; set; } + public DateTime DatePurchase { get; set; } + public Dictionary PurchasePet { get; set; } = new(); + } +} diff --git a/VeterinaryView/VeterinaryContracts/BindingModels/VisitBindingModel.cs b/VeterinaryView/VeterinaryContracts/BindingModels/VisitBindingModel.cs new file mode 100644 index 0000000..4b9ac40 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/BindingModels/VisitBindingModel.cs @@ -0,0 +1,13 @@ +using VeterinaryDataModels; + +namespace VeterinaryContracts.BindingModels +{ + public class VisitBindingModel : IVisitModel + { + public int Id { get; set; } + public int OwnerId { get; set; } + public int? DoctorId { get; set; } = null; + public DateTime DateVisit { get; set; } + public Dictionary VisitPet { get; set; } = new(); + } +} diff --git a/VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IOwnerLogic.cs b/VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IOwnerLogic.cs new file mode 100644 index 0000000..5392ae7 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IOwnerLogic.cs @@ -0,0 +1,16 @@ +using VeterinaryContracts.BindingModels; +using VeterinaryContracts.SearchModels; +using VeterinaryContracts.ViewModels; + +namespace VeterinaryContracts.BusinessLogicContracts +{ + public interface IOwnerLogic + { + List? ReadList(OwnerSearchModel? model); + OwnerViewModel? ReadElement(OwnerSearchModel model); + bool Create(OwnerBindingModel model); + bool Update(OwnerBindingModel model); + bool Delete(OwnerBindingModel model); + + } +} diff --git a/VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IPetLogic.cs b/VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IPetLogic.cs new file mode 100644 index 0000000..8e41712 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IPetLogic.cs @@ -0,0 +1,15 @@ +using VeterinaryContracts.BindingModels; +using VeterinaryContracts.SearchModels; +using VeterinaryContracts.ViewModels; + +namespace VeterinaryContracts.BusinessLogicContracts +{ + public interface IPetLogic + { + List? ReadList(PetSearchModel? model); + PetViewModel? ReadElement(PetSearchModel model); + bool Create(PetBindingModel model); + bool Update(PetBindingModel model); + bool Delete(PetBindingModel model); + } +} diff --git a/VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IPurchaseLogic.cs b/VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IPurchaseLogic.cs new file mode 100644 index 0000000..2955fca --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IPurchaseLogic.cs @@ -0,0 +1,13 @@ +using VeterinaryContracts.BindingModels; +using VeterinaryContracts.SearchModels; +using VeterinaryContracts.ViewModels; + +namespace VeterinaryContracts.BusinessLogicContracts +{ + public interface IPurchaseLogic + { + List? ReadList(PurchaseSearchModel? model); + PurchaseViewModel? ReadElement(PurchaseSearchModel model); + bool CreateOrder(PurchaseBindingModel model); + } +} diff --git a/VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IVisitLogic.cs b/VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IVisitLogic.cs new file mode 100644 index 0000000..a6bdafc --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/BusinessLogicContracts/IVisitLogic.cs @@ -0,0 +1,13 @@ +using VeterinaryContracts.BindingModels; +using VeterinaryContracts.SearchModels; +using VeterinaryContracts.ViewModels; + +namespace VeterinaryContracts.BusinessLogicContracts +{ + public interface IVisitLogic + { + List? ReadList(VisitSearchModel? model); + VisitViewModel? ReadElement(VisitSearchModel model); + bool CreateVisit(VisitBindingModel model); + } +} diff --git a/VeterinaryView/VeterinaryContracts/SearchModels/OwnerSearchModel.cs b/VeterinaryView/VeterinaryContracts/SearchModels/OwnerSearchModel.cs new file mode 100644 index 0000000..e14560d --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/SearchModels/OwnerSearchModel.cs @@ -0,0 +1,10 @@ +namespace VeterinaryContracts.SearchModels +{ + public class OwnerSearchModel + { + public int? Id { get; set; } + public string? OwnerFIO { get; set; } + public string? Login { get; set; } + public string? Password { get; set; } + } +} diff --git a/VeterinaryView/VeterinaryContracts/SearchModels/PetSearchModel.cs b/VeterinaryView/VeterinaryContracts/SearchModels/PetSearchModel.cs new file mode 100644 index 0000000..da358f5 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/SearchModels/PetSearchModel.cs @@ -0,0 +1,8 @@ +namespace VeterinaryContracts.SearchModels +{ + public class PetSearchModel + { + public int? Id { get; set; } + public string? PetName { get; set; } + } +} diff --git a/VeterinaryView/VeterinaryContracts/SearchModels/PurchaseSearchModel.cs b/VeterinaryView/VeterinaryContracts/SearchModels/PurchaseSearchModel.cs new file mode 100644 index 0000000..0d126c5 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/SearchModels/PurchaseSearchModel.cs @@ -0,0 +1,10 @@ +namespace VeterinaryContracts.SearchModels +{ + public class PurchaseSearchModel + { + public int? Id { get; set; } + public int? OwnerId { get; set; } + public int? DrugId { get; set; } + public DateTime? DatePurchase { get; set; } + } +} diff --git a/VeterinaryView/VeterinaryContracts/SearchModels/VisitSearchModel.cs b/VeterinaryView/VeterinaryContracts/SearchModels/VisitSearchModel.cs new file mode 100644 index 0000000..914cf89 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/SearchModels/VisitSearchModel.cs @@ -0,0 +1,10 @@ +namespace VeterinaryContracts.SearchModels +{ + public class VisitSearchModel + { + public int? Id { get; set; } + public int? OwnerId { get; set; } + public int? DoctorId { get; set; } + public DateTime? DateVisit { get; set; } + } +} diff --git a/VeterinaryView/VeterinaryContracts/StorageContracts/IOwnerStorage.cs b/VeterinaryView/VeterinaryContracts/StorageContracts/IOwnerStorage.cs new file mode 100644 index 0000000..7c14cc5 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/StorageContracts/IOwnerStorage.cs @@ -0,0 +1,16 @@ +using VeterinaryContracts.BindingModels; +using VeterinaryContracts.SearchModels; +using VeterinaryContracts.ViewModels; + +namespace VeterinaryContracts.StorageContracts +{ + public interface IOwnerStorage + { + List GetFullList(); + List GetFilteredList(OwnerSearchModel model); + OwnerViewModel? GetElement(OwnerSearchModel model); + OwnerViewModel? Insert(OwnerBindingModel model); + OwnerViewModel? Update(OwnerBindingModel model); + OwnerViewModel? Delete(OwnerBindingModel model); + } +} diff --git a/VeterinaryView/VeterinaryContracts/StorageContracts/IPetStorage.cs b/VeterinaryView/VeterinaryContracts/StorageContracts/IPetStorage.cs new file mode 100644 index 0000000..9984635 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/StorageContracts/IPetStorage.cs @@ -0,0 +1,16 @@ +using VeterinaryContracts.BindingModels; +using VeterinaryContracts.SearchModels; +using VeterinaryContracts.ViewModels; + +namespace VeterinaryContracts.StorageContracts +{ + public interface IPetStorage + { + List GetFullList(); + List GetFilteredList(PetSearchModel model); + PetViewModel? GetElement(PetSearchModel model); + PetViewModel? Insert(PetBindingModel model); + PetViewModel? Update(PetBindingModel model); + PetViewModel? Delete(PetBindingModel model); + } +} diff --git a/VeterinaryView/VeterinaryContracts/StorageContracts/IPurchaseStorage.cs b/VeterinaryView/VeterinaryContracts/StorageContracts/IPurchaseStorage.cs new file mode 100644 index 0000000..3add211 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/StorageContracts/IPurchaseStorage.cs @@ -0,0 +1,16 @@ +using VeterinaryContracts.BindingModels; +using VeterinaryContracts.SearchModels; +using VeterinaryContracts.ViewModels; + +namespace VeterinaryContracts.StorageContracts +{ + public interface IPurchaseStorage + { + List GetFullList(); + List GetFilteredList(PurchaseSearchModel model); + PurchaseViewModel? GetElement(PurchaseSearchModel model); + PurchaseViewModel? Insert(PurchaseBindingModel model); + PurchaseViewModel? Update(PurchaseBindingModel model); + PurchaseViewModel? Delete(PurchaseBindingModel model); + } +} diff --git a/VeterinaryView/VeterinaryContracts/StorageContracts/IVisitStorage.cs b/VeterinaryView/VeterinaryContracts/StorageContracts/IVisitStorage.cs new file mode 100644 index 0000000..9702870 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/StorageContracts/IVisitStorage.cs @@ -0,0 +1,16 @@ +using VeterinaryContracts.BindingModels; +using VeterinaryContracts.SearchModels; +using VeterinaryContracts.ViewModels; + +namespace VeterinaryContracts.StorageContracts +{ + public interface IVisitStorage + { + List GetFullList(); + List GetFilteredList(VisitSearchModel model); + VisitViewModel? GetElement(VisitSearchModel model); + VisitViewModel? Insert(VisitBindingModel model); + VisitViewModel? Update(VisitBindingModel model); + VisitViewModel? Delete(VisitBindingModel model); + } +} diff --git a/VeterinaryView/VeterinaryContracts/VeterinaryContracts.csproj b/VeterinaryView/VeterinaryContracts/VeterinaryContracts.csproj index 80a6443..bb7c3dc 100644 --- a/VeterinaryView/VeterinaryContracts/VeterinaryContracts.csproj +++ b/VeterinaryView/VeterinaryContracts/VeterinaryContracts.csproj @@ -6,14 +6,6 @@ enable - - - - - - - - diff --git a/VeterinaryView/VeterinaryContracts/ViewModels/OwnerViewModel.cs b/VeterinaryView/VeterinaryContracts/ViewModels/OwnerViewModel.cs new file mode 100644 index 0000000..d562597 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/ViewModels/OwnerViewModel.cs @@ -0,0 +1,16 @@ +using System.ComponentModel; +using VeterinaryDataModels; + +namespace VeterinaryContracts.ViewModels +{ + public class OwnerViewModel : IOwnerModel + { + public int Id { get; set; } + [DisplayName("ФИО хозяина")] + public string OwnerFIO { get; set; } = string.Empty; + [DisplayName("Логин (эл. почта)")] + public string Login { get; set; } = string.Empty; + [DisplayName("Пароль")] + public string Password { get; set; } = string.Empty; + } +} diff --git a/VeterinaryView/VeterinaryContracts/ViewModels/PetViewModel.cs b/VeterinaryView/VeterinaryContracts/ViewModels/PetViewModel.cs new file mode 100644 index 0000000..593a4b8 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/ViewModels/PetViewModel.cs @@ -0,0 +1,20 @@ +using System.ComponentModel; +using VeterinaryDataModels; + +namespace VeterinaryContracts.ViewModels +{ + public class PetViewModel : IPetModel + { + public int Id { get; set; } + [DisplayName("Хозяин")] + public int OwnerId { get; set; } + [DisplayName("Кличка")] + public string PetName { get; set; } = string.Empty; + [DisplayName("Вид")] + public string PetType { get; set; } = string.Empty; + [DisplayName("Порода")] + public string PetBreed { get; set; } = string.Empty; + [DisplayName("Пол")] + public string PetGender { get; set; } = string.Empty; + } +} diff --git a/VeterinaryView/VeterinaryContracts/ViewModels/PurchaseViewModel.cs b/VeterinaryView/VeterinaryContracts/ViewModels/PurchaseViewModel.cs new file mode 100644 index 0000000..39399bd --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/ViewModels/PurchaseViewModel.cs @@ -0,0 +1,19 @@ +using System.ComponentModel; +using VeterinaryDataModels; + +namespace VeterinaryContracts.ViewModels +{ + public class PurchaseViewModel : IPurchaseModel + { + public int Id { get; set; } + [DisplayName("Хозяин")] + public int OwnerId { get; set; } + [DisplayName("Лекарство")] + public int DrugId { get; set; } + [DisplayName("Количество")] + public int Count { get; set; } + [DisplayName("Дата покупки")] + public DateTime DatePurchase { get; set; } + public Dictionary PurchasePet { get; set; } = new(); + } +} diff --git a/VeterinaryView/VeterinaryContracts/ViewModels/VisitViewModel.cs b/VeterinaryView/VeterinaryContracts/ViewModels/VisitViewModel.cs new file mode 100644 index 0000000..cdfc128 --- /dev/null +++ b/VeterinaryView/VeterinaryContracts/ViewModels/VisitViewModel.cs @@ -0,0 +1,17 @@ +using System.ComponentModel; +using VeterinaryDataModels; + +namespace VeterinaryContracts.ViewModels +{ + public class VisitViewModel : IVisitModel + { + public int Id { get; set; } + [DisplayName("Хозяин")] + public int OwnerId { get; set; } + [DisplayName("Врач")] + public int? DoctorId { get; set; } = null; + [DisplayName("Дата посещения")] + public DateTime DateVisit { get; set; } + public Dictionary VisitPet { get; set; } = new(); + } +} diff --git a/VeterinaryView/VeterinaryDataModels/IPurchaseModel.cs b/VeterinaryView/VeterinaryDataModels/IPurchaseModel.cs index e4e4fb8..2684d1b 100644 --- a/VeterinaryView/VeterinaryDataModels/IPurchaseModel.cs +++ b/VeterinaryView/VeterinaryDataModels/IPurchaseModel.cs @@ -4,7 +4,8 @@ { int OwnerId { get; } int DrugId { get; } - string Count { get; } + int Count { get; } DateTime DatePurchase { get; } + Dictionary PurchasePet { get; } } } diff --git a/VeterinaryView/VeterinaryDataModels/IVisitModel.cs b/VeterinaryView/VeterinaryDataModels/IVisitModel.cs index a912ab4..9314f88 100644 --- a/VeterinaryView/VeterinaryDataModels/IVisitModel.cs +++ b/VeterinaryView/VeterinaryDataModels/IVisitModel.cs @@ -3,7 +3,8 @@ public interface IVisitModel : IId { int OwnerId { get; } - int DoctorId { get; } + int? DoctorId { get; } DateTime DateVisit { get; } + Dictionary VisitPet { get; } } }