From 952d283aacdf19a7742fbf8374ecbebf1b3a9ab1 Mon Sep 17 00:00:00 2001 From: kotcheshir73 Date: Fri, 18 Mar 2022 22:08:29 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4=20?= =?UTF-8?q?=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D0=B5=D0=B9=20=D0=BA=D0=B0=D1=84?= =?UTF-8?q?=D0=B5=D0=B4=D1=80=D1=8B,=20=D0=B8=D1=82=D0=B5=D1=80=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Enums/Department/AcademicCourse.cs | 16 ++++++++ .../Enums/Department}/StudentState.cs | 10 ++--- .../ModelsDepartment/IStudentGroupModel.cs | 21 +++++++++++ .../ModelsDepartment/IStudentModel.cs | 37 +++++++++++++++++++ .../DatabaseCore/Models/Department/Student.cs | 29 +++------------ .../Models/Department/StudentGroup.cs | 24 +++--------- .../ModuleTools/BusinessLogics/Mapper.cs | 2 +- .../BindingModels/StudentBindingModels.cs | 26 ++++--------- .../StudentGroupBindingModels.cs | 18 ++++----- .../OrderStudentRecordBusinessLogic.cs | 3 +- .../OrderSyncHistoryBusinessLogic.cs | 3 +- .../Enums/AcademicCourse.cs | 16 -------- .../ViewModels/StudentGroupViewModels.cs | 19 ++++------ .../ViewModels/StudentViewModels.cs | 25 ++++--------- .../Implementations/StudentGroupService.cs | 2 +- .../Implementations/StudentService.cs | 2 +- .../Student/ControlStudentList.cs | 12 +++--- 17 files changed, 133 insertions(+), 132 deletions(-) create mode 100644 DepartmentPortal/Common/CoreModels/Enums/Department/AcademicCourse.cs rename DepartmentPortal/{Department/DepartmentBusinessLogic/Enums => Common/CoreModels/Enums/Department}/StudentState.cs (56%) create mode 100644 DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentGroupModel.cs create mode 100644 DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentModel.cs delete mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/Enums/AcademicCourse.cs diff --git a/DepartmentPortal/Common/CoreModels/Enums/Department/AcademicCourse.cs b/DepartmentPortal/Common/CoreModels/Enums/Department/AcademicCourse.cs new file mode 100644 index 0000000..0a4d80f --- /dev/null +++ b/DepartmentPortal/Common/CoreModels/Enums/Department/AcademicCourse.cs @@ -0,0 +1,16 @@ +namespace CoreModels.Enums.Department +{ + /// + /// Учебный курс + /// + public enum AcademicCourse + { + Курс_1 = 1, + + Курс_2 = 2, + + Курс_3 = 3, + + Курс_4 = 4 + } +} diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/StudentState.cs b/DepartmentPortal/Common/CoreModels/Enums/Department/StudentState.cs similarity index 56% rename from DepartmentPortal/Department/DepartmentBusinessLogic/Enums/StudentState.cs rename to DepartmentPortal/Common/CoreModels/Enums/Department/StudentState.cs index 18ef8ab..02bbb60 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/StudentState.cs +++ b/DepartmentPortal/Common/CoreModels/Enums/Department/StudentState.cs @@ -1,9 +1,9 @@ -namespace DepartmentBusinessLogic.Enums +namespace CoreModels.Enums.Department { - /// - /// Статус студента - /// - public enum StudentState + /// + /// Статус студента + /// + public enum StudentState { Неопределен = -1, diff --git a/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentGroupModel.cs b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentGroupModel.cs new file mode 100644 index 0000000..53f971a --- /dev/null +++ b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentGroupModel.cs @@ -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; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentModel.cs b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentModel.cs new file mode 100644 index 0000000..8668f39 --- /dev/null +++ b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentModel.cs @@ -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; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/Student.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/Student.cs index 1a217fc..a6134ff 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/Student.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/Student.cs @@ -1,5 +1,6 @@ -using DatabaseCore.Models.Security; -using ModuleTools.Attributes; +using CoreModels.Enums.Department; +using CoreModels.ModelsDepartment; +using DatabaseCore.Models.Security; using ModuleTools.Extensions; using ModuleTools.Interfaces; using System; @@ -10,66 +11,48 @@ using System.Runtime.Serialization; namespace DatabaseCore.Models.Department { - /// - /// Класс, описывающий студента кафедры - /// - [DataContract] - [EntityDescription("Student", "Студент кафедры")] - [EntityDependency("User", "UserId", "К какому пользователю относится студент")] - [EntityDependency("StudentGroup", "StudentGroupId", "К какой группе относится студент")] - public class Student : BaseEntity, IEntitySecurityExtenstion + [DataContract] + public class Student : BaseEntity, IEntitySecurityExtenstion, IStudentModel { [DataMember] [Required] - [MapConfiguration("UserId")] public Guid UserId { get; set; } [DataMember] - [MapConfiguration("StudentGroupId")] public Guid? StudentGroupId { get; set; } [DataMember] [Required] - [MapConfiguration("Iduniv")] public string Iduniv { get; set; } [DataMember] [Required] - [MapConfiguration("NumberOfBook")] public string NumberOfBook { get; set; } [DataMember] [Required] - [MapConfiguration("LastName")] public string LastName { get; set; } [DataMember] [Required] - [MapConfiguration("FirstName")] public string FirstName { get; set; } [DataMember] - [MapConfiguration("Patronymic")] public string Patronymic { get; set; } [DataMember] - [MapConfiguration("Email")] public string Email { get; set; } [DataMember] - [MapConfiguration("Description")] public string Description { get; set; } [Required(ErrorMessage = "required")] - [MapConfiguration("StudentState")] - public int StudentState { get; set; } + public StudentState StudentState { get; set; } [DataMember] - [MapConfiguration("Photo")] public byte[] Photo { get; set; } [DataMember] - [MapConfiguration("IsSteward")] public bool IsSteward { get; set; } //------------------------------------------------------------------------- diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/StudentGroup.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/StudentGroup.cs index 4060ef2..965bda7 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/StudentGroup.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/StudentGroup.cs @@ -1,4 +1,5 @@ -using ModuleTools.Attributes; +using CoreModels.Enums.Department; +using CoreModels.ModelsDepartment; using ModuleTools.Interfaces; using System; using System.Collections.Generic; @@ -6,36 +7,25 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Runtime.Serialization; -using System.Text; namespace DatabaseCore.Models.Department { - /// - /// Класс, описывающий учебную группу кафедры - /// - [DataContract] - [EntityDescription("StudentGroup", "Учебная группа кафедры")] - [EntityDependency("EducationDirection", "EducationDirectionId", "Направление, по которому учится группа")] - [EntityDependency("Lecturer", "LecturerId", "Куратор группы")] - public class StudentGroup : BaseEntity, IEntitySecurityExtenstion + [DataContract] + public class StudentGroup : BaseEntity, IEntitySecurityExtenstion, IStudentGroupModel { [DataMember] [Required(ErrorMessage = "required")] - [MapConfiguration("EducationDirectionId")] public Guid EducationDirectionId { get; set; } [DataMember] [Required(ErrorMessage = "required")] - [MapConfiguration("GroupNumber")] public int GroupNumber { get; set; } [DataMember] [Required(ErrorMessage = "required")] - [MapConfiguration("AcademicCourse")] - public int AcademicCourse { get; set; } + public AcademicCourse AcademicCourse { get; set; } [DataMember] - [MapConfiguration("LecturerId")] public Guid? LecturerId { get; set; } //------------------------------------------------------------------------- @@ -61,9 +51,7 @@ namespace DatabaseCore.Models.Department public override string ToString() => $"{EducationDirection?.ShortName}-{AcademicCourse}{GroupNumber}"; - //------------------------------------------------------------------------- - - public int GetStudnetsByState(int state) + public int GetStudnetsByState(StudentState state) { return Students?.Where(x => x.StudentState == state)?.Count() ?? 0; } diff --git a/DepartmentPortal/Common/ModuleTools/BusinessLogics/Mapper.cs b/DepartmentPortal/Common/ModuleTools/BusinessLogics/Mapper.cs index 5607a30..deb85e9 100644 --- a/DepartmentPortal/Common/ModuleTools/BusinessLogics/Mapper.cs +++ b/DepartmentPortal/Common/ModuleTools/BusinessLogics/Mapper.cs @@ -140,7 +140,7 @@ namespace ModuleTools.BusinessLogics switch (type) { 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; } } diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/StudentBindingModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/StudentBindingModels.cs index 5c8ebf2..64835cb 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/StudentBindingModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/StudentBindingModels.cs @@ -1,15 +1,15 @@ -using DepartmentBusinessLogic.Enums; -using ModuleTools.Attributes; +using CoreModels.Enums.Department; +using CoreModels.ModelsDepartment; using ModuleTools.BindingModels; using System; using System.ComponentModel.DataAnnotations; namespace DepartmentBusinessLogic.BindingModels { - /// - /// Получение студента - /// - public class StudentGetBindingModel : GetBindingModel + /// + /// Получение студента + /// + public class StudentGetBindingModel : GetBindingModel { public Guid? UserId { get; set; } @@ -23,48 +23,36 @@ namespace DepartmentBusinessLogic.BindingModels /// /// Сохранение студента /// - public class StudentSetBindingModel : SetBindingModel + public class StudentSetBindingModel : SetBindingModel, IStudentModel { [Required(ErrorMessage = "required")] - [MapConfiguration("UserId")] public Guid UserId { get; set; } - [MapConfiguration("StudentGroupId")] public Guid? StudentGroupId { get; set; } [Required(ErrorMessage = "required")] - [MapConfiguration("Iduniv")] public string Iduniv { get; set; } [Required(ErrorMessage = "required")] - [MapConfiguration("NumberOfBook")] public string NumberOfBook { get; set; } [Required(ErrorMessage = "required")] - [MapConfiguration("FirstName")] public string FirstName { get; set; } [Required(ErrorMessage = "required")] - [MapConfiguration("LastName")] public string LastName { get; set; } - [MapConfiguration("Patronymic")] public string Patronymic { get; set; } - [MapConfiguration("Email")] public string Email { get; set; } - [MapConfiguration("Description")] public string Description { get; set; } [Required(ErrorMessage = "required")] - [MapConfiguration("StudentState")] public StudentState StudentState { get; set; } - [MapConfiguration("Photo")] public byte[] Photo { get; set; } - [MapConfiguration("IsSteward")] public bool IsSteward { get; set; } } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/StudentGroupBindingModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/StudentGroupBindingModels.cs index 7ca901f..f39b8c0 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/StudentGroupBindingModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/StudentGroupBindingModels.cs @@ -1,15 +1,15 @@ -using DepartmentBusinessLogic.Enums; -using ModuleTools.Attributes; +using CoreModels.Enums.Department; +using CoreModels.ModelsDepartment; using ModuleTools.BindingModels; using System; using System.ComponentModel.DataAnnotations; namespace DepartmentBusinessLogic.BindingModels { - /// - /// Получение студенческой группы - /// - public class StudentGroupGetBindingModel : GetBindingModel + /// + /// Получение студенческой группы + /// + public class StudentGroupGetBindingModel : GetBindingModel { public Guid? EducationDirectionId { get; set; } @@ -19,21 +19,17 @@ namespace DepartmentBusinessLogic.BindingModels /// /// Сохранение студенческой группы /// - public class StudentGroupSetBindingModel : SetBindingModel + public class StudentGroupSetBindingModel : SetBindingModel, IStudentGroupModel { [Required(ErrorMessage = "required")] - [MapConfiguration("EducationDirectionId")] public Guid EducationDirectionId { get; set; } [Required(ErrorMessage = "required")] - [MapConfiguration("GroupNumber")] public int GroupNumber { get; set; } [Required(ErrorMessage = "required")] - [MapConfiguration("AcademicCourse")] public AcademicCourse AcademicCourse { get; set; } - [MapConfiguration("LecturerId")] public Guid? LecturerId { get; set; } } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderStudentRecordBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderStudentRecordBusinessLogic.cs index e4adfc7..a1ba892 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderStudentRecordBusinessLogic.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderStudentRecordBusinessLogic.cs @@ -1,4 +1,5 @@ -using DepartmentBusinessLogic.BindingModels; +using CoreModels.Enums.Department; +using DepartmentBusinessLogic.BindingModels; using DepartmentBusinessLogic.Enums; using DepartmentBusinessLogic.Interfaces; using DepartmentBusinessLogic.ViewModels; diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderSyncHistoryBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderSyncHistoryBusinessLogic.cs index 8ed8034..1643c85 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderSyncHistoryBusinessLogic.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderSyncHistoryBusinessLogic.cs @@ -1,4 +1,5 @@ -using DepartmentBusinessLogic.BindingModels; +using CoreModels.Enums.Department; +using DepartmentBusinessLogic.BindingModels; using DepartmentBusinessLogic.Enums; using DepartmentBusinessLogic.HelperModels; using DepartmentBusinessLogic.Interfaces; diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/AcademicCourse.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/AcademicCourse.cs deleted file mode 100644 index e721de2..0000000 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/AcademicCourse.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace DepartmentBusinessLogic.Enums -{ - /// - /// Учебный курс - /// - public enum AcademicCourse - { - Курс_1 = 1, - - Курс_2 = 2, - - Курс_3 = 3, - - Курс_4 = 4 - } -} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentGroupViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentGroupViewModels.cs index 051ba0a..00bdbd3 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentGroupViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentGroupViewModels.cs @@ -1,16 +1,17 @@ -using DepartmentBusinessLogic.Enums; +using CoreModels.Enums.Department; +using CoreModels.ModelsDepartment; +using DepartmentBusinessLogic.Enums; using ModuleTools.Attributes; using ModuleTools.Enums; using ModuleTools.ViewModels; using System; -using System.Collections.Generic; namespace DepartmentBusinessLogic.ViewModels { - /// - /// Список учебных групп - /// - public class StudentGroupListViewModel : ListViewModel { } + /// + /// Список учебных групп + /// + public class StudentGroupListViewModel : ListViewModel { } /// /// Элемент учебная группа @@ -18,10 +19,9 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 1000, Height = 900)] [ViewModelControlElementDependenceEntity(Title = "Студенты", Order = 1, ParentPropertyName = "StudentGroupId", 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")] - [MapConfiguration("EducationDirectionId")] public Guid EducationDirectionId { get; set; } [ViewModelControlListProperty("Шифр", ColumnWidth = 80)] @@ -39,7 +39,6 @@ namespace DepartmentBusinessLogic.ViewModels public string GroupName => $"{EducationDirectionShortName}-{(int)AcademicCourse}{GroupNumber}"; [ViewModelControlElementProperty("Курс", ControlType.ControlEnum, MustHaveValue = true)] - [MapConfiguration("AcademicCourse")] public AcademicCourse AcademicCourse { get; set; } [ViewModelControlListProperty("Курс")] @@ -47,7 +46,6 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlListProperty("Номер группы")] [ViewModelControlElementProperty("Номер группы", ControlType.ControlInt, MustHaveValue = true, MinValue = 0, MaxValue = 4)] - [MapConfiguration("GroupNumber")] public int GroupNumber { get; set; } [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})"; [ViewModelControlElementProperty("Куратор", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerList, DepartmentWindowsDesktop")] - [MapConfiguration("LecturerId")] public Guid? LecturerId { get; set; } [ViewModelControlListProperty("Куратор")] diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentViewModels.cs index b13072b..b2c8901 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentViewModels.cs @@ -1,4 +1,5 @@ -using DepartmentBusinessLogic.Enums; +using CoreModels.Enums.Department; +using CoreModels.ModelsDepartment; using ModuleTools.Attributes; using ModuleTools.Enums; using ModuleTools.ViewModels; @@ -6,10 +7,10 @@ using System; namespace DepartmentBusinessLogic.ViewModels { - /// - /// Список студентов - /// - public class StudentListViewModel : ListViewModel { } + /// + /// Список студентов + /// + public class StudentListViewModel : ListViewModel { } /// /// Элемент студент @@ -17,65 +18,53 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)] [ViewModelControlElementDependenceEntity(Title = "Приказы по студенту", Order = 1, ParentPropertyName = "StudentId", 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")] - [MapConfiguration("UserId")] public Guid UserId { get; set; } [ViewModelControlElementProperty("Группа", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentGroupList, DepartmentWindowsDesktop")] - [MapConfiguration("StudentGroupId")] public Guid? StudentGroupId { get; set; } [MapConfiguration("StudentGroup.ToString", IsDifficle = true)] public string StudentGroupName { get; set; } [ViewModelControlElementProperty("Идентификатор универа", ControlType.ControlString, MustHaveValue = true, ReadOnly = true)] - [MapConfiguration("Iduniv")] public string Iduniv { get; set; } [ViewModelControlListProperty("Номер зачетки")] [ViewModelControlElementProperty("Номер зачетки", ControlType.ControlString, MustHaveValue = true, ReadOnly = true)] - [MapConfiguration("NumberOfBook")] public string NumberOfBook { 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; } [ViewModelControlListProperty("Эл. почта", ColumnWidth = 90)] [ViewModelControlElementProperty("Эл. почта", ControlType.ControlString, MustHaveValue = true)] - [MapConfiguration("Email")] public string Email { get; set; } [ViewModelControlElementProperty("Описание", ControlType.ControlText)] - [MapConfiguration("Description")] public string Description { get; set; } [ViewModelControlElementProperty("Статус", ControlType.ControlEnum, MustHaveValue = true)] - [MapConfiguration("StudentState")] public StudentState StudentState { get; set; } [ViewModelControlListProperty("Статус", ColumnWidth = 90)] public string StudentStateTitle => StudentState.ToString("G"); [ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)] - [MapConfiguration("Photo")] public byte[] Photo { get; set; } [ViewModelControlElementProperty("Староста", ControlType.ControlBool, MustHaveValue = true)] - [MapConfiguration("IsSteward")] public bool IsSteward { get; set; } } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentGroupService.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentGroupService.cs index b5f82b6..23ca71c 100644 --- a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentGroupService.cs +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentGroupService.cs @@ -55,7 +55,7 @@ namespace DepartmentDatabaseImplementation.Implementations context.SaveChanges(); } - protected override StudentGroup GetUniqueEntity(StudentGroupSetBindingModel model, DbContext context) => context.Set().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().FirstOrDefault(x => x.EducationDirectionId == model.EducationDirectionId && x.AcademicCourse == model.AcademicCourse && x.GroupNumber == model.GroupNumber && x.Id != model.Id); protected override IQueryable IncludingWhenReading(IQueryable query) => query.Include(x => x.EducationDirection).Include(x => x.Lecturer).Include(x => x.Students); diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentService.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentService.cs index 00c55c6..23054a6 100644 --- a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentService.cs +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentService.cs @@ -34,7 +34,7 @@ namespace DepartmentDatabaseImplementation.Implementations } 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; } diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Student/ControlStudentList.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Student/ControlStudentList.cs index dd51150..9a5ff73 100644 --- a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Student/ControlStudentList.cs +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Student/ControlStudentList.cs @@ -1,6 +1,6 @@ -using DepartmentBusinessLogic.BindingModels; +using CoreModels.Enums.Department; +using DepartmentBusinessLogic.BindingModels; using DepartmentBusinessLogic.BusinessLogics; -using DepartmentBusinessLogic.Enums; using DepartmentBusinessLogic.ViewModels; using DesktopTools.Controls; using DesktopTools.Enums; @@ -13,10 +13,10 @@ using System.Linq; namespace DepartmentWindowsDesktop.EntityControls { - /// - /// Реализация контрола для списка студентов - /// - public partial class ControlStudentList : + /// + /// Реализация контрола для списка студентов + /// + public partial class ControlStudentList : GenericControlEntityList, IGenericControlEntityList {