From 2a801a8f1392d4d191a49c6d0eada7d780fc920e Mon Sep 17 00:00:00 2001 From: Kristina Date: Sun, 2 Jun 2024 18:27:18 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D0=B0=20viewmodels?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/ClientViewModel.cs | 10 ++-- .../ViewModels/ComponentViewModel.cs | 8 +-- .../ViewModels/ImplementerViewModel.cs | 28 +++++++--- .../ViewModels/ManufactureViewModel.cs | 25 ++++++--- .../ViewModels/MessageInfoViewModel.cs | 25 +++++++-- .../ViewModels/OrderViewModel.cs | 54 ++++++++++++++----- 6 files changed, 109 insertions(+), 41 deletions(-) diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ClientViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ClientViewModel.cs index bfdc6d1..5abe725 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ClientViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ClientViewModel.cs @@ -1,4 +1,5 @@ -using BlacksmithWorkshopDataModels.Models; +using BlacksmithWorkshopContracts.Attributes; +using BlacksmithWorkshopDataModels.Models; using System; using System.Collections.Generic; using System.ComponentModel; @@ -10,12 +11,13 @@ namespace BlacksmithWorkshopContracts.ViewModels { public class ClientViewModel : IClientModel { + [Column(visible: false)] public int Id { get; set; } - [DisplayName("ФИО клиента")] + [Column(title: "Client's FIO", width: 150)] public string ClientFIO { get; set; } = string.Empty; - [DisplayName("Логин (эл. почта)")] + [Column(title: "Login (Email)", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] public string Email { get; set; } = string.Empty; - [DisplayName("Пароль")] + [Column(title: "Password", width: 150)] public string Password { get; set; } = string.Empty; } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ComponentViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ComponentViewModel.cs index 616ef51..dc09cfc 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ComponentViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ComponentViewModel.cs @@ -1,4 +1,5 @@ -using BlacksmithWorkshopDataModels.Models; +using BlacksmithWorkshopContracts.Attributes; +using BlacksmithWorkshopDataModels.Models; using System; using System.Collections.Generic; using System.ComponentModel; @@ -10,10 +11,11 @@ namespace BlacksmithWorkshopContracts.ViewModels { public class ComponentViewModel : IComponentModel { + [Column(visible: false)] public int Id { get; set; } - [DisplayName("Название компонента")] + [Column("Component's name", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] public string ComponentName { get; set; } = string.Empty; - [DisplayName("Цена")] + [Column("Cost", width: 100)] public double Cost { get; set; } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ImplementerViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ImplementerViewModel.cs index 58ee191..2882272 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ImplementerViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ImplementerViewModel.cs @@ -1,4 +1,5 @@ -using BlacksmithWorkshopDataModels.Models; +using BlacksmithWorkshopContracts.Attributes; +using BlacksmithWorkshopDataModels.Models; using System; using System.Collections.Generic; using System.ComponentModel; @@ -10,14 +11,27 @@ namespace BlacksmithWorkshopContracts.ViewModels { public class ImplementerViewModel : IImplementerModel { + //public int Id { get; set; } + //[DisplayName("ФИО исполнителя")] + //public string ImplementerFIO { get; set; } = string.Empty; + //[DisplayName("Стаж работы")] + //public int WorkExperience { get; set; } = 0; + //[DisplayName("Квалификация")] + //public int Qualification { get; set; } = 0; + //[DisplayName("Пароль")] + //public string Password { get; set; } = string.Empty; + [Column(visible: false)] public int Id { get; set; } - [DisplayName("ФИО исполнителя")] + [Column("FIO", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] public string ImplementerFIO { get; set; } = string.Empty; - [DisplayName("Стаж работы")] - public int WorkExperience { get; set; } = 0; - [DisplayName("Квалификация")] - public int Qualification { get; set; } = 0; - [DisplayName("Пароль")] + + [Column("Password", width: 150)] public string Password { get; set; } = string.Empty; + + [Column("Work expirience", width: 150)] + public int WorkExperience { get; set; } + + [Column("Qualification", width: 150)] + public int Qualification { get; set; } } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ManufactureViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ManufactureViewModel.cs index 64ac3a9..447483d 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ManufactureViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/ManufactureViewModel.cs @@ -1,4 +1,5 @@ -using BlacksmithWorkshopDataModels.Models; +using BlacksmithWorkshopContracts.Attributes; +using BlacksmithWorkshopDataModels.Models; using System; using System.Collections.Generic; using System.ComponentModel; @@ -10,15 +11,23 @@ namespace BlacksmithWorkshopContracts.ViewModels { public class ManufactureViewModel : IManufactureModel { + //public int Id { get; set; } + //[DisplayName("Название кузнечного изделия")] + //public string ManufactureName { get; set; } = string.Empty; + //[DisplayName("Цена")] + //public double Price { get; set; } + //public Dictionary ManufactureComponents + //{ + // get; + // set; + //} = new(); + [Column(visible: false)] public int Id { get; set; } - [DisplayName("Название кузнечного изделия")] + [Column("Wood's name", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] public string ManufactureName { get; set; } = string.Empty; - [DisplayName("Цена")] + [Column("Price", width: 100)] public double Price { get; set; } - public Dictionary ManufactureComponents - { - get; - set; - } = new(); + [Column(visible: false)] + public Dictionary ManufactureComponents { get; set; } = new(); } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/MessageInfoViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/MessageInfoViewModel.cs index 9093103..b9989fb 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/MessageInfoViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/MessageInfoViewModel.cs @@ -1,4 +1,5 @@ -using BlacksmithWorkshopDataModels.Models; +using BlacksmithWorkshopContracts.Attributes; +using BlacksmithWorkshopDataModels.Models; using System; using System.Collections.Generic; using System.ComponentModel; @@ -10,15 +11,29 @@ namespace BlacksmithWorkshopContracts.ViewModels { public class MessageInfoViewModel : IMessageInfoModel { + //public string MessageId { get; set; } = string.Empty; + //public int? ClientId { get; set; } + //[DisplayName("Отправитель")] + //public string SenderName { get; set; } = string.Empty; + //[DisplayName("Дата письма")] + //public DateTime DateDelivery { get; set; } + //[DisplayName("Заголовок")] + //public string Subject { get; set; } = string.Empty; + //[DisplayName("Текст")] + //public string Body { get; set; } = string.Empty; + [Column(visible: false)] public string MessageId { get; set; } = string.Empty; + [Column(visible: false)] public int? ClientId { get; set; } - [DisplayName("Отправитель")] + [Column("Sender", gridViewAutoSize: GridViewAutoSize.DisplayedCells, isUseAutoSize: true)] public string SenderName { get; set; } = string.Empty; - [DisplayName("Дата письма")] + [Column("Delivery Date", width: 100)] public DateTime DateDelivery { get; set; } - [DisplayName("Заголовок")] + [Column("Subject", width: 150)] public string Subject { get; set; } = string.Empty; - [DisplayName("Текст")] + [Column("Body", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] public string Body { get; set; } = string.Empty; + [Column(visible: false)] + public int Id => throw new NotImplementedException(); } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs index 0cd267f..efada83 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs @@ -1,4 +1,5 @@ -using BlacksmithWorkshopDataModels.Enums; +using BlacksmithWorkshopContracts.Attributes; +using BlacksmithWorkshopDataModels.Enums; using BlacksmithWorkshopDataModels.Models; using System; using System.Collections.Generic; @@ -11,26 +12,51 @@ namespace BlacksmithWorkshopContracts.ViewModels { public class OrderViewModel : IOrderModel { - [DisplayName("Номер")] + //[DisplayName("Номер")] + //public int Id { get; set; } + //public int? ImplementerId { get; set; } = null; + //public int ClientId { get; set; } + //[DisplayName("Клиент")] + //public string ClientFIO { get; set; } = string.Empty; + //public int ManufactureId { get; set; } + //[DisplayName("Кузнечное изделие")] + //public string ManufactureName { 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 string ImplementerFIO { get; set; } = string.Empty; + //[DisplayName("Дата создания")] + //public DateTime DateCreate { get; set; } = DateTime.Now; + //[DisplayName("Дата выполнения")] + //public DateTime? DateImplement { get; set; } + + [Column("Number", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] public int Id { get; set; } - public int? ImplementerId { get; set; } = null; - public int ClientId { get; set; } - [DisplayName("Клиент")] - public string ClientFIO { get; set; } = string.Empty; + [Column(visible: false)] public int ManufactureId { get; set; } - [DisplayName("Кузнечное изделие")] + [Column("Wood's name", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] public string ManufactureName { get; set; } = string.Empty; - [DisplayName("Количество")] + [Column(visible: false)] + public int ClientId { get; set; } + [Column("Client's FIO", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] + public string ClientFIO { get; set; } = string.Empty; + [Column(visible: false)] + public int? ImplementerId { get; set; } + [Column("Implementer's FIO", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] + public string? ImplementerFIO { get; set; } + [Column("Count", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] public int Count { get; set; } - [DisplayName("Сумма")] + [Column("Sum", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] public double Sum { get; set; } - [DisplayName("Статус")] + [Column("Status", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)] public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; - [DisplayName("Исполнитель")] - public string ImplementerFIO { get; set; } = string.Empty; - [DisplayName("Дата создания")] + [Column("Date of creation", width: 100)] public DateTime DateCreate { get; set; } = DateTime.Now; - [DisplayName("Дата выполнения")] + [Column("Date of completion", width: 100)] public DateTime? DateImplement { get; set; } } }