From 999fb75c989f2484b292fd9b39bbbe9f3d11e4ae Mon Sep 17 00:00:00 2001 From: kotcheshir73 Date: Sat, 3 Apr 2021 09:18:19 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=BE=D0=B3=D0=B8=D0=BA=D0=B0=20=D1=81?= =?UTF-8?q?=D0=B2=D1=8F=D0=B7=D0=B5=D0=B9=20=D1=81=D0=BE=D1=82=D1=80=D1=83?= =?UTF-8?q?=D0=B4=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2=20=D0=B8=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=BB=D0=B6=D0=BD=D0=BE=D1=81=D1=82=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BindingModels/EmployeeBindingModels.cs | 8 ++- .../EmployeeEmployeePostBindingModels.cs | 41 ++++++++++++++ .../EmployeePostBindingModels.cs | 6 ++ .../EmployeeEmployeePostBusinessLogic.cs | 16 ++++++ .../IEmployeeEmployeePostService.cs | 10 ++++ .../EmployeeEmployeePostViewModels.cs | 56 +++++++++++++++++++ .../ViewModels/EmployeeViewModels.cs | 16 +++--- 7 files changed, 144 insertions(+), 9 deletions(-) create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeeEmployeePostBindingModels.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/EmployeeEmployeePostBusinessLogic.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IEmployeeEmployeePostService.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeEmployeePostViewModels.cs diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeeBindingModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeeBindingModels.cs index 7a69e2a..1db4e0a 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeeBindingModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeeBindingModels.cs @@ -5,10 +5,16 @@ using System.ComponentModel.DataAnnotations; namespace DepartmentBusinessLogic.BindingModels { - public class EmployeeGetBindingModel : GetBindingModel + /// + /// Получение сотрудника + /// + public class EmployeeGetBindingModel : GetBindingModel { } + /// + /// Сохранение сотрудника + /// public class EmployeeSetBindingModel : SetBindingModel { [Required(ErrorMessage = "required")] diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeeEmployeePostBindingModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeeEmployeePostBindingModels.cs new file mode 100644 index 0000000..9492eb7 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeeEmployeePostBindingModels.cs @@ -0,0 +1,41 @@ +using ModuleTools.Attributes; +using ModuleTools.BindingModels; +using System; +using System.ComponentModel.DataAnnotations; + +namespace DepartmentBusinessLogic.BindingModels +{ + /// + /// Получение связи сотрудника с должностью + /// + public class EmployeeEmployeePostGetBindingModel : GetBindingModel + { + public Guid? EmployeeId { get; set; } + + public Guid? EmployeePostId { get; set; } + } + + /// + /// Сохранение связи сотрудника с должностью + /// + public class EmployeeEmployeePostSetBindingModel : SetBindingModel + { + [Required(ErrorMessage = "required")] + [MapConfiguration("EmployeeId")] + public Guid EmployeeId { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("EmployeePostId")] + public Guid EmployeePostId { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("Rate")] + public decimal Rate { get; set; } + + [MapConfiguration("IsInternalCombination")] + public bool IsInternalCombination { get; set; } + + [MapConfiguration("IsExternalCombination")] + public bool IsExternalCombination { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeePostBindingModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeePostBindingModels.cs index 2627fae..a2a4a15 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeePostBindingModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeePostBindingModels.cs @@ -4,10 +4,16 @@ using System.ComponentModel.DataAnnotations; namespace DepartmentBusinessLogic.BindingModels { + /// + /// Получение должности сотрудника + /// public class EmployeePostGetBindingModel : GetBindingModel { } + /// + /// Сохранение должности сотрудника + /// public class EmployeePostSetBindingModel : SetBindingModel { [Required(ErrorMessage = "required")] diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/EmployeeEmployeePostBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/EmployeeEmployeePostBusinessLogic.cs new file mode 100644 index 0000000..8e95cb8 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/EmployeeEmployeePostBusinessLogic.cs @@ -0,0 +1,16 @@ +using DepartmentBusinessLogic.BindingModels; +using DepartmentBusinessLogic.Interfaces; +using DepartmentBusinessLogic.ViewModels; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; + +namespace DepartmentBusinessLogic.BusinessLogics +{ + /// + /// Логика работы со связями сотрудников и должностей + /// + public class EmployeeEmployeePostBusinessLogic : GenericBusinessLogic + { + public EmployeeEmployeePostBusinessLogic(IEmployeeEmployeePostService service) : base(service, "Должности сотрудников", AccessOperation.Сотрудники) { } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IEmployeeEmployeePostService.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IEmployeeEmployeePostService.cs new file mode 100644 index 0000000..4af5d78 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IEmployeeEmployeePostService.cs @@ -0,0 +1,10 @@ +using DepartmentBusinessLogic.BindingModels; +using ModuleTools.Interfaces; + +namespace DepartmentBusinessLogic.Interfaces +{ + /// + /// Хранение связей сотрудников и должностей + /// + public interface IEmployeeEmployeePostService : IGenerticEntityService { } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeEmployeePostViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeEmployeePostViewModels.cs new file mode 100644 index 0000000..7ce2119 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeEmployeePostViewModels.cs @@ -0,0 +1,56 @@ +using ModuleTools.Attributes; +using ModuleTools.Enums; +using ModuleTools.ViewModels; +using System; + +namespace DepartmentBusinessLogic.ViewModels +{ + /// + /// Список связей сотрудников и должностей + /// + public class EmployeeEmployeePostListViewModel : ListViewModel { } + + /// + /// Связь сотрудника и должности + /// + [ViewModelControlElementClass()] + public class EmployeeEmployeePostViewModel : ElementViewModel + { + [MapConfiguration("EmployeeId", AllowCopyWithoutRigth = false)] + // [ViewModelControlElementProperty("Сотрудник", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserList, SecurityWindowsDesktop")] + public Guid EmployeeId { get; set; } + + [ViewModelControlListProperty("Сотрудник")] + [MapConfiguration("Employee.LastName", IsDifficle = true)] + public string EmployeeName { get; set; } + + [MapConfiguration("EmployeePostId")] + //[ViewModelControlElementProperty("Должность", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlRoleList, SecurityWindowsDesktop")] + public Guid EmployeePostId { get; set; } + + [ViewModelControlListProperty("Должность")] + [MapConfiguration("EmployeePost.PostName", IsDifficle = true)] + public string EmployeePostName { get; set; } + + [ViewModelControlListProperty("Ставка", 80)] + [ViewModelControlElementProperty("Ставка", ControlType.ControlDecimal, MustHaveValue = true)] + [MapConfiguration("Rate")] + public decimal Rate { get; set; } + + [ViewModelControlElementProperty("Внутр. совм.", ControlType.ControlBool)] + [MapConfiguration("IsInternalCombination")] + public bool IsInternalCombination { get; set; } + + [ViewModelControlListProperty("Внутр. совм.", 80)] + public string InternalCombination => IsInternalCombination ? "Да" : "Нет"; + + [ViewModelControlElementProperty("Внеш. совм.", ControlType.ControlBool)] + [MapConfiguration("IsExternalCombination")] + public bool IsExternalCombination { get; set; } + + [ViewModelControlListProperty("Внеш. совм.", 80)] + public string ExternalCombination => IsExternalCombination ? "Да" : "Нет"; + + public override string ToString() => $"{EmployeeName}-{EmployeePostName}"; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeViewModels.cs index 865015d..4b1b3b4 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeViewModels.cs @@ -7,12 +7,12 @@ using System; namespace DepartmentBusinessLogic.ViewModels { /// - /// Список ролей + /// Список сотрудников /// public class EmployeeListViewModel : ListViewModel { } /// - /// Элемент ролей + /// Элемент сотрудник /// [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)] //[ViewModelControlElementDependenceEntity(Title = "Сотрудники", Order = 1, ParentPropertyName = "EmployeePostId", @@ -38,28 +38,28 @@ namespace DepartmentBusinessLogic.ViewModels public string Patronymic { get; set; } [ViewModelControlListProperty("Отчество")] - [ViewModelControlElementProperty("Отчество", ControlType.ControlDateTime, MustHaveValue = true)] - [MapConfiguration("DateBirth")] + [ViewModelControlElementProperty("Отчество", ControlType.ControlDateTime, MustHaveValue = true )] + [MapConfiguration("DateBirth", AllowCopyWithoutRigth = false)] public DateTime DateBirth { get; set; } [ViewModelControlListProperty("Адрес")] [ViewModelControlElementProperty("Адрес", ControlType.ControlString, MustHaveValue = true)] - [MapConfiguration("Address")] + [MapConfiguration("Address", AllowCopyWithoutRigth = false)] public string Address { get; set; } [ViewModelControlListProperty("Эл. почта")] [ViewModelControlElementProperty("Эл. почта", ControlType.ControlString, MustHaveValue = true)] - [MapConfiguration("Email")] + [MapConfiguration("Email", AllowCopyWithoutRigth = false)] public string Email { get; set; } [ViewModelControlListProperty("Моб. номер")] [ViewModelControlElementProperty("Моб. номер", ControlType.ControlString, MustHaveValue = true)] - [MapConfiguration("MobileNumber")] + [MapConfiguration("MobileNumber", AllowCopyWithoutRigth = false)] public string MobileNumber { get; set; } [ViewModelControlListProperty("Дом. номер")] [ViewModelControlElementProperty("Дом. номер", ControlType.ControlString, MustHaveValue = true)] - [MapConfiguration("HomeNumber")] + [MapConfiguration("HomeNumber", AllowCopyWithoutRigth = false)] public string HomeNumber { get; set; } [ViewModelControlElementProperty("Описание", ControlType.ControlText, MustHaveValue = true)]