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 = "DepartmentWindowsDesktop.EntityControls.ControlEmployeeList, DepartmentWindowsDesktop")] 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 = "DepartmentWindowsDesktop.EntityControls.ControlEmployeePostList, DepartmentWindowsDesktop")] public Guid EmployeePostId { get; set; } [ViewModelControlListProperty("Должность")] [MapConfiguration("EmployeePost.EmployeePostName", IsDifficle = true)] public string EmployeePostName { get; set; } [ViewModelControlListProperty("Ставка", 80)] [ViewModelControlElementProperty("Ставка", ControlType.ControlDecimal, DecimalPlaces = 1, MustHaveValue = true)] [MapConfiguration("Rate")] public decimal Rate { get; set; } [ViewModelControlElementProperty("Внутр. совм.", ControlType.ControlBool, MustHaveValue = true)] [MapConfiguration("IsInternalCombination")] public bool IsInternalCombination { get; set; } [ViewModelControlListProperty("Внутр. совм.", 80)] public string InternalCombination => IsInternalCombination ? "Да" : "Нет"; [ViewModelControlElementProperty("Внеш. совм.", ControlType.ControlBool, MustHaveValue = true)] [MapConfiguration("IsExternalCombination")] public bool IsExternalCombination { get; set; } [ViewModelControlListProperty("Внеш. совм.", 80)] public string ExternalCombination => IsExternalCombination ? "Да" : "Нет"; public override string ToString() => $"{EmployeeName}-{EmployeePostName}"; } }