перевод моделей кафедры, итерация
This commit is contained in:
parent
c7a24dcaad
commit
952d283aac
@ -0,0 +1,16 @@
|
||||
namespace CoreModels.Enums.Department
|
||||
{
|
||||
/// <summary>
|
||||
/// Учебный курс
|
||||
/// </summary>
|
||||
public enum AcademicCourse
|
||||
{
|
||||
Курс_1 = 1,
|
||||
|
||||
Курс_2 = 2,
|
||||
|
||||
Курс_3 = 3,
|
||||
|
||||
Курс_4 = 4
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace DepartmentBusinessLogic.Enums
|
||||
namespace CoreModels.Enums.Department
|
||||
{
|
||||
/// <summary>
|
||||
/// Статус студента
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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; }
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс, описывающий студента кафедры
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
[EntityDescription("Student", "Студент кафедры")]
|
||||
[EntityDependency("User", "UserId", "К какому пользователю относится студент")]
|
||||
[EntityDependency("StudentGroup", "StudentGroupId", "К какой группе относится студент")]
|
||||
public class Student : BaseEntity, IEntitySecurityExtenstion<Student>
|
||||
public class Student : BaseEntity, IEntitySecurityExtenstion<Student>, 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; }
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс, описывающий учебную группу кафедры
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
[EntityDescription("StudentGroup", "Учебная группа кафедры")]
|
||||
[EntityDependency("EducationDirection", "EducationDirectionId", "Направление, по которому учится группа")]
|
||||
[EntityDependency("Lecturer", "LecturerId", "Куратор группы")]
|
||||
public class StudentGroup : BaseEntity, IEntitySecurityExtenstion<StudentGroup>
|
||||
public class StudentGroup : BaseEntity, IEntitySecurityExtenstion<StudentGroup>, 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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using DepartmentBusinessLogic.Enums;
|
||||
using ModuleTools.Attributes;
|
||||
using CoreModels.Enums.Department;
|
||||
using CoreModels.ModelsDepartment;
|
||||
using ModuleTools.BindingModels;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
@ -23,48 +23,36 @@ namespace DepartmentBusinessLogic.BindingModels
|
||||
/// <summary>
|
||||
/// Сохранение студента
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
using DepartmentBusinessLogic.Enums;
|
||||
using ModuleTools.Attributes;
|
||||
using CoreModels.Enums.Department;
|
||||
using CoreModels.ModelsDepartment;
|
||||
using ModuleTools.BindingModels;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
@ -19,21 +19,17 @@ namespace DepartmentBusinessLogic.BindingModels
|
||||
/// <summary>
|
||||
/// Сохранение студенческой группы
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using DepartmentBusinessLogic.BindingModels;
|
||||
using CoreModels.Enums.Department;
|
||||
using DepartmentBusinessLogic.BindingModels;
|
||||
using DepartmentBusinessLogic.Enums;
|
||||
using DepartmentBusinessLogic.Interfaces;
|
||||
using DepartmentBusinessLogic.ViewModels;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using DepartmentBusinessLogic.BindingModels;
|
||||
using CoreModels.Enums.Department;
|
||||
using DepartmentBusinessLogic.BindingModels;
|
||||
using DepartmentBusinessLogic.Enums;
|
||||
using DepartmentBusinessLogic.HelperModels;
|
||||
using DepartmentBusinessLogic.Interfaces;
|
||||
|
@ -1,16 +0,0 @@
|
||||
namespace DepartmentBusinessLogic.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// Учебный курс
|
||||
/// </summary>
|
||||
public enum AcademicCourse
|
||||
{
|
||||
Курс_1 = 1,
|
||||
|
||||
Курс_2 = 2,
|
||||
|
||||
Курс_3 = 3,
|
||||
|
||||
Курс_4 = 4
|
||||
}
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
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
|
||||
{
|
||||
@ -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("Куратор")]
|
||||
|
@ -1,4 +1,5 @@
|
||||
using DepartmentBusinessLogic.Enums;
|
||||
using CoreModels.Enums.Department;
|
||||
using CoreModels.ModelsDepartment;
|
||||
using ModuleTools.Attributes;
|
||||
using ModuleTools.Enums;
|
||||
using ModuleTools.ViewModels;
|
||||
@ -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; }
|
||||
}
|
||||
}
|
@ -55,7 +55,7 @@ namespace DepartmentDatabaseImplementation.Implementations
|
||||
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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user