бизнес-логика сотрудников
This commit is contained in:
parent
f2921ecc7a
commit
94b54e712e
@ -0,0 +1,57 @@
|
||||
using ModuleTools.Attributes;
|
||||
using ModuleTools.BindingModels;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace DepartmentBusinessLogic.BindingModels
|
||||
{
|
||||
public class EmployeeGetBindingModel : GetBindingModel
|
||||
{
|
||||
}
|
||||
|
||||
public class EmployeeSetBindingModel : SetBindingModel
|
||||
{
|
||||
[Required(ErrorMessage = "required")]
|
||||
[MapConfiguration("UserId")]
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "required")]
|
||||
[MapConfiguration("FirstName")]
|
||||
public string FirstName { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "required")]
|
||||
[MapConfiguration("LastName")]
|
||||
public string LastName { get; set; }
|
||||
|
||||
[MapConfiguration("Patronymic")]
|
||||
public string Patronymic { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "required")]
|
||||
[MapConfiguration("DateBirth")]
|
||||
public DateTime DateBirth { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "required")]
|
||||
[MapConfiguration("Address")]
|
||||
public string Address { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "required")]
|
||||
[MapConfiguration("Email")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "required")]
|
||||
[MapConfiguration("MobileNumber")]
|
||||
public string MobileNumber { get; set; }
|
||||
|
||||
[MapConfiguration("HomeNumber")]
|
||||
public string HomeNumber { get; set; }
|
||||
|
||||
[MapConfiguration("Description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[MapConfiguration("Photo")]
|
||||
public byte[] Photo { get; set; }
|
||||
|
||||
[MapConfiguration("GroupElectricalSafety")]
|
||||
public string GroupElectricalSafety { get; set; }
|
||||
}
|
||||
}
|
@ -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 EmployeeBusinessLogic : GenericBusinessLogic<EmployeeGetBindingModel, EmployeeSetBindingModel, EmployeeListViewModel, EmployeeViewModel>
|
||||
{
|
||||
public EmployeeBusinessLogic(IEmployeeService service) : base(service, "Сотрудники", AccessOperation.Сотрудники) { }
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
using DepartmentBusinessLogic.BindingModels;
|
||||
using ModuleTools.Interfaces;
|
||||
|
||||
namespace DepartmentBusinessLogic.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Хранение сотрудников
|
||||
/// </summary>
|
||||
public interface IEmployeeService : IGenerticEntityService<EmployeeGetBindingModel, EmployeeSetBindingModel> { }
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
using ModuleTools.Attributes;
|
||||
using ModuleTools.Enums;
|
||||
using ModuleTools.Extensions;
|
||||
using ModuleTools.ViewModels;
|
||||
using System;
|
||||
|
||||
namespace DepartmentBusinessLogic.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Список ролей
|
||||
/// </summary>
|
||||
public class EmployeeListViewModel : ListViewModel<EmployeeViewModel> { }
|
||||
|
||||
/// <summary>
|
||||
/// Элемент ролей
|
||||
/// </summary>
|
||||
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
|
||||
//[ViewModelControlElementDependenceEntity(Title = "Сотрудники", Order = 1, ParentPropertyName = "EmployeePostId",
|
||||
// ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlRoleUserList, SecurityWindowsDesktop")]
|
||||
public class EmployeeViewModel : ElementViewModel
|
||||
{
|
||||
[MapConfiguration("UserId")]
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Имя")]
|
||||
[ViewModelControlElementProperty("Имя", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("FirstName")]
|
||||
public string FirstName { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Фамилия")]
|
||||
[ViewModelControlElementProperty("Фамилия", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("LastName")]
|
||||
public string LastName { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Отчество")]
|
||||
[ViewModelControlElementProperty("Отчество", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("Patronymic")]
|
||||
public string Patronymic { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Отчество")]
|
||||
[ViewModelControlElementProperty("Отчество", ControlType.ControlDateTime, MustHaveValue = true)]
|
||||
[MapConfiguration("DateBirth")]
|
||||
public DateTime DateBirth { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Адрес")]
|
||||
[ViewModelControlElementProperty("Адрес", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("Address")]
|
||||
public string Address { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Эл. почта")]
|
||||
[ViewModelControlElementProperty("Эл. почта", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("Email")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Моб. номер")]
|
||||
[ViewModelControlElementProperty("Моб. номер", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("MobileNumber")]
|
||||
public string MobileNumber { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Дом. номер")]
|
||||
[ViewModelControlElementProperty("Дом. номер", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("HomeNumber")]
|
||||
public string HomeNumber { get; set; }
|
||||
|
||||
[ViewModelControlElementProperty("Описание", ControlType.ControlText, MustHaveValue = true)]
|
||||
[MapConfiguration("Description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[ViewModelControlElementProperty("Фото", ControlType.ControlImage, MustHaveValue = true)]
|
||||
[MapConfiguration("Photo")]
|
||||
public byte[] Photo { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Группа эл.безоп")]
|
||||
[ViewModelControlElementProperty("Группа эл.безоп", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("GroupElectricalSafety")]
|
||||
public string GroupElectricalSafety { get; set; }
|
||||
|
||||
public override string ToString() =>
|
||||
$"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user