diff --git a/FurnitureAssembly/FurnitureAssemFileImplement/Models/Order.cs b/FurnitureAssembly/FurnitureAssemFileImplement/Models/Order.cs index 3f55d4a..7e92e6e 100644 --- a/FurnitureAssembly/FurnitureAssemFileImplement/Models/Order.cs +++ b/FurnitureAssembly/FurnitureAssemFileImplement/Models/Order.cs @@ -33,6 +33,8 @@ namespace FurnitureAssemFileImplement.Models public int ClientId { get; private set; } + public int? ImplementerId { get; private set; } = null; + public static Order? Create(OrderBindingModel? model) { if (model == null) @@ -48,7 +50,8 @@ namespace FurnitureAssemFileImplement.Models Status = model.Status, DateCreate = model.DateCreate, DateImplement = model.DateImplement, - ClientId = model.ClientId + ClientId = model.ClientId, + ImplementerId = model.ImplementerId }; } @@ -65,7 +68,8 @@ namespace FurnitureAssemFileImplement.Models Count = Convert.ToInt32(element.Element("Count")!.Value), Sum = Convert.ToDouble(element.Element("Sum")!.Value), DateCreate = DateTime.ParseExact(element.Element("DateCreate")!.Value, "G", null), - ClientId = Convert.ToInt32(element.Element("ClientId")!.Value) + ClientId = Convert.ToInt32(element.Element("ClientId")!.Value), + ImplementerId = Convert.ToInt32(element.Element("ImplementerId")?.Value) }; DateTime.TryParse(element.Element("DateImplement")!.Value, out DateTime dateImpl); @@ -88,6 +92,7 @@ namespace FurnitureAssemFileImplement.Models Status = model.Status; DateImplement = model.DateImplement; + ImplementerId = model.ImplementerId; } public OrderViewModel GetViewModel => new() @@ -99,7 +104,8 @@ namespace FurnitureAssemFileImplement.Models Status = Status, DateCreate = DateCreate, DateImplement = DateImplement, - ClientId = ClientId + ClientId = ClientId, + ImplementerId = ImplementerId }; public XElement GetXElement => new("Order", @@ -110,6 +116,7 @@ namespace FurnitureAssemFileImplement.Models new XElement("Sum", Sum.ToString()), new XElement("Status", Status.ToString()), new XElement("DateCreate", DateCreate.ToString()), - new XElement("DateImplement", DateImplement.ToString())); + new XElement("DateImplement", DateImplement.ToString()), + new XElement("ImplemwenterId", ImplementerId.ToString())); } } diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/BindingModels/OrderBindingModel.cs b/FurnitureAssembly/FurnitureAssemblyContracts/BindingModels/OrderBindingModel.cs index 288a1d2..cf5c111 100644 --- a/FurnitureAssembly/FurnitureAssemblyContracts/BindingModels/OrderBindingModel.cs +++ b/FurnitureAssembly/FurnitureAssemblyContracts/BindingModels/OrderBindingModel.cs @@ -18,5 +18,6 @@ namespace FurnitureAssemblyContracts.BindingModels public DateTime DateCreate { get; set; } = DateTime.Now; public DateTime? DateImplement { get; set; } public int ClientId { get; set; } + public int? ImplementerId { get; set; } } } diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/SearchModels/OrderSearchModel.cs b/FurnitureAssembly/FurnitureAssemblyContracts/SearchModels/OrderSearchModel.cs index a816e97..67f997e 100644 --- a/FurnitureAssembly/FurnitureAssemblyContracts/SearchModels/OrderSearchModel.cs +++ b/FurnitureAssembly/FurnitureAssemblyContracts/SearchModels/OrderSearchModel.cs @@ -1,4 +1,5 @@ -using System; +using FurnitureAssemblyDataModels.Enums; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -12,5 +13,7 @@ namespace FurnitureAssemblyContracts.SearchModels public DateTime? DateFrom { get; set; } public DateTime? DateTo { get; set; } public int? ClientId { get; set; } + public OrderStatus? Status { get; set; } + public int? ImplementerId { get; set; } } } diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/OrderViewModel.cs b/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/OrderViewModel.cs index 7044dfa..f2fb1e3 100644 --- a/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/OrderViewModel.cs +++ b/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/OrderViewModel.cs @@ -28,6 +28,9 @@ namespace FurnitureAssemblyContracts.ViewModels [DisplayName("Дата создания")] public DateTime DateCreate { get; set; } = DateTime.Now; [DisplayName("Дата выполнения")] - public DateTime? DateImplement { get; set; } + public DateTime? DateImplement { get; set; } + public int? ImplementerId { get; set; } + [DisplayName("Исполнитель")] + public string? ImplementerFIO { get; set; } = string.Empty; } } diff --git a/FurnitureAssembly/FurnitureAssemblyDataModels/Models/IOrderModel.cs b/FurnitureAssembly/FurnitureAssemblyDataModels/Models/IOrderModel.cs index 747b3b7..e7c2477 100644 --- a/FurnitureAssembly/FurnitureAssemblyDataModels/Models/IOrderModel.cs +++ b/FurnitureAssembly/FurnitureAssemblyDataModels/Models/IOrderModel.cs @@ -15,7 +15,7 @@ namespace FurnitureAssemblyDataModels.Models OrderStatus Status { get; } DateTime DateCreate { get; } DateTime? DateImplement { get; } - int ClientId { get; } + int? ImplementerId { get; } } } diff --git a/FurnitureAssembly/FurnitureAssemblyDatabaseImplement/Models/Order.cs b/FurnitureAssembly/FurnitureAssemblyDatabaseImplement/Models/Order.cs index c03873a..bcbb379 100644 --- a/FurnitureAssembly/FurnitureAssemblyDatabaseImplement/Models/Order.cs +++ b/FurnitureAssembly/FurnitureAssemblyDatabaseImplement/Models/Order.cs @@ -34,6 +34,10 @@ namespace FurnitureAssemblyDatabaseImplement.Models public virtual Client Client { get; set; } + public int? ImplementerId { get; private set; } + + public virtual Implementer Implementer { get; set; } + public virtual Furniture Furniture { get; set; } public static Order? Create(OrderBindingModel? model) @@ -51,7 +55,8 @@ namespace FurnitureAssemblyDatabaseImplement.Models Status = model.Status, DateCreate = model.DateCreate, DateImplement = model.DateImplement, - ClientId = model.ClientId + ClientId = model.ClientId, + ImplementerId = model.ImplementerId }; } @@ -66,7 +71,8 @@ namespace FurnitureAssemblyDatabaseImplement.Models Status = model.Status, DateCreate = model.DateCreate, DateImplement = model.DateImplement, - ClientId = model.ClientId + ClientId = model.ClientId, + ImplementerId = model.ImplementerId }; } @@ -79,6 +85,7 @@ namespace FurnitureAssemblyDatabaseImplement.Models Status = model.Status; DateImplement = model.DateImplement; + ImplementerId = model.ImplementerId; } public OrderViewModel GetViewModel => new() { @@ -91,7 +98,9 @@ namespace FurnitureAssemblyDatabaseImplement.Models DateCreate = DateCreate, DateImplement = DateImplement, ClientId = ClientId, - ClientFIO = Client.ClientFIO + ClientFIO = Client.ClientFIO, + ImplementerId = ImplementerId, + ImplementerFIO = Implementer.ImplementerFIO }; } diff --git a/FurnitureAssembly/FurnitureAssemblyListImplement/Models/Order.cs b/FurnitureAssembly/FurnitureAssemblyListImplement/Models/Order.cs index 5d4fac6..2c77cfc 100644 --- a/FurnitureAssembly/FurnitureAssemblyListImplement/Models/Order.cs +++ b/FurnitureAssembly/FurnitureAssemblyListImplement/Models/Order.cs @@ -30,6 +30,8 @@ namespace FurnitureAssemblyListImplement.Models public int ClientId { get; private set; } + public int? ImplementerId { get; private set; } + public static Order? Create(OrderBindingModel? model) { if (model == null) @@ -45,7 +47,8 @@ namespace FurnitureAssemblyListImplement.Models Status = model.Status, DateCreate = model.DateCreate, DateImplement = model.DateImplement, - ClientId = model.ClientId + ClientId = model.ClientId, + ImplementerId = model.ImplementerId }; } @@ -57,7 +60,8 @@ namespace FurnitureAssemblyListImplement.Models } Status = model.Status; - DateImplement = model.DateImplement; + DateImplement = model.DateImplement; + ImplementerId = model.ImplementerId; } public OrderViewModel GetViewModel => new() @@ -69,7 +73,8 @@ namespace FurnitureAssemblyListImplement.Models Status = Status, DateCreate = DateCreate, DateImplement = DateImplement, - ClientId = ClientId + ClientId = ClientId, + ImplementerId = ImplementerId }; } }