работа с маппером
This commit is contained in:
parent
9c76b680b7
commit
34fe571fdc
@ -16,11 +16,6 @@ namespace ToolsModule.ManagmentMapping
|
||||
/// </summary>
|
||||
public string PropertyNameFromModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Сложное свойство (свойствое в другом классе-свойстве)
|
||||
/// </summary>
|
||||
public bool IsDifficle { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Можно копировать поле даже при доступе без прав
|
||||
/// </summary>
|
||||
|
@ -105,8 +105,6 @@ namespace ToolsModule.ManagmentMapping
|
||||
private static object GetValueFromCustomAttribute(MapConfigurationAttribute customAttribute, Type typeFrom, object obj)
|
||||
{
|
||||
object value = obj;
|
||||
if (customAttribute.IsDifficle)
|
||||
{
|
||||
var props = customAttribute.PropertyNameFromModel.Split('.');
|
||||
foreach (var prop in props)
|
||||
{
|
||||
@ -168,19 +166,6 @@ namespace ToolsModule.ManagmentMapping
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (customAttribute.PropertyNameFromModel == "ToString")
|
||||
{
|
||||
value = value.ToString();
|
||||
}
|
||||
var bindingProperty = typeFrom.GetProperty(customAttribute.PropertyNameFromModel);
|
||||
if (bindingProperty != null)
|
||||
{
|
||||
value = bindingProperty.GetValue(obj);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@ -21,10 +21,10 @@ namespace DepartmentContract.ViewModels
|
||||
public Guid AcademicPlanRecordId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Дисциплина")]
|
||||
[MapConfiguration("AcademicPlanRecord.Discipline.ToString", IsDifficle = true)]
|
||||
[MapConfiguration("AcademicPlanRecord.Discipline.ToString")]
|
||||
public string DisciplineName { get; set; }
|
||||
|
||||
[MapConfiguration("AcademicPlanRecord.Semester", IsDifficle = true)]
|
||||
[MapConfiguration("AcademicPlanRecord.Semester")]
|
||||
public Semester Semester { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Семестр", ColumnWidth = 80)]
|
||||
@ -34,7 +34,7 @@ namespace DepartmentContract.ViewModels
|
||||
public Guid TimeNormId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Норма времени")]
|
||||
[MapConfiguration("TimeNorm.ToString", IsDifficle = true)]
|
||||
[MapConfiguration("TimeNorm.ToString")]
|
||||
public string TimeNormName { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Часы", ColumnWidth = 80)]
|
||||
|
@ -26,7 +26,7 @@ namespace DepartmentContract.ViewModels
|
||||
public Guid DisciplineId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Дисциплина")]
|
||||
[MapConfiguration("Discipline.ToString", IsDifficle = true)]
|
||||
[MapConfiguration("Discipline.ToString")]
|
||||
public string DisciplineName { get; set; }
|
||||
|
||||
[ViewModelControlElementProperty("Преподается на кафедре", ControlType.ControlBool, MustHaveValue = true)]
|
||||
|
@ -22,11 +22,11 @@ namespace DepartmentContract.ViewModels
|
||||
public Guid? EducationDirectionId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Направление")]
|
||||
[MapConfiguration("EducationDirection.Cipher", IsDifficle = true)]
|
||||
[MapConfiguration("EducationDirection.Cipher")]
|
||||
public string EducationDirectionCipher { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Профиль")]
|
||||
[MapConfiguration("EducationDirection.Profile", IsDifficle = true)]
|
||||
[MapConfiguration("EducationDirection.Profile")]
|
||||
public string EducationDirectionProfile { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Дата начала", ColumnWidth = 120)]
|
||||
|
@ -29,7 +29,7 @@ namespace DepartmentContract.ViewModels
|
||||
public Guid EmployeeId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Сотрудник")]
|
||||
[MapConfiguration("Employee.LastName", IsDifficle = true)]
|
||||
[MapConfiguration("Employee.LastName")]
|
||||
public string EmployeeName { get; set; }
|
||||
|
||||
[ViewModelControlElementProperty("Тип", ControlType.ControlEnum, MustHaveValue = true)]
|
||||
|
@ -41,7 +41,7 @@ namespace DepartmentContract.ViewModels
|
||||
public Guid LecturerId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Руководитель ОПОП", ColumnWidth = 120)]
|
||||
[MapConfiguration("Lecturer.LastName", IsDifficle = true)]
|
||||
[MapConfiguration("Lecturer.LastName")]
|
||||
public string LecturerName { get; set; }
|
||||
|
||||
[ViewModelControlElementProperty("Уровень обучения", ControlType.ControlEnum, MustHaveValue = true)]
|
||||
|
@ -20,14 +20,14 @@ namespace DepartmentContract.ViewModels
|
||||
public Guid EmployeeId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Сотрудник")]
|
||||
[MapConfiguration("Employee.ToString", IsDifficle = true)]
|
||||
[MapConfiguration("Employee.ToString")]
|
||||
public string EmployeeName { get; set; }
|
||||
|
||||
[ViewModelControlElementProperty("Должность", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlPostList, DepartmentWindowsDesktop")]
|
||||
public Guid PostId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Должность")]
|
||||
[MapConfiguration("Post.ToString", IsDifficle = true)]
|
||||
[MapConfiguration("Post.ToString")]
|
||||
public string PostName { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Ставка", ColumnWidth = 80, DefaultCellStyleFormat = "N1")]
|
||||
|
@ -20,14 +20,14 @@ namespace DepartmentContract.ViewModels
|
||||
public Guid LecturerId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Преподаватель")]
|
||||
[MapConfiguration("Lecturer.ToString", IsDifficle = true)]
|
||||
[MapConfiguration("Lecturer.ToString")]
|
||||
public string LecturerName { get; set; }
|
||||
|
||||
[ViewModelControlElementProperty("Должность", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlPostList, DepartmentWindowsDesktop")]
|
||||
public Guid PostId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Должность")]
|
||||
[MapConfiguration("Post.ToString", IsDifficle = true)]
|
||||
[MapConfiguration("Post.ToString")]
|
||||
public string PostName { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Ставка", ColumnWidth = 80, DefaultCellStyleFormat = "N1")]
|
||||
|
@ -29,14 +29,14 @@ namespace DepartmentContract.ViewModels
|
||||
public Guid? LecturerAcademicDegreeId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Уч. степень")]
|
||||
[MapConfiguration("LecturerAcademicDegree.LecturerAcademicDegreeName", IsDifficle = true)]
|
||||
[MapConfiguration("LecturerAcademicDegree.LecturerAcademicDegreeName")]
|
||||
public string LecturerAcademicDegree { get; set; }
|
||||
|
||||
[ViewModelControlElementProperty("Уч. звание", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerAcademicRankList, DepartmentWindowsDesktop")]
|
||||
public Guid? LecturerAcademicRankId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Уч. звание")]
|
||||
[MapConfiguration("LecturerAcademicRank.LecturerAcademicRankName", IsDifficle = true)]
|
||||
[MapConfiguration("LecturerAcademicRank.LecturerAcademicRankName")]
|
||||
public string LecturerAcademicRank { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Фамилия")]
|
||||
|
@ -20,7 +20,7 @@ namespace DepartmentContract.ViewModels
|
||||
public Guid OrderSyncHistoryId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Дата", ColumnWidth = 100, DefaultCellStyleFormat = "dd.MM.yyyy")]
|
||||
[MapConfiguration("OrderSyncHistory.SyncDate", IsDifficle = true)]
|
||||
[MapConfiguration("OrderSyncHistory.SyncDate")]
|
||||
public DateTime SyncDate { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Описание")]
|
||||
|
@ -23,14 +23,14 @@ namespace DepartmentContract.ViewModels
|
||||
public Guid EducationDirectionId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Шифр", ColumnWidth = 80)]
|
||||
[MapConfiguration("EducationDirection.Cipher", IsDifficle = true)]
|
||||
[MapConfiguration("EducationDirection.Cipher")]
|
||||
public string EducationDirectionCipher { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Профиль")]
|
||||
[MapConfiguration("EducationDirection.Profile", IsDifficle = true)]
|
||||
[MapConfiguration("EducationDirection.Profile")]
|
||||
public string EducationDirectionProfile { get; set; }
|
||||
|
||||
[MapConfiguration("EducationDirection.ShortName", IsDifficle = true)]
|
||||
[MapConfiguration("EducationDirection.ShortName")]
|
||||
public string EducationDirectionShortName { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Группа")]
|
||||
@ -46,10 +46,10 @@ namespace DepartmentContract.ViewModels
|
||||
[ViewModelControlElementProperty("Номер группы", ControlType.ControlInt, MustHaveValue = true, MinValue = 0, MaxValue = 4)]
|
||||
public int GroupNumber { get; set; }
|
||||
|
||||
[MapConfiguration("Method.GetStudnetsByState[Enum:Учится]", IsDifficle = true, MethodParams = new Type[] { typeof(StudentState) })]
|
||||
[MapConfiguration("Method.GetStudnetsByState[Enum:Учится]", MethodParams = new Type[] { typeof(StudentState) })]
|
||||
public int StudentActualCount { get; set; }
|
||||
|
||||
[MapConfiguration("Method.GetStudnetsByState[Enum:Академ]", IsDifficle = true, MethodParams = new Type[] { typeof(StudentState) })]
|
||||
[MapConfiguration("Method.GetStudnetsByState[Enum:Академ]", MethodParams = new Type[] { typeof(StudentState) })]
|
||||
public int StudentAcademCount { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Количество студентов")]
|
||||
@ -59,7 +59,7 @@ namespace DepartmentContract.ViewModels
|
||||
public Guid? LecturerId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Куратор")]
|
||||
[MapConfiguration("Lecturer.ToString", IsDifficle = true)]
|
||||
[MapConfiguration("Lecturer.ToString")]
|
||||
public string Lecturer { get; set; }
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ namespace DepartmentContract.ViewModels
|
||||
[ViewModelControlElementProperty("Группа", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentGroupList, DepartmentWindowsDesktop")]
|
||||
public Guid? StudentGroupId { get; set; }
|
||||
|
||||
[MapConfiguration("StudentGroup.ToString", IsDifficle = true)]
|
||||
[MapConfiguration("StudentGroup.ToString")]
|
||||
public string StudentGroupName { get; set; }
|
||||
|
||||
[ViewModelControlElementProperty("Идентификатор универа", ControlType.ControlString, MustHaveValue = true, ReadOnly = true)]
|
||||
|
@ -21,7 +21,7 @@ namespace SecurityContract.ViewModels
|
||||
public Guid RoleId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Роль", ColumnWidth = 100)]
|
||||
[MapConfiguration("Role.ToString", IsDifficle = true, AllowCopyWithoutRigth = false)]
|
||||
[MapConfiguration("Role.ToString", AllowCopyWithoutRigth = false)]
|
||||
public string RoleName { get; set; }
|
||||
|
||||
[ViewModelControlElementProperty("Операция", ControlType.ControlEnum, MustHaveValue = true)]
|
||||
|
@ -20,14 +20,14 @@ namespace SecurityContract.ViewModels
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Пользователь")]
|
||||
[MapConfiguration("User.ToString", IsDifficle = true, AllowCopyWithoutRigth = false)]
|
||||
[MapConfiguration("User.ToString", AllowCopyWithoutRigth = false)]
|
||||
public string UserName { get; set; }
|
||||
|
||||
[ViewModelControlElementProperty("Роль", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlRoleList, SecurityWindowsDesktop")]
|
||||
public Guid RoleId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Роль")]
|
||||
[MapConfiguration("Role.ToString", IsDifficle = true, AllowCopyWithoutRigth = false)]
|
||||
[MapConfiguration("Role.ToString", AllowCopyWithoutRigth = false)]
|
||||
public string RoleName { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user