using ModuleTools.Attributes; using ModuleTools.Enums; using ModuleTools.Extensions; using ModuleTools.ViewModels; using System; namespace DepartmentBusinessLogic.ViewModels { /// /// Список преподавателей /// public class LecturerListViewModel : ListViewModel { } /// /// Элемент преподаватель /// [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 700)] [ViewModelControlElementDependenceEntity(Title = "Должности", Order = 1, ParentPropertyName = "LecturerId", ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerEmployeePostList, DepartmentWindowsDesktop")] public class LecturerViewModel : ElementViewModel { [ViewModelControlElementProperty("Пользователь", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserList, SecurityWindowsDesktop")] [MapConfiguration("UserId")] public Guid UserId { get; set; } [ViewModelControlElementProperty("Должность", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerPostList, DepartmentWindowsDesktop")] [MapConfiguration("LecturerPostId")] public Guid LecturerPostId { get; set; } [ViewModelControlListProperty("Должность")] [MapConfiguration("LecturerPost.LecturerPostName", IsDifficle = true)] public string EmployeePostName { get; set; } [ViewModelControlListProperty("Ставка")] [ViewModelControlElementProperty("Ставка", ControlType.ControlDecimal, MustHaveValue = true)] [MapConfiguration("LecturerPostRate")] public decimal LecturerPostRate { get; set; } [ViewModelControlElementProperty("Уч. степень", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerAcademicDegreeList, DepartmentWindowsDesktop")] [MapConfiguration("LecturerAcademicDegreeId")] public Guid? LecturerAcademicDegreeId { get; set; } [ViewModelControlListProperty("Уч. степень")] [MapConfiguration("LecturerAcademicDegree.LecturerAcademicDegreeName", IsDifficle = true)] public string LecturerAcademicDegree { get; set; } [ViewModelControlElementProperty("Уч. звание", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerAcademicRankList, DepartmentWindowsDesktop")] [MapConfiguration("LecturerAcademicRankId")] public Guid? LecturerAcademicRankId { get; set; } [ViewModelControlListProperty("Уч. звание")] [MapConfiguration("LecturerAcademicRank.LecturerAcademicRankName", IsDifficle = true)] public string LecturerAcademicRank { get; set; } [ViewModelControlListProperty("Фамилия")] [ViewModelControlElementProperty("Фамилия", ControlType.ControlString, MustHaveValue = true)] [MapConfiguration("LastName")] public string LastName { get; set; } [ViewModelControlListProperty("Имя")] [ViewModelControlElementProperty("Имя", ControlType.ControlString, MustHaveValue = true)] [MapConfiguration("FirstName")] public string FirstName { get; set; } [ViewModelControlListProperty("Отчество")] [ViewModelControlElementProperty("Отчество", ControlType.ControlString, MustHaveValue = true)] [MapConfiguration("Patronymic")] public string Patronymic { get; set; } [ViewModelControlElementProperty("Аббревиатура", ControlType.ControlString)] [MapConfiguration("Abbreviation")] public string Abbreviation { get; set; } [ViewModelControlListProperty("Дата рожд.", ColumnWidth = 100, DefaultCellStyleFormat = "dd.MM.yyyy")] [ViewModelControlElementProperty("Дата рожд.", ControlType.ControlDateTime, MustHaveValue = true)] [MapConfiguration("DateBirth", AllowCopyWithoutRigth = false)] public DateTime DateBirth { get; set; } [ViewModelControlListProperty("Адрес", ColumnWidth = 90)] [ViewModelControlElementProperty("Адрес", ControlType.ControlString, MustHaveValue = true)] [MapConfiguration("Address", AllowCopyWithoutRigth = false)] public string Address { get; set; } [ViewModelControlListProperty("Эл. почта", ColumnWidth = 90)] [ViewModelControlElementProperty("Эл. почта", ControlType.ControlString, MustHaveValue = true)] [MapConfiguration("Email", AllowCopyWithoutRigth = false)] public string Email { get; set; } [ViewModelControlListProperty("Моб. номер", ColumnWidth = 100)] [ViewModelControlElementProperty("Моб. номер", ControlType.ControlString, MustHaveValue = true)] [MapConfiguration("MobileNumber", AllowCopyWithoutRigth = false)] public string MobileNumber { get; set; } [ViewModelControlListProperty("Дом. номер", ColumnWidth = 100)] [ViewModelControlElementProperty("Дом. номер", ControlType.ControlString)] [MapConfiguration("HomeNumber", AllowCopyWithoutRigth = false)] public string HomeNumber { get; set; } [ViewModelControlElementProperty("Описание", ControlType.ControlText)] [MapConfiguration("Description")] public string Description { get; set; } [ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)] [MapConfiguration("Photo")] public byte[] Photo { get; set; } [ViewModelControlElementProperty("Для внутр. пользования", ControlType.ControlBool, MustHaveValue = true)] [MapConfiguration("OnlyForPrivate")] public bool OnlyForPrivate { get; set; } public override string ToString() => $"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}"; } }