From 6e91db5f8f84b632201251e8e8f877ef4bca9fa7 Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Sat, 27 Apr 2024 22:59:12 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BB=20=D1=81=D1=83?= =?UTF-8?q?=D1=89=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20"=D0=B8=D1=81=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D0=BD=D0=B8=D1=82=D0=B5=D0=BB=D1=8C",=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20=D0=B2=D0=BC=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=BE=20=D0=BD=D0=B5=D0=B5=20=D1=81=D1=83=D1=89=D0=BD?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D1=8C=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8F=20=D0=B8=20=D0=BF=D0=B5?= =?UTF-8?q?=D1=80=D0=B5=D1=87=D0=B8=D1=81=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=80=D0=BE=D0=BB=D0=B5=D0=B9.=20=D0=97=D0=B0=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=BB=20=D0=B2=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D1=8F=D1=85=20=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B8=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8=D1=82=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=81=D1=81=D1=8B=D0=BB=D0=BA=D0=B0=D0=BC=D0=B8=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BindingModels/DiagnosisBindingModel.cs | 2 +- ...torBindingModel.cs => UserBindingModel.cs} | 6 ++++-- .../BusinessLogicsContracts/IExecutorLogic.cs | 15 --------------- .../BusinessLogicsContracts/IUserLogic.cs | 15 +++++++++++++++ .../SearchModels/DiagnosisSearchModel.cs | 2 +- ...cutorSearchModel.cs => UserSearchModel.cs} | 2 +- .../StoragesContracts/IExecutorStorage.cs | 16 ---------------- .../StoragesContracts/IUserStorage.cs | 16 ++++++++++++++++ .../ViewModels/DiagnosisViewModel.cs | 2 +- .../ViewModels/ExecutorViewModel.cs | 15 --------------- .../ViewModels/UserViewModel.cs | 19 +++++++++++++++++++ .../PolyclinicDataModels/Enums/UserRole.cs | 10 ++++++++++ .../Models/IDiagnosisModel.cs | 2 +- .../Models/IExecutorModel.cs | 9 --------- .../Models/ISuretorModel.cs | 15 --------------- .../PolyclinicDataModels/Models/IUserModel.cs | 12 ++++++++++++ 16 files changed, 81 insertions(+), 77 deletions(-) rename Polyclinic/PolyclinicContracts/BindingModels/{ExecutorBindingModel.cs => UserBindingModel.cs} (57%) delete mode 100644 Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IExecutorLogic.cs create mode 100644 Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IUserLogic.cs rename Polyclinic/PolyclinicContracts/SearchModels/{ExecutorSearchModel.cs => UserSearchModel.cs} (83%) delete mode 100644 Polyclinic/PolyclinicContracts/StoragesContracts/IExecutorStorage.cs create mode 100644 Polyclinic/PolyclinicContracts/StoragesContracts/IUserStorage.cs delete mode 100644 Polyclinic/PolyclinicContracts/ViewModels/ExecutorViewModel.cs create mode 100644 Polyclinic/PolyclinicContracts/ViewModels/UserViewModel.cs create mode 100644 Polyclinic/PolyclinicDataModels/Enums/UserRole.cs delete mode 100644 Polyclinic/PolyclinicDataModels/Models/IExecutorModel.cs delete mode 100644 Polyclinic/PolyclinicDataModels/Models/ISuretorModel.cs create mode 100644 Polyclinic/PolyclinicDataModels/Models/IUserModel.cs diff --git a/Polyclinic/PolyclinicContracts/BindingModels/DiagnosisBindingModel.cs b/Polyclinic/PolyclinicContracts/BindingModels/DiagnosisBindingModel.cs index 9d936df..6827d46 100644 --- a/Polyclinic/PolyclinicContracts/BindingModels/DiagnosisBindingModel.cs +++ b/Polyclinic/PolyclinicContracts/BindingModels/DiagnosisBindingModel.cs @@ -6,7 +6,7 @@ namespace PolyclinicContracts.BindingModels { public string Name { get; set; } = string.Empty; public string Comment { get; set; } = string.Empty; - public int ExecutorId { get; set; } + public int UserId { get; set; } public int Id { get; set; } } } diff --git a/Polyclinic/PolyclinicContracts/BindingModels/ExecutorBindingModel.cs b/Polyclinic/PolyclinicContracts/BindingModels/UserBindingModel.cs similarity index 57% rename from Polyclinic/PolyclinicContracts/BindingModels/ExecutorBindingModel.cs rename to Polyclinic/PolyclinicContracts/BindingModels/UserBindingModel.cs index f97a6fe..9b66a0d 100644 --- a/Polyclinic/PolyclinicContracts/BindingModels/ExecutorBindingModel.cs +++ b/Polyclinic/PolyclinicContracts/BindingModels/UserBindingModel.cs @@ -1,12 +1,14 @@ -using PolyclinicDataModels.Models; +using PolyclinicDataModels.Enums; +using PolyclinicDataModels.Models; namespace PolyclinicContracts.BindingModels { - public class ExecutorBindingModel : IExecutorModel + public class UserBindingModel : IUserModel { public string FIO { get; set; } = string.Empty; public string Email { get; set; } = string.Empty; public string Password { get; set; } = string.Empty; + public UserRole Role { get; set; } = UserRole.Неизвестный; public int Id { get; set; } } } diff --git a/Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IExecutorLogic.cs b/Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IExecutorLogic.cs deleted file mode 100644 index 59e4d22..0000000 --- a/Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IExecutorLogic.cs +++ /dev/null @@ -1,15 +0,0 @@ -using PolyclinicContracts.BindingModels; -using PolyclinicContracts.SearchModels; -using PolyclinicContracts.ViewModels; - -namespace PolyclinicContracts.BusinessLogicsContracts -{ - public interface IExecutorLogic - { - List? ReadList(ExecutorSearchModel? model); - ExecutorViewModel? ReadElement(ExecutorSearchModel model); - bool Create(ExecutorBindingModel model); - bool Update(ExecutorBindingModel model); - bool Delete(ExecutorBindingModel model); - } -} diff --git a/Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IUserLogic.cs b/Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IUserLogic.cs new file mode 100644 index 0000000..7be0b9b --- /dev/null +++ b/Polyclinic/PolyclinicContracts/BusinessLogicsContracts/IUserLogic.cs @@ -0,0 +1,15 @@ +using PolyclinicContracts.BindingModels; +using PolyclinicContracts.SearchModels; +using PolyclinicContracts.ViewModels; + +namespace PolyclinicContracts.BusinessLogicsContracts +{ + public interface IUserLogic + { + List? ReadList(UserSearchModel? model); + UserViewModel? ReadElement(UserSearchModel model); + bool Create(UserBindingModel model); + bool Update(UserBindingModel model); + bool Delete(UserBindingModel model); + } +} diff --git a/Polyclinic/PolyclinicContracts/SearchModels/DiagnosisSearchModel.cs b/Polyclinic/PolyclinicContracts/SearchModels/DiagnosisSearchModel.cs index 812bfa3..03435b6 100644 --- a/Polyclinic/PolyclinicContracts/SearchModels/DiagnosisSearchModel.cs +++ b/Polyclinic/PolyclinicContracts/SearchModels/DiagnosisSearchModel.cs @@ -3,6 +3,6 @@ public class DiagnosisSearchModel { public int? Id { get; set; } - public int? ExecutorId { get; set; } + public int? UserId { get; set; } } } diff --git a/Polyclinic/PolyclinicContracts/SearchModels/ExecutorSearchModel.cs b/Polyclinic/PolyclinicContracts/SearchModels/UserSearchModel.cs similarity index 83% rename from Polyclinic/PolyclinicContracts/SearchModels/ExecutorSearchModel.cs rename to Polyclinic/PolyclinicContracts/SearchModels/UserSearchModel.cs index 872b783..00ec1f2 100644 --- a/Polyclinic/PolyclinicContracts/SearchModels/ExecutorSearchModel.cs +++ b/Polyclinic/PolyclinicContracts/SearchModels/UserSearchModel.cs @@ -1,6 +1,6 @@ namespace PolyclinicContracts.SearchModels { - public class ExecutorSearchModel + public class UserSearchModel { public int? Id { get; set; } public string? Email { get; set; } diff --git a/Polyclinic/PolyclinicContracts/StoragesContracts/IExecutorStorage.cs b/Polyclinic/PolyclinicContracts/StoragesContracts/IExecutorStorage.cs deleted file mode 100644 index 331af33..0000000 --- a/Polyclinic/PolyclinicContracts/StoragesContracts/IExecutorStorage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using PolyclinicContracts.BindingModels; -using PolyclinicContracts.SearchModels; -using PolyclinicContracts.ViewModels; - -namespace PolyclinicContracts.StoragesContracts -{ - public interface IExecutorStorage - { - List GetFullList(); - List GetFilteredList(ExecutorSearchModel model); - ExecutorViewModel? GetElement(ExecutorSearchModel model); - ExecutorViewModel? Insert(ExecutorBindingModel model); - ExecutorViewModel? Update(ExecutorBindingModel model); - ExecutorViewModel? Delete(ExecutorBindingModel model); - } -} diff --git a/Polyclinic/PolyclinicContracts/StoragesContracts/IUserStorage.cs b/Polyclinic/PolyclinicContracts/StoragesContracts/IUserStorage.cs new file mode 100644 index 0000000..810fee5 --- /dev/null +++ b/Polyclinic/PolyclinicContracts/StoragesContracts/IUserStorage.cs @@ -0,0 +1,16 @@ +using PolyclinicContracts.BindingModels; +using PolyclinicContracts.SearchModels; +using PolyclinicContracts.ViewModels; + +namespace PolyclinicContracts.StoragesContracts +{ + public interface IUserStorage + { + List GetFullList(); + List GetFilteredList(UserSearchModel model); + UserViewModel? GetElement(UserSearchModel model); + UserViewModel? Insert(UserBindingModel model); + UserViewModel? Update(UserBindingModel model); + UserViewModel? Delete(UserBindingModel model); + } +} diff --git a/Polyclinic/PolyclinicContracts/ViewModels/DiagnosisViewModel.cs b/Polyclinic/PolyclinicContracts/ViewModels/DiagnosisViewModel.cs index 10f4d44..8140660 100644 --- a/Polyclinic/PolyclinicContracts/ViewModels/DiagnosisViewModel.cs +++ b/Polyclinic/PolyclinicContracts/ViewModels/DiagnosisViewModel.cs @@ -9,7 +9,7 @@ namespace PolyclinicContracts.ViewModels public string Name { get; set; } = string.Empty; [DisplayName("Комментарий")] public string Comment { get; set; } = string.Empty; - public int ExecutorId { get; set; } + public int UserId { get; set; } public int Id { get; set; } } } diff --git a/Polyclinic/PolyclinicContracts/ViewModels/ExecutorViewModel.cs b/Polyclinic/PolyclinicContracts/ViewModels/ExecutorViewModel.cs deleted file mode 100644 index 04f492c..0000000 --- a/Polyclinic/PolyclinicContracts/ViewModels/ExecutorViewModel.cs +++ /dev/null @@ -1,15 +0,0 @@ -using PolyclinicDataModels.Models; -using System.ComponentModel; - -namespace PolyclinicContracts.ViewModels -{ - public class ExecutorViewModel : IExecutorModel - { - [DisplayName("ФИО исполнителя")] - public string FIO { get; set; } = string.Empty; - [DisplayName("Email исполнителя")] - public string Email { get; set; } = string.Empty; - public string Password { get; set; } = string.Empty; - public int Id { get; set; } - } -} diff --git a/Polyclinic/PolyclinicContracts/ViewModels/UserViewModel.cs b/Polyclinic/PolyclinicContracts/ViewModels/UserViewModel.cs new file mode 100644 index 0000000..3dece25 --- /dev/null +++ b/Polyclinic/PolyclinicContracts/ViewModels/UserViewModel.cs @@ -0,0 +1,19 @@ +using PolyclinicDataModels.Enums; +using PolyclinicDataModels.Models; +using System.ComponentModel; + +namespace PolyclinicContracts.ViewModels +{ + public class UserViewModel : IUserModel + { + [DisplayName("ФИО")] + public string FIO { get; set; } = string.Empty; + [DisplayName("Email")] + public string Email { get; set; } = string.Empty; + [DisplayName("Пароль")] + public string Password { get; set; } = string.Empty; + [DisplayName("Роль")] + public UserRole Role { get; set; } = UserRole.Неизвестный; + public int Id { get; set; } + } +} diff --git a/Polyclinic/PolyclinicDataModels/Enums/UserRole.cs b/Polyclinic/PolyclinicDataModels/Enums/UserRole.cs new file mode 100644 index 0000000..fbf5684 --- /dev/null +++ b/Polyclinic/PolyclinicDataModels/Enums/UserRole.cs @@ -0,0 +1,10 @@ +namespace PolyclinicDataModels.Enums +{ + public enum UserRole + { + Неизвестный = -1, + Администратор = 0, + Исполнитель = 1, + Поручитель = 2 + } +} diff --git a/Polyclinic/PolyclinicDataModels/Models/IDiagnosisModel.cs b/Polyclinic/PolyclinicDataModels/Models/IDiagnosisModel.cs index 7e23ea8..9a6c0a3 100644 --- a/Polyclinic/PolyclinicDataModels/Models/IDiagnosisModel.cs +++ b/Polyclinic/PolyclinicDataModels/Models/IDiagnosisModel.cs @@ -4,6 +4,6 @@ { string Name { get; } string Comment { get; } - int ExecutorId { get; } + int UserId { get; } } } diff --git a/Polyclinic/PolyclinicDataModels/Models/IExecutorModel.cs b/Polyclinic/PolyclinicDataModels/Models/IExecutorModel.cs deleted file mode 100644 index 44b0365..0000000 --- a/Polyclinic/PolyclinicDataModels/Models/IExecutorModel.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace PolyclinicDataModels.Models -{ - public interface IExecutorModel : IId - { - string FIO { get; } - string Email { get; } - string Password { get; } - } -} diff --git a/Polyclinic/PolyclinicDataModels/Models/ISuretorModel.cs b/Polyclinic/PolyclinicDataModels/Models/ISuretorModel.cs deleted file mode 100644 index e88c68f..0000000 --- a/Polyclinic/PolyclinicDataModels/Models/ISuretorModel.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace PolyclinicDataModels.Models -{ - public interface ISuretorModel : IId - { - string FIO { get; } - string Password { get; } - string Email { get; } - } -} diff --git a/Polyclinic/PolyclinicDataModels/Models/IUserModel.cs b/Polyclinic/PolyclinicDataModels/Models/IUserModel.cs new file mode 100644 index 0000000..cb10e4c --- /dev/null +++ b/Polyclinic/PolyclinicDataModels/Models/IUserModel.cs @@ -0,0 +1,12 @@ +using PolyclinicDataModels.Enums; + +namespace PolyclinicDataModels.Models +{ + public interface IUserModel : IId + { + string FIO { get; } + string Email { get; } + string Password { get; } + UserRole Role { get; } + } +}