From 791ab703b23149feec2c7d2aa314af4d1a5ce7bd Mon Sep 17 00:00:00 2001 From: Danila_Mochalov Date: Sun, 29 Jan 2023 16:12:26 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D1=8B-=D0=BA=D0=BE=D0=BC=D0=BF?= =?UTF-8?q?=D0=BE=D0=BD=D0=B5=D0=BD=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LawFirm/LawFirm.sln | 10 ++- .../LawFirmBusinessLogic.csproj | 8 ++ .../LawFirmContracts/LawFirmContracts.csproj | 4 + .../LawFirmListImplements.csproj | 9 +++ LawFirm/LawFirmListImplements/Models/Blank.cs | 52 +++++++++++++ .../LawFirmListImplements/Models/Document.cs | 55 ++++++++++++++ LawFirm/LawFirmListImplements/Models/Order.cs | 73 +++++++++++++++++++ 7 files changed, 209 insertions(+), 2 deletions(-) create mode 100644 LawFirm/LawFirmListImplements/LawFirmListImplements.csproj create mode 100644 LawFirm/LawFirmListImplements/Models/Blank.cs create mode 100644 LawFirm/LawFirmListImplements/Models/Document.cs create mode 100644 LawFirm/LawFirmListImplements/Models/Order.cs diff --git a/LawFirm/LawFirm.sln b/LawFirm/LawFirm.sln index 2daaad6..363eec1 100644 --- a/LawFirm/LawFirm.sln +++ b/LawFirm/LawFirm.sln @@ -7,9 +7,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirm", "LawFirm\LawFirm. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirmDataModels", "LawFirmDataModels\LawFirmDataModels.csproj", "{E30F4943-0DB0-4715-881F-BC23EBAAF573}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LawFirmContracts", "LawFirmContracts\LawFirmContracts.csproj", "{0BFA7B8D-BA92-4DA4-9477-144606DFFF96}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirmContracts", "LawFirmContracts\LawFirmContracts.csproj", "{0BFA7B8D-BA92-4DA4-9477-144606DFFF96}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LawFirmBusinessLogic", "LawFirmBusinessLogic\LawFirmBusinessLogic.csproj", "{1A498224-4BAC-48FF-B6BC-E829BF86C5E4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LawFirmBusinessLogic", "LawFirmBusinessLogic\LawFirmBusinessLogic.csproj", "{1A498224-4BAC-48FF-B6BC-E829BF86C5E4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LawFirmListImplements", "LawFirmListImplements\LawFirmListImplements.csproj", "{43B2BE7C-83F0-4A91-B2F1-F2F2A2BE5CAE}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -33,6 +35,10 @@ Global {1A498224-4BAC-48FF-B6BC-E829BF86C5E4}.Debug|Any CPU.Build.0 = Debug|Any CPU {1A498224-4BAC-48FF-B6BC-E829BF86C5E4}.Release|Any CPU.ActiveCfg = Release|Any CPU {1A498224-4BAC-48FF-B6BC-E829BF86C5E4}.Release|Any CPU.Build.0 = Release|Any CPU + {43B2BE7C-83F0-4A91-B2F1-F2F2A2BE5CAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {43B2BE7C-83F0-4A91-B2F1-F2F2A2BE5CAE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {43B2BE7C-83F0-4A91-B2F1-F2F2A2BE5CAE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {43B2BE7C-83F0-4A91-B2F1-F2F2A2BE5CAE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/LawFirm/LawFirmBusinessLogic/LawFirmBusinessLogic.csproj b/LawFirm/LawFirmBusinessLogic/LawFirmBusinessLogic.csproj index 132c02c..426ab2e 100644 --- a/LawFirm/LawFirmBusinessLogic/LawFirmBusinessLogic.csproj +++ b/LawFirm/LawFirmBusinessLogic/LawFirmBusinessLogic.csproj @@ -6,4 +6,12 @@ enable + + + + + + + + diff --git a/LawFirm/LawFirmContracts/LawFirmContracts.csproj b/LawFirm/LawFirmContracts/LawFirmContracts.csproj index 132c02c..46ea406 100644 --- a/LawFirm/LawFirmContracts/LawFirmContracts.csproj +++ b/LawFirm/LawFirmContracts/LawFirmContracts.csproj @@ -6,4 +6,8 @@ enable + + + + diff --git a/LawFirm/LawFirmListImplements/LawFirmListImplements.csproj b/LawFirm/LawFirmListImplements/LawFirmListImplements.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/LawFirm/LawFirmListImplements/LawFirmListImplements.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/LawFirm/LawFirmListImplements/Models/Blank.cs b/LawFirm/LawFirmListImplements/Models/Blank.cs new file mode 100644 index 0000000..bf324f6 --- /dev/null +++ b/LawFirm/LawFirmListImplements/Models/Blank.cs @@ -0,0 +1,52 @@ +using LawFirmContracts.BindingModels; +using LawFirmContracts.ViewModels; +using LawFirmDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LawFirmListImplements.Models +{ + public class Blank : IBlankModel + { + public string BlankName { get; private set; } = String.Empty; + + public double Cost { get; set; } + + public int Id { get; private set; } + + public static Blank? Create(BlankBindingModel? model) + { + if (model == null) + { + return null; + } + return new Blank() + { + Id = model.Id, + BlankName = model.BlankName, + Cost = model.Cost + }; + } + + public void Update(BlankBindingModel? model) + { + if (model == null) + { + return; + } + BlankName = model.BlankName; + Cost = model.Cost; + } + public BlankViewModel GetViewModel => new() + { + Id = Id, + BlankName = BlankName, + Cost = Cost + }; + + } +} diff --git a/LawFirm/LawFirmListImplements/Models/Document.cs b/LawFirm/LawFirmListImplements/Models/Document.cs new file mode 100644 index 0000000..c5d72ba --- /dev/null +++ b/LawFirm/LawFirmListImplements/Models/Document.cs @@ -0,0 +1,55 @@ +using LawFirmContracts.BindingModels; +using LawFirmContracts.ViewModels; +using LawFirmDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LawFirmListImplements.Models +{ + public class Document : IDocumentModel + { + public string DocumentName { get; private set; } = string.Empty; + + public double Price { get; private set; } + + public Dictionary DocumentBlanks { get; private set; } = new Dictionary(); + + public int Id { get; private set; } + + public static Document? Create(DocumentBindingModel? model) + { + if (model == null) + { + return null; + } + return new Document() + { + Id = model.Id, + DocumentName = model.DocumentName, + Price = model.Price, + DocumentBlanks = model.DocumentBlanks + }; + } + + public void Update(DocumentBindingModel? model) + { + if (model == null) + { + return; + } + DocumentName = model.DocumentName; + Price = model.Price; + DocumentBlanks = model.DocumentBlanks; + } + public DocumentViewModel GetViewModel => new() + { + Id = Id, + DocumentName = DocumentName, + Price = Price, + DocumentBlanks = DocumentBlanks + }; + } +} diff --git a/LawFirm/LawFirmListImplements/Models/Order.cs b/LawFirm/LawFirmListImplements/Models/Order.cs new file mode 100644 index 0000000..221a965 --- /dev/null +++ b/LawFirm/LawFirmListImplements/Models/Order.cs @@ -0,0 +1,73 @@ +using LawFirmContracts.BindingModels; +using LawFirmContracts.ViewModels; +using LawFirmDataModels.Enums; +using LawFirmDataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LawFirmListImplements.Models +{ + public class Order : IOrderModel + { + public int DocumentId { get; private set; } + + public int Count { get; private set; } + + public double Sum { get; private set; } + + public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен; + + public DateTime DateCreate { get; private set; } = DateTime.Now; + + public DateTime? DateImplement { get; private set; } + + public int Id { get; private set; } + + public static Order? Create(OrderBindingModel? model) + { + if (model == null) + { + return null; + } + return new Order + { + DocumentId = model.DocumentId, + Count = model.Count, + Sum = model.Sum, + Status = model.Status, + DateCreate = model.DateCreate, + DateImplement = model.DateImplement, + Id = model.Id, + }; + } + + public void Update(OrderBindingModel? model) + { + if (model == null) + { + return; + } + DocumentId = model.DocumentId; + Count = model.Count; + Sum = model.Sum; + Status = model.Status; + DateCreate = model.DateCreate; + DateImplement = model.DateImplement; + Id = model.Id; + } + + public OrderViewModel GetViewModel() => new() + { + DocumentId = DocumentId, + Count = Count, + Sum = Sum, + DateCreate = DateCreate, + DateImplement= DateImplement, + Id = Id, + Status= Status, + }; + } +}