using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.Extensions;
using ModuleTools.ViewModels;
using System;
namespace DepartmentBusinessLogic.ViewModels
{
///
/// Список учебных групп
///
public class StudentGroupListViewModel : ListViewModel { }
///
/// Элемент учебная группа
///
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
[ViewModelControlElementDependenceEntity(Title = "Студенты", Order = 1, ParentPropertyName = "StudentGroupId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")]
public class StudentGroupViewModel : ElementViewModel
{
[ViewModelControlElementProperty("Учебный план", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlAcademicPlanList, DepartmentWindowsDesktop")]
[MapConfiguration("AcademicPlanId")]
public Guid AcademicPlanId { get; set; }
[ViewModelControlListProperty("Шифр", ColumnWidth = 80)]
[MapConfiguration("AcademicPlan.EducationDirection.Cipher", IsDifficle = true)]
public string AcademicPlanEducationDirectionCipher { get; set; }
[ViewModelControlListProperty("Профиль")]
[MapConfiguration("AcademicPlan.EducationDirection.Profile", IsDifficle = true)]
public string AcademicPlanEducationDirectionProfile { get; set; }
[MapConfiguration("AcademicPlan.EducationDirection.ShortName", IsDifficle = true)]
public string AcademicPlanEducationDirectionShortName { get; set; }
[ViewModelControlListProperty("Группа")]
public string GroupName => $"{AcademicPlanEducationDirectionShortName}({EnrollmentYear})-{GroupNumber}";
[ViewModelControlListProperty("Номер группы")]
[ViewModelControlElementProperty("Номер группы", ControlType.ControlInt, MustHaveValue = true, MinValue = 1, MaxValue = 4)]
[MapConfiguration("GroupNumber")]
public int GroupNumber { get; set; }
[ViewModelControlListProperty("Год зачисления")]
[ViewModelControlElementProperty("Год зачисления", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("EnrollmentYear")]
public int EnrollmentYear { get; set; }
[ViewModelControlElementProperty("Куратор", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerList, DepartmentWindowsDesktop")]
[MapConfiguration("LecturerId")]
public Guid? CuratorId { get; set; }
[MapConfiguration("Lecturer.LastName", IsDifficle = true)]
public string LecturerLastName { get; set; }
[MapConfiguration("Lecturer.FirstName", IsDifficle = true)]
public string LecturerFirstName { get; set; }
[MapConfiguration("Lecturer.Patronymic", IsDifficle = true)]
public string LecturerPatronymic { get; set; }
[ViewModelControlListProperty("Куратор")]
public string Lecturer => $"{LecturerLastName}{(LecturerFirstName.IsNotEmpty() ? $" {LecturerFirstName[0]}." : string.Empty)}{(LecturerPatronymic.IsNotEmpty() ? $"{LecturerPatronymic[0]}." : string.Empty)}";
public override string ToString() => GroupName;
}
}