ViewModel were modified and Attribute enum + class were created.
This commit is contained in:
parent
b9fb91e4ff
commit
d0d4333580
27
DressAtelierContracts/Attributes/ColumnAttribute.cs
Normal file
27
DressAtelierContracts/Attributes/ColumnAttribute.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DressAtelierContracts.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class ColumnAttribute : Attribute
|
||||
{
|
||||
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 ColumnAttribute(string title = "", bool visible = true, int width = 0, GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool isUseAutoSize = false)
|
||||
{
|
||||
Title = title;
|
||||
Visible = visible;
|
||||
Width = width;
|
||||
GridViewAutoSize = gridViewAutoSize;
|
||||
IsUseAutoSize = isUseAutoSize;
|
||||
}
|
||||
}
|
||||
}
|
20
DressAtelierContracts/Attributes/GridViewAutoSize.cs
Normal file
20
DressAtelierContracts/Attributes/GridViewAutoSize.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DressAtelierContracts.Attributes
|
||||
{
|
||||
public enum GridViewAutoSize
|
||||
{
|
||||
NotSet = 0,
|
||||
None = 1,
|
||||
ColumnHeader = 2,
|
||||
AllCellsExceptHeader = 4,
|
||||
AllCells = 6,
|
||||
DisplayedCellsExceptHeader = 8,
|
||||
DisplayedCells = 10,
|
||||
Fill = 16
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using DressAtelierDataModels.Models;
|
||||
using DressAtelierContracts.Attributes;
|
||||
using DressAtelierDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -10,14 +11,16 @@ namespace DressAtelierContracts.ViewModels
|
||||
{
|
||||
public class ClientViewModel : IClientModel
|
||||
{
|
||||
[Column(visible: false)]
|
||||
public int ID { get; set; }
|
||||
[DisplayName("Client's full name")]
|
||||
|
||||
[Column(title: "Client's full name", width: 150)]
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Login")]
|
||||
[Column(title: "Login", gridViewAutoSize: GridViewAutoSize.Fill,isUseAutoSize: true)]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Password")]
|
||||
[Column(title:"Password", width: 150)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using DressAtelierDataModels.Models;
|
||||
using DressAtelierContracts.Attributes;
|
||||
using DressAtelierDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -10,14 +11,16 @@ namespace DressAtelierContracts.ViewModels
|
||||
{
|
||||
public class DressViewModel : IDressModel
|
||||
{
|
||||
[DisplayName("Name of dress")]
|
||||
[Column(title: "Name of dress", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string DressName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Cost")]
|
||||
[Column(title: "Cost", width: 100)]
|
||||
public double Price { get; set; }
|
||||
|
||||
[Column(visible: false)]
|
||||
public Dictionary<int, (IMaterialModel, int)> DressComponents { get; set; } = new();
|
||||
|
||||
[Column(visible: false)]
|
||||
public int ID { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using DressAtelierDataModels.Models;
|
||||
using DressAtelierContracts.Attributes;
|
||||
using DressAtelierDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -10,14 +11,15 @@ namespace DressAtelierContracts.ViewModels
|
||||
{
|
||||
public class EmployeeViewModel : IEmployeeModel
|
||||
{
|
||||
[Column(visible: false)]
|
||||
public int ID { get; set; }
|
||||
[DisplayName("Employee's fullname")]
|
||||
[Column(title:"Employee's fullname",width: 150)]
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
[DisplayName("Password")]
|
||||
[Column(title: "Password", width: 150)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[DisplayName("WorkExperience")]
|
||||
[Column(title: "WorkExperience", width: 50)]
|
||||
public int WorkExperience { get; set; }
|
||||
[DisplayName("Qualification")]
|
||||
[Column(title: "Qualification", width: 50)]
|
||||
public int Qualification { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -5,16 +5,19 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel;
|
||||
using DressAtelierContracts.Attributes;
|
||||
|
||||
namespace DressAtelierContracts.ViewModels
|
||||
{
|
||||
public class MaterialViewModel : IMaterialModel
|
||||
{
|
||||
[DisplayName("Name of component")]
|
||||
[Column(title: "Name of component", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Cost")]
|
||||
[Column(title: "Cost", width: 100)]
|
||||
public double Cost { get; set; }
|
||||
|
||||
[Column(visible: false)]
|
||||
public int ID { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using DressAtelierDataModels.Models;
|
||||
using DressAtelierContracts.Attributes;
|
||||
using DressAtelierDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -10,20 +11,22 @@ namespace DressAtelierContracts.ViewModels
|
||||
{
|
||||
public class MessageInfoViewModel : IMessageInfoModel
|
||||
{
|
||||
[Column(visible: false)]
|
||||
public string ID { get; set; } = string.Empty;
|
||||
|
||||
[Column(visible: false)]
|
||||
public int? ClientID { get; set; }
|
||||
|
||||
[DisplayName("Sender's name")]
|
||||
[Column(title: "Sender's name", width: 150)]
|
||||
public string SenderName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Delivery date")]
|
||||
[Column(title: "Delivery date", width: 150)]
|
||||
public DateTime DeliveryDate { get; set; }
|
||||
|
||||
[DisplayName("Message subject")]
|
||||
[Column(title: "Message subject", width: 150)]
|
||||
public string Subject { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Message content")]
|
||||
[Column(title: "Message content", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string Body { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using DressAtelierDataModels.Enums;
|
||||
using DressAtelierContracts.Attributes;
|
||||
using DressAtelierDataModels.Enums;
|
||||
using DressAtelierDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -11,32 +12,40 @@ namespace DressAtelierContracts.ViewModels
|
||||
{
|
||||
public class OrderViewModel : IOrderModel
|
||||
{
|
||||
[DisplayName("ID")]
|
||||
[Column(title: "ID", width: 50)]
|
||||
public int ID { get; set; }
|
||||
|
||||
[Column(visible: false)]
|
||||
public int DressID { get; set; }
|
||||
|
||||
[Column(visible: false)]
|
||||
public int ClientID { get; set; }
|
||||
[DisplayName("Client's name")]
|
||||
|
||||
[Column(title:"Client's name", width: 150)]
|
||||
public string ClientFullName { get; set; } = string.Empty;
|
||||
|
||||
[Column(visible: false)]
|
||||
public int? EmployeeID { get; set; }
|
||||
[DisplayName("Employee's name")]
|
||||
|
||||
[Column(title:"Employee's name", width: 150)]
|
||||
public string? EmployeeFullName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("DressName")]
|
||||
[Column(title: "DressName", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string DressName { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Quantity")]
|
||||
[Column(title: "Quantity", width: 50)]
|
||||
public int Count { get; set; }
|
||||
|
||||
[DisplayName("Overall price")]
|
||||
[Column(title: "Overall price", width: 50)]
|
||||
public double Sum { get; set; }
|
||||
|
||||
[DisplayName("Status")]
|
||||
[Column(title: "Status", width: 150)]
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Unknown;
|
||||
|
||||
[DisplayName("Date of creation")]
|
||||
[Column(title: "Date of creation", width: 150)]
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
|
||||
[DisplayName("Date of implementation")]
|
||||
[Column(title: "Date of implementation", width: 150)]
|
||||
public DateTime? DateImplement { get; set; }
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user