форматирую себе диск цэ
This commit is contained in:
parent
632e6609a2
commit
c4e66e3245
@ -33,6 +33,7 @@ namespace LawFirmView
|
||||
// ищем нужный нам атрибут
|
||||
if (attribute is ColumnAttribute columnAttr)
|
||||
{
|
||||
column.DefaultCellStyle.Format = columnAttr.Format;
|
||||
column.HeaderText = columnAttr.Title;
|
||||
column.Visible = columnAttr.Visible;
|
||||
if (columnAttr.IsUseAutoSize)
|
||||
|
@ -36,16 +36,7 @@ namespace LawFirmView
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["Name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||
dataGridView.Columns["ShopDocuments"].Visible = false;
|
||||
}
|
||||
|
||||
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
||||
_logger.LogInformation("Загрузка магазинов");
|
||||
|
||||
}
|
||||
|
@ -9,19 +9,21 @@ namespace LawFirmContracts.Attributes
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class ColumnAttribute : Attribute
|
||||
{
|
||||
public ColumnAttribute(string title = "", bool visible = true, int width = 0, GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool isUseAutoSize = false)
|
||||
public ColumnAttribute(string title = "", bool visible = true, int width = 0, GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool isUseAutoSize = false, string format = "")
|
||||
{
|
||||
Title = title;
|
||||
Visible = visible;
|
||||
Width = width;
|
||||
GridViewAutoSize = gridViewAutoSize;
|
||||
IsUseAutoSize = isUseAutoSize;
|
||||
Format = format;
|
||||
}
|
||||
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 string Format { get; private set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,14 +27,15 @@ namespace LawFirmContracts.DI
|
||||
/// </summary>
|
||||
public static void InitDependency()
|
||||
{
|
||||
var extList = ServiceProviderLoader.GetImplementationExtensions();
|
||||
foreach (var ext in extList)
|
||||
// берем все расширения и проходимся по ним, регистрируя сервисы в каждом
|
||||
var extensions = ServiceProviderLoader.GetImplementationExtensions();
|
||||
foreach (var extension in extensions)
|
||||
{
|
||||
if (ext == null)
|
||||
if (extension == null)
|
||||
{
|
||||
throw new ArgumentNullException("Отсутствуют компоненты для загрузки зависимостей по модулям");
|
||||
}
|
||||
ext.RegisterServices();
|
||||
extension.RegisterServices();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace LawFirmContracts.ViewModels
|
||||
[Column("Название бланка", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string BlankName { get; set; } = string.Empty;
|
||||
|
||||
[Column("Цена", width: 100)]
|
||||
[Column("Цена", width: 100, format: "0.00")]
|
||||
public double Cost { get; set; }
|
||||
|
||||
[Column(visible: false)]
|
||||
|
@ -14,7 +14,7 @@ namespace LawFirmContracts.ViewModels
|
||||
[Column("Название документа", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string DocumentName {get; set;} = string.Empty;
|
||||
|
||||
[Column("Цена", width: 100)]
|
||||
[Column("Цена", width: 100, format:"0.00")]
|
||||
public double Price { get; set; }
|
||||
|
||||
[Column(visible: false)]
|
||||
|
@ -20,7 +20,7 @@ namespace LawFirmContracts.ViewModels
|
||||
[Column("Отправитель", gridViewAutoSize: GridViewAutoSize.DisplayedCells, isUseAutoSize: true)]
|
||||
public string SenderName { get; set; } = string.Empty;
|
||||
|
||||
[Column("Дата письма", width: 100)]
|
||||
[Column("Дата письма", width: 100, format:"D")]
|
||||
public DateTime DateDelivery { get; set; }
|
||||
|
||||
[Column("Заголовок", width: 150)]
|
||||
@ -29,7 +29,7 @@ namespace LawFirmContracts.ViewModels
|
||||
[Column("Текст", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string Body { get; set; } = string.Empty;
|
||||
|
||||
[Column("Прочитано", width: 30)]
|
||||
[Column("Прочитано", width: 50)]
|
||||
public bool IsReaded { get; set; }
|
||||
|
||||
[Column("Ответ", width: 150)]
|
||||
|
@ -36,16 +36,16 @@ namespace LawFirmContracts.ViewModels
|
||||
[Column("Количество", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||
public int Count { get; set; }
|
||||
|
||||
[Column("Сумма", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||
[Column("Сумма", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true, format:"0.00")]
|
||||
public double Sum { get; set; }
|
||||
|
||||
[Column("Статус", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
|
||||
[Column("Дата создания", width: 100)]
|
||||
[Column("Дата создания", width: 100, format:"D")]
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
|
||||
[Column("Дата выполнения", width: 100)]
|
||||
[Column("Дата выполнения", width: 100, format:"D")]
|
||||
public DateTime? DateImplement { get; set; }
|
||||
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using LawFirmDataModels.Models;
|
||||
using LawFirmContracts.Attributes;
|
||||
using LawFirmDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -10,19 +11,25 @@ namespace LawFirmContracts.ViewModels
|
||||
{
|
||||
public class ShopViewModel : IShopModel
|
||||
{
|
||||
[DisplayName("Название магазина")]
|
||||
[Column("Название магазина", gridViewAutoSize:GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DisplayName("Адрес")]
|
||||
|
||||
[Column("Адрес", width: 150)]
|
||||
public string Adress { get; set; } = string.Empty;
|
||||
[DisplayName("Дата открытия")]
|
||||
|
||||
[Column("Дата открытия", format:"D", isUseAutoSize:true, gridViewAutoSize:GridViewAutoSize.AllCells)]
|
||||
public DateTime OpeningDate { get; set; }
|
||||
|
||||
[Column(visible: false)]
|
||||
public Dictionary<int, (IDocumentModel, int)> ShopDocuments { get; set; } = new();
|
||||
|
||||
[Column(visible: false)]
|
||||
public List<Tuple<string, int>>? DocumentCount { get; set; } = new();
|
||||
|
||||
[Column(visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Макс. документов в магазине")]
|
||||
[Column("Макс. документов в магазине", width:100)]
|
||||
public int MaxCountDocuments { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user