формат вывода на списке
This commit is contained in:
parent
6368698bff
commit
34ff70b8ca
@ -173,9 +173,13 @@ namespace DesktopTools.Controls
|
||||
Name = string.Format("Column{0}", property.Name),
|
||||
ReadOnly = true,
|
||||
Visible = !attr.IsHide,
|
||||
Width = attr.ColumnWidth ?? 0,
|
||||
AutoSizeMode = attr.ColumnWidth.HasValue ? DataGridViewAutoSizeColumnMode.None : DataGridViewAutoSizeColumnMode.Fill
|
||||
Width = attr.ColumnWidth,
|
||||
AutoSizeMode = attr.ColumnWidth != 0 ? DataGridViewAutoSizeColumnMode.None : DataGridViewAutoSizeColumnMode.Fill
|
||||
});
|
||||
if (attr.DefaultCellStyleFormat.IsNotEmpty())
|
||||
{
|
||||
dataGridViewList.Columns[colIndex].DefaultCellStyle.Format = attr.DefaultCellStyleFormat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -571,7 +575,7 @@ namespace DesktopTools.Controls
|
||||
StartPosition = FormStartPosition.CenterScreen,
|
||||
ControlBox = false
|
||||
};
|
||||
control.Open( new ControlOpenModel
|
||||
control.Open(new ControlOpenModel
|
||||
{
|
||||
OpenMode = ControlOpenMode.List,
|
||||
ElementId = id,
|
||||
|
@ -22,7 +22,12 @@ namespace ModuleTools.Attributes
|
||||
/// <summary>
|
||||
/// Ширина колонки
|
||||
/// </summary>
|
||||
public int? ColumnWidth { get; set; } = null;
|
||||
public int ColumnWidth { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Формат вывода в колонке
|
||||
/// </summary>
|
||||
public string DefaultCellStyleFormat { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Настройка отображения элемента в контролах
|
||||
@ -32,16 +37,5 @@ namespace ModuleTools.Attributes
|
||||
{
|
||||
DisplayName = displayName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Настройка отображения элемента в контролах
|
||||
/// </summary>
|
||||
/// <param name="displayName">Название на форме</param>
|
||||
/// <param name="columnWidth">Ширина колонки</param>
|
||||
public ViewModelControlListPropertyAttribute(string displayName, int columnWidth)
|
||||
{
|
||||
DisplayName = displayName;
|
||||
ColumnWidth = columnWidth;
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ namespace DepartmentBusinessLogic.ViewModels
|
||||
[ViewModelControlElementClass()]
|
||||
public class ClassroomViewModel : ElementViewModel
|
||||
{
|
||||
[ViewModelControlListProperty("Номер", 80)]
|
||||
[ViewModelControlListProperty("Номер", ColumnWidth = 80)]
|
||||
[ViewModelControlElementProperty("Номер аудитории", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("Number")]
|
||||
public string Number { get; set; }
|
||||
@ -39,15 +39,15 @@ namespace DepartmentBusinessLogic.ViewModels
|
||||
[MapConfiguration("ClassroomType")]
|
||||
public ClassroomType ClassroomType { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Тип", 120)]
|
||||
[ViewModelControlListProperty("Тип", ColumnWidth = 120)]
|
||||
public string ClassroomTypeTitle => ClassroomType.ToString("G");
|
||||
|
||||
[ViewModelControlListProperty("Площадь", 90)]
|
||||
[ViewModelControlListProperty("Площадь", ColumnWidth = 90)]
|
||||
[ViewModelControlElementProperty("Площадь", ControlType.ControlDecimal, MustHaveValue = true)]
|
||||
[MapConfiguration("Square")]
|
||||
public decimal Square { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Кол-во мест", 100)]
|
||||
[ViewModelControlListProperty("Кол-во мест", ColumnWidth = 100)]
|
||||
[ViewModelControlElementProperty("Кол-во мест", ControlType.ControlInt, MustHaveValue = true)]
|
||||
[MapConfiguration("Capacity")]
|
||||
public int Capacity { get; set; }
|
||||
|
@ -32,7 +32,7 @@ namespace DepartmentBusinessLogic.ViewModels
|
||||
[MapConfiguration("EmployeePost.EmployeePostName", IsDifficle = true)]
|
||||
public string EmployeePostName { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Ставка", 80)]
|
||||
[ViewModelControlListProperty("Ставка", ColumnWidth = 80, DefaultCellStyleFormat = "N1")]
|
||||
[ViewModelControlElementProperty("Ставка", ControlType.ControlDecimal, DecimalPlaces = 1, MustHaveValue = true)]
|
||||
[MapConfiguration("Rate")]
|
||||
public decimal Rate { get; set; }
|
||||
@ -41,14 +41,14 @@ namespace DepartmentBusinessLogic.ViewModels
|
||||
[MapConfiguration("IsInternalCombination")]
|
||||
public bool IsInternalCombination { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Внутр. совм.", 80)]
|
||||
[ViewModelControlListProperty("Внутр. совм.", ColumnWidth = 80)]
|
||||
public string InternalCombination => IsInternalCombination ? "Да" : "Нет";
|
||||
|
||||
[ViewModelControlElementProperty("Внеш. совм.", ControlType.ControlBool, MustHaveValue = true)]
|
||||
[MapConfiguration("IsExternalCombination")]
|
||||
public bool IsExternalCombination { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Внеш. совм.", 80)]
|
||||
[ViewModelControlListProperty("Внеш. совм.", ColumnWidth = 80)]
|
||||
public string ExternalCombination => IsExternalCombination ? "Да" : "Нет";
|
||||
|
||||
public override string ToString() => $"{EmployeeName}-{EmployeePostName}";
|
||||
|
@ -22,7 +22,7 @@ namespace DepartmentBusinessLogic.ViewModels
|
||||
[MapConfiguration("EmployeePostName")]
|
||||
public string EmployeePostName { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Порядок", 100)]
|
||||
[ViewModelControlListProperty("Порядок", ColumnWidth = 100)]
|
||||
[ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)]
|
||||
[MapConfiguration("Order")]
|
||||
public int Order { get; set; }
|
||||
|
@ -40,27 +40,27 @@ namespace DepartmentBusinessLogic.ViewModels
|
||||
[MapConfiguration("Patronymic")]
|
||||
public string Patronymic { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Дата рожд.", 100)]
|
||||
[ViewModelControlListProperty("Дата рожд.", ColumnWidth = 100, DefaultCellStyleFormat = "dd.MM.yyyy")]
|
||||
[ViewModelControlElementProperty("Дата рожд.", ControlType.ControlDateTime, MustHaveValue = true )]
|
||||
[MapConfiguration("DateBirth", AllowCopyWithoutRigth = false)]
|
||||
public DateTime DateBirth { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Адрес", 90)]
|
||||
[ViewModelControlListProperty("Адрес", ColumnWidth = 90)]
|
||||
[ViewModelControlElementProperty("Адрес", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("Address", AllowCopyWithoutRigth = false)]
|
||||
public string Address { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Эл. почта", 90)]
|
||||
[ViewModelControlListProperty("Эл. почта", ColumnWidth = 90)]
|
||||
[ViewModelControlElementProperty("Эл. почта", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("Email", AllowCopyWithoutRigth = false)]
|
||||
public string Email { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Моб. номер", 100)]
|
||||
[ViewModelControlListProperty("Моб. номер", ColumnWidth = 100)]
|
||||
[ViewModelControlElementProperty("Моб. номер", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("MobileNumber", AllowCopyWithoutRigth = false)]
|
||||
public string MobileNumber { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Дом. номер", 100)]
|
||||
[ViewModelControlListProperty("Дом. номер", ColumnWidth = 100)]
|
||||
[ViewModelControlElementProperty("Дом. номер", ControlType.ControlString)]
|
||||
[MapConfiguration("HomeNumber", AllowCopyWithoutRigth = false)]
|
||||
public string HomeNumber { get; set; }
|
||||
@ -73,7 +73,7 @@ namespace DepartmentBusinessLogic.ViewModels
|
||||
[MapConfiguration("Photo")]
|
||||
public byte[] Photo { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Гр. эл.без.", 90)]
|
||||
[ViewModelControlListProperty("Гр. эл.без.", ColumnWidth = 90)]
|
||||
[ViewModelControlElementProperty("Группа эл.безоп", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("GroupElectricalSafety")]
|
||||
public string GroupElectricalSafety { get; set; }
|
||||
|
@ -20,7 +20,7 @@ namespace SecurityBusinessLogic.ViewModels
|
||||
[ViewModelControlElementProperty("Роль", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = true, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlRoleList, SecurityWindowsDesktop")]
|
||||
public Guid RoleId { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Роль", 100)]
|
||||
[ViewModelControlListProperty("Роль", ColumnWidth = 100)]
|
||||
[MapConfiguration("Role.RoleName", IsDifficle = true, AllowCopyWithoutRigth = false)]
|
||||
public string RoleName { get; set; }
|
||||
|
||||
@ -35,7 +35,7 @@ namespace SecurityBusinessLogic.ViewModels
|
||||
[ViewModelControlElementProperty("Тип", ControlType.ControlEnum, MustHaveValue = true)]
|
||||
public AccessType AccessType { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Тип", 150)]
|
||||
[ViewModelControlListProperty("Тип", ColumnWidth = 150)]
|
||||
public string AccessTypeTitle => AccessType switch
|
||||
{
|
||||
AccessType.Delete => "Полные права",
|
||||
|
@ -24,7 +24,7 @@ namespace SecurityBusinessLogic.ViewModels
|
||||
[MapConfiguration("RoleName")]
|
||||
public string RoleName { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Приоритет", 100)]
|
||||
[ViewModelControlListProperty("Приоритет", ColumnWidth = 100)]
|
||||
[ViewModelControlElementProperty("Приоритет", ControlType.ControlInt, MustHaveValue = true)]
|
||||
[MapConfiguration("RolePriority")]
|
||||
public int RolePriority { get; set; }
|
||||
|
@ -5,54 +5,54 @@ using System;
|
||||
|
||||
namespace SecurityBusinessLogic.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Список пользователей
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Список пользователей
|
||||
/// </summary>
|
||||
public class UserListViewModel : ListViewModel<UserViewModel> { }
|
||||
|
||||
/// <summary>
|
||||
/// Элемент пользователей
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Элемент пользователей
|
||||
/// </summary>
|
||||
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
|
||||
[ViewModelControlElementDependenceEntity(Title = "Роли", Order = 1, ParentPropertyName = "UserId",
|
||||
ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserRoleList, SecurityWindowsDesktop")]
|
||||
public class UserViewModel : ElementViewModel
|
||||
{
|
||||
[ViewModelControlListProperty("Пользователь")]
|
||||
[ViewModelControlElementProperty("Логин", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("UserName")]
|
||||
public string Login { get; set; }
|
||||
[ViewModelControlElementDependenceEntity(Title = "Роли", Order = 1, ParentPropertyName = "UserId",
|
||||
ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserRoleList, SecurityWindowsDesktop")]
|
||||
public class UserViewModel : ElementViewModel
|
||||
{
|
||||
[ViewModelControlListProperty("Пользователь")]
|
||||
[ViewModelControlElementProperty("Логин", ControlType.ControlString, MustHaveValue = true)]
|
||||
[MapConfiguration("UserName")]
|
||||
public string Login { get; set; }
|
||||
|
||||
[MapConfiguration("PasswordHash", AllowCopyWithoutRigth = false)]
|
||||
public string Password { get; set; }
|
||||
[MapConfiguration("PasswordHash", AllowCopyWithoutRigth = false)]
|
||||
public string Password { get; set; }
|
||||
|
||||
[MapConfiguration("Avatar")]
|
||||
[ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)]
|
||||
public byte[] Avatar { get; set; }
|
||||
[MapConfiguration("Avatar")]
|
||||
[ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)]
|
||||
public byte[] Avatar { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Посл. визит", 100)]
|
||||
[MapConfiguration("DateLastVisit")]
|
||||
public DateTime? DateLastVisit { get; set; }
|
||||
[ViewModelControlListProperty("Посл. визит", ColumnWidth = 100, DefaultCellStyleFormat = "dd.MM.yyyy")]
|
||||
[MapConfiguration("DateLastVisit")]
|
||||
public DateTime? DateLastVisit { get; set; }
|
||||
|
||||
[MapConfiguration("IsBanned", AllowCopyWithoutRigth = false)]
|
||||
[ViewModelControlElementProperty("Заблокирован", ControlType.ControlBool, MustHaveValue = true)]
|
||||
public bool IsBanned { get; set; }
|
||||
[MapConfiguration("IsBanned", AllowCopyWithoutRigth = false)]
|
||||
[ViewModelControlElementProperty("Заблокирован", ControlType.ControlBool, MustHaveValue = true)]
|
||||
public bool IsBanned { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Блокир.", 80)]
|
||||
public string Banned => IsBanned ? "Да" : "Нет";
|
||||
[ViewModelControlListProperty("Блокир.", ColumnWidth = 80)]
|
||||
public string Banned => IsBanned ? "Да" : "Нет";
|
||||
|
||||
[MapConfiguration("DateBanned", AllowCopyWithoutRigth = false)]
|
||||
[ViewModelControlElementProperty("Дата блокировки", ControlType.ControlDateTime, ReadOnly = true)]
|
||||
public DateTime? DateBanned { get; set; }
|
||||
[MapConfiguration("DateBanned", AllowCopyWithoutRigth = false)]
|
||||
[ViewModelControlElementProperty("Дата блокировки", ControlType.ControlDateTime, ReadOnly = true)]
|
||||
public DateTime? DateBanned { get; set; }
|
||||
|
||||
[ViewModelControlListProperty("Дата Б.", 100)]
|
||||
public string DateBannedTitle => DateBanned.HasValue ? DateBanned.Value.ToShortDateString() : string.Empty;
|
||||
[ViewModelControlListProperty("Дата Б.", ColumnWidth = 100)]
|
||||
public string DateBannedTitle => DateBanned.HasValue ? DateBanned.Value.ToShortDateString() : string.Empty;
|
||||
|
||||
[MapConfiguration("CountAttempt", AllowCopyWithoutRigth = false)]
|
||||
[ViewModelControlElementProperty("Попытки входа", ControlType.ControlInt , ReadOnly = true)]
|
||||
public int CountAttempt { get; set; }
|
||||
[MapConfiguration("CountAttempt", AllowCopyWithoutRigth = false)]
|
||||
[ViewModelControlElementProperty("Попытки входа", ControlType.ControlInt, ReadOnly = true)]
|
||||
public int CountAttempt { get; set; }
|
||||
|
||||
public override string ToString() => Login;
|
||||
public override string ToString() => Login;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user