Set ViewModel attributes
This commit is contained in:
parent
cfd78033b2
commit
44548da8de
26
AutoWorkshopContracts/Attrubites/ColumnAttribute.cs
Normal file
26
AutoWorkshopContracts/Attrubites/ColumnAttribute.cs
Normal file
@ -0,0 +1,26 @@
|
||||
namespace AutoWorkshopContracts.Attrubites
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class ColumnAttribute : Attribute
|
||||
{
|
||||
public ColumnAttribute(string Title = "", bool Visible = true, int Width = 0,
|
||||
GridViewAutoSize GridViewAutoSize = GridViewAutoSize.None, bool IsUseAutoSize = false)
|
||||
{
|
||||
this.Title = Title;
|
||||
this.Visible = Visible;
|
||||
this.Width = Width;
|
||||
this.GridViewAutoSize = GridViewAutoSize;
|
||||
this.IsUseAutoSize = IsUseAutoSize;
|
||||
}
|
||||
|
||||
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; }
|
||||
}
|
||||
}
|
14
AutoWorkshopContracts/Attrubites/GridViewAutoSize.cs
Normal file
14
AutoWorkshopContracts/Attrubites/GridViewAutoSize.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace AutoWorkshopContracts.Attrubites
|
||||
{
|
||||
public enum GridViewAutoSize
|
||||
{
|
||||
NotSet = 0,
|
||||
None = 1,
|
||||
ColumnHeader = 2,
|
||||
AllCellsExceptHeader = 4,
|
||||
AllCells = 6,
|
||||
DisplayedCellsExceptHeader = 8,
|
||||
DisplayedCells = 10,
|
||||
Fill = 16
|
||||
}
|
||||
}
|
@ -1,19 +1,19 @@
|
||||
using AutoWorkshopDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
using AutoWorkshopContracts.Attrubites;
|
||||
using AutoWorkshopDataModels.Models;
|
||||
|
||||
namespace AutoWorkshopContracts.ViewModels
|
||||
{
|
||||
public class ClientViewModel : IClientModel
|
||||
public class ClientViewModel : IClientModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(Title: "ФИО клиента", Width: 150)]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("ФИО клиента")]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Логин (эл. почта)")]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[Column(Title: "Логин (эл. почта)", GridViewAutoSize: GridViewAutoSize.Fill, IsUseAutoSize: true)]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[Column(Title: "Пароль", Width: 150)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
using AutoWorkshopDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
using AutoWorkshopContracts.Attrubites;
|
||||
using AutoWorkshopDataModels.Models;
|
||||
|
||||
namespace AutoWorkshopContracts.ViewModels
|
||||
{
|
||||
public class ComponentViewModel : IComponentModel
|
||||
public class ComponentViewModel : IComponentModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Название компонента")]
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Цена")]
|
||||
public double Cost { 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; }
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,22 @@
|
||||
using AutoWorkshopDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
using AutoWorkshopContracts.Attrubites;
|
||||
using AutoWorkshopDataModels.Models;
|
||||
|
||||
namespace AutoWorkshopContracts.ViewModels
|
||||
{
|
||||
public class ImplementerViewModel : IImplementerModel
|
||||
public class ImplementerViewModel : IImplementerModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("ФИО исполнителя")]
|
||||
public string ImplementerFIO { get; set; } = string.Empty;
|
||||
[Column(Title: "ФИО исполнителя", GridViewAutoSize: GridViewAutoSize.Fill, IsUseAutoSize: true)]
|
||||
public string ImplementerFIO { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Пароль")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[Column(Title: "Пароль", Width: 100)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Стаж работы")]
|
||||
public int WorkExperience { get; set; }
|
||||
[Column(Title: "Стаж работы", Width: 60)]
|
||||
public int WorkExperience { get; set; }
|
||||
|
||||
[DisplayName("Квалификация")]
|
||||
public int Qualification { get; set; }
|
||||
[Column(Title: "Квалификация", Width: 60)]
|
||||
public int Qualification { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,26 @@
|
||||
using AutoWorkshopDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
using AutoWorkshopContracts.Attrubites;
|
||||
using AutoWorkshopDataModels.Models;
|
||||
|
||||
namespace AutoWorkshopContracts.ViewModels
|
||||
{
|
||||
public class MessageInfoViewModel : IMessageInfoModel
|
||||
public class MessageInfoViewModel : IMessageInfoModel
|
||||
{
|
||||
public string MessageId { get; set; } = string.Empty;
|
||||
[Column(Visible: false)]
|
||||
public string MessageId { get; set; } = string.Empty;
|
||||
|
||||
public int? ClientId { get; set; }
|
||||
[Column(Visible: false)]
|
||||
public int? ClientId { get; set; }
|
||||
|
||||
[DisplayName("Отправитель")]
|
||||
public string SenderName { get; set; } = string.Empty;
|
||||
[Column(Title: "Отправитель", Width: 150)]
|
||||
public string SenderName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Дата доставки")]
|
||||
public DateTime DateDelivery { get; set; }
|
||||
[Column(Title: "Дата доставки", Width: 120)]
|
||||
public DateTime DateDelivery { get; set; }
|
||||
|
||||
[DisplayName("Тема")]
|
||||
public string Subject { get; set; } = string.Empty;
|
||||
[Column(Title: "Тема", Width: 120)]
|
||||
public string Subject { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Содержание")]
|
||||
public string Body { get; set; } = string.Empty;
|
||||
[Column(Title: "Содержание", GridViewAutoSize: GridViewAutoSize.Fill, IsUseAutoSize: true)]
|
||||
public string Body { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -1,45 +1,48 @@
|
||||
using AutoWorkshopDataModels.Enums;
|
||||
using AutoWorkshopContracts.Attrubites;
|
||||
using AutoWorkshopDataModels.Enums;
|
||||
using AutoWorkshopDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace AutoWorkshopContracts.ViewModels
|
||||
{
|
||||
public class OrderViewModel : IOrderModel
|
||||
public class OrderViewModel : IOrderModel
|
||||
{
|
||||
[DisplayName("Номер")]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int RepairId { get; set; }
|
||||
[Column(Title: "Номер", Width: 90)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Ремонт")]
|
||||
public string RepairName { get; set; } = string.Empty;
|
||||
[Column(Visible: false)]
|
||||
public int RepairId { get; set; }
|
||||
|
||||
public int ClientId { get; set; }
|
||||
|
||||
[DisplayName("Клиент")]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
[Column(Title: "Ремонт", GridViewAutoSize: GridViewAutoSize.Fill, IsUseAutoSize: true)]
|
||||
public string RepairName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Почта клиента")]
|
||||
public string ClientEmail { get; set; } = string.Empty;
|
||||
[Column(Visible: false)]
|
||||
public int ClientId { get; set; }
|
||||
|
||||
public int? ImplementerId { get; set; }
|
||||
|
||||
[DisplayName("Исполнитель")]
|
||||
public string? ImplementerFIO { get; set; }
|
||||
[Column(Title: "Клиент", Width: 190)]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Количество")]
|
||||
public int Count { get; set; }
|
||||
|
||||
[DisplayName("Сумма")]
|
||||
public double Sum { get; set; }
|
||||
|
||||
[DisplayName("Статус")]
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Undefined;
|
||||
|
||||
[DisplayName("Дата создания")]
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
|
||||
[DisplayName("Дата выполнения")]
|
||||
public DateTime? DateImplement { get; set; }
|
||||
[Column(Title: "Почта клиента", Width: 190)]
|
||||
public string ClientEmail { get; set; } = string.Empty;
|
||||
|
||||
[Column(Visible: false)]
|
||||
public int? ImplementerId { get; set; }
|
||||
|
||||
[Column(Title: "Исполнитель", Width: 150)]
|
||||
public string? ImplementerFIO { get; set; }
|
||||
|
||||
[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.Undefined;
|
||||
|
||||
[Column(Title: "Дата создания", Width: 120)]
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
|
||||
[Column(Title: "Дата выполнения", Width: 120)]
|
||||
public DateTime? DateImplement { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,20 @@
|
||||
using AutoWorkshopDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
using AutoWorkshopContracts.Attrubites;
|
||||
using AutoWorkshopDataModels.Models;
|
||||
|
||||
namespace AutoWorkshopContracts.ViewModels
|
||||
{
|
||||
public class RepairViewModel : IRepairModel
|
||||
public class RepairViewModel : IRepairModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Column(Visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DisplayName("Название ремонта")]
|
||||
public string RepairName { get; set; } = string.Empty;
|
||||
[Column(Title: "Название ремонта", GridViewAutoSize: GridViewAutoSize.Fill, IsUseAutoSize: true)]
|
||||
public string RepairName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Цена")]
|
||||
public double Price { get; set; }
|
||||
|
||||
public Dictionary<int, (IComponentModel, int)> RepairComponents
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = new();
|
||||
[Column(Title: "Цена", Width: 70)]
|
||||
public double Price { get; set; }
|
||||
|
||||
[Column(Visible: false)]
|
||||
public Dictionary<int, (IComponentModel, int)> RepairComponents { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user