using CoreModels.Enums.Department; using CoreModels.ModelsDepartment; using ToolsModule.Attributes; using ToolsModule.Enums; using ToolsModule.ViewModels; using System; namespace DepartmentContract.ViewModels { /// /// Список аудиторий /// public class ClassroomListViewModel : ListViewModel { } /// /// Элемент аудитории /// [ViewModelControlElementClass()] public class ClassroomViewModel : ElementViewModel, IClassroomModel { [ViewModelControlListProperty("Номер", ColumnWidth = 80)] [ViewModelControlElementProperty("Номер аудитории", ControlType.ControlString, MustHaveValue = true)] public string Number { get; set; } [ViewModelControlListProperty("Название")] [ViewModelControlElementProperty("Название", ControlType.ControlString)] public string Title { get; set; } [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; } [ViewModelControlElementProperty("Тип", ControlType.ControlEnum, MustHaveValue = true)] public ClassroomType ClassroomType { get; set; } [ViewModelControlListProperty("Тип", ColumnWidth = 120)] public string ClassroomTypeTitle => ClassroomType.ToString("G"); [ViewModelControlListProperty("Площадь", ColumnWidth = 90)] [ViewModelControlElementProperty("Площадь", ControlType.ControlDecimal, MustHaveValue = true)] public decimal Square { get; set; } [ViewModelControlListProperty("Кол-во мест", ColumnWidth = 100)] [ViewModelControlElementProperty("Кол-во мест", ControlType.ControlInt, MustHaveValue = true)] public int Capacity { get; set; } [ViewModelControlListProperty("Код безоп.", ColumnWidth = 100)] [ViewModelControlElementProperty("Код безоп.", ControlType.ControlString, MustHaveValue = true)] public string SecurityCode { get; set; } [ViewModelControlElementProperty("Есть проектор", ControlType.ControlBool, MustHaveValue = true)] public bool HaveProjector { get; set; } [ViewModelControlListProperty("Есть проектор", ColumnWidth = 80)] public string IsHaveProjector => HaveProjector ? "Да" : "Нет"; [ViewModelControlElementProperty("Описание", ControlType.ControlText)] public string Description { get; set; } [ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)] public byte[] Photo { get; set; } } }