поменяла вью модели и обозначила всем колонкам свойства согласно конструктору класса ColumnAttribute

This commit is contained in:
Елена Бакальская 2024-05-16 23:58:39 +04:00
parent 734a2f2d51
commit 17da7d4304
6 changed files with 49 additions and 33 deletions

View File

@ -1,4 +1,5 @@
using SushiBarDataModels; using SushiBarContracts.Attributes;
using SushiBarDataModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -10,15 +11,16 @@ namespace SushiBarContracts.ViewModels
{ {
public class ClientViewModel : IClientModel public class ClientViewModel : IClientModel
{ {
[Column(visible: false)]
public int Id { get; set; } public int Id { get; set; }
[DisplayName("ФИО Клиента")] [Column(title: "ФИО клиента", width: 200)]
public string ClientFIO { get; set; } = string.Empty; public string ClientFIO { get; set; } = string.Empty;
[DisplayName("Логин (эл. почта)")] [Column(title: "Логин (эл. почта)", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string Email { get; set; } = string.Empty; public string Email { get; set; } = string.Empty;
[DisplayName("Пароль")] [Column(title: "Пароль", width: 50)]
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
} }
} }

View File

@ -1,18 +1,19 @@
using System.ComponentModel; using System.ComponentModel;
using SushiBarContracts.Attributes;
using SushiBarDataModels.Models; using SushiBarDataModels.Models;
namespace SushiBarContracts.ViewModels namespace SushiBarContracts.ViewModels
{ {
public class ComponentViewModel : IComponentModel public class ComponentViewModel : IComponentModel
{ {
[Column(visible: false)]
public int Id { get; set; } public int Id { get; set; }
[DisplayName("Название компонента")]
[Column(title: "Компонент", width: 50)]
public string ComponentName { get; set; } = string.Empty; public string ComponentName { get; set; } = string.Empty;
[DisplayName("Цена")] [DisplayName("Цена")]
[Column(title: "Цена", width: 30)]
public double Cost { get; set; } public double Cost { get; set; }
} }
} }

View File

@ -1,4 +1,5 @@
using SushiBarDataModels; using SushiBarContracts.Attributes;
using SushiBarDataModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -10,17 +11,19 @@ namespace SushiBarContracts.ViewModels
{ {
public class ImplementerViewModel : IImplementerModel public class ImplementerViewModel : IImplementerModel
{ {
[Column(visible: false)]
public int Id { get; set; } public int Id { get; set; }
[DisplayName("Исполнитель ФИО")]
[Column(title: "Исполнитель ФИО", width: 150)]
public string ImplementerFIO { get; set; } = string.Empty; public string ImplementerFIO { get; set; } = string.Empty;
[DisplayName("Пароль")] [Column(title: "Пароль", width: 50)]
public string Password { get; set; } = string.Empty; public string Password { get; set; } = string.Empty;
[DisplayName("Опыт работы")] [Column(title: "Опыт работы", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public int WorkExperience { get; set; } public int WorkExperience { get; set; }
[DisplayName("Квалификация")] [Column(title: "Квалификация", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public int Qualification { get; set; } public int Qualification { get; set; }
} }
} }

View File

@ -1,4 +1,5 @@
using SushiBarDataModels; using SushiBarContracts.Attributes;
using SushiBarDataModels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -11,20 +12,24 @@ namespace SushiBarContracts.ViewModels
{ {
public class MessageInfoViewModel : IMessageInfoModel public class MessageInfoViewModel : IMessageInfoModel
{ {
[Column(visible: false)]
public string MessageId { get; set; } = string.Empty; public string MessageId { get; set; } = string.Empty;
[Column(visible: false)]
public int? ClientId { get; set; } public int? ClientId { get; set; }
[DisplayName("Имя отправителя")] [Column(title: "Имя отправителя", width: 200)]
public string SenderName { get; set; } = string.Empty; public string SenderName { get; set; } = string.Empty;
[DisplayName("Дата получения")] [Column(title: "Дата получения", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public DateTime DateDelivery { get; set; } = DateTime.Now; public DateTime DateDelivery { get; set; } = DateTime.Now;
[DisplayName("Тема письма")]
[Column(title: "Тема письма", width: 150)]
public string Subject { get; set; } = string.Empty; public string Subject { get; set; } = string.Empty;
[DisplayName("Душа письма...")]
[Column(title: "Душа письма...", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string Body { get; set; } = string.Empty; public string Body { get; set; } = string.Empty;
} }
} }

View File

@ -2,45 +2,50 @@
using SushiBarDataModels.Models; using SushiBarDataModels.Models;
using SushiBarDataModels.Enums; using SushiBarDataModels.Enums;
using SushiBarDataModels; using SushiBarDataModels;
using SushiBarContracts.Attributes;
namespace SushiBarContracts.ViewModels namespace SushiBarContracts.ViewModels
{ {
public class OrderViewModel : IOrderModel public class OrderViewModel : IOrderModel
{ {
[DisplayName("Номер")] [Column(title: "Номер", width: 10)]
public int Id { get; set; } public int Id { get; set; }
[Column(visible: false)]
public int SushiId { get; set; } public int SushiId { get; set; }
[Column(visible: false)]
public int ClientId { get; set; } public int ClientId { get; set; }
[Column(visible: false)]
public int? ImplementerId { get; set; } public int? ImplementerId { get; set; }
[Column(title: "Имя клиента", width: 150)]
[DisplayName("Имя клиента")]
public string ClientFIO { get; set; } = string.Empty; public string ClientFIO { get; set; } = string.Empty;
[DisplayName("Имя исполнителя")] [Column(title: "Имя исполнителя", width: 150)]
public string? ImplementerFIO { get; set; } public string? ImplementerFIO { get; set; }
[DisplayName("Суши")] [Column(title: "Суши", width: 50)]
public string SushiName { get; set; } = string.Empty; public string SushiName { get; set; } = string.Empty;
[Column(title: "Количество", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
[DisplayName("Количество")]
public int Count { get; set; } public int Count { get; set; }
[DisplayName("Сумма")] [Column(title: "Сумма", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public double Sum { get; set; } public double Sum { get; set; }
[DisplayName("Статус")] [Column(title: "Статус", width: 30)]
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен; public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
[DisplayName("Дата создания")] [Column(title: "Дата создания", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public DateTime DateCreate { get; set; } = DateTime.Now; public DateTime DateCreate { get; set; } = DateTime.Now;
[DisplayName("Дата выполнения")] [Column(title: "Дата выполнения", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public DateTime? DateImplement { get; set; } public DateTime? DateImplement { get; set; }
} }
} }

View File

@ -1,18 +1,18 @@
using System.ComponentModel; using System.ComponentModel;
using SushiBarContracts.Attributes;
using SushiBarDataModels.Models; using SushiBarDataModels.Models;
namespace SushiBarContracts.ViewModels namespace SushiBarContracts.ViewModels
{ {
public class SushiViewModel : ISushiModel public class SushiViewModel : ISushiModel
{ {
[Column(visible: false)]
public int Id { get; set; } public int Id { get; set; }
[DisplayName("Название изделия")]
[Column(title: "Название изделия", width: 50)]
public string SushiName { get; set; } = string.Empty; public string SushiName { get; set; } = string.Empty;
[DisplayName("Цена")]
[Column(title: "Цена", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public double Price { get; set; } public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> SushiComponents public Dictionary<int, (IComponentModel, int)> SushiComponents
{ {