DepartmentProject/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeViewModels.cs

81 lines
3.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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", AllowCopyWithoutRigth = false)]
public DateTime DateBirth { get; set; }
[ViewModelControlListProperty("Адрес")]
[ViewModelControlElementProperty("Адрес", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("Address", AllowCopyWithoutRigth = false)]
public string Address { get; set; }
[ViewModelControlListProperty("Эл. почта")]
[ViewModelControlElementProperty("Эл. почта", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("Email", AllowCopyWithoutRigth = false)]
public string Email { get; set; }
[ViewModelControlListProperty("Моб. номер")]
[ViewModelControlElementProperty("Моб. номер", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("MobileNumber", AllowCopyWithoutRigth = false)]
public string MobileNumber { get; set; }
[ViewModelControlListProperty("Дом. номер")]
[ViewModelControlElementProperty("Дом. номер", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("HomeNumber", AllowCopyWithoutRigth = false)]
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)}";
}
}