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

This commit is contained in:
kotcheshir73 2022-03-18 22:24:10 +04:00
parent 952d283aac
commit e4377b8801
18 changed files with 141 additions and 135 deletions

View File

@ -1,9 +1,9 @@
namespace DepartmentBusinessLogic.Enums
namespace CoreModels.Enums.Department
{
/// <summary>
/// Типы приказов по студентам
/// </summary>
public enum OrderStudentMoveType
/// <summary>
/// Типы приказов по студентам
/// </summary>
public enum OrderStudentMoveType
{
Неопределено = -1,

View File

@ -1,9 +1,9 @@
namespace DepartmentBusinessLogic.Enums
namespace CoreModels.Enums.Department
{
/// <summary>
/// Тип приказа
/// </summary>
public enum OrderType
/// <summary>
/// Тип приказа
/// </summary>
public enum OrderType
{
Игнорировать = -2,

View File

@ -0,0 +1,17 @@
using CoreModels.Enums.Department;
using CoreModels.Tools;
using ModuleTools.Attributes;
using System;
namespace CoreModels.ModelsDepartment
{
[EntityDescription("Order", "Приказ")]
public interface IOrderModel : IId
{
string OrderNumber { get; }
DateTime OrderDate { get; }
OrderType OrderType { get; }
}
}

View File

@ -0,0 +1,27 @@
using CoreModels.Enums.Department;
using CoreModels.Tools;
using ModuleTools.Attributes;
using System;
namespace CoreModels.ModelsDepartment
{
[EntityDescription("OrderStudentRecord", "Запись приказа по студенту")]
[EntityDependency("Order", "OrderId", "Приказ, к которому относится запись")]
[EntityDependency("Student", "StudentId", "Студент, указанный в приказе")]
[EntityDependency("StudentGroup", "StudentGroupFromId", "Из какой группы уходит студент")]
[EntityDependency("StudentGroup", "StudentGroupToId", "В какую группу приходит студент")]
public interface IOrderStudentRecordModel : IId
{
public Guid OrderId { get; set; }
public Guid StudentId { get; set; }
public Guid? StudentGroupFromId { get; set; }
public Guid? StudentGroupToId { get; set; }
public OrderStudentMoveType OrderStudentMoveType { get; set; }
public string Info { get; set; }
}
}

View File

@ -0,0 +1,36 @@
using CoreModels.Enums.Department;
using CoreModels.Tools;
using ModuleTools.Attributes;
using System;
namespace CoreModels.ModelsDepartment
{
[EntityDescription("TimeNorm", "Норма времени")]
[EntityDependency("DisciplineBlock", "DisciplineBlockId", "Блок дисцпилн, к которому относится норма")]
public interface ITimeNormModel : IId
{
Guid DisciplineBlockId { get; }
string TimeNormName { get; }
string TimeNormShortName { get; }
int TimeNormOrder { get; }
EducationDirectionQualification? TimeNormEducationDirectionQualification { get; }
string KindOfLoadName { get; }
string KindOfLoadAttributeName { get; }
string KindOfLoadBlueAsteriskName { get; }
string KindOfLoadBlueAsteriskAttributeName { get; }
string KindOfLoadBlueAsteriskPracticName { get; }
bool UseInLearningProgress { get; }
bool UseInSite { get; }
}
}

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.Enums.Department;
using CoreModels.ModelsDepartment;
using ModuleTools.Interfaces;
using System;
using System.Collections.Generic;
@ -8,27 +9,20 @@ using System.Runtime.Serialization;
namespace DatabaseCore.Models.Department
{
/// <summary>
/// Класс, описывающий приказ
/// </summary>
[DataContract]
[EntityDescription("Order", "Приказ")]
public class Order : BaseEntity, IEntitySecurityExtenstion<Order>
[DataContract]
public class Order : BaseEntity, IEntitySecurityExtenstion<Order>, IOrderModel
{
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderNumber")]
public string OrderNumber { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderDate")]
public DateTime OrderDate { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderType")]
public int OrderType { get; set; }
public OrderType OrderType { get; set; }
//-------------------------------------------------------------------------

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using CoreModels.Enums.Department;
using CoreModels.ModelsDepartment;
using ModuleTools.Interfaces;
using System;
using System.ComponentModel.DataAnnotations;
@ -6,42 +7,28 @@ using System.Runtime.Serialization;
namespace DatabaseCore.Models.Department
{
/// <summary>
/// Класс, описывающий запись приказа по студенту
/// </summary>
[DataContract]
[EntityDescription("OrderStudentRecord", "Запись приказа по студенту")]
[EntityDependency("Order", "OrderId", "Приказ, к которому относится запись")]
[EntityDependency("Student", "StudentId", "Студент, указанный в приказе")]
[EntityDependency("StudentGroup", "StudentGroupFromId", "Из какой группы уходит студент")]
[EntityDependency("StudentGroup", "StudentGroupToId", "В какую группу приходит студент")]
public class OrderStudentRecord : BaseEntity, IEntitySecurityExtenstion<OrderStudentRecord>
[DataContract]
public class OrderStudentRecord : BaseEntity, IEntitySecurityExtenstion<OrderStudentRecord>, IOrderStudentRecordModel
{
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderId")]
public Guid OrderId { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("StudentId")]
public Guid StudentId { get; set; }
[DataMember]
[MapConfiguration("StudentGroupFromId")]
public Guid? StudentGroupFromId { get; set; }
[DataMember]
[MapConfiguration("StudentGroupToId")]
public Guid? StudentGroupToId { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderStudentMoveType")]
public int OrderStudentMoveType { get; set; }
public OrderStudentMoveType OrderStudentMoveType { get; set; }
[DataMember]
[MapConfiguration("Info")]
public string Info { get; set; }
//-------------------------------------------------------------------------

View File

@ -1,5 +1,5 @@
using CoreModels.Enums.Department;
using ModuleTools.Attributes;
using CoreModels.ModelsDepartment;
using ModuleTools.Interfaces;
using System;
using System.Collections.Generic;
@ -9,65 +9,48 @@ using System.Runtime.Serialization;
namespace DatabaseCore.Models.Department
{
/// <summary>
/// Класс, описывающий норму времени
/// </summary>
[DataContract]
[EntityDescription("TimeNorm", "Норма времени")]
[EntityDependency("DisciplineBlock", "DisciplineBlockId", "Блок дисцпилн, к которому относится норма")]
public class TimeNorm : BaseEntity, IEntitySecurityExtenstion<TimeNorm>
[DataContract]
public class TimeNorm : BaseEntity, IEntitySecurityExtenstion<TimeNorm>, ITimeNormModel
{
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("DisciplineBlockId")]
public Guid DisciplineBlockId { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("TimeNormName")]
public string TimeNormName { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("TimeNormShortName")]
public string TimeNormShortName { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("TimeNormOrder")]
public int TimeNormOrder { get; set; }
[DataMember]
[MapConfiguration("TimeNormEducationDirectionQualification")]
public EducationDirectionQualification? TimeNormEducationDirectionQualification { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("KindOfLoadName")]
public string KindOfLoadName { get; set; }
[DataMember]
[MapConfiguration("KindOfLoadAttributeName")]
public string KindOfLoadAttributeName { get; set; }
[DataMember]
[MapConfiguration("KindOfLoadBlueAsteriskName")]
public string KindOfLoadBlueAsteriskName { get; set; }
[DataMember]
[MapConfiguration("KindOfLoadBlueAsteriskAttributeName")]
public string KindOfLoadBlueAsteriskAttributeName { get; set; }
[DataMember]
[MapConfiguration("KindOfLoadBlueAsteriskPracticName")]
public string KindOfLoadBlueAsteriskPracticName { get; set; }
[DataMember]
[MapConfiguration("UseInLearningProgress")]
public bool UseInLearningProgress { get; set; }
[DataMember]
[MapConfiguration("UseInSite")]
public bool UseInSite { get; set; }
//-------------------------------------------------------------------------

View File

@ -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
{
/// <summary>
/// Получение приказа
/// </summary>
public class OrderGetBindingModel : GetBindingModel
/// <summary>
/// Получение приказа
/// </summary>
public class OrderGetBindingModel : GetBindingModel
{
public string OrderNumber { get; set; }
@ -19,18 +19,15 @@ namespace DepartmentBusinessLogic.BindingModels
/// <summary>
/// Сохранение приказа
/// </summary>
public class OrderSetBindingModel : SetBindingModel
public class OrderSetBindingModel : SetBindingModel, IOrderModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderNumber")]
public string OrderNumber { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderDate")]
public DateTime OrderDate { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderType")]
public OrderType OrderType { get; set; }
}
}

View File

@ -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
{
/// <summary>
/// Получение записи приказа по студенту
/// </summary>
public class OrderStudentRecordGetBindingModel : GetBindingModel
/// <summary>
/// Получение записи приказа по студенту
/// </summary>
public class OrderStudentRecordGetBindingModel : GetBindingModel
{
public Guid? OrderId { get; set; }
@ -23,27 +23,21 @@ namespace DepartmentBusinessLogic.BindingModels
/// <summary>
/// Сохранение записи приказа по студенту
/// </summary>
public class OrderStudentRecordSetBindingModel : SetBindingModel
public class OrderStudentRecordSetBindingModel : SetBindingModel, IOrderStudentRecordModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderId")]
public Guid OrderId { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("StudentId")]
public Guid StudentId { get; set; }
[MapConfiguration("StudentGroupFromId")]
public Guid? StudentGroupFromId { get; set; }
[MapConfiguration("StudentGroupToId")]
public Guid? StudentGroupToId { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderStudentMoveType")]
public OrderStudentMoveType OrderStudentMoveType { get; set; }
[MapConfiguration("Info")]
public string Info { get; set; }
}
}

View File

@ -1,5 +1,5 @@
using CoreModels.Enums.Department;
using ModuleTools.Attributes;
using CoreModels.ModelsDepartment;
using ModuleTools.BindingModels;
using System;
using System.ComponentModel.DataAnnotations;
@ -17,47 +17,35 @@ namespace DepartmentBusinessLogic.BindingModels
/// <summary>
/// Сохранение нормы времени
/// </summary>
public class TimeNormSetBindingModel : SetBindingModel
public class TimeNormSetBindingModel : SetBindingModel, ITimeNormModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("DisciplineBlockId")]
public Guid DisciplineBlockId { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("TimeNormName")]
public string TimeNormName { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("TimeNormShortName")]
public string TimeNormShortName { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("TimeNormOrder")]
public int TimeNormOrder { get; set; }
[MapConfiguration("TimeNormEducationDirectionQualification")]
public EducationDirectionQualification? TimeNormEducationDirectionQualification { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("KindOfLoadName")]
public string KindOfLoadName { get; set; }
[MapConfiguration("KindOfLoadAttributeName")]
public string KindOfLoadAttributeName { get; set; }
[MapConfiguration("KindOfLoadBlueAsteriskName")]
public string KindOfLoadBlueAsteriskName { get; set; }
[MapConfiguration("KindOfLoadBlueAsteriskAttributeName")]
public string KindOfLoadBlueAsteriskAttributeName { get; set; }
[MapConfiguration("KindOfLoadBlueAsteriskPracticName")]
public string KindOfLoadBlueAsteriskPracticName { get; set; }
[MapConfiguration("UseInLearningProgress")]
public bool UseInLearningProgress { get; set; }
[MapConfiguration("UseInSite")]
public bool UseInSite { get; set; }
/// <summary>

View File

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

View File

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

View File

@ -1,4 +1,5 @@
using DepartmentBusinessLogic.Enums;
using CoreModels.Enums.Department;
using CoreModels.ModelsDepartment;
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
@ -6,40 +7,38 @@ using System;
namespace DepartmentBusinessLogic.ViewModels
{
/// <summary>
/// Список приказов
/// </summary>
public class OrderStudentRecordListViewModel : ListViewModel<OrderStudentRecordViewModel> { }
/// <summary>
/// Список приказов
/// </summary>
public class OrderStudentRecordListViewModel : ListViewModel<OrderStudentRecordViewModel> { }
/// <summary>
/// Элемент приказа
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = false)]
public class OrderStudentRecordViewModel : ElementViewModel
public class OrderStudentRecordViewModel : ElementViewModel, IOrderStudentRecordModel
{
[ViewModelControlElementProperty("Приказ", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderList, DepartmentWindowsDesktop")]
[MapConfiguration("OrderId")]
public Guid OrderId { get; set; }
[ViewModelControlElementProperty("Студент", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")]
[MapConfiguration("StudentId")]
public Guid StudentId { get; set; }
[ViewModelControlElementProperty("Из группы", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentGroupList, DepartmentWindowsDesktop")]
[MapConfiguration("StudentGroupFromId")]
public Guid? StudentGroupFromId { get; set; }
[ViewModelControlElementProperty("В группу", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentGroupList, DepartmentWindowsDesktop")]
[MapConfiguration("StudentGroupToId")]
public Guid? StudentGroupToId { get; set; }
[ViewModelControlElementProperty("Тип приказа", ControlType.ControlEnum, MustHaveValue = true)]
[MapConfiguration("OrderStudentMoveType")]
public OrderStudentMoveType OrderStudentMoveType { get; set; }
[ViewModelControlListProperty("Тип приказа")]
public string OrderStudentMoveTypeTitle => OrderStudentMoveType.ToString("G");
public override string ToString() => $"";
[ViewModelControlElementProperty("Тип приказа", ControlType.ControlText, Height = 200)]
public string Info { get; set; }
public override string ToString() => $"";
}
}

View File

@ -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
{
/// <summary>
/// Список приказов
/// </summary>
public class OrderListViewModel : ListViewModel<OrderViewModel> { }
/// <summary>
/// Список приказов
/// </summary>
public class OrderListViewModel : ListViewModel<OrderViewModel> { }
/// <summary>
/// Элемент приказа
@ -17,20 +18,17 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
[ViewModelControlElementDependenceEntity(Title = "Записи по студентам", Order = 1, ParentPropertyName = "AcademicPlanId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderStudentRecordList, DepartmentWindowsDesktop")]
public class OrderViewModel : ElementViewModel
public class OrderViewModel : ElementViewModel, IOrderModel
{
[ViewModelControlListProperty("Номер приказа", ColumnWidth = 120)]
[ViewModelControlElementProperty("Номер приказа", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("OrderNumber")]
public string OrderNumber { get; set; }
[ViewModelControlListProperty("Дата приказа", ColumnWidth = 120, DefaultCellStyleFormat = "dd.MM.yyyy")]
[ViewModelControlElementProperty("Дата приказа", ControlType.ControlDateTime, MustHaveValue = true)]
[MapConfiguration("OrderDate")]
public DateTime OrderDate { get; set; }
[ViewModelControlElementProperty("Тип приказа", ControlType.ControlEnum, MustHaveValue = true)]
[MapConfiguration("OrderType")]
public OrderType OrderType { get; set; }
[ViewModelControlListProperty("Тип приказа")]

View File

@ -1,6 +1,5 @@
using CoreModels.Enums.Department;
using CoreModels.ModelsDepartment;
using DepartmentBusinessLogic.Enums;
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;

View File

@ -1,4 +1,5 @@
using CoreModels.Enums.Department;
using CoreModels.ModelsDepartment;
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
@ -17,29 +18,24 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
[ViewModelControlElementDependenceEntity(Title = "Нагрузки в планах", Order = 1, ParentPropertyName = "TimeNormId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlAcademicPlanRecordTimeNormHourList, DepartmentWindowsDesktop")]
public class TimeNormViewModel : ElementViewModel
{
public class TimeNormViewModel : ElementViewModel, ITimeNormModel
{
[ViewModelControlElementProperty("Блок дисциплин", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlDisciplineBlockList, DepartmentWindowsDesktop")]
[MapConfiguration("DisciplineBlockId")]
public Guid DisciplineBlockId { get; set; }
[ViewModelControlListProperty("Название")]
[ViewModelControlElementProperty("Название", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("TimeNormName")]
public string TimeNormName { get; set; }
[ViewModelControlListProperty("Сокращение", ColumnWidth = 100)]
[ViewModelControlElementProperty("Сокращение", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("TimeNormShortName")]
public string TimeNormShortName { get; set; }
[ViewModelControlListProperty("Порядок", ColumnWidth = 100)]
[ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("TimeNormOrder")]
public int TimeNormOrder { get; set; }
[ViewModelControlElementProperty("Обучение", ControlType.ControlEnum, MustHaveValue = false)]
[MapConfiguration("TimeNormEducationDirectionQualification")]
public EducationDirectionQualification? TimeNormEducationDirectionQualification { get; set; }
[ViewModelControlListProperty("Обучение", ColumnWidth = 100)]
@ -47,31 +43,24 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlListProperty("Тип нагрузки", ColumnWidth = 300)]
[ViewModelControlElementProperty("Тип нагрузки", ControlType.ControlString)]
[MapConfiguration("KindOfLoadName")]
public string KindOfLoadName { get; set; }
[ViewModelControlElementProperty("Атрибут для поиска в старой версии", ControlType.ControlString)]
[MapConfiguration("KindOfLoadAttributeName")]
public string KindOfLoadAttributeName { get; set; }
[ViewModelControlElementProperty("Название нагрузки в справочнике видов работ", ControlType.ControlString)]
[MapConfiguration("KindOfLoadBlueAsteriskName")]
public string KindOfLoadBlueAsteriskName { get; set; }
[ViewModelControlElementProperty("Название нагрузки в справочнике видов работ", ControlType.ControlString)]
[MapConfiguration("KindOfLoadBlueAsteriskAttributeName")]
public string KindOfLoadBlueAsteriskAttributeName { get; set; }
[ViewModelControlElementProperty("Название атрибута по которму извлекать часы", ControlType.ControlString)]
[MapConfiguration("KindOfLoadBlueAsteriskPracticName")]
public string KindOfLoadBlueAsteriskPracticName { get; set; }
[ViewModelControlElementProperty("Учитывается в учебной нагрузке", ControlType.ControlBool, MustHaveValue = true)]
[MapConfiguration("UseInLearningProgress")]
public bool UseInLearningProgress { get; set; }
[ViewModelControlElementProperty("Выводить для сайта", ControlType.ControlBool, MustHaveValue = true)]
[MapConfiguration("UseInSite")]
public bool UseInSite { get; set; }
}
}

View File

@ -60,7 +60,7 @@ namespace DepartmentDatabaseImplementation.Implementations
{
if (model.OrderId.HasValue && model.StudentId.HasValue && model.OrderStudentMoveType.HasValue)
{
return list.FirstOrDefault(x => x.OrderId == model.OrderId && x.StudentId == model.StudentId && x.OrderStudentMoveType == (int)model.OrderStudentMoveType);
return list.FirstOrDefault(x => x.OrderId == model.OrderId && x.StudentId == model.StudentId && x.OrderStudentMoveType == model.OrderStudentMoveType);
}
return base.GetSingleRecord(list, model);
}