From 1e2e4b0f2141d187a94dbbb3eaef80dcaea698b4 Mon Sep 17 00:00:00 2001 From: malimova Date: Sun, 2 Jun 2024 20:11:06 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20view-=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D1=8C=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/ComponentViewModel.cs | 12 +++--- .../ViewModels/ImplementerViewModel.cs | 10 +++-- .../ViewModels/MessageInfoViewModel.cs | 14 ++++--- .../ViewModels/OrderViewModel.cs | 41 +++++++++++-------- .../ViewModels/PastryViewModel.cs | 15 ++++--- .../ConfectioneryDataModels/IClientModel.cs | 2 +- .../DataGridViewExtension.cs | 12 ++++++ 7 files changed, 67 insertions(+), 39 deletions(-) create mode 100644 Confectionery/ConfectioneryView/DataGridViewExtension.cs diff --git a/Confectionery/ConfectioneryContracts/ViewModels/ComponentViewModel.cs b/Confectionery/ConfectioneryContracts/ViewModels/ComponentViewModel.cs index 7ef4f36..7d4702e 100644 --- a/Confectionery/ConfectioneryContracts/ViewModels/ComponentViewModel.cs +++ b/Confectionery/ConfectioneryContracts/ViewModels/ComponentViewModel.cs @@ -1,4 +1,5 @@ using ConfectioneryDataModels.Models; +using ConfectioneryContracts.Attributes; using System; using System.Collections.Generic; using System.ComponentModel; @@ -10,10 +11,11 @@ namespace ConfectioneryContracts.ViewModels { public class ComponentViewModel : IComponentModel { - public int Id { get; set; } - [DisplayName("Название компонента")] - public string ComponentName { get; set; } = string.Empty; - [DisplayName("Цена")] - public double Cost { get; set; } + [Column(visible: false)] + public int Id { get; set; } + [Column(title: "Название компонента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] + public string ComponentName { get; set; } = string.Empty; + [Column(title: "Цена", width: 150)] + public double Cost { get; set; } } } diff --git a/Confectionery/ConfectioneryContracts/ViewModels/ImplementerViewModel.cs b/Confectionery/ConfectioneryContracts/ViewModels/ImplementerViewModel.cs index 7427339..cc178f7 100644 --- a/Confectionery/ConfectioneryContracts/ViewModels/ImplementerViewModel.cs +++ b/Confectionery/ConfectioneryContracts/ViewModels/ImplementerViewModel.cs @@ -1,4 +1,5 @@ using ConfectioneryDataModels.Models; +using ConfectioneryContracts.Attributes; using System; using System.Collections.Generic; using System.ComponentModel; @@ -10,18 +11,19 @@ namespace ConfectioneryContracts.ViewModels { public class ImplementerViewModel : IImplementerModel { + [Column(visible: false)] public int Id { get; set; } - [DisplayName("ФИО исполнителя")] + [Column(title: "ФИО исполнителя", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] public string ImplementerFIO { get; set; } = string.Empty; - [DisplayName("Пароль")] + [Column(title: "Пароль", width: 100)] public string Password { get; set; } = string.Empty; - [DisplayName("Стаж работы")] + [Column(title: "Стаж работы", width: 60)] public int WorkExperience { get; set; } - [DisplayName("Квалификация")] + [Column(title: "Квалификация", width: 60)] public int Qualification { get; set; } } } diff --git a/Confectionery/ConfectioneryContracts/ViewModels/MessageInfoViewModel.cs b/Confectionery/ConfectioneryContracts/ViewModels/MessageInfoViewModel.cs index 6f8e090..d7f41f6 100644 --- a/Confectionery/ConfectioneryContracts/ViewModels/MessageInfoViewModel.cs +++ b/Confectionery/ConfectioneryContracts/ViewModels/MessageInfoViewModel.cs @@ -1,4 +1,5 @@ using ConfectioneryDataModels.Models; +using ConfectioneryContracts.Attributes; using System; using System.Collections.Generic; using System.ComponentModel; @@ -10,20 +11,23 @@ namespace ConfectioneryContracts.ViewModels { public class MessageInfoViewModel : IMessageInfoModel { + [Column(visible: false)] + public int Id { get; set; } + [Column(visible: false)] public string MessageId { get; set; } = string.Empty; - + [Column(visible: false)] public int? ClientId { get; set; } - [DisplayName("Отправитель")] + [Column(title: "Отправитель", width: 150)] public string SenderName { get; set; } = string.Empty; - [DisplayName("Дата письма")] + [Column(title: "Дата письма", width: 120)] public DateTime DateDelivery { get; set; } - [DisplayName("Заголовок")] + [Column(title: "Заголовок", width: 120)] public string Subject { get; set; } = string.Empty; - [DisplayName("Текст")] + [Column(title: "Текст", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] public string Body { get; set; } = string.Empty; } } diff --git a/Confectionery/ConfectioneryContracts/ViewModels/OrderViewModel.cs b/Confectionery/ConfectioneryContracts/ViewModels/OrderViewModel.cs index 968a73c..63a1d40 100644 --- a/Confectionery/ConfectioneryContracts/ViewModels/OrderViewModel.cs +++ b/Confectionery/ConfectioneryContracts/ViewModels/OrderViewModel.cs @@ -1,5 +1,6 @@ using ConfectioneryDataModels.Enums; using ConfectioneryDataModels.Models; +using ConfectioneryContracts.Attributes; using System; using System.Collections.Generic; using System.ComponentModel; @@ -11,28 +12,32 @@ namespace ConfectioneryContracts.ViewModels { public class OrderViewModel : IOrderModel { - [DisplayName("Номер")] - public int Id { get; set; } - public int ClientId { get; set; } + [Column(title: "Номер", width: 90)] + public int Id { get; set; } + [Column(visible: false)] + public int ClientId { get; set; } - [DisplayName("ФИО клиента")] - public string ClientFIO { get; set; } = string.Empty; + [Column(title: "ФИО клиента", width: 190)] + public string ClientFIO { get; set; } = string.Empty; + [Column(visible: false)] public string ClientEmail { get; set; } = string.Empty; + [Column(visible: false)] public int? ImplementerId { get; set; } - [DisplayName("Исполнитель")] + [Column(title: "Исполнитель", width: 150)] public string? ImplementerFIO { get; set; } = null; + [Column(visible: false)] public int PastryId { get; set; } - [DisplayName("Изделие")] - public string PastryName { get; set; } = string.Empty; - [DisplayName("Количество")] - public int Count { get; set; } - [DisplayName("Сумма")] - public double Sum { get; set; } - [DisplayName("Статус")] - public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; - [DisplayName("Дата создания")] - public DateTime DateCreate { get; set; } = DateTime.Now; - [DisplayName("Дата выполнения")] - public DateTime? DateImplement { get; set; } + [Column(title: "Изделие", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] + public string PastryName { get; set; } = string.Empty; + [Column(title: "Количество", width: 100)] + public int Count { get; set; } + [Column(title: "Сумма", width: 120)] + public double Sum { get; set; } + [Column(title: "Статус", width: 70)] + public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; + [Column(title: "Дата создания", width: 120)] + public DateTime DateCreate { get; set; } = DateTime.Now; + [Column(title: "Дата выполнения", width: 120)] + public DateTime? DateImplement { get; set; } } } diff --git a/Confectionery/ConfectioneryContracts/ViewModels/PastryViewModel.cs b/Confectionery/ConfectioneryContracts/ViewModels/PastryViewModel.cs index 15257b0..86b12d8 100644 --- a/Confectionery/ConfectioneryContracts/ViewModels/PastryViewModel.cs +++ b/Confectionery/ConfectioneryContracts/ViewModels/PastryViewModel.cs @@ -1,4 +1,5 @@ using ConfectioneryDataModels.Models; +using ConfectioneryContracts.Attributes; using System; using System.Collections.Generic; using System.ComponentModel; @@ -10,11 +11,13 @@ namespace ConfectioneryContracts.ViewModels { public class PastryViewModel : IPastryModel { - public int Id { get; set; } - [DisplayName("Название изделия")] - public string PastryName { get; set; } = string.Empty; - [DisplayName("Цена")] - public double Price { get; set; } - public Dictionary PastryComponents { get; set; } = new(); + [Column(visible: false)] + public int Id { get; set; } + [Column(title: "Название изделия", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] + public string PastryName { get; set; } = string.Empty; + [Column(title: "Цена", width: 70)] + public double Price { get; set; } + [Column(visible: false)] + public Dictionary PastryComponents { get; set; } = new(); } } diff --git a/Confectionery/ConfectioneryDataModels/IClientModel.cs b/Confectionery/ConfectioneryDataModels/IClientModel.cs index ddad9f3..004fd69 100644 --- a/Confectionery/ConfectioneryDataModels/IClientModel.cs +++ b/Confectionery/ConfectioneryDataModels/IClientModel.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace ConfectioneryDataModels.Models { - public interface IClientModel + public interface IClientModel : IId { string ClientFIO { get; } string Email { get; } diff --git a/Confectionery/ConfectioneryView/DataGridViewExtension.cs b/Confectionery/ConfectioneryView/DataGridViewExtension.cs new file mode 100644 index 0000000..a0f05e5 --- /dev/null +++ b/Confectionery/ConfectioneryView/DataGridViewExtension.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ConfectioneryView +{ + internal class DataGridViewExtension + { + } +}