перевод моделей кафедры, итерация

This commit is contained in:
kotcheshir73 2022-03-18 22:08:29 +04:00
parent c7a24dcaad
commit 952d283aac
17 changed files with 133 additions and 132 deletions

View File

@ -0,0 +1,16 @@
namespace CoreModels.Enums.Department
{
/// <summary>
/// Учебный курс
/// </summary>
public enum AcademicCourse
{
Курс_1 = 1,
Курс_2 = 2,
Курс_3 = 3,
Курс_4 = 4
}
}

View File

@ -1,9 +1,9 @@
namespace DepartmentBusinessLogic.Enums namespace CoreModels.Enums.Department
{ {
/// <summary> /// <summary>
/// Статус студента /// Статус студента
/// </summary> /// </summary>
public enum StudentState public enum StudentState
{ {
Неопределен = -1, Неопределен = -1,

View File

@ -0,0 +1,21 @@
using CoreModels.Enums.Department;
using CoreModels.Tools;
using ModuleTools.Attributes;
using System;
namespace CoreModels.ModelsDepartment
{
[EntityDescription("StudentGroup", "Учебная группа кафедры")]
[EntityDependency("EducationDirection", "EducationDirectionId", "Направление, по которому учится группа")]
[EntityDependency("Lecturer", "LecturerId", "Куратор группы")]
public interface IStudentGroupModel : IId
{
Guid EducationDirectionId { get; }
int GroupNumber { get; }
AcademicCourse AcademicCourse { get; }
Guid? LecturerId { get; }
}
}

View File

@ -0,0 +1,37 @@
using CoreModels.Enums.Department;
using CoreModels.Tools;
using ModuleTools.Attributes;
using System;
namespace CoreModels.ModelsDepartment
{
[EntityDescription("Student", "Студент кафедры")]
[EntityDependency("User", "UserId", "К какому пользователю относится студент")]
[EntityDependency("StudentGroup", "StudentGroupId", "К какой группе относится студент")]
public interface IStudentModel : IId
{
Guid UserId { get; }
Guid? StudentGroupId { get; }
string Iduniv { get; }
string NumberOfBook { get; }
string LastName { get; }
string FirstName { get; }
string Patronymic { get; }
string Email { get; }
string Description { get; }
StudentState StudentState { get; }
byte[] Photo { get; }
bool IsSteward { get; }
}
}

View File

@ -1,5 +1,6 @@
using DatabaseCore.Models.Security; using CoreModels.Enums.Department;
using ModuleTools.Attributes; using CoreModels.ModelsDepartment;
using DatabaseCore.Models.Security;
using ModuleTools.Extensions; using ModuleTools.Extensions;
using ModuleTools.Interfaces; using ModuleTools.Interfaces;
using System; using System;
@ -10,66 +11,48 @@ using System.Runtime.Serialization;
namespace DatabaseCore.Models.Department namespace DatabaseCore.Models.Department
{ {
/// <summary> [DataContract]
/// Класс, описывающий студента кафедры public class Student : BaseEntity, IEntitySecurityExtenstion<Student>, IStudentModel
/// </summary>
[DataContract]
[EntityDescription("Student", "Студент кафедры")]
[EntityDependency("User", "UserId", "К какому пользователю относится студент")]
[EntityDependency("StudentGroup", "StudentGroupId", "К какой группе относится студент")]
public class Student : BaseEntity, IEntitySecurityExtenstion<Student>
{ {
[DataMember] [DataMember]
[Required] [Required]
[MapConfiguration("UserId")]
public Guid UserId { get; set; } public Guid UserId { get; set; }
[DataMember] [DataMember]
[MapConfiguration("StudentGroupId")]
public Guid? StudentGroupId { get; set; } public Guid? StudentGroupId { get; set; }
[DataMember] [DataMember]
[Required] [Required]
[MapConfiguration("Iduniv")]
public string Iduniv { get; set; } public string Iduniv { get; set; }
[DataMember] [DataMember]
[Required] [Required]
[MapConfiguration("NumberOfBook")]
public string NumberOfBook { get; set; } public string NumberOfBook { get; set; }
[DataMember] [DataMember]
[Required] [Required]
[MapConfiguration("LastName")]
public string LastName { get; set; } public string LastName { get; set; }
[DataMember] [DataMember]
[Required] [Required]
[MapConfiguration("FirstName")]
public string FirstName { get; set; } public string FirstName { get; set; }
[DataMember] [DataMember]
[MapConfiguration("Patronymic")]
public string Patronymic { get; set; } public string Patronymic { get; set; }
[DataMember] [DataMember]
[MapConfiguration("Email")]
public string Email { get; set; } public string Email { get; set; }
[DataMember] [DataMember]
[MapConfiguration("Description")]
public string Description { get; set; } public string Description { get; set; }
[Required(ErrorMessage = "required")] [Required(ErrorMessage = "required")]
[MapConfiguration("StudentState")] public StudentState StudentState { get; set; }
public int StudentState { get; set; }
[DataMember] [DataMember]
[MapConfiguration("Photo")]
public byte[] Photo { get; set; } public byte[] Photo { get; set; }
[DataMember] [DataMember]
[MapConfiguration("IsSteward")]
public bool IsSteward { get; set; } public bool IsSteward { get; set; }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes; using CoreModels.Enums.Department;
using CoreModels.ModelsDepartment;
using ModuleTools.Interfaces; using ModuleTools.Interfaces;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -6,36 +7,25 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Text;
namespace DatabaseCore.Models.Department namespace DatabaseCore.Models.Department
{ {
/// <summary> [DataContract]
/// Класс, описывающий учебную группу кафедры public class StudentGroup : BaseEntity, IEntitySecurityExtenstion<StudentGroup>, IStudentGroupModel
/// </summary>
[DataContract]
[EntityDescription("StudentGroup", "Учебная группа кафедры")]
[EntityDependency("EducationDirection", "EducationDirectionId", "Направление, по которому учится группа")]
[EntityDependency("Lecturer", "LecturerId", "Куратор группы")]
public class StudentGroup : BaseEntity, IEntitySecurityExtenstion<StudentGroup>
{ {
[DataMember] [DataMember]
[Required(ErrorMessage = "required")] [Required(ErrorMessage = "required")]
[MapConfiguration("EducationDirectionId")]
public Guid EducationDirectionId { get; set; } public Guid EducationDirectionId { get; set; }
[DataMember] [DataMember]
[Required(ErrorMessage = "required")] [Required(ErrorMessage = "required")]
[MapConfiguration("GroupNumber")]
public int GroupNumber { get; set; } public int GroupNumber { get; set; }
[DataMember] [DataMember]
[Required(ErrorMessage = "required")] [Required(ErrorMessage = "required")]
[MapConfiguration("AcademicCourse")] public AcademicCourse AcademicCourse { get; set; }
public int AcademicCourse { get; set; }
[DataMember] [DataMember]
[MapConfiguration("LecturerId")]
public Guid? LecturerId { get; set; } public Guid? LecturerId { get; set; }
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
@ -61,9 +51,7 @@ namespace DatabaseCore.Models.Department
public override string ToString() => $"{EducationDirection?.ShortName}-{AcademicCourse}{GroupNumber}"; public override string ToString() => $"{EducationDirection?.ShortName}-{AcademicCourse}{GroupNumber}";
//------------------------------------------------------------------------- public int GetStudnetsByState(StudentState state)
public int GetStudnetsByState(int state)
{ {
return Students?.Where(x => x.StudentState == state)?.Count() ?? 0; return Students?.Where(x => x.StudentState == state)?.Count() ?? 0;
} }

View File

@ -140,7 +140,7 @@ namespace ModuleTools.BusinessLogics
switch (type) switch (type)
{ {
case "Enum": case "Enum":
objs[i] = (int)Enum.Parse(customAttribute.MethodParams[i], parameters[i].Split(':')[1]); objs[i] = Enum.Parse(customAttribute.MethodParams[i], parameters[i].Split(':')[1]);
break; break;
} }
} }

View File

@ -1,15 +1,15 @@
using DepartmentBusinessLogic.Enums; using CoreModels.Enums.Department;
using ModuleTools.Attributes; using CoreModels.ModelsDepartment;
using ModuleTools.BindingModels; using ModuleTools.BindingModels;
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace DepartmentBusinessLogic.BindingModels namespace DepartmentBusinessLogic.BindingModels
{ {
/// <summary> /// <summary>
/// Получение студента /// Получение студента
/// </summary> /// </summary>
public class StudentGetBindingModel : GetBindingModel public class StudentGetBindingModel : GetBindingModel
{ {
public Guid? UserId { get; set; } public Guid? UserId { get; set; }
@ -23,48 +23,36 @@ namespace DepartmentBusinessLogic.BindingModels
/// <summary> /// <summary>
/// Сохранение студента /// Сохранение студента
/// </summary> /// </summary>
public class StudentSetBindingModel : SetBindingModel public class StudentSetBindingModel : SetBindingModel, IStudentModel
{ {
[Required(ErrorMessage = "required")] [Required(ErrorMessage = "required")]
[MapConfiguration("UserId")]
public Guid UserId { get; set; } public Guid UserId { get; set; }
[MapConfiguration("StudentGroupId")]
public Guid? StudentGroupId { get; set; } public Guid? StudentGroupId { get; set; }
[Required(ErrorMessage = "required")] [Required(ErrorMessage = "required")]
[MapConfiguration("Iduniv")]
public string Iduniv { get; set; } public string Iduniv { get; set; }
[Required(ErrorMessage = "required")] [Required(ErrorMessage = "required")]
[MapConfiguration("NumberOfBook")]
public string NumberOfBook { get; set; } public string NumberOfBook { get; set; }
[Required(ErrorMessage = "required")] [Required(ErrorMessage = "required")]
[MapConfiguration("FirstName")]
public string FirstName { get; set; } public string FirstName { get; set; }
[Required(ErrorMessage = "required")] [Required(ErrorMessage = "required")]
[MapConfiguration("LastName")]
public string LastName { get; set; } public string LastName { get; set; }
[MapConfiguration("Patronymic")]
public string Patronymic { get; set; } public string Patronymic { get; set; }
[MapConfiguration("Email")]
public string Email { get; set; } public string Email { get; set; }
[MapConfiguration("Description")]
public string Description { get; set; } public string Description { get; set; }
[Required(ErrorMessage = "required")] [Required(ErrorMessage = "required")]
[MapConfiguration("StudentState")]
public StudentState StudentState { get; set; } public StudentState StudentState { get; set; }
[MapConfiguration("Photo")]
public byte[] Photo { get; set; } public byte[] Photo { get; set; }
[MapConfiguration("IsSteward")]
public bool IsSteward { get; set; } public bool IsSteward { get; set; }
} }
} }

View File

@ -1,15 +1,15 @@
using DepartmentBusinessLogic.Enums; using CoreModels.Enums.Department;
using ModuleTools.Attributes; using CoreModels.ModelsDepartment;
using ModuleTools.BindingModels; using ModuleTools.BindingModels;
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace DepartmentBusinessLogic.BindingModels namespace DepartmentBusinessLogic.BindingModels
{ {
/// <summary> /// <summary>
/// Получение студенческой группы /// Получение студенческой группы
/// </summary> /// </summary>
public class StudentGroupGetBindingModel : GetBindingModel public class StudentGroupGetBindingModel : GetBindingModel
{ {
public Guid? EducationDirectionId { get; set; } public Guid? EducationDirectionId { get; set; }
@ -19,21 +19,17 @@ namespace DepartmentBusinessLogic.BindingModels
/// <summary> /// <summary>
/// Сохранение студенческой группы /// Сохранение студенческой группы
/// </summary> /// </summary>
public class StudentGroupSetBindingModel : SetBindingModel public class StudentGroupSetBindingModel : SetBindingModel, IStudentGroupModel
{ {
[Required(ErrorMessage = "required")] [Required(ErrorMessage = "required")]
[MapConfiguration("EducationDirectionId")]
public Guid EducationDirectionId { get; set; } public Guid EducationDirectionId { get; set; }
[Required(ErrorMessage = "required")] [Required(ErrorMessage = "required")]
[MapConfiguration("GroupNumber")]
public int GroupNumber { get; set; } public int GroupNumber { get; set; }
[Required(ErrorMessage = "required")] [Required(ErrorMessage = "required")]
[MapConfiguration("AcademicCourse")]
public AcademicCourse AcademicCourse { get; set; } public AcademicCourse AcademicCourse { get; set; }
[MapConfiguration("LecturerId")]
public Guid? LecturerId { get; set; } public Guid? LecturerId { get; set; }
} }
} }

View File

@ -1,4 +1,5 @@
using DepartmentBusinessLogic.BindingModels; using CoreModels.Enums.Department;
using DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.Enums; using DepartmentBusinessLogic.Enums;
using DepartmentBusinessLogic.Interfaces; using DepartmentBusinessLogic.Interfaces;
using DepartmentBusinessLogic.ViewModels; using DepartmentBusinessLogic.ViewModels;

View File

@ -1,4 +1,5 @@
using DepartmentBusinessLogic.BindingModels; using CoreModels.Enums.Department;
using DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.Enums; using DepartmentBusinessLogic.Enums;
using DepartmentBusinessLogic.HelperModels; using DepartmentBusinessLogic.HelperModels;
using DepartmentBusinessLogic.Interfaces; using DepartmentBusinessLogic.Interfaces;

View File

@ -1,16 +0,0 @@
namespace DepartmentBusinessLogic.Enums
{
/// <summary>
/// Учебный курс
/// </summary>
public enum AcademicCourse
{
Курс_1 = 1,
Курс_2 = 2,
Курс_3 = 3,
Курс_4 = 4
}
}

View File

@ -1,16 +1,17 @@
using DepartmentBusinessLogic.Enums; using CoreModels.Enums.Department;
using CoreModels.ModelsDepartment;
using DepartmentBusinessLogic.Enums;
using ModuleTools.Attributes; using ModuleTools.Attributes;
using ModuleTools.Enums; using ModuleTools.Enums;
using ModuleTools.ViewModels; using ModuleTools.ViewModels;
using System; using System;
using System.Collections.Generic;
namespace DepartmentBusinessLogic.ViewModels namespace DepartmentBusinessLogic.ViewModels
{ {
/// <summary> /// <summary>
/// Список учебных групп /// Список учебных групп
/// </summary> /// </summary>
public class StudentGroupListViewModel : ListViewModel<StudentGroupViewModel> { } public class StudentGroupListViewModel : ListViewModel<StudentGroupViewModel> { }
/// <summary> /// <summary>
/// Элемент учебная группа /// Элемент учебная группа
@ -18,10 +19,9 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 1000, Height = 900)] [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 1000, Height = 900)]
[ViewModelControlElementDependenceEntity(Title = "Студенты", Order = 1, ParentPropertyName = "StudentGroupId", [ViewModelControlElementDependenceEntity(Title = "Студенты", Order = 1, ParentPropertyName = "StudentGroupId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")] ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")]
public class StudentGroupViewModel : ElementViewModel public class StudentGroupViewModel : ElementViewModel, IStudentGroupModel
{ {
[ViewModelControlElementProperty("Направление", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlEducationDirectionList, DepartmentWindowsDesktop")] [ViewModelControlElementProperty("Направление", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlEducationDirectionList, DepartmentWindowsDesktop")]
[MapConfiguration("EducationDirectionId")]
public Guid EducationDirectionId { get; set; } public Guid EducationDirectionId { get; set; }
[ViewModelControlListProperty("Шифр", ColumnWidth = 80)] [ViewModelControlListProperty("Шифр", ColumnWidth = 80)]
@ -39,7 +39,6 @@ namespace DepartmentBusinessLogic.ViewModels
public string GroupName => $"{EducationDirectionShortName}-{(int)AcademicCourse}{GroupNumber}"; public string GroupName => $"{EducationDirectionShortName}-{(int)AcademicCourse}{GroupNumber}";
[ViewModelControlElementProperty("Курс", ControlType.ControlEnum, MustHaveValue = true)] [ViewModelControlElementProperty("Курс", ControlType.ControlEnum, MustHaveValue = true)]
[MapConfiguration("AcademicCourse")]
public AcademicCourse AcademicCourse { get; set; } public AcademicCourse AcademicCourse { get; set; }
[ViewModelControlListProperty("Курс")] [ViewModelControlListProperty("Курс")]
@ -47,7 +46,6 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlListProperty("Номер группы")] [ViewModelControlListProperty("Номер группы")]
[ViewModelControlElementProperty("Номер группы", ControlType.ControlInt, MustHaveValue = true, MinValue = 0, MaxValue = 4)] [ViewModelControlElementProperty("Номер группы", ControlType.ControlInt, MustHaveValue = true, MinValue = 0, MaxValue = 4)]
[MapConfiguration("GroupNumber")]
public int GroupNumber { get; set; } public int GroupNumber { get; set; }
[MapConfiguration("Method.GetStudnetsByState[Enum:Учится]", IsDifficle = true, MethodParams = new Type[] { typeof(StudentState) })] [MapConfiguration("Method.GetStudnetsByState[Enum:Учится]", IsDifficle = true, MethodParams = new Type[] { typeof(StudentState) })]
@ -60,7 +58,6 @@ namespace DepartmentBusinessLogic.ViewModels
public string StudentCount => $"{StudentActualCount + StudentAcademCount} ({StudentActualCount}, {StudentAcademCount})"; public string StudentCount => $"{StudentActualCount + StudentAcademCount} ({StudentActualCount}, {StudentAcademCount})";
[ViewModelControlElementProperty("Куратор", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerList, DepartmentWindowsDesktop")] [ViewModelControlElementProperty("Куратор", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerList, DepartmentWindowsDesktop")]
[MapConfiguration("LecturerId")]
public Guid? LecturerId { get; set; } public Guid? LecturerId { get; set; }
[ViewModelControlListProperty("Куратор")] [ViewModelControlListProperty("Куратор")]

View File

@ -1,4 +1,5 @@
using DepartmentBusinessLogic.Enums; using CoreModels.Enums.Department;
using CoreModels.ModelsDepartment;
using ModuleTools.Attributes; using ModuleTools.Attributes;
using ModuleTools.Enums; using ModuleTools.Enums;
using ModuleTools.ViewModels; using ModuleTools.ViewModels;
@ -6,10 +7,10 @@ using System;
namespace DepartmentBusinessLogic.ViewModels namespace DepartmentBusinessLogic.ViewModels
{ {
/// <summary> /// <summary>
/// Список студентов /// Список студентов
/// </summary> /// </summary>
public class StudentListViewModel : ListViewModel<StudentViewModel> { } public class StudentListViewModel : ListViewModel<StudentViewModel> { }
/// <summary> /// <summary>
/// Элемент студент /// Элемент студент
@ -17,65 +18,53 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)] [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
[ViewModelControlElementDependenceEntity(Title = "Приказы по студенту", Order = 1, ParentPropertyName = "StudentId", [ViewModelControlElementDependenceEntity(Title = "Приказы по студенту", Order = 1, ParentPropertyName = "StudentId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderStudentRecordList, DepartmentWindowsDesktop")] ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderStudentRecordList, DepartmentWindowsDesktop")]
public class StudentViewModel : ElementViewModel public class StudentViewModel : ElementViewModel, IStudentModel
{ {
[ViewModelControlElementProperty("Пользователь", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserList, SecurityWindowsDesktop")] [ViewModelControlElementProperty("Пользователь", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserList, SecurityWindowsDesktop")]
[MapConfiguration("UserId")]
public Guid UserId { get; set; } public Guid UserId { get; set; }
[ViewModelControlElementProperty("Группа", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentGroupList, DepartmentWindowsDesktop")] [ViewModelControlElementProperty("Группа", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentGroupList, DepartmentWindowsDesktop")]
[MapConfiguration("StudentGroupId")]
public Guid? StudentGroupId { get; set; } public Guid? StudentGroupId { get; set; }
[MapConfiguration("StudentGroup.ToString", IsDifficle = true)] [MapConfiguration("StudentGroup.ToString", IsDifficle = true)]
public string StudentGroupName { get; set; } public string StudentGroupName { get; set; }
[ViewModelControlElementProperty("Идентификатор универа", ControlType.ControlString, MustHaveValue = true, ReadOnly = true)] [ViewModelControlElementProperty("Идентификатор универа", ControlType.ControlString, MustHaveValue = true, ReadOnly = true)]
[MapConfiguration("Iduniv")]
public string Iduniv { get; set; } public string Iduniv { get; set; }
[ViewModelControlListProperty("Номер зачетки")] [ViewModelControlListProperty("Номер зачетки")]
[ViewModelControlElementProperty("Номер зачетки", ControlType.ControlString, MustHaveValue = true, ReadOnly = true)] [ViewModelControlElementProperty("Номер зачетки", ControlType.ControlString, MustHaveValue = true, ReadOnly = true)]
[MapConfiguration("NumberOfBook")]
public string NumberOfBook { get; set; } public string NumberOfBook { get; set; }
[ViewModelControlListProperty("Фамилия")] [ViewModelControlListProperty("Фамилия")]
[ViewModelControlElementProperty("Фамилия", ControlType.ControlString, MustHaveValue = true)] [ViewModelControlElementProperty("Фамилия", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("LastName")]
public string LastName { get; set; } public string LastName { get; set; }
[ViewModelControlListProperty("Имя")] [ViewModelControlListProperty("Имя")]
[ViewModelControlElementProperty("Имя", ControlType.ControlString, MustHaveValue = true)] [ViewModelControlElementProperty("Имя", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("FirstName")]
public string FirstName { get; set; } public string FirstName { get; set; }
[ViewModelControlListProperty("Отчество")] [ViewModelControlListProperty("Отчество")]
[ViewModelControlElementProperty("Отчество", ControlType.ControlString, MustHaveValue = true)] [ViewModelControlElementProperty("Отчество", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("Patronymic")]
public string Patronymic { get; set; } public string Patronymic { get; set; }
[ViewModelControlListProperty("Эл. почта", ColumnWidth = 90)] [ViewModelControlListProperty("Эл. почта", ColumnWidth = 90)]
[ViewModelControlElementProperty("Эл. почта", ControlType.ControlString, MustHaveValue = true)] [ViewModelControlElementProperty("Эл. почта", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("Email")]
public string Email { get; set; } public string Email { get; set; }
[ViewModelControlElementProperty("Описание", ControlType.ControlText)] [ViewModelControlElementProperty("Описание", ControlType.ControlText)]
[MapConfiguration("Description")]
public string Description { get; set; } public string Description { get; set; }
[ViewModelControlElementProperty("Статус", ControlType.ControlEnum, MustHaveValue = true)] [ViewModelControlElementProperty("Статус", ControlType.ControlEnum, MustHaveValue = true)]
[MapConfiguration("StudentState")]
public StudentState StudentState { get; set; } public StudentState StudentState { get; set; }
[ViewModelControlListProperty("Статус", ColumnWidth = 90)] [ViewModelControlListProperty("Статус", ColumnWidth = 90)]
public string StudentStateTitle => StudentState.ToString("G"); public string StudentStateTitle => StudentState.ToString("G");
[ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)] [ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)]
[MapConfiguration("Photo")]
public byte[] Photo { get; set; } public byte[] Photo { get; set; }
[ViewModelControlElementProperty("Староста", ControlType.ControlBool, MustHaveValue = true)] [ViewModelControlElementProperty("Староста", ControlType.ControlBool, MustHaveValue = true)]
[MapConfiguration("IsSteward")]
public bool IsSteward { get; set; } public bool IsSteward { get; set; }
} }
} }

View File

@ -55,7 +55,7 @@ namespace DepartmentDatabaseImplementation.Implementations
context.SaveChanges(); context.SaveChanges();
} }
protected override StudentGroup GetUniqueEntity(StudentGroupSetBindingModel model, DbContext context) => context.Set<StudentGroup>().FirstOrDefault(x => x.EducationDirectionId == model.EducationDirectionId && x.AcademicCourse == (int)model.AcademicCourse && x.GroupNumber == model.GroupNumber && x.Id != model.Id); protected override StudentGroup GetUniqueEntity(StudentGroupSetBindingModel model, DbContext context) => context.Set<StudentGroup>().FirstOrDefault(x => x.EducationDirectionId == model.EducationDirectionId && x.AcademicCourse == model.AcademicCourse && x.GroupNumber == model.GroupNumber && x.Id != model.Id);
protected override IQueryable<StudentGroup> IncludingWhenReading(IQueryable<StudentGroup> query) => query.Include(x => x.EducationDirection).Include(x => x.Lecturer).Include(x => x.Students); protected override IQueryable<StudentGroup> IncludingWhenReading(IQueryable<StudentGroup> query) => query.Include(x => x.EducationDirection).Include(x => x.Lecturer).Include(x => x.Students);

View File

@ -34,7 +34,7 @@ namespace DepartmentDatabaseImplementation.Implementations
} }
if (model.StudentState.HasValue) if (model.StudentState.HasValue)
{ {
query = query.Where(x => x.StudentState == (int)model.StudentState.Value); query = query.Where(x => x.StudentState == model.StudentState.Value);
} }
return query; return query;
} }

View File

@ -1,6 +1,6 @@
using DepartmentBusinessLogic.BindingModels; using CoreModels.Enums.Department;
using DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.BusinessLogics; using DepartmentBusinessLogic.BusinessLogics;
using DepartmentBusinessLogic.Enums;
using DepartmentBusinessLogic.ViewModels; using DepartmentBusinessLogic.ViewModels;
using DesktopTools.Controls; using DesktopTools.Controls;
using DesktopTools.Enums; using DesktopTools.Enums;
@ -13,10 +13,10 @@ using System.Linq;
namespace DepartmentWindowsDesktop.EntityControls namespace DepartmentWindowsDesktop.EntityControls
{ {
/// <summary> /// <summary>
/// Реализация контрола для списка студентов /// Реализация контрола для списка студентов
/// </summary> /// </summary>
public partial class ControlStudentList : public partial class ControlStudentList :
GenericControlEntityList<StudentGetBindingModel, StudentSetBindingModel, StudentListViewModel, StudentViewModel, StudentBusinessLogic>, GenericControlEntityList<StudentGetBindingModel, StudentSetBindingModel, StudentListViewModel, StudentViewModel, StudentBusinessLogic>,
IGenericControlEntityList IGenericControlEntityList
{ {