Этап 1. Форматирование данных в колонках
This commit is contained in:
parent
e7941ff84c
commit
11bd076201
@ -44,6 +44,10 @@ namespace FurnitureAssembly
|
||||
{
|
||||
column.Width = columnAttr.Width;
|
||||
}
|
||||
if (columnAttr.IsFormatable)
|
||||
{
|
||||
column.DefaultCellStyle.Format = columnAttr.Formatter;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace FurnitureAssemblyContracts.Attributes
|
||||
{
|
||||
@ -7,18 +8,23 @@ namespace FurnitureAssemblyContracts.Attributes
|
||||
{
|
||||
public ColumnAttribute(string title = "", bool visible = true, int width
|
||||
= 0, GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool
|
||||
isUseAutoSize = false)
|
||||
isUseAutoSize = false, bool isFormatable = false, string? formatter = null)
|
||||
{
|
||||
Title = title;
|
||||
Visible = visible;
|
||||
Width = width;
|
||||
GridViewAutoSize = gridViewAutoSize;
|
||||
IsUseAutoSize = isUseAutoSize;
|
||||
IsFormatable = isFormatable;
|
||||
Formatter = formatter;
|
||||
|
||||
}
|
||||
public string Title { get; private set; }
|
||||
public bool Visible { get; private set; }
|
||||
public int Width { get; private set; }
|
||||
public GridViewAutoSize GridViewAutoSize { get; private set; }
|
||||
public bool IsUseAutoSize { get; private set; }
|
||||
public bool IsFormatable { get; private set; }
|
||||
public string? Formatter { get; private set; }
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace FurnitureAssemblyContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
[Column(title: "Название компонента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
[Column(title: "Цена", width: 70)]
|
||||
[Column(title: "Цена", width: 70, isFormatable: true, formatter: "0.00##")]
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace FurnitureAssemblyContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
[Column(title: "Название изделия", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string FurnitureName { get; set; } = string.Empty;
|
||||
[Column(title: "Цена", width: 70)]
|
||||
[Column(title: "Цена", width: 70, isFormatable: true, formatter: "0.00##")]
|
||||
public double Price { get; set; }
|
||||
[Column(visible: false)]
|
||||
public Dictionary<int, (IComponentModel, int)> FurnitureComponents{ get; set; } = new();
|
||||
|
@ -12,15 +12,15 @@ namespace FurnitureAssemblyContracts.ViewModels
|
||||
public int? ClientId { get; set; }
|
||||
[Column(title: "Отправитель", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string SenderName { get; set; } = string.Empty;
|
||||
[Column(title: "Дата письма", width: 100)]
|
||||
[Column(title: "Дата письма", width: 100, isFormatable: true, formatter: "dd/MM/yyyy")]
|
||||
public DateTime DateDelivery { get; set; }
|
||||
[Column(title: "Заголовок", width: 170)]
|
||||
public string Subject { get; set; } = string.Empty;
|
||||
[Column(title: "Текст", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string Body { get; set; } = string.Empty;
|
||||
[DisplayName("Прочитано")]
|
||||
[Column(title: "Прочитано", width: 10)]
|
||||
public bool IsRead { get; set; }
|
||||
[DisplayName("Ответ")]
|
||||
[Column(title: "Ответ", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string? Reply { get; set; }
|
||||
|
||||
public int Id => throw new NotImplementedException();
|
||||
|
@ -23,13 +23,13 @@ namespace FurnitureAssemblyContracts.ViewModels
|
||||
public string FurnitureName { get; set; } = string.Empty;
|
||||
[Column(title: "Количество", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public int Count { get; set; }
|
||||
[Column(title: "Сумма", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
[Column(title: "Сумма", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true, isFormatable: true, formatter: "0.00##")]
|
||||
public double Sum { get; set; }
|
||||
[Column(title: "Статус", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
[Column(title: "Дата создания", width: 100)]
|
||||
[Column(title: "Дата создания", width: 100, isFormatable: true, formatter: "dd/MM/yyyy")]
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
[Column(title: "Дата выполнения", width: 100)]
|
||||
[Column(title: "Дата выполнения", width: 100, isFormatable: true, formatter: "dd/MM/yyyy")]
|
||||
public DateTime? DateImplement { get; set; }
|
||||
[Column(visible: false)]
|
||||
public int? ImplementerId { get; set; }
|
||||
|
@ -11,7 +11,7 @@ namespace FurnitureAssemblyContracts.ViewModels
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
[Column(title: "Адрес магазина", isUseAutoSize: true, gridViewAutoSize: GridViewAutoSize.Fill)]
|
||||
public string Address { get; set; } = string.Empty;
|
||||
[Column(title: "Дата открытия", width: 100)]
|
||||
[Column(title: "Дата открытия", width: 100, isFormatable: true, formatter: "dd/MM/yyyy")]
|
||||
public DateTime DateOpening { get; set; }
|
||||
|
||||
public Dictionary<int, (IFurnitureModel, int)> Furnitures { get; set; } = new();
|
||||
|
Loading…
Reference in New Issue
Block a user