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

41 lines
1.8 KiB
C#

using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
namespace DepartmentBusinessLogic.ViewModels
{
/// <summary>
/// Список должностей
/// </summary>
public class PostListViewModel : ListViewModel<PostViewModel> { }
/// <summary>
/// Элемент должности
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
[ViewModelControlElementDependenceEntity(Title = "Сотрудники", Order = 1, ParentPropertyName = "PostId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlEmployeePostList, DepartmentWindowsDesktop")]
[ViewModelControlElementDependenceEntity(Title = "Преподаватели", Order = 1, ParentPropertyName = "PostId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerPostList, DepartmentWindowsDesktop")]
public class PostViewModel : ElementViewModel
{
[ViewModelControlListProperty("Название должности")]
[ViewModelControlElementProperty("Название должности", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("PostName")]
public string PostName { get; set; }
[ViewModelControlElementProperty("Часы", ControlType.ControlInt, MustHaveValue = false)]
[MapConfiguration("Hours")]
public int? Hours { get; set; }
[ViewModelControlListProperty("Часы", ColumnWidth = 100)]
public string HoursStr => Hours.HasValue ? Hours.ToString() : string.Empty;
[ViewModelControlListProperty("Порядок", ColumnWidth = 100)]
[ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("Order")]
public int Order { get; set; }
public override string ToString() => PostName;
}
}