From 52d5d17600f741a89808c7b008311adc9b4af6ce Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Wed, 5 Apr 2023 11:00:15 +0400 Subject: [PATCH] =?UTF-8?q?Implementer=20=D0=B8=20Order=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=B2=D1=81=D0=B5=D1=85=20=D0=B2=D0=B0=D1=80=D0=B8?= =?UTF-8?q?=D0=B0=D0=BD=D1=82=D0=BE=D0=B2=20=D1=85=D1=80=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BindingModels/OrderBindingModel.cs | 4 +- .../SearchModels/OrderSearchModel.cs | 3 + .../ViewModels/OrderViewModel.cs | 7 +- .../Models/IOrderModel.cs | 7 +- .../BlacksmithWorkshopDatabase.cs | 4 +- .../Implements/ImplementerStorage.cs | 128 ++++++++++++++++++ .../Implements/OrderStorage.cs | 26 +++- .../Models/Implementer.cs | 86 ++++++++++++ .../Models/Order.cs | 13 +- .../Implements/OrderStorage.cs | 20 ++- .../Models/Order.cs | 10 +- .../Implements/OrderStorage.cs | 12 +- .../Models/Order.cs | 7 +- 13 files changed, 310 insertions(+), 17 deletions(-) create mode 100644 BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/ImplementerStorage.cs create mode 100644 BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Implementer.cs diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/OrderBindingModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/OrderBindingModel.cs index f0075de..ea5088c 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/OrderBindingModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/BindingModels/OrderBindingModel.cs @@ -15,7 +15,9 @@ namespace BlacksmithWorkshopContracts.BindingModels public int ClientId { get; set; } - public int ManufactureId { get; set; } + public int ImplementerId { get; set; } + + public int ManufactureId { get; set; } public int Count { get; set; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/OrderSearchModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/OrderSearchModel.cs index 7b26761..2d598b9 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/OrderSearchModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/SearchModels/OrderSearchModel.cs @@ -15,6 +15,9 @@ namespace BlacksmithWorkshopContracts.SearchModels //для поиска по клиенту public int? ClientId { get; set; } + //для поиска по исполнителю + public int? ImplementerId { get; set; } + //два поля для возможности производить выборку public DateTime? DateFrom { get; set; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs index aabfa1b..2e4b181 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopContracts/ViewModels/OrderViewModel.cs @@ -17,6 +17,8 @@ namespace BlacksmithWorkshopContracts.ViewModels public int ClientId { get; set; } + public int ImplementerId { get; set; } + public int ManufactureId { get; set; } [DisplayName("ФИО клиента")] @@ -25,7 +27,10 @@ namespace BlacksmithWorkshopContracts.ViewModels [DisplayName("Изделие")] public string ManufactureName { get; set; } = string.Empty; - [DisplayName("Количество")] + [DisplayName("ФИО исполнителя")] + public string ImplementerFIO { get; set; } = string.Empty; + + [DisplayName("Количество")] public int Count { get; set; } [DisplayName("Сумма")] diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IOrderModel.cs b/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IOrderModel.cs index a7de5a6..c716888 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IOrderModel.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDataModels/Models/IOrderModel.cs @@ -16,8 +16,11 @@ namespace BlacksmithWorkshopDataModels.Models //id клиента int ClientId { get; } - //кол-во продуктов - int Count { get; } + //id исполнителя + int ImplementerId { get; } + + //кол-во продуктов + int Count { get; } //суммарная стоимость продуктов double Sum { get; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/BlacksmithWorkshopDatabase.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/BlacksmithWorkshopDatabase.cs index f9c9474..24ee424 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/BlacksmithWorkshopDatabase.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/BlacksmithWorkshopDatabase.cs @@ -30,5 +30,7 @@ namespace BlacksmithWorkshopDatabaseImplement public virtual DbSet Orders { set; get; } public virtual DbSet Clients { get; set; } - } + + public virtual DbSet Implementers { set; get; } + } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/ImplementerStorage.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/ImplementerStorage.cs new file mode 100644 index 0000000..7ddca5e --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/ImplementerStorage.cs @@ -0,0 +1,128 @@ +using BlacksmithWorkshopContracts.BindingModels; +using BlacksmithWorkshopContracts.SearchModels; +using BlacksmithWorkshopContracts.StoragesContracts; +using BlacksmithWorkshopContracts.ViewModels; +using BlacksmithWorkshopDatabaseImplement.Models; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlacksmithWorkshopDatabaseImplement.Implements +{ + public class ImplementerStorage : IImplementerStorage + { + public List GetFullList() + { + using var context = new BlacksmithWorkshopDatabase(); + + return context.Implementers + .Include(x => x.Orders) + .Select(x => x.GetViewModel) + .ToList(); + } + public List GetFilteredList(ImplementerSearchModel model) + { + if (string.IsNullOrEmpty(model.ImplementerFIO)) + { + return new(); + } + + using var context = new BlacksmithWorkshopDatabase(); + + return context.Implementers + .Include(x => x.Orders) + .Where(x => x.ImplementerFIO.Contains(model.ImplementerFIO)) + .Select(x => x.GetViewModel) + .ToList(); + } + + public ImplementerViewModel? GetElement(ImplementerSearchModel model) + { + using var context = new BlacksmithWorkshopDatabase(); + + if (model.Id.HasValue) + { + return context.Implementers + .Include(x => x.Orders) + .FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id) + ?.GetViewModel; + } + else if (!string.IsNullOrEmpty(model.ImplementerFIO) && !string.IsNullOrEmpty(model.Password)) + { + return context.Implementers + .Include(x => x.Orders) + .FirstOrDefault(x => (x.ImplementerFIO == model.ImplementerFIO && x.Password == model.Password)) + ?.GetViewModel; + } + + return new(); + } + + public ImplementerViewModel? Insert(ImplementerBindingModel model) + { + var newImplementer = Implementer.Create(model); + + if (newImplementer == null) + { + return null; + } + + using var context = new BlacksmithWorkshopDatabase(); + + context.Implementers.Add(newImplementer); + context.SaveChanges(); + + return context.Implementers + .Include(x => x.Orders) + .FirstOrDefault(x => x.Id == newImplementer.Id) + ?.GetViewModel; + } + + public ImplementerViewModel? Update(ImplementerBindingModel model) + { + using var context = new BlacksmithWorkshopDatabase(); + var order = context.Implementers + .Include(x => x.Orders) + .FirstOrDefault(x => x.Id == model.Id); + + if (order == null) + { + return null; + } + + order.Update(model); + context.SaveChanges(); + + return context.Implementers + .Include(x => x.Orders) + .FirstOrDefault(x => x.Id == model.Id) + ?.GetViewModel; + } + public ImplementerViewModel? Delete(ImplementerBindingModel model) + { + using var context = new BlacksmithWorkshopDatabase(); + + var element = context.Implementers + .FirstOrDefault(rec => rec.Id == model.Id); + + if (element != null) + { + // для отображения КОРРЕКТНОЙ ViewModel-и + var deletedElement = context.Implementers + .Include(x => x.Orders) + .FirstOrDefault(x => x.Id == model.Id) + ?.GetViewModel; + + context.Implementers.Remove(element); + context.SaveChanges(); + + return deletedElement; + } + + return null; + } + } +} diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs index 9ec068f..09df5c2 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Implements/OrderStorage.cs @@ -27,6 +27,7 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements var deletedElement = context.Orders .Include(x => x.Manufacture) .Include(x => x.Client) + .Include(x => x.Implementer) .FirstOrDefault(x => x.Id == model.Id) ?.GetViewModel; @@ -51,6 +52,7 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements return context.Orders .Include(x => x.Manufacture) .Include(x => x.Client) + .Include(x => x.Implementer) .FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id) ?.GetViewModel; } @@ -64,7 +66,8 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements return context.Orders .Include(x => x.Manufacture) .Include(x => x.Client) - .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo) + .Include(x => x.Implementer) + .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo) .Select(x => x.GetViewModel) .ToList(); } @@ -73,7 +76,8 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements return context.Orders .Include(x => x.Manufacture) .Include(x => x.Client) - .Where(x => x.Id == model.Id) + .Include(x => x.Implementer) + .Where(x => x.Id == model.Id) .Select(x => x.GetViewModel) .ToList(); } @@ -82,10 +86,21 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements return context.Orders .Include(x => x.Manufacture) .Include(x => x.Client) + .Include(x => x.Implementer) .Where(x => x.ClientId == model.ClientId) .Select(x => x.GetViewModel) .ToList(); } + else if (model.ImplementerId.HasValue) + { + return context.Orders + .Include(x => x.Manufacture) + .Include(x => x.Client) + .Include(x => x.Implementer) + .Where(x => x.ImplementerId == model.ImplementerId) + .Select(x => x.GetViewModel) + .ToList(); + } return new(); } @@ -97,6 +112,7 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements return context.Orders .Include(x => x.Manufacture) .Include(x => x.Client) + .Include(x => x.Implementer) .Select(x => x.GetViewModel) .ToList(); } @@ -118,6 +134,7 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements return context.Orders .Include(x => x.Manufacture) .Include(x => x.Client) + .Include(x => x.Implementer) .FirstOrDefault(x => x.Id == newOrder.Id) ?.GetViewModel; } @@ -125,10 +142,12 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements public OrderViewModel? Update(OrderBindingModel model) { using var context = new BlacksmithWorkshopDatabase(); + var order = context.Orders .Include(x => x.Manufacture) .Include(x => x.Client) - .FirstOrDefault(x => x.Id == model.Id); + .Include(x => x.Implementer) + .FirstOrDefault(x => x.Id == model.Id); if (order == null) { @@ -141,6 +160,7 @@ namespace BlacksmithWorkshopDatabaseImplement.Implements return context.Orders .Include(x => x.Manufacture) .Include(x => x.Client) + .Include(x => x.Implementer) .FirstOrDefault(x => x.Id == model.Id) ?.GetViewModel; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Implementer.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Implementer.cs new file mode 100644 index 0000000..972afd3 --- /dev/null +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Implementer.cs @@ -0,0 +1,86 @@ +using BlacksmithWorkshopContracts.BindingModels; +using BlacksmithWorkshopContracts.ViewModels; +using BlacksmithWorkshopDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BlacksmithWorkshopDatabaseImplement.Models +{ + public class Implementer : IImplementerModel + { + public int Id { get; set; } + + [Required] + public string ImplementerFIO { get; set; } = string.Empty; + + [Required] + public string Password { get; set; } = string.Empty; + + [Required] + public int WorkExperience { get; set; } + + [Required] + public int Qualification { get; set; } + + //для реализации связи один ко многим с заказами + [ForeignKey("ImplementerId")] + public virtual List Orders { get; set; } = new(); + + public static Implementer? Create(ImplementerBindingModel model) + { + if (model == null) + { + return null; + } + + return new Implementer() + { + Id = model.Id, + Password = model.Password, + ImplementerFIO = model.ImplementerFIO, + Qualification = model.Qualification, + WorkExperience = model.WorkExperience + }; + } + + public static Implementer Create(ImplementerViewModel model) + { + return new Implementer + { + Id = model.Id, + Password = model.Password, + ImplementerFIO = model.ImplementerFIO, + Qualification = model.Qualification, + WorkExperience = model.WorkExperience + }; + } + + public void Update(ImplementerBindingModel model) + { + if (model == null) + { + return; + } + + Id = model.Id; + Password = model.Password; + ImplementerFIO = model.ImplementerFIO; + Qualification = model.Qualification; + WorkExperience = model.WorkExperience; + } + + public ImplementerViewModel GetViewModel => new() + { + Id = Id, + Password = Password, + ImplementerFIO = ImplementerFIO, + Qualification = Qualification, + WorkExperience = WorkExperience + }; + } +} diff --git a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs index a39b1ca..fd396f7 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopDatabaseImplement/Models/Order.cs @@ -22,6 +22,9 @@ namespace BlacksmithWorkshopDatabaseImplement.Models [Required] public int ClientId { get; private set; } + [Required] + public int ImplementerId { get; private set; } + [Required] public int Count { get; private set; } @@ -42,7 +45,10 @@ namespace BlacksmithWorkshopDatabaseImplement.Models //для передачи имени клиента public virtual Client Client { get; set; } - public static Order? Create(OrderBindingModel model) + //для передачи имени исполнителя + public virtual Implementer Implementer { get; set; } + + public static Order? Create(OrderBindingModel model) { if (model == null) { @@ -54,6 +60,7 @@ namespace BlacksmithWorkshopDatabaseImplement.Models Id = model.Id, ManufactureId = model.ManufactureId, ClientId = model.ClientId, + ImplementerId = model.ImplementerId, Count = model.Count, Sum = model.Sum, Status = model.Status, @@ -78,13 +85,15 @@ namespace BlacksmithWorkshopDatabaseImplement.Models Id = Id, ManufactureId = ManufactureId, ClientId = ClientId, + ImplementerId = ImplementerId, Count = Count, Sum = Sum, Status = Status, DateCreate = DateCreate, DateImplement = DateImplement, ManufactureName = Manufacture.ManufactureName, - ClientFIO = Client.ClientFIO + ClientFIO = Client.ClientFIO, + ImplementerFIO = Implementer.ImplementerFIO }; } } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Implements/OrderStorage.cs b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Implements/OrderStorage.cs index 86ea186..7bdaac1 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Implements/OrderStorage.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Implements/OrderStorage.cs @@ -48,8 +48,15 @@ namespace BlacksmithWorkshopFileImplement.Implements .Select(x => GetViewModel(x)) .ToList(); } + else if (model.ImplementerId.HasValue) + { + return source.Orders + .Where(x => x.ImplementerId == model.ImplementerId) + .Select(x => GetViewModel(x)) + .ToList(); + } - return new(); + return new(); } public OrderViewModel? GetElement(OrderSearchModel model) @@ -62,7 +69,7 @@ namespace BlacksmithWorkshopFileImplement.Implements return source.Orders.FirstOrDefault(x =>(model.Id.HasValue && x.Id == model.Id))?.GetViewModel; } - //для загрузки названий изделия в заказе + //для загрузки названий и имён в заказ private OrderViewModel GetViewModel(Order order) { var viewModel = order.GetViewModel; @@ -71,6 +78,8 @@ namespace BlacksmithWorkshopFileImplement.Implements var client = source.Clients.FirstOrDefault(x => x.Id == order.ClientId); + var implementer = source.Implementers.FirstOrDefault(x => x.Id == order.ImplementerId); + if(manufacture != null) { viewModel.ManufactureName = manufacture.ManufactureName; @@ -81,7 +90,12 @@ namespace BlacksmithWorkshopFileImplement.Implements viewModel.ClientFIO = client.ClientFIO; } - return viewModel; + if (implementer != null) + { + viewModel.ImplementerFIO = implementer.ImplementerFIO; + } + + return viewModel; } public OrderViewModel? Insert(OrderBindingModel model) diff --git a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Order.cs b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Order.cs index dc79c2c..44648c3 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Order.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopFileImplement/Models/Order.cs @@ -19,6 +19,8 @@ namespace BlacksmithWorkshopFileImplement.Models public int ClientId { get; private set; } + public int ImplementerId { get; private set; } + public int ManufactureId { get; private set; } public int Count { get; private set; } @@ -43,6 +45,7 @@ namespace BlacksmithWorkshopFileImplement.Models Id = model.Id, ClientId = model.ClientId, ManufactureId = model.ManufactureId, + ImplementerId = model.ImplementerId, Count = model.Count, Sum = model.Sum, Status = model.Status, @@ -61,7 +64,8 @@ namespace BlacksmithWorkshopFileImplement.Models return new Order() { Id = Convert.ToInt32(element.Attribute("Id")!.Value), - ClientId = Convert.ToInt32(element.Attribute("Id")!.Value), + ClientId = Convert.ToInt32(element.Attribute("ClientId")!.Value), + ImplementerId = Convert.ToInt32(element.Attribute("ImplementerId")!.Value), ManufactureId = Convert.ToInt32(element.Element("ManufactureId")!.Value), Count = Convert.ToInt32(element.Element("Count")!.Value), Sum = Convert.ToDouble(element.Element("Sum")!.Value), @@ -87,7 +91,8 @@ namespace BlacksmithWorkshopFileImplement.Models { Id = Id, ClientId = ClientId, - ManufactureId = ManufactureId, + ImplementerId = ImplementerId, + ManufactureId = ManufactureId, Count = Count, Sum = Sum, Status = Status, @@ -98,6 +103,7 @@ namespace BlacksmithWorkshopFileImplement.Models public XElement GetXElement => new("Order", new XAttribute("Id", Id), new XElement("ClientId", ClientId.ToString()), + new XElement("ImplementerId", ClientId.ToString()), new XElement("ManufactureId", ManufactureId.ToString()), new XElement("Count", Count.ToString()), new XElement("Sum", Sum.ToString()), diff --git a/BlacksmithWorkshop/BlacksmithWorkshopListImplement/Implements/OrderStorage.cs b/BlacksmithWorkshop/BlacksmithWorkshopListImplement/Implements/OrderStorage.cs index 9b08397..411cf4b 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopListImplement/Implements/OrderStorage.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopListImplement/Implements/OrderStorage.cs @@ -100,7 +100,7 @@ namespace BlacksmithWorkshopListImplement.Implements return null; } - //метод для записи названия изделия на форме с заказами + //метод для передачи названий и имён на форму private OrderViewModel GetViewModel(Order order) { var viewModel = order.GetViewModel; @@ -124,6 +124,16 @@ namespace BlacksmithWorkshopListImplement.Implements } } + foreach (var implementer in _source.Implementers) + { + if (implementer.Id == order.ImplementerId) + { + viewModel.ImplementerFIO = implementer.ImplementerFIO; + + break; + } + } + return viewModel; } diff --git a/BlacksmithWorkshop/BlacksmithWorkshopListImplement/Models/Order.cs b/BlacksmithWorkshop/BlacksmithWorkshopListImplement/Models/Order.cs index 533437e..fd65dfe 100644 --- a/BlacksmithWorkshop/BlacksmithWorkshopListImplement/Models/Order.cs +++ b/BlacksmithWorkshop/BlacksmithWorkshopListImplement/Models/Order.cs @@ -5,6 +5,7 @@ using BlacksmithWorkshopDataModels.Models; using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Reflection.PortableExecutable; using System.Text; using System.Threading.Tasks; @@ -19,6 +20,8 @@ namespace BlacksmithWorkshopListImplement.Models public int ClientId { get; private set; } + public int ImplementerId { get; private set; } + public int ManufactureId { get; private set; } public int Count { get; private set; } @@ -43,6 +46,7 @@ namespace BlacksmithWorkshopListImplement.Models Id = model.Id, ManufactureId = model.ManufactureId, ClientId = model.ClientId, + ImplementerId = model.ImplementerId, Count = model.Count, Sum = model.Sum, Status = model.Status, @@ -69,7 +73,8 @@ namespace BlacksmithWorkshopListImplement.Models Id = Id, ManufactureId = ManufactureId, ClientId = ClientId, - Count = Count, + ImplementerId = ImplementerId, + Count = Count, Sum = Sum, Status = Status, DateCreate = DateCreate,