Бизнес-логика по должностям сотрудников

This commit is contained in:
kotcheshir73 2021-04-02 22:44:29 +04:00
parent 99bcbb6945
commit 4230c26a1a
5 changed files with 83 additions and 4 deletions

View File

@ -0,0 +1,21 @@
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System.ComponentModel.DataAnnotations;
namespace DepartmentBusinessLogic.BindingModels
{
public class EmployeePostGetBindingModel : GetBindingModel
{
}
public class EmployeePostSetBindingModel : SetBindingModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("EmployeePostName")]
public string EmployeePostName { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("Order")]
public int Order { get; set; }
}
}

View File

@ -0,0 +1,16 @@
using DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.Interfaces;
using DepartmentBusinessLogic.ViewModels;
using ModuleTools.BusinessLogics;
using ModuleTools.Enums;
namespace DepartmentBusinessLogic.BusinessLogics
{
/// <summary>
/// Логика работы с должностями сотрудников
/// </summary>
public class EmployeePostBusinessLogic : GenericBusinessLogic<EmployeePostGetBindingModel, EmployeePostSetBindingModel, EmployeePostListViewModel, EmployeePostViewModel>
{
public EmployeePostBusinessLogic(IEmployeePostService service) : base(service, "Должности сотрудников", AccessOperation.Сотрудники) { }
}
}

View File

@ -5,11 +5,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Folder Include="BindingModels\" /> <ProjectReference Include="..\..\Common\ModuleTools\ModuleTools.csproj" />
<Folder Include="BusinessLogics\" /> </ItemGroup>
<ItemGroup>
<Folder Include="Enums\" /> <Folder Include="Enums\" />
<Folder Include="Interfaces\" />
<Folder Include="ViewModels\" />
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -0,0 +1,10 @@
using DepartmentBusinessLogic.BindingModels;
using ModuleTools.Interfaces;
namespace DepartmentBusinessLogic.Interfaces
{
/// <summary>
/// Хранение должностей сотрудников
/// </summary>
public interface IEmployeePostService : IGenerticEntityService<EmployeePostGetBindingModel, EmployeePostSetBindingModel> { }
}

View File

@ -0,0 +1,32 @@
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
namespace DepartmentBusinessLogic.ViewModels
{
/// <summary>
/// Список ролей
/// </summary>
public class EmployeePostListViewModel : ListViewModel<EmployeePostViewModel> { }
/// <summary>
/// Элемент ролей
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
//[ViewModelControlElementDependenceEntity(Title = "Сотрудники", Order = 1, ParentPropertyName = "EmployeePostId",
// ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlRoleUserList, SecurityWindowsDesktop")]
public class EmployeePostViewModel : ElementViewModel
{
[ViewModelControlListProperty("Название должность")]
[ViewModelControlElementProperty("Название должность", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("EmployeePostName")]
public string EmployeePostName { get; set; }
[ViewModelControlListProperty("Порядок", 100)]
[ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("Order")]
public int Order { get; set; }
public override string ToString() => EmployeePostName;
}
}