Этап 2. В заказ добавлено поле ImplementerId

This commit is contained in:
prodigygirl 2023-04-09 11:57:19 +04:00
parent ebaead1f2e
commit c27fb1b974
7 changed files with 41 additions and 13 deletions

View File

@ -33,6 +33,8 @@ namespace FurnitureAssemFileImplement.Models
public int ClientId { get; private set; } public int ClientId { get; private set; }
public int? ImplementerId { get; private set; } = null;
public static Order? Create(OrderBindingModel? model) public static Order? Create(OrderBindingModel? model)
{ {
if (model == null) if (model == null)
@ -48,7 +50,8 @@ namespace FurnitureAssemFileImplement.Models
Status = model.Status, Status = model.Status,
DateCreate = model.DateCreate, DateCreate = model.DateCreate,
DateImplement = model.DateImplement, 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), Count = Convert.ToInt32(element.Element("Count")!.Value),
Sum = Convert.ToDouble(element.Element("Sum")!.Value), Sum = Convert.ToDouble(element.Element("Sum")!.Value),
DateCreate = DateTime.ParseExact(element.Element("DateCreate")!.Value, "G", null), 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); DateTime.TryParse(element.Element("DateImplement")!.Value, out DateTime dateImpl);
@ -88,6 +92,7 @@ namespace FurnitureAssemFileImplement.Models
Status = model.Status; Status = model.Status;
DateImplement = model.DateImplement; DateImplement = model.DateImplement;
ImplementerId = model.ImplementerId;
} }
public OrderViewModel GetViewModel => new() public OrderViewModel GetViewModel => new()
@ -99,7 +104,8 @@ namespace FurnitureAssemFileImplement.Models
Status = Status, Status = Status,
DateCreate = DateCreate, DateCreate = DateCreate,
DateImplement = DateImplement, DateImplement = DateImplement,
ClientId = ClientId ClientId = ClientId,
ImplementerId = ImplementerId
}; };
public XElement GetXElement => new("Order", public XElement GetXElement => new("Order",
@ -110,6 +116,7 @@ namespace FurnitureAssemFileImplement.Models
new XElement("Sum", Sum.ToString()), new XElement("Sum", Sum.ToString()),
new XElement("Status", Status.ToString()), new XElement("Status", Status.ToString()),
new XElement("DateCreate", DateCreate.ToString()), new XElement("DateCreate", DateCreate.ToString()),
new XElement("DateImplement", DateImplement.ToString())); new XElement("DateImplement", DateImplement.ToString()),
new XElement("ImplemwenterId", ImplementerId.ToString()));
} }
} }

View File

@ -18,5 +18,6 @@ namespace FurnitureAssemblyContracts.BindingModels
public DateTime DateCreate { get; set; } = DateTime.Now; public DateTime DateCreate { get; set; } = DateTime.Now;
public DateTime? DateImplement { get; set; } public DateTime? DateImplement { get; set; }
public int ClientId { get; set; } public int ClientId { get; set; }
public int? ImplementerId { get; set; }
} }
} }

View File

@ -1,4 +1,5 @@
using System; using FurnitureAssemblyDataModels.Enums;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -12,5 +13,7 @@ namespace FurnitureAssemblyContracts.SearchModels
public DateTime? DateFrom { get; set; } public DateTime? DateFrom { get; set; }
public DateTime? DateTo { get; set; } public DateTime? DateTo { get; set; }
public int? ClientId { get; set; } public int? ClientId { get; set; }
public OrderStatus? Status { get; set; }
public int? ImplementerId { get; set; }
} }
} }

View File

@ -29,5 +29,8 @@ namespace FurnitureAssemblyContracts.ViewModels
public DateTime DateCreate { get; set; } = DateTime.Now; public DateTime DateCreate { get; set; } = DateTime.Now;
[DisplayName("Дата выполнения")] [DisplayName("Дата выполнения")]
public DateTime? DateImplement { get; set; } public DateTime? DateImplement { get; set; }
public int? ImplementerId { get; set; }
[DisplayName("Исполнитель")]
public string? ImplementerFIO { get; set; } = string.Empty;
} }
} }

View File

@ -15,7 +15,7 @@ namespace FurnitureAssemblyDataModels.Models
OrderStatus Status { get; } OrderStatus Status { get; }
DateTime DateCreate { get; } DateTime DateCreate { get; }
DateTime? DateImplement { get; } DateTime? DateImplement { get; }
int ClientId { get; } int ClientId { get; }
int? ImplementerId { get; }
} }
} }

View File

@ -34,6 +34,10 @@ namespace FurnitureAssemblyDatabaseImplement.Models
public virtual Client Client { get; set; } 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 virtual Furniture Furniture { get; set; }
public static Order? Create(OrderBindingModel? model) public static Order? Create(OrderBindingModel? model)
@ -51,7 +55,8 @@ namespace FurnitureAssemblyDatabaseImplement.Models
Status = model.Status, Status = model.Status,
DateCreate = model.DateCreate, DateCreate = model.DateCreate,
DateImplement = model.DateImplement, DateImplement = model.DateImplement,
ClientId = model.ClientId ClientId = model.ClientId,
ImplementerId = model.ImplementerId
}; };
} }
@ -66,7 +71,8 @@ namespace FurnitureAssemblyDatabaseImplement.Models
Status = model.Status, Status = model.Status,
DateCreate = model.DateCreate, DateCreate = model.DateCreate,
DateImplement = model.DateImplement, DateImplement = model.DateImplement,
ClientId = model.ClientId ClientId = model.ClientId,
ImplementerId = model.ImplementerId
}; };
} }
@ -79,6 +85,7 @@ namespace FurnitureAssemblyDatabaseImplement.Models
Status = model.Status; Status = model.Status;
DateImplement = model.DateImplement; DateImplement = model.DateImplement;
ImplementerId = model.ImplementerId;
} }
public OrderViewModel GetViewModel => new() public OrderViewModel GetViewModel => new()
{ {
@ -91,7 +98,9 @@ namespace FurnitureAssemblyDatabaseImplement.Models
DateCreate = DateCreate, DateCreate = DateCreate,
DateImplement = DateImplement, DateImplement = DateImplement,
ClientId = ClientId, ClientId = ClientId,
ClientFIO = Client.ClientFIO ClientFIO = Client.ClientFIO,
ImplementerId = ImplementerId,
ImplementerFIO = Implementer.ImplementerFIO
}; };
} }

View File

@ -30,6 +30,8 @@ namespace FurnitureAssemblyListImplement.Models
public int ClientId { get; private set; } public int ClientId { get; private set; }
public int? ImplementerId { get; private set; }
public static Order? Create(OrderBindingModel? model) public static Order? Create(OrderBindingModel? model)
{ {
if (model == null) if (model == null)
@ -45,7 +47,8 @@ namespace FurnitureAssemblyListImplement.Models
Status = model.Status, Status = model.Status,
DateCreate = model.DateCreate, DateCreate = model.DateCreate,
DateImplement = model.DateImplement, DateImplement = model.DateImplement,
ClientId = model.ClientId ClientId = model.ClientId,
ImplementerId = model.ImplementerId
}; };
} }
@ -58,6 +61,7 @@ namespace FurnitureAssemblyListImplement.Models
Status = model.Status; Status = model.Status;
DateImplement = model.DateImplement; DateImplement = model.DateImplement;
ImplementerId = model.ImplementerId;
} }
public OrderViewModel GetViewModel => new() public OrderViewModel GetViewModel => new()
@ -69,7 +73,8 @@ namespace FurnitureAssemblyListImplement.Models
Status = Status, Status = Status,
DateCreate = DateCreate, DateCreate = DateCreate,
DateImplement = DateImplement, DateImplement = DateImplement,
ClientId = ClientId ClientId = ClientId,
ImplementerId = ImplementerId
}; };
} }
} }