From 36fd4e9aa54686b642487910dd567057aaa80b2c Mon Sep 17 00:00:00 2001
From: DyCTaTOR <125912249+DyCTaTOR@users.noreply.github.com>
Date: Tue, 13 Feb 2024 22:03:16 +0400
Subject: [PATCH 1/8] =?UTF-8?q?=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D0=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../PlumbingRepairDataModels.sln | 25 +++++++++++++++++++
.../PlumbingRepairDataModels/Class1.cs | 7 ++++++
.../PlumbingRepairDataModels.csproj | 9 +++++++
3 files changed, 41 insertions(+)
create mode 100644 PlumbingRepairDataModels/PlumbingRepairDataModels.sln
create mode 100644 PlumbingRepairDataModels/PlumbingRepairDataModels/Class1.cs
create mode 100644 PlumbingRepairDataModels/PlumbingRepairDataModels/PlumbingRepairDataModels.csproj
diff --git a/PlumbingRepairDataModels/PlumbingRepairDataModels.sln b/PlumbingRepairDataModels/PlumbingRepairDataModels.sln
new file mode 100644
index 0000000..d054714
--- /dev/null
+++ b/PlumbingRepairDataModels/PlumbingRepairDataModels.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33801.468
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairDataModels", "PlumbingRepairDataModels\PlumbingRepairDataModels.csproj", "{4BA66634-173E-44AA-9423-18F10AD0C54A}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {4BA66634-173E-44AA-9423-18F10AD0C54A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4BA66634-173E-44AA-9423-18F10AD0C54A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4BA66634-173E-44AA-9423-18F10AD0C54A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4BA66634-173E-44AA-9423-18F10AD0C54A}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {64A4C77F-7D64-427C-AC56-E79B23936823}
+ EndGlobalSection
+EndGlobal
diff --git a/PlumbingRepairDataModels/PlumbingRepairDataModels/Class1.cs b/PlumbingRepairDataModels/PlumbingRepairDataModels/Class1.cs
new file mode 100644
index 0000000..5d924fd
--- /dev/null
+++ b/PlumbingRepairDataModels/PlumbingRepairDataModels/Class1.cs
@@ -0,0 +1,7 @@
+namespace PlumbingRepairDataModels
+{
+ public class Class1
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepairDataModels/PlumbingRepairDataModels/PlumbingRepairDataModels.csproj b/PlumbingRepairDataModels/PlumbingRepairDataModels/PlumbingRepairDataModels.csproj
new file mode 100644
index 0000000..bafd05b
--- /dev/null
+++ b/PlumbingRepairDataModels/PlumbingRepairDataModels/PlumbingRepairDataModels.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
--
2.25.1
From ebe59fdfa4d5a876f42b4b715c5aa141a2c76027 Mon Sep 17 00:00:00 2001
From: DyCTaTOR <125912249+DyCTaTOR@users.noreply.github.com>
Date: Tue, 13 Feb 2024 23:15:11 +0400
Subject: [PATCH 2/8] =?UTF-8?q?=D0=9D=D0=B0=D1=87=D0=B0=D0=BB=D0=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
PlumbingRepair/PlumbingRepair.sln | 14 ++++++++-
.../BindingModels/ComponentBindingModel.cs | 16 ++++++++++
.../BindingModels/OrderBindingModel.cs | 21 ++++++++++++++
.../BindingModels/ProductBindingModel.cs | 18 ++++++++++++
.../BusinesLogicsContracts/IComponentLogic.cs | 20 +++++++++++++
.../BusinesLogicsContracts/IOrderLogic.cs | 20 +++++++++++++
.../BusinesLogicsContracts/IProductLogic.cs | 20 +++++++++++++
.../PlumbingRepairContracts/Class1.cs | 7 +++++
.../PlumbingRepairContracts.csproj | 9 ++++++
.../SearchModels/ComponentSearchModel.cs | 14 +++++++++
.../SearchModels/OrderSearchModel.cs | 13 +++++++++
.../SearchModels/ProductSearchModel.cs | 14 +++++++++
.../StoragesContracts/IComponentStorage.cs | 21 ++++++++++++++
.../StoragesContracts/IOrderStorage.cs | 21 ++++++++++++++
.../StoragesContracts/IProductStorage.cs | 21 ++++++++++++++
.../ViewModels/ComponentViewModel.cs | 19 ++++++++++++
.../ViewModels/OrderViewModel.cs | 29 +++++++++++++++++++
.../ViewModels/ProductViewModel.cs | 21 ++++++++++++++
.../Enums/IOrderModel.cs | 18 ++++++++++++
.../Enums/OrderStatus.cs | 21 ++++++++++++++
.../PlumbingRepairDataModels/IId.cs | 12 ++++----
.../Models/IComponentModel.cs | 14 +++++++++
.../Models/IProductModel.cs | 16 ++++++++++
.../PlumbingRepairDataModels.csproj | 18 ++++++------
.../PlumbingRepairDataModels.sln | 25 ----------------
25 files changed, 401 insertions(+), 41 deletions(-)
create mode 100644 PlumbingRepair/PlumbingRepairContracts/BindingModels/ComponentBindingModel.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/BindingModels/ProductBindingModel.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IComponentLogic.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IOrderLogic.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IProductLogic.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/Class1.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/PlumbingRepairContracts.csproj
create mode 100644 PlumbingRepair/PlumbingRepairContracts/SearchModels/ComponentSearchModel.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/SearchModels/OrderSearchModel.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/SearchModels/ProductSearchModel.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IComponentStorage.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IOrderStorage.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IProductStorage.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/ViewModels/ComponentViewModel.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/ViewModels/ProductViewModel.cs
create mode 100644 PlumbingRepair/PlumbingRepairDataModels/Enums/IOrderModel.cs
create mode 100644 PlumbingRepair/PlumbingRepairDataModels/Enums/OrderStatus.cs
rename PlumbingRepairDataModels/PlumbingRepairDataModels/Class1.cs => PlumbingRepair/PlumbingRepairDataModels/IId.cs (50%)
create mode 100644 PlumbingRepair/PlumbingRepairDataModels/Models/IComponentModel.cs
create mode 100644 PlumbingRepair/PlumbingRepairDataModels/Models/IProductModel.cs
rename {PlumbingRepairDataModels => PlumbingRepair}/PlumbingRepairDataModels/PlumbingRepairDataModels.csproj (95%)
delete mode 100644 PlumbingRepairDataModels/PlumbingRepairDataModels.sln
diff --git a/PlumbingRepair/PlumbingRepair.sln b/PlumbingRepair/PlumbingRepair.sln
index c6873d0..076fa65 100644
--- a/PlumbingRepair/PlumbingRepair.sln
+++ b/PlumbingRepair/PlumbingRepair.sln
@@ -3,7 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33801.468
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepair", "PlumbingRepair\PlumbingRepair.csproj", "{16CDF38C-189C-4BED-AB66-DB3C212C4047}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepair", "PlumbingRepair\PlumbingRepair.csproj", "{16CDF38C-189C-4BED-AB66-DB3C212C4047}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairDataModels", "PlumbingRepairDataModels\PlumbingRepairDataModels.csproj", "{F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairContracts", "PlumbingRepairContracts\PlumbingRepairContracts.csproj", "{FD429137-A114-4447-B51A-FCC11FEF7E2C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +19,14 @@ Global
{16CDF38C-189C-4BED-AB66-DB3C212C4047}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16CDF38C-189C-4BED-AB66-DB3C212C4047}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16CDF38C-189C-4BED-AB66-DB3C212C4047}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FD429137-A114-4447-B51A-FCC11FEF7E2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FD429137-A114-4447-B51A-FCC11FEF7E2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FD429137-A114-4447-B51A-FCC11FEF7E2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FD429137-A114-4447-B51A-FCC11FEF7E2C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/PlumbingRepair/PlumbingRepairContracts/BindingModels/ComponentBindingModel.cs b/PlumbingRepair/PlumbingRepairContracts/BindingModels/ComponentBindingModel.cs
new file mode 100644
index 0000000..679aab2
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/BindingModels/ComponentBindingModel.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using PlumbingRepairDataModels.Models;
+
+namespace PlumbingRepairContracts.BindingModels
+{
+ public class ComponentBindingModel : IComponentModel
+ {
+ public int Id { get; set; }
+ public string ComponentName { get; set; } = string.Empty;
+ public double Cost { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs b/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs
new file mode 100644
index 0000000..d90335e
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using PlumbingRepairDataModels.Models;
+using PlumbingRepairDataModels.Enums;
+
+namespace PlumbingRepairContracts.BindingModels
+{
+ public class OrderBindingModel : IOrderModel
+ {
+ public int Id { get; set; }
+ public int ProductId { get; set; }
+ public int Count { get; set; }
+ public double Sum { get; set; }
+ public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
+ public DateTime DateCreate { get; set; } = DateTime.Now;
+ public DateTime? DateImplement { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairContracts/BindingModels/ProductBindingModel.cs b/PlumbingRepair/PlumbingRepairContracts/BindingModels/ProductBindingModel.cs
new file mode 100644
index 0000000..d8d1988
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/BindingModels/ProductBindingModel.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using PlumbingRepairDataModels.Models;
+
+namespace PlumbingRepairContracts.BindingModels
+{
+ public class ProductBindingModel : IProductModel
+ {
+ public int Id { get; set; }
+ public string ProductName { get; set; } = string.Empty;
+ public double Price { get; set; }
+ public Dictionary ProductComponents
+ { get; set; } = new();
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IComponentLogic.cs b/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IComponentLogic.cs
new file mode 100644
index 0000000..29c3b87
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IComponentLogic.cs
@@ -0,0 +1,20 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairContracts.BusinesLogicsContracts
+{
+ public interface IComponentLogic
+ {
+ List? ReadList(ComponentSearchModel? model);
+ ComponentViewModel? ReadElement(ComponentSearchModel model);
+ bool Create(ComponentBindingModel model);
+ bool Update(ComponentBindingModel model);
+ bool Delete(ComponentBindingModel model);
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IOrderLogic.cs b/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IOrderLogic.cs
new file mode 100644
index 0000000..35251d3
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IOrderLogic.cs
@@ -0,0 +1,20 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairContracts.BusinesLogicsContracts
+{
+ public interface IOrderLogic
+ {
+ List? ReadList(OrderSearchModel? model);
+ bool CreateOrder(OrderBindingModel model);
+ bool TakeOrderInWork(OrderBindingModel model);
+ bool FinishOrder(OrderBindingModel model);
+ bool DeliveryOrder(OrderBindingModel model);
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IProductLogic.cs b/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IProductLogic.cs
new file mode 100644
index 0000000..5f3308f
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IProductLogic.cs
@@ -0,0 +1,20 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairContracts.BusinesLogicsContracts
+{
+ public interface IProductLogic
+ {
+ List? ReadList(ProductSearchModel? model);
+ ProductViewModel? ReadElement(ProductSearchModel model);
+ bool Create(ProductBindingModel model);
+ bool Update(ProductBindingModel model);
+ bool Delete(ProductBindingModel model);
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairContracts/Class1.cs b/PlumbingRepair/PlumbingRepairContracts/Class1.cs
new file mode 100644
index 0000000..12ca490
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/Class1.cs
@@ -0,0 +1,7 @@
+namespace PlumbingRepairContracts
+{
+ public class Class1
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairContracts/PlumbingRepairContracts.csproj b/PlumbingRepair/PlumbingRepairContracts/PlumbingRepairContracts.csproj
new file mode 100644
index 0000000..132c02c
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/PlumbingRepairContracts.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
diff --git a/PlumbingRepair/PlumbingRepairContracts/SearchModels/ComponentSearchModel.cs b/PlumbingRepair/PlumbingRepairContracts/SearchModels/ComponentSearchModel.cs
new file mode 100644
index 0000000..5bda8ef
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/SearchModels/ComponentSearchModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairContracts.SearchModels
+{
+ public class ComponentSearchModel
+ {
+ public int? Id { get; set; }
+ public string? ComponentName { get; set; }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairContracts/SearchModels/OrderSearchModel.cs b/PlumbingRepair/PlumbingRepairContracts/SearchModels/OrderSearchModel.cs
new file mode 100644
index 0000000..f19402b
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/SearchModels/OrderSearchModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairContracts.SearchModels
+{
+ public class OrderSearchModel
+ {
+ public int? Id { get; set; }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairContracts/SearchModels/ProductSearchModel.cs b/PlumbingRepair/PlumbingRepairContracts/SearchModels/ProductSearchModel.cs
new file mode 100644
index 0000000..a3706af
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/SearchModels/ProductSearchModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairContracts.SearchModels
+{
+ public class ProductSearchModel
+ {
+ public int? Id { get; set; }
+ public string? ProductName { get; set; }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IComponentStorage.cs b/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IComponentStorage.cs
new file mode 100644
index 0000000..722b5b5
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IComponentStorage.cs
@@ -0,0 +1,21 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairContracts.StoragesContracts
+{
+ public interface IComponentStorage
+ {
+ List GetFullList();
+ List GetFilteredList(ComponentSearchModel model);
+ ComponentViewModel? GetElement(ComponentSearchModel model);
+ ComponentViewModel? Insert(ComponentBindingModel model);
+ ComponentViewModel? Update(ComponentBindingModel model);
+ ComponentViewModel? Delete(ComponentBindingModel model);
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IOrderStorage.cs b/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IOrderStorage.cs
new file mode 100644
index 0000000..0ae4569
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IOrderStorage.cs
@@ -0,0 +1,21 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairContracts.StoragesContracts
+{
+ public interface IOrderStorage
+ {
+ List GetFullList();
+ List GetFilteredList(OrderSearchModel model);
+ OrderViewModel? GetElement(OrderSearchModel model);
+ OrderViewModel? Insert(OrderBindingModel model);
+ OrderViewModel? Update(OrderBindingModel model);
+ OrderViewModel? Delete(OrderBindingModel model);
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IProductStorage.cs b/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IProductStorage.cs
new file mode 100644
index 0000000..8a4f9a9
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IProductStorage.cs
@@ -0,0 +1,21 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairContracts.StoragesContracts
+{
+ public interface IProductStorage
+ {
+ List GetFullList();
+ List GetFilteredList(ProductSearchModel model);
+ ProductViewModel? GetElement(ProductSearchModel model);
+ ProductViewModel? Insert(ProductBindingModel model);
+ ProductViewModel? Update(ProductBindingModel model);
+ ProductViewModel? Delete(ProductBindingModel model);
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairContracts/ViewModels/ComponentViewModel.cs b/PlumbingRepair/PlumbingRepairContracts/ViewModels/ComponentViewModel.cs
new file mode 100644
index 0000000..6ffcec2
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/ViewModels/ComponentViewModel.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using PlumbingRepairDataModels.Models;
+
+namespace PlumbingRepairContracts.ViewModels
+{
+ public class ComponentViewModel : IComponentModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Название компонента")]
+ public string ComponentName { get; set; } = string.Empty;
+ [DisplayName("Цена")]
+ public double Cost { get; set; }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs b/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs
new file mode 100644
index 0000000..2442c3c
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs
@@ -0,0 +1,29 @@
+using PlumbingRepairDataModels.Enums;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairContracts.ViewModels
+{
+ public class OrderViewModel : IOrderModel
+ {
+ [DisplayName("Номер")]
+ public int Id { get; set; }
+ public int ProductId { get; set; }
+ [DisplayName("Изделие")]
+ public string ProductName { get; set; } = string.Empty;
+ [DisplayName("Количество")]
+ public int Count { get; set; }
+ [DisplayName("Сумма")]
+ public double Sum { get; set; }
+ [DisplayName("Статус")]
+ public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
+ [DisplayName("Дата создания")]
+ public DateTime DateCreate { get; set; } = DateTime.Now;
+ [DisplayName("Дата выполнения")]
+ public DateTime? DateImplement { get; set; }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairContracts/ViewModels/ProductViewModel.cs b/PlumbingRepair/PlumbingRepairContracts/ViewModels/ProductViewModel.cs
new file mode 100644
index 0000000..b8badf8
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/ViewModels/ProductViewModel.cs
@@ -0,0 +1,21 @@
+using PlumbingRepairDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairContracts.ViewModels
+{
+ public class ProductViewModel : IProductModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Название изделия")]
+ public string ProductName { get; set; } = string.Empty;
+ [DisplayName("Цена")]
+ public double Price { get; set; }
+ public Dictionary ProductComponents
+ { get; set; } = new();
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairDataModels/Enums/IOrderModel.cs b/PlumbingRepair/PlumbingRepairDataModels/Enums/IOrderModel.cs
new file mode 100644
index 0000000..b6ccef3
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairDataModels/Enums/IOrderModel.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairDataModels.Enums
+{
+ public interface IOrderModel : IId
+ {
+ int ProductId { get; }
+ int Count { get; }
+ double Sum { get; }
+ OrderStatus Status { get; }
+ DateTime DateCreate { get; }
+ DateTime? DateImplement { get; }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairDataModels/Enums/OrderStatus.cs b/PlumbingRepair/PlumbingRepairDataModels/Enums/OrderStatus.cs
new file mode 100644
index 0000000..387ac9c
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairDataModels/Enums/OrderStatus.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairDataModels.Enums
+{
+ public enum OrderStatus
+ {
+ Неизвестен = -1,
+
+ Принят = 0,
+
+ Выполняется = 1,
+
+ Готов = 2,
+
+ Выдан = 3
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepairDataModels/PlumbingRepairDataModels/Class1.cs b/PlumbingRepair/PlumbingRepairDataModels/IId.cs
similarity index 50%
rename from PlumbingRepairDataModels/PlumbingRepairDataModels/Class1.cs
rename to PlumbingRepair/PlumbingRepairDataModels/IId.cs
index 5d924fd..bb2cdbd 100644
--- a/PlumbingRepairDataModels/PlumbingRepairDataModels/Class1.cs
+++ b/PlumbingRepair/PlumbingRepairDataModels/IId.cs
@@ -1,7 +1,7 @@
-namespace PlumbingRepairDataModels
-{
- public class Class1
- {
-
- }
+namespace PlumbingRepairDataModels
+{
+ public interface IId
+ {
+ int Id { get; }
+ }
}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairDataModels/Models/IComponentModel.cs b/PlumbingRepair/PlumbingRepairDataModels/Models/IComponentModel.cs
new file mode 100644
index 0000000..dd84a9f
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairDataModels/Models/IComponentModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairDataModels.Models
+{
+ public interface IComponentModel : IId
+ {
+ string ComponentName { get; }
+ double Cost { get; }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairDataModels/Models/IProductModel.cs b/PlumbingRepair/PlumbingRepairDataModels/Models/IProductModel.cs
new file mode 100644
index 0000000..b7bb523
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairDataModels/Models/IProductModel.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairDataModels.Models
+{
+ public interface IProductModel
+ {
+ string ProductName { get; }
+ double Price { get; }
+ Dictionary ProductComponents { get; }
+
+ }
+}
diff --git a/PlumbingRepairDataModels/PlumbingRepairDataModels/PlumbingRepairDataModels.csproj b/PlumbingRepair/PlumbingRepairDataModels/PlumbingRepairDataModels.csproj
similarity index 95%
rename from PlumbingRepairDataModels/PlumbingRepairDataModels/PlumbingRepairDataModels.csproj
rename to PlumbingRepair/PlumbingRepairDataModels/PlumbingRepairDataModels.csproj
index bafd05b..132c02c 100644
--- a/PlumbingRepairDataModels/PlumbingRepairDataModels/PlumbingRepairDataModels.csproj
+++ b/PlumbingRepair/PlumbingRepairDataModels/PlumbingRepairDataModels.csproj
@@ -1,9 +1,9 @@
-
-
-
- net6.0
- enable
- enable
-
-
-
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
diff --git a/PlumbingRepairDataModels/PlumbingRepairDataModels.sln b/PlumbingRepairDataModels/PlumbingRepairDataModels.sln
deleted file mode 100644
index d054714..0000000
--- a/PlumbingRepairDataModels/PlumbingRepairDataModels.sln
+++ /dev/null
@@ -1,25 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.6.33801.468
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairDataModels", "PlumbingRepairDataModels\PlumbingRepairDataModels.csproj", "{4BA66634-173E-44AA-9423-18F10AD0C54A}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4BA66634-173E-44AA-9423-18F10AD0C54A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4BA66634-173E-44AA-9423-18F10AD0C54A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4BA66634-173E-44AA-9423-18F10AD0C54A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4BA66634-173E-44AA-9423-18F10AD0C54A}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {64A4C77F-7D64-427C-AC56-E79B23936823}
- EndGlobalSection
-EndGlobal
--
2.25.1
From 5df383fc54d581b959fc1dfee8aabcb2fefaa391 Mon Sep 17 00:00:00 2001
From: DyCTaTOR <125912249+DyCTaTOR@users.noreply.github.com>
Date: Wed, 14 Feb 2024 11:14:37 +0400
Subject: [PATCH 3/8] =?UTF-8?q?=D0=94=D0=B0=D0=BB=D1=8C=D1=88=D0=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
PlumbingRepair/PlumbingRepair.sln | 80 ++++++------
.../BusinessLogics/ComponentLogic.cs | 113 +++++++++++++++++
.../BusinessLogics/OrderLogic.cs | 106 ++++++++++++++++
.../BusinessLogics/WorkLogic.cs | 118 ++++++++++++++++++
.../PlumbingRepairBusinessLogic.csproj | 13 ++
.../BindingModels/OrderBindingModel.cs | 2 +-
...uctBindingModel.cs => WorkBindingModel.cs} | 4 +-
.../BusinesLogicsContracts/IProductLogic.cs | 20 ---
.../IComponentLogic.cs | 2 +-
.../IOrderLogic.cs | 2 +-
.../BusinessLogicsContracts/IWorkLogic.cs | 20 +++
.../PlumbingRepairContracts.csproj | 4 +
.../SearchModels/OrderSearchModel.cs | 2 +-
...oductSearchModel.cs => WorkSearchModel.cs} | 0
.../StoragesContracts/IProductStorage.cs | 21 ----
.../StoragesContracts/IWorkStorage.cs | 21 ++++
.../ViewModels/OrderViewModel.cs | 4 +-
.../{ProductViewModel.cs => WorkViewModel.cs} | 6 +-
.../Enums/IOrderModel.cs | 2 +-
.../Models/IOrderModel.cs | 20 +++
.../{IProductModel.cs => IWorkModel.cs} | 6 +-
21 files changed, 473 insertions(+), 93 deletions(-)
create mode 100644 PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/ComponentLogic.cs
create mode 100644 PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
create mode 100644 PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/WorkLogic.cs
create mode 100644 PlumbingRepair/PlumbingRepairBusinessLogic/PlumbingRepairBusinessLogic.csproj
rename PlumbingRepair/PlumbingRepairContracts/BindingModels/{ProductBindingModel.cs => WorkBindingModel.cs} (77%)
delete mode 100644 PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IProductLogic.cs
rename PlumbingRepair/PlumbingRepairContracts/{BusinesLogicsContracts => BusinessLogicsContracts}/IComponentLogic.cs (91%)
rename PlumbingRepair/PlumbingRepairContracts/{BusinesLogicsContracts => BusinessLogicsContracts}/IOrderLogic.cs (90%)
create mode 100644 PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IWorkLogic.cs
rename PlumbingRepair/PlumbingRepairContracts/SearchModels/{ProductSearchModel.cs => WorkSearchModel.cs} (100%)
delete mode 100644 PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IProductStorage.cs
create mode 100644 PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IWorkStorage.cs
rename PlumbingRepair/PlumbingRepairContracts/ViewModels/{ProductViewModel.cs => WorkViewModel.cs} (70%)
create mode 100644 PlumbingRepair/PlumbingRepairDataModels/Models/IOrderModel.cs
rename PlumbingRepair/PlumbingRepairDataModels/Models/{IProductModel.cs => IWorkModel.cs} (58%)
diff --git a/PlumbingRepair/PlumbingRepair.sln b/PlumbingRepair/PlumbingRepair.sln
index 076fa65..4088c1d 100644
--- a/PlumbingRepair/PlumbingRepair.sln
+++ b/PlumbingRepair/PlumbingRepair.sln
@@ -1,37 +1,43 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.6.33801.468
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepair", "PlumbingRepair\PlumbingRepair.csproj", "{16CDF38C-189C-4BED-AB66-DB3C212C4047}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairDataModels", "PlumbingRepairDataModels\PlumbingRepairDataModels.csproj", "{F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairContracts", "PlumbingRepairContracts\PlumbingRepairContracts.csproj", "{FD429137-A114-4447-B51A-FCC11FEF7E2C}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {16CDF38C-189C-4BED-AB66-DB3C212C4047}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {16CDF38C-189C-4BED-AB66-DB3C212C4047}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {16CDF38C-189C-4BED-AB66-DB3C212C4047}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {16CDF38C-189C-4BED-AB66-DB3C212C4047}.Release|Any CPU.Build.0 = Release|Any CPU
- {F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}.Release|Any CPU.Build.0 = Release|Any CPU
- {FD429137-A114-4447-B51A-FCC11FEF7E2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FD429137-A114-4447-B51A-FCC11FEF7E2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FD429137-A114-4447-B51A-FCC11FEF7E2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FD429137-A114-4447-B51A-FCC11FEF7E2C}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {1BA93531-B041-4CEC-AEAB-2877EA63E1E5}
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33801.468
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepair", "PlumbingRepair\PlumbingRepair.csproj", "{16CDF38C-189C-4BED-AB66-DB3C212C4047}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairDataModels", "PlumbingRepairDataModels\PlumbingRepairDataModels.csproj", "{F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairContracts", "PlumbingRepairContracts\PlumbingRepairContracts.csproj", "{FD429137-A114-4447-B51A-FCC11FEF7E2C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairBusinessLogic", "PlumbingRepairBusinessLogic\PlumbingRepairBusinessLogic.csproj", "{B960E476-E516-4BAA-B5D7-55F29B376993}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {16CDF38C-189C-4BED-AB66-DB3C212C4047}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {16CDF38C-189C-4BED-AB66-DB3C212C4047}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {16CDF38C-189C-4BED-AB66-DB3C212C4047}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {16CDF38C-189C-4BED-AB66-DB3C212C4047}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FD429137-A114-4447-B51A-FCC11FEF7E2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FD429137-A114-4447-B51A-FCC11FEF7E2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FD429137-A114-4447-B51A-FCC11FEF7E2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FD429137-A114-4447-B51A-FCC11FEF7E2C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B960E476-E516-4BAA-B5D7-55F29B376993}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B960E476-E516-4BAA-B5D7-55F29B376993}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B960E476-E516-4BAA-B5D7-55F29B376993}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B960E476-E516-4BAA-B5D7-55F29B376993}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {1BA93531-B041-4CEC-AEAB-2877EA63E1E5}
+ EndGlobalSection
+EndGlobal
diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/ComponentLogic.cs b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/ComponentLogic.cs
new file mode 100644
index 0000000..37cfe2e
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/ComponentLogic.cs
@@ -0,0 +1,113 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.BusinessLogicsContracts;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.StoragesContracts;
+using PlumbingRepairContracts.ViewModels;
+using Microsoft.Extensions.Logging;
+
+namespace PlumbingRepairBusinessLogic.BusinessLogics
+{
+ public class ComponentLogic : IComponentLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IComponentStorage _componentStorage;
+ public ComponentLogic(ILogger logger, IComponentStorage
+ componentStorage)
+ {
+ _logger = logger;
+ _componentStorage = componentStorage;
+ }
+ public List? ReadList(ComponentSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. ComponentName: {ComponentName}.Id:{Id} ",
+ model?.ComponentName, model?.Id);
+ var list = model == null ? _componentStorage.GetFullList() :
+ _componentStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count:{Count}", list.Count);
+ return list;
+ }
+ public ComponentViewModel? ReadElement(ComponentSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. ComponentName:{ComponentName}.Id:{Id}",
+ model.ComponentName, model.Id);
+ var element = _componentStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
+ return element;
+ }
+ public bool Create(ComponentBindingModel model)
+ {
+ CheckModel(model);
+ if (_componentStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+ public bool Update(ComponentBindingModel model)
+ {
+ CheckModel(model);
+ if (_componentStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+ public bool Delete(ComponentBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id:{Id}", model.Id);
+ if (_componentStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+ private void CheckModel(ComponentBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.ComponentName))
+ {
+ throw new ArgumentNullException("Нет названия компонента",
+ nameof(model.ComponentName));
+ }
+ if (model.Cost <= 0)
+ {
+ throw new ArgumentNullException("Цена компонента должна быть больше 0", nameof(model.Cost));
+ }
+ _logger.LogInformation("Component. ComponentName:{ComponentName}.Cost:{Cost}. Id: {Id}",
+ model.ComponentName, model.Cost, model.Id);
+ var element = _componentStorage.GetElement(new ComponentSearchModel
+ {
+ ComponentName = model.ComponentName
+ });
+ if (element != null && element.Id != model.Id)
+ {
+ throw new InvalidOperationException("Компонент с таким названием уже есть");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
new file mode 100644
index 0000000..f6cc670
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
@@ -0,0 +1,106 @@
+using Microsoft.Extensions.Logging;
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.BusinessLogicsContracts;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.StoragesContracts;
+using PlumbingRepairContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairBusinessLogic.BusinessLogics
+{
+ public class OrderLogic : IOrderLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IOrderStorage _orderStorage;
+ public OrderLogic(ILogger logger, IOrderStorage
+ orderStorage)
+ {
+ _logger = logger;
+ _orderStorage = orderStorage;
+ }
+ public List? ReadList(OrderSearchModel? model)
+ {
+ _logger.LogInformation("ReadList.Id:{Id} ", model?.Id);
+ var list = model == null ? _orderStorage.GetFullList() :
+ _orderStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count:{Count}", list.Count);
+ return list;
+ }
+ public OrderViewModel? ReadElement(OrderSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement.Id:{Id}", model.Id);
+ var element = _orderStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
+ return element;
+ }
+ public bool Create(OrderBindingModel model)
+ {
+ CheckModel(model);
+ if (_orderStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+ public bool Update(OrderBindingModel model)
+ {
+ CheckModel(model);
+ if (_orderStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+ public bool Delete(OrderBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id:{Id}", model.Id);
+ if (_orderStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+ private void CheckModel(OrderBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ _logger.LogInformation("Component.Id: {Id}", model.Id);
+ var element = _orderStorage.GetElement(new OrderSearchModel
+ {
+ WorkName = model.WorkName
+ });
+ if (element != null && element.Id != model.Id)
+ {
+ throw new InvalidOperationException("Работа с таким названием уже есть");
+ }
+ }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/WorkLogic.cs b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/WorkLogic.cs
new file mode 100644
index 0000000..93e1f00
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/WorkLogic.cs
@@ -0,0 +1,118 @@
+using Microsoft.Extensions.Logging;
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.BusinessLogicsContracts;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.StoragesContracts;
+using PlumbingRepairContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairBusinessLogic.BusinessLogics
+{
+ public class WorkLogic : IWorkLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IWorkStorage _workStorage;
+ public WorkLogic(ILogger logger, IWorkStorage
+ workStorage)
+ {
+ _logger = logger;
+ _workStorage = workStorage;
+ }
+ public List? ReadList(WorkSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. WorkName: {WorkName}.Id:{Id} ",
+ model?.WorkName, model?.Id);
+ var list = model == null ? _workStorage.GetFullList() :
+ _workStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count:{Count}", list.Count);
+ return list;
+ }
+ public WorkViewModel? ReadElement(WorkSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. WorkName:{WorkName}.Id:{Id}",
+ model.WorkName, model.Id);
+ var element = _workStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
+ return element;
+ }
+ public bool Create(WorkBindingModel model)
+ {
+ CheckModel(model);
+ if (_workStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+ public bool Update(WorkBindingModel model)
+ {
+ CheckModel(model);
+ if (_workStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+ public bool Delete(WorkBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id:{Id}", model.Id);
+ if (_workStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+ private void CheckModel(WorkBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.WorkName))
+ {
+ throw new ArgumentNullException("Нет названия работы",
+ nameof(model.WorkName));
+ }
+ if (model.Price <= 0)
+ {
+ throw new ArgumentNullException("Цена работы должна быть больше 0", nameof(model.Price));
+ }
+ _logger.LogInformation("Work. WorkName:{WorkName}.Price:{Price}. Id: {Id}",
+ model.WorkName, model.Price, model.Id);
+ var element = _workStorage.GetElement(new WorkSearchModel
+ {
+ WorkName = model.WorkName
+ });
+ if (element != null && element.Id != model.Id)
+ {
+ throw new InvalidOperationException("Работа с таким названием уже есть");
+ }
+ }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/PlumbingRepairBusinessLogic.csproj b/PlumbingRepair/PlumbingRepairBusinessLogic/PlumbingRepairBusinessLogic.csproj
new file mode 100644
index 0000000..c384a70
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairBusinessLogic/PlumbingRepairBusinessLogic.csproj
@@ -0,0 +1,13 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs b/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs
index d90335e..80b2ea5 100644
--- a/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs
@@ -11,7 +11,7 @@ namespace PlumbingRepairContracts.BindingModels
public class OrderBindingModel : IOrderModel
{
public int Id { get; set; }
- public int ProductId { get; set; }
+ public int WorkId { get; set; }
public int Count { get; set; }
public double Sum { get; set; }
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
diff --git a/PlumbingRepair/PlumbingRepairContracts/BindingModels/ProductBindingModel.cs b/PlumbingRepair/PlumbingRepairContracts/BindingModels/WorkBindingModel.cs
similarity index 77%
rename from PlumbingRepair/PlumbingRepairContracts/BindingModels/ProductBindingModel.cs
rename to PlumbingRepair/PlumbingRepairContracts/BindingModels/WorkBindingModel.cs
index d8d1988..a3f01d8 100644
--- a/PlumbingRepair/PlumbingRepairContracts/BindingModels/ProductBindingModel.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/BindingModels/WorkBindingModel.cs
@@ -7,10 +7,10 @@ using PlumbingRepairDataModels.Models;
namespace PlumbingRepairContracts.BindingModels
{
- public class ProductBindingModel : IProductModel
+ public class WorkBindingModel : IWorkModel
{
public int Id { get; set; }
- public string ProductName { get; set; } = string.Empty;
+ public string WorkName { get; set; } = string.Empty;
public double Price { get; set; }
public Dictionary ProductComponents
{ get; set; } = new();
diff --git a/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IProductLogic.cs b/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IProductLogic.cs
deleted file mode 100644
index 5f3308f..0000000
--- a/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IProductLogic.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using PlumbingRepairContracts.BindingModels;
-using PlumbingRepairContracts.SearchModels;
-using PlumbingRepairContracts.ViewModels;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PlumbingRepairContracts.BusinesLogicsContracts
-{
- public interface IProductLogic
- {
- List? ReadList(ProductSearchModel? model);
- ProductViewModel? ReadElement(ProductSearchModel model);
- bool Create(ProductBindingModel model);
- bool Update(ProductBindingModel model);
- bool Delete(ProductBindingModel model);
- }
-}
diff --git a/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IComponentLogic.cs b/PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IComponentLogic.cs
similarity index 91%
rename from PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IComponentLogic.cs
rename to PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IComponentLogic.cs
index 29c3b87..ed446bd 100644
--- a/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IComponentLogic.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IComponentLogic.cs
@@ -7,7 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace PlumbingRepairContracts.BusinesLogicsContracts
+namespace PlumbingRepairContracts.BusinessLogicsContracts
{
public interface IComponentLogic
{
diff --git a/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IOrderLogic.cs b/PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IOrderLogic.cs
similarity index 90%
rename from PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IOrderLogic.cs
rename to PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IOrderLogic.cs
index 35251d3..7bdf845 100644
--- a/PlumbingRepair/PlumbingRepairContracts/BusinesLogicsContracts/IOrderLogic.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IOrderLogic.cs
@@ -7,7 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace PlumbingRepairContracts.BusinesLogicsContracts
+namespace PlumbingRepairContracts.BusinessLogicsContracts
{
public interface IOrderLogic
{
diff --git a/PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IWorkLogic.cs b/PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IWorkLogic.cs
new file mode 100644
index 0000000..bd5dba3
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/BusinessLogicsContracts/IWorkLogic.cs
@@ -0,0 +1,20 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairContracts.BusinessLogicsContracts
+{
+ public interface IWorkLogic
+ {
+ List? ReadList(WorkSearchModel? model);
+ WorkViewModel? ReadElement(WorkSearchModel model);
+ bool Create(WorkBindingModel model);
+ bool Update(WorkBindingModel model);
+ bool Delete(WorkBindingModel model);
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairContracts/PlumbingRepairContracts.csproj b/PlumbingRepair/PlumbingRepairContracts/PlumbingRepairContracts.csproj
index 132c02c..667ab73 100644
--- a/PlumbingRepair/PlumbingRepairContracts/PlumbingRepairContracts.csproj
+++ b/PlumbingRepair/PlumbingRepairContracts/PlumbingRepairContracts.csproj
@@ -6,4 +6,8 @@
enable
+
+
+
+
diff --git a/PlumbingRepair/PlumbingRepairContracts/SearchModels/OrderSearchModel.cs b/PlumbingRepair/PlumbingRepairContracts/SearchModels/OrderSearchModel.cs
index f19402b..d1df87a 100644
--- a/PlumbingRepair/PlumbingRepairContracts/SearchModels/OrderSearchModel.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/SearchModels/OrderSearchModel.cs
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace PlumbingRepairContracts.SearchModels
{
public class OrderSearchModel
- {
+ {
public int? Id { get; set; }
}
}
diff --git a/PlumbingRepair/PlumbingRepairContracts/SearchModels/ProductSearchModel.cs b/PlumbingRepair/PlumbingRepairContracts/SearchModels/WorkSearchModel.cs
similarity index 100%
rename from PlumbingRepair/PlumbingRepairContracts/SearchModels/ProductSearchModel.cs
rename to PlumbingRepair/PlumbingRepairContracts/SearchModels/WorkSearchModel.cs
diff --git a/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IProductStorage.cs b/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IProductStorage.cs
deleted file mode 100644
index 8a4f9a9..0000000
--- a/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IProductStorage.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using PlumbingRepairContracts.BindingModels;
-using PlumbingRepairContracts.SearchModels;
-using PlumbingRepairContracts.ViewModels;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PlumbingRepairContracts.StoragesContracts
-{
- public interface IProductStorage
- {
- List GetFullList();
- List GetFilteredList(ProductSearchModel model);
- ProductViewModel? GetElement(ProductSearchModel model);
- ProductViewModel? Insert(ProductBindingModel model);
- ProductViewModel? Update(ProductBindingModel model);
- ProductViewModel? Delete(ProductBindingModel model);
- }
-}
diff --git a/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IWorkStorage.cs b/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IWorkStorage.cs
new file mode 100644
index 0000000..253affd
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairContracts/StoragesContracts/IWorkStorage.cs
@@ -0,0 +1,21 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairContracts.StoragesContracts
+{
+ public interface IWorkStorage
+ {
+ List GetFullList();
+ List GetFilteredList(WorkSearchModel model);
+ WorkViewModel? GetElement(WorkSearchModel model);
+ WorkViewModel? Insert(WorkBindingModel model);
+ WorkViewModel? Update(WorkBindingModel model);
+ WorkViewModel? Delete(WorkBindingModel model);
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs b/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs
index 2442c3c..4aab652 100644
--- a/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs
@@ -12,9 +12,9 @@ namespace PlumbingRepairContracts.ViewModels
{
[DisplayName("Номер")]
public int Id { get; set; }
- public int ProductId { get; set; }
+ public int WorkId { get; set; }
[DisplayName("Изделие")]
- public string ProductName { get; set; } = string.Empty;
+ public string WorkName { get; set; } = string.Empty;
[DisplayName("Количество")]
public int Count { get; set; }
[DisplayName("Сумма")]
diff --git a/PlumbingRepair/PlumbingRepairContracts/ViewModels/ProductViewModel.cs b/PlumbingRepair/PlumbingRepairContracts/ViewModels/WorkViewModel.cs
similarity index 70%
rename from PlumbingRepair/PlumbingRepairContracts/ViewModels/ProductViewModel.cs
rename to PlumbingRepair/PlumbingRepairContracts/ViewModels/WorkViewModel.cs
index b8badf8..2ff0250 100644
--- a/PlumbingRepair/PlumbingRepairContracts/ViewModels/ProductViewModel.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/ViewModels/WorkViewModel.cs
@@ -8,14 +8,14 @@ using System.Threading.Tasks;
namespace PlumbingRepairContracts.ViewModels
{
- public class ProductViewModel : IProductModel
+ public class WorkViewModel : IWorkModel
{
public int Id { get; set; }
[DisplayName("Название изделия")]
- public string ProductName { get; set; } = string.Empty;
+ public string WorkName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
- public Dictionary ProductComponents
+ public Dictionary WorkComponents
{ get; set; } = new();
}
}
diff --git a/PlumbingRepair/PlumbingRepairDataModels/Enums/IOrderModel.cs b/PlumbingRepair/PlumbingRepairDataModels/Enums/IOrderModel.cs
index b6ccef3..206a418 100644
--- a/PlumbingRepair/PlumbingRepairDataModels/Enums/IOrderModel.cs
+++ b/PlumbingRepair/PlumbingRepairDataModels/Enums/IOrderModel.cs
@@ -8,7 +8,7 @@ namespace PlumbingRepairDataModels.Enums
{
public interface IOrderModel : IId
{
- int ProductId { get; }
+ int WorkId { get; }
int Count { get; }
double Sum { get; }
OrderStatus Status { get; }
diff --git a/PlumbingRepair/PlumbingRepairDataModels/Models/IOrderModel.cs b/PlumbingRepair/PlumbingRepairDataModels/Models/IOrderModel.cs
new file mode 100644
index 0000000..439de32
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairDataModels/Models/IOrderModel.cs
@@ -0,0 +1,20 @@
+using PlumbingRepairDataModels.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairDataModels.Models
+{
+ public interface IOrderModel : IId
+ {
+ int WorkId { get; }
+ int Count { get; }
+ double Sum { get; }
+ OrderStatus Status { get; }
+ DateTime DateCreate { get; }
+ DateTime? DateImplement { get; }
+
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairDataModels/Models/IProductModel.cs b/PlumbingRepair/PlumbingRepairDataModels/Models/IWorkModel.cs
similarity index 58%
rename from PlumbingRepair/PlumbingRepairDataModels/Models/IProductModel.cs
rename to PlumbingRepair/PlumbingRepairDataModels/Models/IWorkModel.cs
index b7bb523..4a0700b 100644
--- a/PlumbingRepair/PlumbingRepairDataModels/Models/IProductModel.cs
+++ b/PlumbingRepair/PlumbingRepairDataModels/Models/IWorkModel.cs
@@ -6,11 +6,11 @@ using System.Threading.Tasks;
namespace PlumbingRepairDataModels.Models
{
- public interface IProductModel
+ public interface IWorkModel : IId
{
- string ProductName { get; }
+ string WorkName { get; }
double Price { get; }
- Dictionary ProductComponents { get; }
+ Dictionary WorkComponents { get; }
}
}
--
2.25.1
From 1a62aada4fca765798cfbf015a7d6df86dc1681c Mon Sep 17 00:00:00 2001
From: DyCTaTOR <125912249+DyCTaTOR@users.noreply.github.com>
Date: Thu, 15 Feb 2024 12:18:02 +0400
Subject: [PATCH 4/8] .
---
.../BusinessLogics/ComponentLogic.cs | 2 +-
.../PlumbingRepairBusinessLogic.csproj | 4 ++++
.../BindingModels/WorkBindingModel.cs | 2 +-
.../PlumbingRepairContracts/Class1.cs | 7 -------
.../SearchModels/WorkSearchModel.cs | 4 ++--
.../Enums/IOrderModel.cs | 18 ------------------
.../Models/IOrderModel.cs | 1 -
.../Models/IWorkModel.cs | 1 -
8 files changed, 8 insertions(+), 31 deletions(-)
delete mode 100644 PlumbingRepair/PlumbingRepairContracts/Class1.cs
delete mode 100644 PlumbingRepair/PlumbingRepairDataModels/Enums/IOrderModel.cs
diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/ComponentLogic.cs b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/ComponentLogic.cs
index 37cfe2e..f869cc4 100644
--- a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/ComponentLogic.cs
+++ b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/ComponentLogic.cs
@@ -21,7 +21,7 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
{
_logger.LogInformation("ReadList. ComponentName: {ComponentName}.Id:{Id} ",
model?.ComponentName, model?.Id);
- var list = model == null ? _componentStorage.GetFullList() :
+ var list = model == null ? _componentStorage.GetFullList() :
_componentStorage.GetFilteredList(model);
if (list == null)
{
diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/PlumbingRepairBusinessLogic.csproj b/PlumbingRepair/PlumbingRepairBusinessLogic/PlumbingRepairBusinessLogic.csproj
index c384a70..973510f 100644
--- a/PlumbingRepair/PlumbingRepairBusinessLogic/PlumbingRepairBusinessLogic.csproj
+++ b/PlumbingRepair/PlumbingRepairBusinessLogic/PlumbingRepairBusinessLogic.csproj
@@ -6,6 +6,10 @@
enable
+
+
+
+
diff --git a/PlumbingRepair/PlumbingRepairContracts/BindingModels/WorkBindingModel.cs b/PlumbingRepair/PlumbingRepairContracts/BindingModels/WorkBindingModel.cs
index a3f01d8..a02fe03 100644
--- a/PlumbingRepair/PlumbingRepairContracts/BindingModels/WorkBindingModel.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/BindingModels/WorkBindingModel.cs
@@ -12,7 +12,7 @@ namespace PlumbingRepairContracts.BindingModels
public int Id { get; set; }
public string WorkName { get; set; } = string.Empty;
public double Price { get; set; }
- public Dictionary ProductComponents
+ public Dictionary WorkComponents
{ get; set; } = new();
}
}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairContracts/Class1.cs b/PlumbingRepair/PlumbingRepairContracts/Class1.cs
deleted file mode 100644
index 12ca490..0000000
--- a/PlumbingRepair/PlumbingRepairContracts/Class1.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-namespace PlumbingRepairContracts
-{
- public class Class1
- {
-
- }
-}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairContracts/SearchModels/WorkSearchModel.cs b/PlumbingRepair/PlumbingRepairContracts/SearchModels/WorkSearchModel.cs
index a3706af..7a4c385 100644
--- a/PlumbingRepair/PlumbingRepairContracts/SearchModels/WorkSearchModel.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/SearchModels/WorkSearchModel.cs
@@ -6,9 +6,9 @@ using System.Threading.Tasks;
namespace PlumbingRepairContracts.SearchModels
{
- public class ProductSearchModel
+ public class WorkSearchModel
{
public int? Id { get; set; }
- public string? ProductName { get; set; }
+ public string? WorkName { get; set; }
}
}
diff --git a/PlumbingRepair/PlumbingRepairDataModels/Enums/IOrderModel.cs b/PlumbingRepair/PlumbingRepairDataModels/Enums/IOrderModel.cs
deleted file mode 100644
index 206a418..0000000
--- a/PlumbingRepair/PlumbingRepairDataModels/Enums/IOrderModel.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PlumbingRepairDataModels.Enums
-{
- public interface IOrderModel : IId
- {
- int WorkId { get; }
- int Count { get; }
- double Sum { get; }
- OrderStatus Status { get; }
- DateTime DateCreate { get; }
- DateTime? DateImplement { get; }
- }
-}
diff --git a/PlumbingRepair/PlumbingRepairDataModels/Models/IOrderModel.cs b/PlumbingRepair/PlumbingRepairDataModels/Models/IOrderModel.cs
index 439de32..330360c 100644
--- a/PlumbingRepair/PlumbingRepairDataModels/Models/IOrderModel.cs
+++ b/PlumbingRepair/PlumbingRepairDataModels/Models/IOrderModel.cs
@@ -15,6 +15,5 @@ namespace PlumbingRepairDataModels.Models
OrderStatus Status { get; }
DateTime DateCreate { get; }
DateTime? DateImplement { get; }
-
}
}
diff --git a/PlumbingRepair/PlumbingRepairDataModels/Models/IWorkModel.cs b/PlumbingRepair/PlumbingRepairDataModels/Models/IWorkModel.cs
index 4a0700b..3bd0de3 100644
--- a/PlumbingRepair/PlumbingRepairDataModels/Models/IWorkModel.cs
+++ b/PlumbingRepair/PlumbingRepairDataModels/Models/IWorkModel.cs
@@ -11,6 +11,5 @@ namespace PlumbingRepairDataModels.Models
string WorkName { get; }
double Price { get; }
Dictionary WorkComponents { get; }
-
}
}
--
2.25.1
From ccef2923534739919f26a433039768ed4447bdc3 Mon Sep 17 00:00:00 2001
From: DyCTaTOR <125912249+DyCTaTOR@users.noreply.github.com>
Date: Tue, 27 Feb 2024 16:18:37 +0400
Subject: [PATCH 5/8] -
---
.../PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
index f6cc670..674bc70 100644
--- a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
+++ b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
@@ -51,7 +51,7 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
return element;
}
- public bool Create(OrderBindingModel model)
+ public bool CreateOrder(OrderBindingModel model)
{
CheckModel(model);
if (_orderStorage.Insert(model) == null)
--
2.25.1
From 0a16389cb0ac7cfc0ec922a8254abd2b807c7d9a Mon Sep 17 00:00:00 2001
From: DyCTaTOR <125912249+DyCTaTOR@users.noreply.github.com>
Date: Tue, 27 Feb 2024 17:37:08 +0400
Subject: [PATCH 6/8] --
---
.../BusinessLogics/OrderLogic.cs | 68 ++++++++++++++-----
1 file changed, 50 insertions(+), 18 deletions(-)
diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
index 674bc70..28467f3 100644
--- a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
+++ b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
@@ -4,6 +4,7 @@ using PlumbingRepairContracts.BusinessLogicsContracts;
using PlumbingRepairContracts.SearchModels;
using PlumbingRepairContracts.StoragesContracts;
using PlumbingRepairContracts.ViewModels;
+using PlumbingRepairDataModels.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -24,7 +25,7 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
}
public List? ReadList(OrderSearchModel? model)
{
- _logger.LogInformation("ReadList.Id:{Id} ", model?.Id);
+ _logger.LogInformation("ReadList.OrderId:{Id} ", model?.Id);
var list = model == null ? _orderStorage.GetFullList() :
_orderStorage.GetFilteredList(model);
if (list == null)
@@ -54,34 +55,59 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
public bool CreateOrder(OrderBindingModel model)
{
CheckModel(model);
+ if (model.Status != OrderStatus.Неизвестен)
+ {
+ _logger.LogWarning("Insert operation failed. Order Status incorrect.");
+ return false;
+ }
+
+ model.Status = OrderStatus.Принят;
+
if (_orderStorage.Insert(model) == null)
{
+ model.Status = OrderStatus.Неизвестен;
_logger.LogWarning("Insert operation failed");
return false;
}
+
return true;
}
- public bool Update(OrderBindingModel model)
+ public bool StatusUpdate(OrderBindingModel model)
{
CheckModel(model);
+ if(model.Status + 1 > OrderStatus.Выдан)
+ {
+ _logger.LogWarning("Status update: operation failed. Order status incorrect.");
+ return false;
+ }
+ model.Status += 1;
+ if(model.Status == OrderStatus.Выдан)
+ {
+ model.DateImplement = DateTime.Now;
+ }
if (_orderStorage.Update(model) == null)
{
+ model.Status--;
_logger.LogWarning("Update operation failed");
return false;
}
return true;
}
- public bool Delete(OrderBindingModel model)
+ public bool TakeOrderInWork(OrderBindingModel model)
{
- CheckModel(model, false);
- _logger.LogInformation("Delete. Id:{Id}", model.Id);
- if (_orderStorage.Delete(model) == null)
- {
- _logger.LogWarning("Delete operation failed");
- return false;
- }
- return true;
+ return StatusUpdate(model);
}
+
+ public bool DeliveryOrder(OrderBindingModel model)
+ {
+ return StatusUpdate(model);
+ }
+
+ public bool FinishOrder(OrderBindingModel model)
+ {
+ return StatusUpdate(model);
+ }
+
private void CheckModel(OrderBindingModel model, bool withParams = true)
{
if (model == null)
@@ -92,15 +118,21 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
{
return;
}
- _logger.LogInformation("Component.Id: {Id}", model.Id);
- var element = _orderStorage.GetElement(new OrderSearchModel
+ if (model.WorkId < 0)
{
- WorkName = model.WorkName
- });
- if (element != null && element.Id != model.Id)
- {
- throw new InvalidOperationException("Работа с таким названием уже есть");
+ throw new ArgumentNullException("Некорректный идентификатор изделия", nameof(model.WorkId));
}
+
+ if (model.Count <= 0)
+ {
+ throw new ArgumentNullException("Количество изделий в заказе должно быть больше 0", nameof(model.Count));
+ }
+
+ if (model.Sum <= 0)
+ {
+ throw new ArgumentNullException("Сумма заказа должна быть больше 0", nameof(model.Sum));
+ }
+ _logger.LogInformation("Order. OrderId:{Id}.Sum:{ Sum}. WorkId: { WorkId}", model.Id, model.Sum, model.WorkId);
}
}
}
--
2.25.1
From a0fd0c6864d6689a137207fdb0181602a67d46d5 Mon Sep 17 00:00:00 2001
From: DyCTaTOR <125912249+DyCTaTOR@users.noreply.github.com>
Date: Tue, 27 Feb 2024 22:51:12 +0400
Subject: [PATCH 7/8] =?UTF-8?q?=D0=9B=D0=B0=D0=B11?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
PlumbingRepair/PlumbingRepair.sln | 18 +-
.../PlumbingRepair/PlumbingRepair.csproj | 4 +
PlumbingRepair/PlumbingRepair/Program.cs | 2 +-
.../BusinessLogics/OrderLogic.cs | 22 +-
.../BindingModels/OrderBindingModel.cs | 1 +
.../ViewModels/OrderViewModel.cs | 1 +
.../DataListSingleton.cs | 31 +++
.../Implements/ComponentStorage.cs | 107 ++++++++
.../Implements/OrderStorage.cs | 105 ++++++++
.../Implements/WorkStorage.cs | 126 +++++++++
.../Models/Component.cs | 41 +++
.../Models/Order.cs | 62 +++++
.../Models/Work.cs | 55 ++++
.../PlumbingRepairListImplement.csproj | 14 +
.../FormComponent.Designer.cs | 117 +++++++++
.../PlumbingRepairView/FormComponent.cs | 87 +++++++
.../PlumbingRepairView/FormComponent.resx | 120 +++++++++
.../FormComponents.Designer.cs | 109 ++++++++
.../PlumbingRepairView/FormComponents.cs | 104 ++++++++
.../PlumbingRepairView/FormComponents.resx | 120 +++++++++
.../FormCreateOrder.Designer.cs | 144 +++++++++++
.../PlumbingRepairView/FormCreateOrder.cs | 141 ++++++++++
.../PlumbingRepairView/FormCreateOrder.resx | 120 +++++++++
.../PlumbingRepairView/FormMain.Designer.cs | 180 +++++++++++++
PlumbingRepair/PlumbingRepairView/FormMain.cs | 199 +++++++++++++++
.../PlumbingRepairView/FormMain.resx | 123 +++++++++
.../PlumbingRepairView/FormWork.Designer.cs | 241 ++++++++++++++++++
PlumbingRepair/PlumbingRepairView/FormWork.cs | 237 +++++++++++++++++
.../PlumbingRepairView/FormWork.resx | 120 +++++++++
.../FormWorkComponent.Designer.cs | 116 +++++++++
.../PlumbingRepairView/FormWorkComponent.cs | 90 +++++++
.../PlumbingRepairView/FormWorkComponent.resx | 120 +++++++++
.../PlumbingRepairView/FormWorks.Designer.cs | 114 +++++++++
.../PlumbingRepairView/FormWorks.cs | 120 +++++++++
.../PlumbingRepairView/FormWorks.resx | 120 +++++++++
.../PlumbingRepairView.csproj | 22 ++
PlumbingRepair/PlumbingRepairView/Program.cs | 53 ++++
37 files changed, 3492 insertions(+), 14 deletions(-)
create mode 100644 PlumbingRepair/PlumbingRepairListImplement/DataListSingleton.cs
create mode 100644 PlumbingRepair/PlumbingRepairListImplement/Implements/ComponentStorage.cs
create mode 100644 PlumbingRepair/PlumbingRepairListImplement/Implements/OrderStorage.cs
create mode 100644 PlumbingRepair/PlumbingRepairListImplement/Implements/WorkStorage.cs
create mode 100644 PlumbingRepair/PlumbingRepairListImplement/Models/Component.cs
create mode 100644 PlumbingRepair/PlumbingRepairListImplement/Models/Order.cs
create mode 100644 PlumbingRepair/PlumbingRepairListImplement/Models/Work.cs
create mode 100644 PlumbingRepair/PlumbingRepairListImplement/PlumbingRepairListImplement.csproj
create mode 100644 PlumbingRepair/PlumbingRepairView/FormComponent.Designer.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormComponent.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormComponent.resx
create mode 100644 PlumbingRepair/PlumbingRepairView/FormComponents.Designer.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormComponents.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormComponents.resx
create mode 100644 PlumbingRepair/PlumbingRepairView/FormCreateOrder.Designer.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormCreateOrder.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormCreateOrder.resx
create mode 100644 PlumbingRepair/PlumbingRepairView/FormMain.Designer.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormMain.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormMain.resx
create mode 100644 PlumbingRepair/PlumbingRepairView/FormWork.Designer.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormWork.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormWork.resx
create mode 100644 PlumbingRepair/PlumbingRepairView/FormWorkComponent.Designer.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormWorkComponent.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormWorkComponent.resx
create mode 100644 PlumbingRepair/PlumbingRepairView/FormWorks.Designer.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormWorks.cs
create mode 100644 PlumbingRepair/PlumbingRepairView/FormWorks.resx
create mode 100644 PlumbingRepair/PlumbingRepairView/PlumbingRepairView.csproj
create mode 100644 PlumbingRepair/PlumbingRepairView/Program.cs
diff --git a/PlumbingRepair/PlumbingRepair.sln b/PlumbingRepair/PlumbingRepair.sln
index 4088c1d..f5fba87 100644
--- a/PlumbingRepair/PlumbingRepair.sln
+++ b/PlumbingRepair/PlumbingRepair.sln
@@ -5,11 +5,15 @@ VisualStudioVersion = 17.6.33801.468
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepair", "PlumbingRepair\PlumbingRepair.csproj", "{16CDF38C-189C-4BED-AB66-DB3C212C4047}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairDataModels", "PlumbingRepairDataModels\PlumbingRepairDataModels.csproj", "{F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairDataModels", "PlumbingRepairDataModels\PlumbingRepairDataModels.csproj", "{F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairContracts", "PlumbingRepairContracts\PlumbingRepairContracts.csproj", "{FD429137-A114-4447-B51A-FCC11FEF7E2C}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairContracts", "PlumbingRepairContracts\PlumbingRepairContracts.csproj", "{FD429137-A114-4447-B51A-FCC11FEF7E2C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairBusinessLogic", "PlumbingRepairBusinessLogic\PlumbingRepairBusinessLogic.csproj", "{B960E476-E516-4BAA-B5D7-55F29B376993}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairBusinessLogic", "PlumbingRepairBusinessLogic\PlumbingRepairBusinessLogic.csproj", "{B960E476-E516-4BAA-B5D7-55F29B376993}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairListImplement", "PlumbingRepairListImplement\PlumbingRepairListImplement.csproj", "{E89CA82F-2FEA-4235-93A2-E5A412D0116F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairView", "PlumbingRepairView\PlumbingRepairView.csproj", "{4FB885A2-56C9-4267-84B0-A2161EB314C2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -33,6 +37,14 @@ Global
{B960E476-E516-4BAA-B5D7-55F29B376993}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B960E476-E516-4BAA-B5D7-55F29B376993}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B960E476-E516-4BAA-B5D7-55F29B376993}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E89CA82F-2FEA-4235-93A2-E5A412D0116F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E89CA82F-2FEA-4235-93A2-E5A412D0116F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E89CA82F-2FEA-4235-93A2-E5A412D0116F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E89CA82F-2FEA-4235-93A2-E5A412D0116F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4FB885A2-56C9-4267-84B0-A2161EB314C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4FB885A2-56C9-4267-84B0-A2161EB314C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4FB885A2-56C9-4267-84B0-A2161EB314C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4FB885A2-56C9-4267-84B0-A2161EB314C2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/PlumbingRepair/PlumbingRepair/PlumbingRepair.csproj b/PlumbingRepair/PlumbingRepair/PlumbingRepair.csproj
index b57c89e..e60bd40 100644
--- a/PlumbingRepair/PlumbingRepair/PlumbingRepair.csproj
+++ b/PlumbingRepair/PlumbingRepair/PlumbingRepair.csproj
@@ -8,4 +8,8 @@
enable
+
+
+
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepair/Program.cs b/PlumbingRepair/PlumbingRepair/Program.cs
index 9bc4817..1d4535b 100644
--- a/PlumbingRepair/PlumbingRepair/Program.cs
+++ b/PlumbingRepair/PlumbingRepair/Program.cs
@@ -11,7 +11,7 @@ namespace PlumbingRepair
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
+ Application.Run(new FormComponent());
}
}
}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
index 28467f3..5fc5c55 100644
--- a/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
+++ b/PlumbingRepair/PlumbingRepairBusinessLogic/BusinessLogics/OrderLogic.cs
@@ -72,40 +72,42 @@ namespace PlumbingRepairBusinessLogic.BusinessLogics
return true;
}
- public bool StatusUpdate(OrderBindingModel model)
+ public bool StatusUpdate(OrderBindingModel model, OrderStatus newStatus)
{
CheckModel(model);
- if(model.Status + 1 > OrderStatus.Выдан)
+ if (model.Status + 1 != newStatus)
{
- _logger.LogWarning("Status update: operation failed. Order status incorrect.");
+ _logger.LogWarning("Status update to " + newStatus.ToString() + " operation failed. Order status incorrect.");
return false;
}
- model.Status += 1;
- if(model.Status == OrderStatus.Выдан)
- {
+
+ model.Status = newStatus;
+
+ if (model.Status == OrderStatus.Выдан)
model.DateImplement = DateTime.Now;
- }
+
if (_orderStorage.Update(model) == null)
{
model.Status--;
_logger.LogWarning("Update operation failed");
return false;
}
+
return true;
}
public bool TakeOrderInWork(OrderBindingModel model)
{
- return StatusUpdate(model);
+ return StatusUpdate(model, OrderStatus.Выполняется);
}
public bool DeliveryOrder(OrderBindingModel model)
{
- return StatusUpdate(model);
+ return StatusUpdate(model, OrderStatus.Готов);
}
public bool FinishOrder(OrderBindingModel model)
{
- return StatusUpdate(model);
+ return StatusUpdate(model, OrderStatus.Выдан);
}
private void CheckModel(OrderBindingModel model, bool withParams = true)
diff --git a/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs b/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs
index 80b2ea5..780a29e 100644
--- a/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs
@@ -17,5 +17,6 @@ namespace PlumbingRepairContracts.BindingModels
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
public DateTime DateCreate { get; set; } = DateTime.Now;
public DateTime? DateImplement { get; set; }
+ public string WorkName { get; set; } = string.Empty;
}
}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs b/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs
index 4aab652..5b54828 100644
--- a/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs
@@ -1,4 +1,5 @@
using PlumbingRepairDataModels.Enums;
+using PlumbingRepairDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
diff --git a/PlumbingRepair/PlumbingRepairListImplement/DataListSingleton.cs b/PlumbingRepair/PlumbingRepairListImplement/DataListSingleton.cs
new file mode 100644
index 0000000..93d388a
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairListImplement/DataListSingleton.cs
@@ -0,0 +1,31 @@
+using PlumbingRepairListImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairListImplement
+{
+ public class DataListSingleton
+ {
+ private static DataListSingleton? _instance;
+ public List Components { get; set; }
+ public List Orders { get; set; }
+ public List Works { get; set; }
+ private DataListSingleton()
+ {
+ Components = new List();
+ Orders = new List();
+ Works = new List();
+ }
+ public static DataListSingleton GetInstance()
+ {
+ if (_instance == null)
+ {
+ _instance = new DataListSingleton();
+ }
+ return _instance;
+ }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairListImplement/Implements/ComponentStorage.cs b/PlumbingRepair/PlumbingRepairListImplement/Implements/ComponentStorage.cs
new file mode 100644
index 0000000..8c350cb
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairListImplement/Implements/ComponentStorage.cs
@@ -0,0 +1,107 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.StoragesContracts;
+using PlumbingRepairContracts.ViewModels;
+using PlumbingRepairListImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairListImplement.Implements
+{
+ public class ComponentStorage : IComponentStorage
+ {
+ private readonly DataListSingleton _source;
+ public ComponentStorage()
+ {
+ _source = DataListSingleton.GetInstance();
+ }
+ public List GetFullList()
+ {
+ var result = new List();
+ foreach (var component in _source.Components)
+ {
+ result.Add(component.GetViewModel);
+ }
+ return result;
+ }
+ public List GetFilteredList(ComponentSearchModel model)
+ {
+ var result = new List();
+ if (string.IsNullOrEmpty(model.ComponentName))
+ {
+ return result;
+ }
+ foreach (var component in _source.Components)
+ {
+ if (component.ComponentName.Contains(model.ComponentName))
+ {
+ result.Add(component.GetViewModel);
+ }
+ }
+ return result;
+ }
+ public ComponentViewModel? GetElement(ComponentSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.ComponentName) && !model.Id.HasValue)
+ {
+ return null;
+ }
+ foreach (var component in _source.Components)
+ {
+ if ((!string.IsNullOrEmpty(model.ComponentName) &&
+ component.ComponentName == model.ComponentName) ||
+ (model.Id.HasValue && component.Id == model.Id))
+ {
+ return component.GetViewModel;
+ }
+ }
+ return null;
+ }
+ public ComponentViewModel? Insert(ComponentBindingModel model)
+ {
+ model.Id = 1;
+ foreach (var component in _source.Components)
+ {
+ if (model.Id <= component.Id)
+ {
+ model.Id = component.Id + 1;
+ }
+ }
+ var newComponent = Component.Create(model);
+ if (newComponent == null)
+ {
+ return null;
+ }
+ _source.Components.Add(newComponent);
+ return newComponent.GetViewModel;
+ }
+ public ComponentViewModel? Update(ComponentBindingModel model)
+ {
+ foreach (var component in _source.Components)
+ {
+ if (component.Id == model.Id)
+ {
+ component.Update(model);
+ return component.GetViewModel;
+ }
+ }
+ return null;
+ }
+ public ComponentViewModel? Delete(ComponentBindingModel model)
+ {
+ for (int i = 0; i < _source.Components.Count; ++i)
+ {
+ if (_source.Components[i].Id == model.Id)
+ {
+ var element = _source.Components[i];
+ _source.Components.RemoveAt(i);
+ return element.GetViewModel;
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairListImplement/Implements/OrderStorage.cs b/PlumbingRepair/PlumbingRepairListImplement/Implements/OrderStorage.cs
new file mode 100644
index 0000000..ab24931
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairListImplement/Implements/OrderStorage.cs
@@ -0,0 +1,105 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.StoragesContracts;
+using PlumbingRepairContracts.ViewModels;
+using PlumbingRepairListImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairListImplement.Implements
+{
+ public class OrderStorage : IOrderStorage
+ {
+ private readonly DataListSingleton _source;
+ public OrderStorage()
+ {
+ _source = DataListSingleton.GetInstance();
+ }
+ public List GetFullList()
+ {
+ var result = new List();
+ foreach (var order in _source.Orders)
+ {
+ result.Add(order.GetViewModel);
+ }
+ return result;
+ }
+ public List GetFilteredList(OrderSearchModel model)
+ {
+ var result = new List();
+ if (!model.Id.HasValue)
+ {
+ return result;
+ }
+ foreach (var order in _source.Orders)
+ {
+ if (model.Id.HasValue && order.Id == model.Id)
+ {
+ result.Add(order.GetViewModel);
+ }
+ }
+ return result;
+ }
+ public OrderViewModel? GetElement(OrderSearchModel model)
+ {
+ if (!model.Id.HasValue)
+ {
+ return null;
+ }
+ foreach (var order in _source.Orders)
+ {
+ if (model.Id.HasValue && order.Id == model.Id)
+ {
+ return order.GetViewModel;
+ }
+ }
+ return null;
+ }
+ public OrderViewModel? Insert(OrderBindingModel model)
+ {
+ model.Id = 1;
+ foreach (var order in _source.Orders)
+ {
+ if (model.Id <= order.Id)
+ {
+ model.Id = order.Id + 1;
+ }
+ }
+ var newOrder = Order.Create(model);
+ if (newOrder == null)
+ {
+ return null;
+ }
+ _source.Orders.Add(newOrder);
+ return newOrder.GetViewModel;
+ }
+ public OrderViewModel? Update(OrderBindingModel model)
+ {
+ foreach (var order in _source.Orders)
+ {
+ if (order.Id == model.Id)
+ {
+ order.Update(model);
+ return order.GetViewModel;
+ }
+ }
+ return null;
+ }
+ public OrderViewModel? Delete(OrderBindingModel model)
+ {
+ for (int i = 0; i < _source.Orders.Count; ++i)
+ {
+ if (_source.Orders[i].Id == model.Id)
+ {
+ var element = _source.Orders[i];
+ _source.Orders.RemoveAt(i);
+ return element.GetViewModel;
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairListImplement/Implements/WorkStorage.cs b/PlumbingRepair/PlumbingRepairListImplement/Implements/WorkStorage.cs
new file mode 100644
index 0000000..7e3846d
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairListImplement/Implements/WorkStorage.cs
@@ -0,0 +1,126 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairContracts.StoragesContracts;
+using PlumbingRepairContracts.ViewModels;
+using PlumbingRepairListImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairListImplement.Implements
+{
+ public class WorkStorage : IWorkStorage
+ {
+ private readonly DataListSingleton _source;
+
+ public WorkStorage()
+ {
+ _source = DataListSingleton.GetInstance();
+ }
+
+ public List GetFullList()
+ {
+ var result = new List();
+
+ foreach (var work in _source.Works)
+ {
+ result.Add(work.GetViewModel);
+ }
+
+ return result;
+ }
+
+ public List GetFilteredList(WorkSearchModel model)
+ {
+ var result = new List();
+
+ if (string.IsNullOrEmpty(model.WorkName))
+ {
+ return result;
+ }
+
+ foreach (var work in _source.Works)
+ {
+ if (work.WorkName.Contains(model.WorkName))
+ {
+ result.Add(work.GetViewModel);
+ }
+ }
+
+ return result;
+ }
+
+ public WorkViewModel? GetElement(WorkSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.WorkName) && !model.Id.HasValue)
+ {
+ return null;
+ }
+
+ foreach (var work in _source.Works)
+ {
+ if ((!string.IsNullOrEmpty(model.WorkName) && work.WorkName == model.WorkName) || (model.Id.HasValue && work.Id == model.Id))
+ {
+ return work.GetViewModel;
+ }
+ }
+
+ return null;
+ }
+
+ public WorkViewModel? Insert(WorkBindingModel model)
+ {
+ model.Id = 1;
+
+ foreach (var work in _source.Works)
+ {
+ if (model.Id <= work.Id)
+ {
+ model.Id = work.Id + 1;
+ }
+ }
+
+ var newWork = Work.Create(model);
+
+ if (newWork == null)
+ {
+ return null;
+ }
+
+ _source.Works.Add(newWork);
+
+ return newWork.GetViewModel;
+ }
+
+ public WorkViewModel? Update(WorkBindingModel model)
+ {
+ foreach (var work in _source.Works)
+ {
+ if (work.Id == model.Id)
+ {
+ work.Update(model);
+ return work.GetViewModel;
+ }
+ }
+
+ return null;
+ }
+
+ public WorkViewModel? Delete(WorkBindingModel model)
+ {
+ for (int i = 0; i < _source.Works.Count; ++i)
+ {
+ if (_source.Works[i].Id == model.Id)
+ {
+ var element = _source.Works[i];
+ _source.Works.RemoveAt(i);
+ return element.GetViewModel;
+ }
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairListImplement/Models/Component.cs b/PlumbingRepair/PlumbingRepairListImplement/Models/Component.cs
new file mode 100644
index 0000000..a84a43e
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairListImplement/Models/Component.cs
@@ -0,0 +1,41 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.ViewModels;
+using PlumbingRepairDataModels.Models;
+
+namespace PlumbingRepairListImplement.Models
+{
+ public class Component : IComponentModel
+ {
+ public int Id { get; private set; }
+ public string ComponentName { get; private set; } = string.Empty;
+ public double Cost { get; set; }
+ public static Component? Create(ComponentBindingModel? model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Component()
+ {
+ Id = model.Id,
+ ComponentName = model.ComponentName,
+ Cost = model.Cost
+ };
+ }
+ public void Update(ComponentBindingModel? model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ ComponentName = model.ComponentName;
+ Cost = model.Cost;
+ }
+ public ComponentViewModel GetViewModel => new()
+ {
+ Id = Id,
+ ComponentName = ComponentName,
+ Cost = Cost
+ };
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairListImplement/Models/Order.cs b/PlumbingRepair/PlumbingRepairListImplement/Models/Order.cs
new file mode 100644
index 0000000..a350881
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairListImplement/Models/Order.cs
@@ -0,0 +1,62 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.ViewModels;
+using PlumbingRepairDataModels.Enums;
+using PlumbingRepairDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairListImplement.Models
+{
+ public class Order : IOrderModel
+ {
+ public int Id { get; private set; }
+ public int WorkId { get; private set; }
+ public int Count { get; private set; }
+ public double Sum { get; private set; }
+ public OrderStatus Status { get; private set; }
+ public DateTime DateCreate { get; private set; }
+ public DateTime? DateImplement { get; private set; }
+ public static Order? Create(OrderBindingModel? model)
+ {
+ if(model == null)
+ {
+ return null;
+ }
+ return new Order()
+ {
+ Id = model.Id,
+ WorkId = model.WorkId,
+ Count = model.Count,
+ Sum = model.Sum,
+ Status = model.Status,
+ DateCreate = model.DateCreate,
+ DateImplement = model.DateImplement,
+ };
+ }
+ public void Update(OrderBindingModel? model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ Count = model.Count;
+ Sum = model.Sum;
+ Status = model.Status;
+ DateCreate = model.DateCreate;
+ DateImplement = model.DateImplement;
+ }
+ public OrderViewModel GetViewModel => new()
+ {
+ Id = Id,
+ WorkId = WorkId,
+ Count = Count,
+ Sum = Sum,
+ Status = Status,
+ DateCreate = DateCreate,
+ DateImplement = DateImplement,
+ };
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairListImplement/Models/Work.cs b/PlumbingRepair/PlumbingRepairListImplement/Models/Work.cs
new file mode 100644
index 0000000..2971326
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairListImplement/Models/Work.cs
@@ -0,0 +1,55 @@
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.BusinessLogicsContracts;
+using PlumbingRepairContracts.ViewModels;
+using PlumbingRepairDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PlumbingRepairListImplement.Models
+{
+ public class Work : IWorkModel
+ {
+ public int Id { get; private set; }
+ public string WorkName { get; private set; } = string.Empty;
+ public double Price { get; private set; }
+ public Dictionary WorkComponents
+ {
+ get;
+ private set;
+ } = new Dictionary();
+ public static Work? Create(WorkBindingModel? model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Work()
+ {
+ Id = model.Id,
+ WorkName = model.WorkName,
+ Price = model.Price,
+ WorkComponents = model.WorkComponents
+ };
+ }
+ public void Update(WorkBindingModel? model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ WorkName = model.WorkName;
+ Price = model.Price;
+ WorkComponents = model.WorkComponents;
+ }
+ public WorkViewModel GetViewModel => new()
+ {
+ Id = Id,
+ WorkName = WorkName,
+ Price = Price,
+ WorkComponents = WorkComponents
+ };
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairListImplement/PlumbingRepairListImplement.csproj b/PlumbingRepair/PlumbingRepairListImplement/PlumbingRepairListImplement.csproj
new file mode 100644
index 0000000..05f8377
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairListImplement/PlumbingRepairListImplement.csproj
@@ -0,0 +1,14 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
diff --git a/PlumbingRepair/PlumbingRepairView/FormComponent.Designer.cs b/PlumbingRepair/PlumbingRepairView/FormComponent.Designer.cs
new file mode 100644
index 0000000..d5db281
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormComponent.Designer.cs
@@ -0,0 +1,117 @@
+namespace PlumbingRepairView
+{
+ partial class FormComponent
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ textBoxName = new TextBox();
+ textBoxCost = new TextBox();
+ labelName = new Label();
+ labelCost = new Label();
+ buttonSave = new Button();
+ buttonCancel = new Button();
+ SuspendLayout();
+ //
+ // textBoxName
+ //
+ textBoxName.Location = new Point(140, 13);
+ textBoxName.Name = "textBoxName";
+ textBoxName.Size = new Size(168, 31);
+ textBoxName.TabIndex = 0;
+ //
+ // textBoxCost
+ //
+ textBoxCost.Location = new Point(140, 58);
+ textBoxCost.Name = "textBoxCost";
+ textBoxCost.Size = new Size(168, 31);
+ textBoxCost.TabIndex = 1;
+ //
+ // labelName
+ //
+ labelName.AutoSize = true;
+ labelName.Location = new Point(10, 19);
+ labelName.Name = "labelName";
+ labelName.Size = new Size(94, 25);
+ labelName.TabIndex = 2;
+ labelName.Text = "Название:";
+ //
+ // labelCost
+ //
+ labelCost.AutoSize = true;
+ labelCost.Location = new Point(12, 64);
+ labelCost.Name = "labelCost";
+ labelCost.Size = new Size(57, 25);
+ labelCost.TabIndex = 3;
+ labelCost.Text = "Цена:";
+ //
+ // buttonSave
+ //
+ buttonSave.Location = new Point(163, 95);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(112, 34);
+ buttonSave.TabIndex = 4;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = true;
+ buttonSave.Click += ButtonSave_Click;
+ //
+ // buttonCancel
+ //
+ buttonCancel.Location = new Point(281, 95);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(86, 34);
+ buttonCancel.TabIndex = 5;
+ buttonCancel.Text = "Отмена";
+ buttonCancel.UseVisualStyleBackColor = true;
+ buttonCancel.Click += ButtonCancel_Click;
+ //
+ // FormComponent
+ //
+ AutoScaleDimensions = new SizeF(10F, 25F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(374, 141);
+ Controls.Add(buttonCancel);
+ Controls.Add(buttonSave);
+ Controls.Add(labelCost);
+ Controls.Add(labelName);
+ Controls.Add(textBoxCost);
+ Controls.Add(textBoxName);
+ Name = "FormComponent";
+ Text = "Компонент";
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private TextBox textBoxName;
+ private TextBox textBoxCost;
+ private Label labelName;
+ private Label labelCost;
+ private Button buttonSave;
+ private Button buttonCancel;
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormComponent.cs b/PlumbingRepair/PlumbingRepairView/FormComponent.cs
new file mode 100644
index 0000000..c080e07
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormComponent.cs
@@ -0,0 +1,87 @@
+using Microsoft.Extensions.Logging;
+using PlumbingRepairContracts.BusinessLogicsContracts;
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.SearchModels;
+using System.Windows.Forms;
+
+namespace PlumbingRepairView
+{
+ public partial class FormComponent : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IComponentLogic _logic;
+ private int? _id;
+ public int Id { set { _id = value; } }
+ public FormComponent(ILogger logger, IComponentLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+ private void FormComponent_Load(object sender, EventArgs e)
+ {
+ if (_id.HasValue)
+ {
+ try
+ {
+ _logger.LogInformation(" ");
+ var view = _logic.ReadElement(new ComponentSearchModel
+ {
+ Id = _id.Value
+ });
+ if (view != null)
+ {
+ textBoxName.Text = view.ComponentName;
+ textBoxCost.Text = view.Cost.ToString();
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, " ");
+ MessageBox.Show(ex.Message, "", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ }
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(textBoxName.Text))
+ {
+ MessageBox.Show(" ", "",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ _logger.LogInformation(" ");
+ try
+ {
+ var model = new ComponentBindingModel
+ {
+ Id = _id ?? 0,
+ ComponentName = textBoxName.Text,
+ Cost = Convert.ToDouble(textBoxCost.Text)
+ };
+ var operationResult = _id.HasValue ? _logic.Update(model) :
+ _logic.Create(model);
+ if (!operationResult)
+ {
+ throw new Exception(" . .");
+ }
+ MessageBox.Show(" ", "",
+ MessageBoxButtons.OK, MessageBoxIcon.Information);
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, " ");
+ MessageBox.Show(ex.Message, "", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormComponent.resx b/PlumbingRepair/PlumbingRepairView/FormComponent.resx
new file mode 100644
index 0000000..a395bff
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormComponent.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormComponents.Designer.cs b/PlumbingRepair/PlumbingRepairView/FormComponents.Designer.cs
new file mode 100644
index 0000000..583fc0f
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormComponents.Designer.cs
@@ -0,0 +1,109 @@
+namespace PlumbingRepairView
+{
+ partial class FormComponents
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ dataGridView = new DataGridView();
+ buttonAdd = new Button();
+ buttonDel = new Button();
+ buttonChange = new Button();
+ buttonRef = new Button();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // dataGridView
+ //
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Location = new Point(12, 10);
+ dataGridView.Name = "dataGridView";
+ dataGridView.RowHeadersWidth = 62;
+ dataGridView.RowTemplate.Height = 33;
+ dataGridView.Size = new Size(640, 505);
+ dataGridView.TabIndex = 0;
+ //
+ // buttonAdd
+ //
+ buttonAdd.Location = new Point(684, 41);
+ buttonAdd.Name = "buttonAdd";
+ buttonAdd.Size = new Size(135, 34);
+ buttonAdd.TabIndex = 1;
+ buttonAdd.Text = "Добавить";
+ buttonAdd.UseVisualStyleBackColor = true;
+ //
+ // buttonDel
+ //
+ buttonDel.Location = new Point(684, 106);
+ buttonDel.Name = "buttonDel";
+ buttonDel.Size = new Size(135, 34);
+ buttonDel.TabIndex = 2;
+ buttonDel.Text = "Удалить";
+ buttonDel.UseVisualStyleBackColor = true;
+ //
+ // buttonChange
+ //
+ buttonChange.Location = new Point(684, 184);
+ buttonChange.Name = "buttonChange";
+ buttonChange.Size = new Size(135, 34);
+ buttonChange.TabIndex = 3;
+ buttonChange.Text = "Изменить";
+ buttonChange.UseVisualStyleBackColor = true;
+ //
+ // buttonRef
+ //
+ buttonRef.Location = new Point(684, 261);
+ buttonRef.Name = "buttonRef";
+ buttonRef.Size = new Size(135, 34);
+ buttonRef.TabIndex = 4;
+ buttonRef.Text = "Обновить";
+ buttonRef.UseVisualStyleBackColor = true;
+ //
+ // FormComponents
+ //
+ AutoScaleDimensions = new SizeF(10F, 25F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(848, 527);
+ Controls.Add(buttonRef);
+ Controls.Add(buttonChange);
+ Controls.Add(buttonDel);
+ Controls.Add(buttonAdd);
+ Controls.Add(dataGridView);
+ Name = "FormComponents";
+ Text = "Компоненты";
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button buttonAdd;
+ private Button buttonDel;
+ private Button buttonChange;
+ private Button buttonRef;
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormComponents.cs b/PlumbingRepair/PlumbingRepairView/FormComponents.cs
new file mode 100644
index 0000000..4cc2bcc
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormComponents.cs
@@ -0,0 +1,104 @@
+using Microsoft.Extensions.Logging;
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.BusinessLogicsContracts;
+
+namespace PlumbingRepairView
+{
+ public partial class FormComponents : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IComponentLogic _logic;
+ public FormComponents(ILogger logger, IComponentLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+ private void FormComponents_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ private void LoadData()
+ {
+ try
+ {
+ var list = _logic.ReadList(null);
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ dataGridView.Columns["Id"].Visible = false;
+ dataGridView.Columns["ComponentName"].AutoSizeMode =
+ DataGridViewAutoSizeColumnMode.Fill;
+ }
+ _logger.LogInformation("Загрузка компонентов");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки компонентов");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
+ if (service is FormComponent form)
+ {
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+ private void ButtonUpd_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
+ if (service is FormComponent form)
+ {
+ form.Id =
+ Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+ }
+ private void ButtonDel_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ if (MessageBox.Show("Удалить запись?", "Вопрос",
+ MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ int id =
+ Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation("Удаление компонента");
+ try
+ {
+ if (!_logic.Delete(new ComponentBindingModel
+ {
+ Id = id
+ }))
+ {
+ throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
+ }
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка удаления компонента");
+ MessageBox.Show(ex.Message, "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+ private void ButtonRef_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairView/FormComponents.resx b/PlumbingRepair/PlumbingRepairView/FormComponents.resx
new file mode 100644
index 0000000..a395bff
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormComponents.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormCreateOrder.Designer.cs b/PlumbingRepair/PlumbingRepairView/FormCreateOrder.Designer.cs
new file mode 100644
index 0000000..4a7df40
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormCreateOrder.Designer.cs
@@ -0,0 +1,144 @@
+namespace PlumbingRepairView
+{
+ partial class FormCreateOrder
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ this.buttonSave = new System.Windows.Forms.Button();
+ this.textBoxCount = new System.Windows.Forms.TextBox();
+ this.textBoxSum = new System.Windows.Forms.TextBox();
+ this.comboBoxWork = new System.Windows.Forms.ComboBox();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(23, 18);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(60, 20);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Работа:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(23, 55);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(93, 20);
+ this.label2.TabIndex = 1;
+ this.label2.Text = "Количество:";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(23, 92);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(58, 20);
+ this.label3.TabIndex = 2;
+ this.label3.Text = "Сумма:";
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.Location = new System.Drawing.Point(389, 139);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(94, 29);
+ this.buttonCancel.TabIndex = 3;
+ this.buttonCancel.Text = "Отмена";
+ this.buttonCancel.UseVisualStyleBackColor = true;
+ this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
+ //
+ // buttonSave
+ //
+ this.buttonSave.Location = new System.Drawing.Point(289, 139);
+ this.buttonSave.Name = "buttonSave";
+ this.buttonSave.Size = new System.Drawing.Size(94, 29);
+ this.buttonSave.TabIndex = 4;
+ this.buttonSave.Text = "Сохранить";
+ this.buttonSave.UseVisualStyleBackColor = true;
+ this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
+ //
+ // textBoxCount
+ //
+ this.textBoxCount.Location = new System.Drawing.Point(142, 55);
+ this.textBoxCount.Name = "textBoxCount";
+ this.textBoxCount.Size = new System.Drawing.Size(341, 27);
+ this.textBoxCount.TabIndex = 5;
+ this.textBoxCount.TextChanged += new System.EventHandler(this.textBoxCount_TextChanged);
+ //
+ // textBoxSum
+ //
+ this.textBoxSum.Location = new System.Drawing.Point(142, 92);
+ this.textBoxSum.Name = "textBoxSum";
+ this.textBoxSum.Size = new System.Drawing.Size(341, 27);
+ this.textBoxSum.TabIndex = 6;
+ //
+ // comboBoxWork
+ //
+ this.comboBoxWork.FormattingEnabled = true;
+ this.comboBoxWork.Location = new System.Drawing.Point(142, 18);
+ this.comboBoxWork.Name = "comboBoxWork";
+ this.comboBoxWork.Size = new System.Drawing.Size(341, 28);
+ this.comboBoxWork.TabIndex = 7;
+ this.comboBoxWork.SelectedIndexChanged += new System.EventHandler(this.comboBoxWork_SelectedIndexChanged);
+ //
+ // FormCreateOrder
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(495, 180);
+ this.Controls.Add(this.comboBoxWork);
+ this.Controls.Add(this.textBoxSum);
+ this.Controls.Add(this.textBoxCount);
+ this.Controls.Add(this.buttonSave);
+ this.Controls.Add(this.buttonCancel);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Name = "FormCreateOrder";
+ this.Text = "Заказ";
+ this.Load += new System.EventHandler(this.FormCreateOrder_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private Label label1;
+ private Label label2;
+ private Label label3;
+ private Button buttonCancel;
+ private Button buttonSave;
+ private TextBox textBoxCount;
+ private TextBox textBoxSum;
+ private ComboBox comboBoxWork;
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormCreateOrder.cs b/PlumbingRepair/PlumbingRepairView/FormCreateOrder.cs
new file mode 100644
index 0000000..b12da69
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormCreateOrder.cs
@@ -0,0 +1,141 @@
+using Microsoft.Extensions.Logging;
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.BusinessLogicsContracts;
+using PlumbingRepairContracts.SearchModels;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace PlumbingRepairView
+{
+ public partial class FormCreateOrder : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IWorkLogic _logicW;
+ private readonly IOrderLogic _logicO;
+
+ public FormCreateOrder(ILogger logger, IWorkLogic logicW, IOrderLogic logicO)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logicW = logicW;
+ _logicO = logicO;
+ LoadData();
+ }
+ private void LoadData()
+ {
+ _logger.LogInformation("Загрузка изделий для заказа");
+
+ try
+ {
+ var list = _logicW.ReadList(null);
+ if (list != null)
+ {
+ comboBoxWork.DisplayMember = "WorkName";
+ comboBoxWork.ValueMember = "Id";
+ comboBoxWork.DataSource = list;
+ comboBoxWork.SelectedItem = null;
+ }
+
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки списка изделий");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void FormCreateOrder_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ private void CalcSum()
+ {
+ if (comboBoxWork.SelectedValue != null && !string.IsNullOrEmpty(textBoxCount.Text))
+ {
+ try
+ {
+ int id = Convert.ToInt32(comboBoxWork.SelectedValue);
+
+ var product = _logicW.ReadElement(new WorkSearchModel
+ {
+ Id = id
+ });
+
+ int count = Convert.ToInt32(textBoxCount.Text);
+ textBoxSum.Text = Math.Round(count * (product?.Price ?? 0), 2).ToString();
+ _logger.LogInformation("Расчет суммы заказа");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка расчета суммы заказа");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ }
+ private void textBoxCount_TextChanged(object sender, EventArgs e)
+ {
+ CalcSum();
+ }
+
+ private void comboBoxWork_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ CalcSum();
+ }
+
+ private void buttonSave_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(textBoxCount.Text))
+ {
+ MessageBox.Show("Заполните поле Количество", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+
+ if (comboBoxWork.SelectedValue == null)
+ {
+ MessageBox.Show("Выберите изделие", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+
+ _logger.LogInformation("Создание заказа");
+
+ try
+ {
+ var operationResult = _logicO.CreateOrder(new OrderBindingModel
+ {
+ WorkId = Convert.ToInt32(comboBoxWork.SelectedValue),
+ WorkName = comboBoxWork.Text,
+ Count = Convert.ToInt32(textBoxCount.Text),
+ Sum = Convert.ToDouble(textBoxSum.Text)
+ });
+
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах.");
+ }
+
+ MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка создания заказа");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void buttonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairView/FormCreateOrder.resx b/PlumbingRepair/PlumbingRepairView/FormCreateOrder.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormCreateOrder.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormMain.Designer.cs b/PlumbingRepair/PlumbingRepairView/FormMain.Designer.cs
new file mode 100644
index 0000000..c3cf2cb
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormMain.Designer.cs
@@ -0,0 +1,180 @@
+namespace PlumbingRepairView
+{
+ partial class FormMain
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ menuStrip1 = new MenuStrip();
+ справочникиToolStripMenuItem = new ToolStripMenuItem();
+ компонентыToolStripMenuItem = new ToolStripMenuItem();
+ работыToolStripMenuItem = new ToolStripMenuItem();
+ dataGridView = new DataGridView();
+ buttonCreateOrder = new Button();
+ buttonTakeOrderInWork = new Button();
+ buttonOrderReady = new Button();
+ buttonIssuedOrder = new Button();
+ buttonUpdateList = new Button();
+ menuStrip1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // menuStrip1
+ //
+ menuStrip1.ImageScalingSize = new Size(20, 20);
+ menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem });
+ menuStrip1.Location = new Point(0, 0);
+ menuStrip1.Name = "menuStrip1";
+ menuStrip1.Padding = new Padding(8, 2, 0, 2);
+ menuStrip1.Size = new Size(992, 33);
+ menuStrip1.TabIndex = 0;
+ menuStrip1.Text = "menuStrip1";
+ //
+ // справочникиToolStripMenuItem
+ //
+ справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, работыToolStripMenuItem });
+ справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
+ справочникиToolStripMenuItem.Size = new Size(139, 29);
+ справочникиToolStripMenuItem.Text = "Справочники";
+ //
+ // компонентыToolStripMenuItem
+ //
+ компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
+ компонентыToolStripMenuItem.Size = new Size(218, 34);
+ компонентыToolStripMenuItem.Text = "Компоненты";
+ компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click;
+ //
+ // работыToolStripMenuItem
+ //
+ работыToolStripMenuItem.Name = "работыToolStripMenuItem";
+ работыToolStripMenuItem.Size = new Size(218, 34);
+ работыToolStripMenuItem.Text = "Работы";
+ работыToolStripMenuItem.Click += работыToolStripMenuItem_Click;
+ //
+ // dataGridView
+ //
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Location = new Point(0, 39);
+ dataGridView.Margin = new Padding(4, 4, 4, 4);
+ dataGridView.Name = "dataGridView";
+ dataGridView.RowHeadersWidth = 51;
+ dataGridView.RowTemplate.Height = 29;
+ dataGridView.Size = new Size(732, 525);
+ dataGridView.TabIndex = 1;
+ //
+ // buttonCreateOrder
+ //
+ buttonCreateOrder.Location = new Point(760, 55);
+ buttonCreateOrder.Margin = new Padding(4, 4, 4, 4);
+ buttonCreateOrder.Name = "buttonCreateOrder";
+ buttonCreateOrder.Size = new Size(212, 36);
+ buttonCreateOrder.TabIndex = 2;
+ buttonCreateOrder.Text = "Создать заказ";
+ buttonCreateOrder.UseVisualStyleBackColor = true;
+ buttonCreateOrder.Click += buttonCreateOrder_Click;
+ //
+ // buttonTakeOrderInWork
+ //
+ buttonTakeOrderInWork.Location = new Point(760, 165);
+ buttonTakeOrderInWork.Margin = new Padding(4, 4, 4, 4);
+ buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
+ buttonTakeOrderInWork.Size = new Size(212, 36);
+ buttonTakeOrderInWork.TabIndex = 3;
+ buttonTakeOrderInWork.Text = "Отдать на выполнение";
+ buttonTakeOrderInWork.UseVisualStyleBackColor = true;
+ buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click;
+ //
+ // buttonOrderReady
+ //
+ buttonOrderReady.Location = new Point(760, 279);
+ buttonOrderReady.Margin = new Padding(4, 4, 4, 4);
+ buttonOrderReady.Name = "buttonOrderReady";
+ buttonOrderReady.Size = new Size(212, 36);
+ buttonOrderReady.TabIndex = 4;
+ buttonOrderReady.Text = "Заказ готов";
+ buttonOrderReady.UseVisualStyleBackColor = true;
+ buttonOrderReady.Click += buttonOrderReady_Click;
+ //
+ // buttonIssuedOrder
+ //
+ buttonIssuedOrder.Location = new Point(760, 391);
+ buttonIssuedOrder.Margin = new Padding(4, 4, 4, 4);
+ buttonIssuedOrder.Name = "buttonIssuedOrder";
+ buttonIssuedOrder.Size = new Size(212, 36);
+ buttonIssuedOrder.TabIndex = 5;
+ buttonIssuedOrder.Text = "Заказ выдан";
+ buttonIssuedOrder.UseVisualStyleBackColor = true;
+ buttonIssuedOrder.Click += buttonIssuedOrder_Click;
+ //
+ // buttonUpdateList
+ //
+ buttonUpdateList.Location = new Point(760, 480);
+ buttonUpdateList.Margin = new Padding(4, 4, 4, 4);
+ buttonUpdateList.Name = "buttonUpdateList";
+ buttonUpdateList.Size = new Size(212, 36);
+ buttonUpdateList.TabIndex = 6;
+ buttonUpdateList.Text = "Обновить список";
+ buttonUpdateList.UseVisualStyleBackColor = true;
+ buttonUpdateList.Click += buttonUpdateList_Click;
+ //
+ // FormMain
+ //
+ AutoScaleDimensions = new SizeF(10F, 25F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(992, 562);
+ Controls.Add(buttonUpdateList);
+ Controls.Add(buttonIssuedOrder);
+ Controls.Add(buttonOrderReady);
+ Controls.Add(buttonTakeOrderInWork);
+ Controls.Add(buttonCreateOrder);
+ Controls.Add(dataGridView);
+ Controls.Add(menuStrip1);
+ MainMenuStrip = menuStrip1;
+ Margin = new Padding(4, 4, 4, 4);
+ Name = "FormMain";
+ Text = "Ремонт сантехники";
+ Load += FormMain_Load;
+ menuStrip1.ResumeLayout(false);
+ menuStrip1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private MenuStrip menuStrip1;
+ private ToolStripMenuItem справочникиToolStripMenuItem;
+ private DataGridView dataGridView;
+ private Button buttonCreateOrder;
+ private Button buttonTakeOrderInWork;
+ private Button buttonOrderReady;
+ private Button buttonIssuedOrder;
+ private Button buttonUpdateList;
+ private ToolStripMenuItem компонентыToolStripMenuItem;
+ private ToolStripMenuItem работыToolStripMenuItem;
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormMain.cs b/PlumbingRepair/PlumbingRepairView/FormMain.cs
new file mode 100644
index 0000000..3ba4a05
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormMain.cs
@@ -0,0 +1,199 @@
+using Microsoft.Extensions.Logging;
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.BusinessLogicsContracts;
+using PlumbingRepairDataModels.Enums;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace PlumbingRepairView
+{
+ public partial class FormMain : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IOrderLogic _orderLogic;
+
+ public FormMain(ILogger logger, IOrderLogic orderLogic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _orderLogic = orderLogic;
+ }
+
+ private void FormMain_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ private void LoadData()
+ {
+ _logger.LogInformation("Загрузка заказов");
+
+ try
+ {
+ var list = _orderLogic.ReadList(null);
+
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ dataGridView.Columns["WorkId"].Visible = false;
+ }
+
+ _logger.LogInformation("Загрузка заказов");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки заказов");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void компонентыToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
+
+ if (service is FormComponents form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void работыToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormWorks));
+
+ if (service is FormWorks form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void buttonCreateOrder_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
+
+ if (service is FormCreateOrder form)
+ {
+ form.ShowDialog();
+ LoadData();
+ }
+ }
+
+ private void buttonTakeOrderInWork_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
+
+ try
+ {
+ var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
+ {
+ Id = id,
+ WorkId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["WorkId"].Value),
+ WorkName = dataGridView.SelectedRows[0].Cells["WorkName"].Value.ToString(),
+ Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
+ Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
+ Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
+ DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
+ });
+
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка передачи заказа в работу");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ private void buttonOrderReady_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
+
+ try
+ {
+ var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel
+ {
+ Id = id,
+ WorkId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["WorkId"].Value),
+ WorkName = dataGridView.SelectedRows[0].Cells["WorkName"].Value.ToString(),
+ Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
+ Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
+ Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
+ DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
+ });
+
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка отметки о готовности заказа");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ private void buttonIssuedOrder_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
+
+ try
+ {
+
+ var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
+ {
+ Id = id,
+ WorkId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["WorkId"].Value),
+ WorkName = dataGridView.SelectedRows[0].Cells["WorkName"].Value.ToString(),
+ Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
+ Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
+ Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
+ DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
+ });
+
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+
+ _logger.LogInformation("Заказ №{id} выдан", id);
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка отметки о выдачи заказа");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ private void buttonUpdateList_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairView/FormMain.resx b/PlumbingRepair/PlumbingRepairView/FormMain.resx
new file mode 100644
index 0000000..5203d24
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormMain.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormWork.Designer.cs b/PlumbingRepair/PlumbingRepairView/FormWork.Designer.cs
new file mode 100644
index 0000000..7efd0de
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormWork.Designer.cs
@@ -0,0 +1,241 @@
+namespace PlumbingRepairView
+{
+ partial class FormWork
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ label1 = new Label();
+ label2 = new Label();
+ groupBox1 = new GroupBox();
+ buttonRef = new Button();
+ buttonDel = new Button();
+ buttonUpd = new Button();
+ buttonAdd = new Button();
+ dataGridView = new DataGridView();
+ ComponentId = new DataGridViewTextBoxColumn();
+ ComponentName = new DataGridViewTextBoxColumn();
+ Count = new DataGridViewTextBoxColumn();
+ textBoxName = new TextBox();
+ textBoxCost = new TextBox();
+ buttonCancel = new Button();
+ buttonSave = new Button();
+ groupBox1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Location = new Point(40, 12);
+ label1.Margin = new Padding(4, 0, 4, 0);
+ label1.Name = "label1";
+ label1.Size = new Size(94, 25);
+ label1.TabIndex = 0;
+ label1.Text = "Название:";
+ //
+ // label2
+ //
+ label2.AutoSize = true;
+ label2.Location = new Point(40, 61);
+ label2.Margin = new Padding(4, 0, 4, 0);
+ label2.Name = "label2";
+ label2.Size = new Size(103, 25);
+ label2.TabIndex = 1;
+ label2.Text = "Стоимость:";
+ //
+ // groupBox1
+ //
+ groupBox1.Controls.Add(buttonRef);
+ groupBox1.Controls.Add(buttonDel);
+ groupBox1.Controls.Add(buttonUpd);
+ groupBox1.Controls.Add(buttonAdd);
+ groupBox1.Controls.Add(dataGridView);
+ groupBox1.Location = new Point(40, 108);
+ groupBox1.Margin = new Padding(4, 4, 4, 4);
+ groupBox1.Name = "groupBox1";
+ groupBox1.Padding = new Padding(4, 4, 4, 4);
+ groupBox1.Size = new Size(945, 384);
+ groupBox1.TabIndex = 2;
+ groupBox1.TabStop = false;
+ groupBox1.Text = "Компоненты";
+ //
+ // buttonRef
+ //
+ buttonRef.Location = new Point(752, 258);
+ buttonRef.Margin = new Padding(4, 4, 4, 4);
+ buttonRef.Name = "buttonRef";
+ buttonRef.Size = new Size(118, 36);
+ buttonRef.TabIndex = 4;
+ buttonRef.Text = "Обновить";
+ buttonRef.UseVisualStyleBackColor = true;
+ buttonRef.Click += UpdateButton_Click;
+ //
+ // buttonDel
+ //
+ buttonDel.Location = new Point(752, 190);
+ buttonDel.Margin = new Padding(4, 4, 4, 4);
+ buttonDel.Name = "buttonDel";
+ buttonDel.Size = new Size(118, 36);
+ buttonDel.TabIndex = 3;
+ buttonDel.Text = "Удалить";
+ buttonDel.UseVisualStyleBackColor = true;
+ buttonDel.Click += DeleteButton_Click;
+ //
+ // buttonUpd
+ //
+ buttonUpd.Location = new Point(752, 122);
+ buttonUpd.Margin = new Padding(4, 4, 4, 4);
+ buttonUpd.Name = "buttonUpd";
+ buttonUpd.Size = new Size(118, 36);
+ buttonUpd.TabIndex = 2;
+ buttonUpd.Text = "Изменить";
+ buttonUpd.UseVisualStyleBackColor = true;
+ buttonUpd.Click += ChangeButton_Click;
+ //
+ // buttonAdd
+ //
+ buttonAdd.Location = new Point(752, 55);
+ buttonAdd.Margin = new Padding(4, 4, 4, 4);
+ buttonAdd.Name = "buttonAdd";
+ buttonAdd.Size = new Size(118, 36);
+ buttonAdd.TabIndex = 1;
+ buttonAdd.Text = "Добавить";
+ buttonAdd.UseVisualStyleBackColor = true;
+ buttonAdd.Click += AddButton_Click;
+ //
+ // dataGridView
+ //
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Columns.AddRange(new DataGridViewColumn[] { ComponentId, ComponentName, Count });
+ dataGridView.Location = new Point(0, 32);
+ dataGridView.Margin = new Padding(4, 4, 4, 4);
+ dataGridView.Name = "dataGridView";
+ dataGridView.RowHeadersWidth = 51;
+ dataGridView.RowTemplate.Height = 29;
+ dataGridView.Size = new Size(668, 344);
+ dataGridView.TabIndex = 0;
+ //
+ // ComponentId
+ //
+ ComponentId.HeaderText = "Id";
+ ComponentId.MinimumWidth = 6;
+ ComponentId.Name = "ComponentId";
+ ComponentId.Visible = false;
+ ComponentId.Width = 125;
+ //
+ // ComponentName
+ //
+ ComponentName.HeaderText = "Компонент";
+ ComponentName.MinimumWidth = 6;
+ ComponentName.Name = "ComponentName";
+ ComponentName.Width = 355;
+ //
+ // Count
+ //
+ Count.HeaderText = "Количество";
+ Count.MinimumWidth = 6;
+ Count.Name = "Count";
+ Count.Width = 125;
+ //
+ // textBoxName
+ //
+ textBoxName.Location = new Point(188, 12);
+ textBoxName.Margin = new Padding(4, 4, 4, 4);
+ textBoxName.Name = "textBoxName";
+ textBoxName.Size = new Size(373, 31);
+ textBoxName.TabIndex = 3;
+ //
+ // textBoxCost
+ //
+ textBoxCost.Location = new Point(188, 61);
+ textBoxCost.Margin = new Padding(4, 4, 4, 4);
+ textBoxCost.Name = "textBoxCost";
+ textBoxCost.Size = new Size(256, 31);
+ textBoxCost.TabIndex = 4;
+ //
+ // buttonCancel
+ //
+ buttonCancel.Location = new Point(857, 511);
+ buttonCancel.Margin = new Padding(4, 4, 4, 4);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(118, 36);
+ buttonCancel.TabIndex = 5;
+ buttonCancel.Text = "Отменить";
+ buttonCancel.UseVisualStyleBackColor = true;
+ buttonCancel.Click += ButtonCancel_Click;
+ //
+ // buttonSave
+ //
+ buttonSave.Location = new Point(731, 511);
+ buttonSave.Margin = new Padding(4, 4, 4, 4);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(118, 36);
+ buttonSave.TabIndex = 6;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = true;
+ buttonSave.Click += SaveButton_Click;
+ //
+ // FormWork
+ //
+ AutoScaleDimensions = new SizeF(10F, 25F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(1000, 562);
+ Controls.Add(buttonSave);
+ Controls.Add(buttonCancel);
+ Controls.Add(textBoxCost);
+ Controls.Add(textBoxName);
+ Controls.Add(groupBox1);
+ Controls.Add(label2);
+ Controls.Add(label1);
+ Margin = new Padding(4, 4, 4, 4);
+ Name = "FormWork";
+ Text = "Работа";
+ groupBox1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private Label label1;
+ private Label label2;
+ private GroupBox groupBox1;
+ private DataGridView dataGridView;
+ private TextBox textBoxName;
+ private TextBox textBoxCost;
+ private Button buttonRef;
+ private Button buttonDel;
+ private Button buttonUpd;
+ private Button buttonAdd;
+ private Button buttonCancel;
+ private Button buttonSave;
+ private DataGridViewTextBoxColumn ComponentId;
+ private DataGridViewTextBoxColumn ComponentName;
+ private DataGridViewTextBoxColumn Count;
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormWork.cs b/PlumbingRepair/PlumbingRepairView/FormWork.cs
new file mode 100644
index 0000000..d79d70e
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormWork.cs
@@ -0,0 +1,237 @@
+using Microsoft.Extensions.Logging;
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.BusinessLogicsContracts;
+using PlumbingRepairContracts.SearchModels;
+using PlumbingRepairDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace PlumbingRepairView
+{
+ public partial class FormWork : Form
+ {
+ private readonly ILogger _logger;
+
+ private readonly IWorkLogic _logic;
+
+ private int? _id;
+
+ private Dictionary _workComponents;
+
+ public int Id { set { _id = value; } }
+ public FormWork(ILogger logger, IWorkLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ _workComponents = new Dictionary();
+ }
+ private void FormWork_Load(object sender, EventArgs e)
+ {
+ if (_id.HasValue)
+ {
+ _logger.LogInformation("Загрузка изделия");
+
+ try
+ {
+ var view = _logic.ReadElement(new WorkSearchModel
+ {
+ Id = _id.Value
+ });
+
+ if (view != null)
+ {
+ textBoxName.Text = view.WorkName;
+ textBoxCost.Text = view.Price.ToString();
+ _workComponents = view.WorkComponents ?? new Dictionary();
+ LoadData();
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки изделия");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ private void LoadData()
+ {
+ _logger.LogInformation("Загрузка компонент изделия");
+
+ try
+ {
+ if (_workComponents != null)
+ {
+ dataGridView.Rows.Clear();
+ foreach (var pc in _workComponents)
+ {
+ dataGridView.Rows.Add(new object[] { pc.Key, pc.Value.Item1.ComponentName, pc.Value.Item2 });
+ }
+ textBoxCost.Text = CalcPrice().ToString();
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки компонент изделия");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ private void AddButton_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormWorkComponent));
+
+ if (service is FormWorkComponent form)
+ {
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ if (form.ComponentModel == null)
+ {
+ return;
+ }
+
+ _logger.LogInformation("Добавление нового компонента: { ComponentName} - { Count}", form.ComponentModel.ComponentName, form.Count);
+
+ if (_workComponents.ContainsKey(form.Id))
+ {
+ _workComponents[form.Id] = (form.ComponentModel, form.Count);
+ }
+
+ else
+ {
+ _workComponents.Add(form.Id, (form.ComponentModel, form.Count));
+ }
+
+ LoadData();
+ }
+ }
+ }
+
+ private void ChangeButton_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormWorkComponent));
+
+ if (service is FormWorkComponent form)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
+ form.Id = id;
+ form.Count = _workComponents[id].Item2;
+
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ if (form.ComponentModel == null)
+ {
+ return;
+ }
+
+ _logger.LogInformation("Изменение компонента: { ComponentName} - { Count}", form.ComponentModel.ComponentName, form.Count);
+ _workComponents[form.Id] = (form.ComponentModel, form.Count);
+ LoadData();
+ }
+ }
+ }
+ }
+
+ private void DeleteButton_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ try
+ {
+ _logger.LogInformation("Удаление компонента: { ComponentName} - { Count}", dataGridView.SelectedRows[0].Cells[1].Value);
+ _workComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
+ LoadData();
+ }
+ }
+ }
+
+ private void UpdateButton_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+
+ private void SaveButton_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(textBoxName.Text))
+ {
+ MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+
+ if (string.IsNullOrEmpty(textBoxCost.Text))
+ {
+ MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+
+ if (_workComponents == null || _workComponents.Count == 0)
+ {
+ MessageBox.Show("Заполните компоненты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+
+ _logger.LogInformation("Сохранение изделия");
+
+ try
+ {
+ var model = new WorkBindingModel
+ {
+ Id = _id ?? 0,
+ WorkName = textBoxName.Text,
+ Price = Convert.ToDouble(textBoxCost.Text),
+ WorkComponents = _workComponents
+ };
+
+ var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
+
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+
+ MessageBox.Show("Сохранение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка сохранения изделия");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+
+ private double CalcPrice()
+ {
+ double price = 0;
+
+ foreach (var elem in _workComponents)
+ {
+ price += ((elem.Value.Item1?.Cost ?? 0) * elem.Value.Item2);
+ }
+
+ return Math.Round(price * 1.1, 2);
+ }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairView/FormWork.resx b/PlumbingRepair/PlumbingRepairView/FormWork.resx
new file mode 100644
index 0000000..a395bff
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormWork.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormWorkComponent.Designer.cs b/PlumbingRepair/PlumbingRepairView/FormWorkComponent.Designer.cs
new file mode 100644
index 0000000..000d6e3
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormWorkComponent.Designer.cs
@@ -0,0 +1,116 @@
+namespace PlumbingRepairView
+{
+ partial class FormWorkComponent
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ comboBoxComponent = new ComboBox();
+ labelComponent = new Label();
+ labelCount = new Label();
+ textBoxCount = new TextBox();
+ buttonSave = new Button();
+ buttonCancel = new Button();
+ SuspendLayout();
+ //
+ // comboBoxComponent
+ //
+ comboBoxComponent.FormattingEnabled = true;
+ comboBoxComponent.Location = new Point(138, 12);
+ comboBoxComponent.Name = "comboBoxComponent";
+ comboBoxComponent.Size = new Size(295, 33);
+ comboBoxComponent.TabIndex = 0;
+ //
+ // labelComponent
+ //
+ labelComponent.AutoSize = true;
+ labelComponent.Location = new Point(12, 15);
+ labelComponent.Name = "labelComponent";
+ labelComponent.Size = new Size(107, 25);
+ labelComponent.TabIndex = 1;
+ labelComponent.Text = "Компонент:";
+ //
+ // labelCount
+ //
+ labelCount.AutoSize = true;
+ labelCount.Location = new Point(12, 69);
+ labelCount.Name = "labelCount";
+ labelCount.Size = new Size(111, 25);
+ labelCount.TabIndex = 2;
+ labelCount.Text = "Количество:";
+ //
+ // textBoxCount
+ //
+ textBoxCount.Location = new Point(140, 69);
+ textBoxCount.Name = "textBoxCount";
+ textBoxCount.Size = new Size(293, 31);
+ textBoxCount.TabIndex = 3;
+ //
+ // buttonSave
+ //
+ buttonSave.Location = new Point(177, 106);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(112, 34);
+ buttonSave.TabIndex = 4;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = true;
+ //
+ // buttonCancel
+ //
+ buttonCancel.Location = new Point(295, 106);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(82, 34);
+ buttonCancel.TabIndex = 5;
+ buttonCancel.Text = "Отмена";
+ buttonCancel.UseVisualStyleBackColor = true;
+ //
+ // FormWorkComponent
+ //
+ AutoScaleDimensions = new SizeF(10F, 25F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(445, 146);
+ Controls.Add(buttonCancel);
+ Controls.Add(buttonSave);
+ Controls.Add(textBoxCount);
+ Controls.Add(labelCount);
+ Controls.Add(labelComponent);
+ Controls.Add(comboBoxComponent);
+ Name = "FormWorkComponent";
+ Text = "Компонент Изделия";
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private ComboBox comboBoxComponent;
+ private Label labelComponent;
+ private Label labelCount;
+ private TextBox textBoxCount;
+ private Button buttonSave;
+ private Button buttonCancel;
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormWorkComponent.cs b/PlumbingRepair/PlumbingRepairView/FormWorkComponent.cs
new file mode 100644
index 0000000..9e2a11f
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormWorkComponent.cs
@@ -0,0 +1,90 @@
+using PlumbingRepairContracts.BusinessLogicsContracts;
+using PlumbingRepairContracts.ViewModels;
+using PlumbingRepairDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace PlumbingRepairView
+{
+ public partial class FormWorkComponent : Form
+ {
+ private readonly List? _list;
+ public int Id
+ {
+ get
+ {
+ return Convert.ToInt32(comboBoxComponent.SelectedValue);
+ }
+ set
+ {
+ comboBoxComponent.SelectedValue = value;
+ }
+ }
+ public IComponentModel? ComponentModel
+ {
+ get
+ {
+ if (_list == null)
+ {
+ return null;
+ }
+ foreach (var elem in _list)
+ {
+ if (elem.Id == Id)
+ {
+ return elem;
+ }
+ }
+ return null;
+ }
+ }
+ public int Count
+ {
+ get { return Convert.ToInt32(textBoxCount.Text); }
+ set
+ { textBoxCount.Text = value.ToString(); }
+ }
+ public FormWorkComponent(IComponentLogic logic)
+ {
+ InitializeComponent();
+ _list = logic.ReadList(null);
+ if (_list != null)
+ {
+ comboBoxComponent.DisplayMember = "ComponentName";
+ comboBoxComponent.ValueMember = "Id";
+ comboBoxComponent.DataSource = _list;
+ comboBoxComponent.SelectedItem = null;
+ }
+ }
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(textBoxCount.Text))
+ {
+ MessageBox.Show("Заполните поле Количество", "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ if (comboBoxComponent.SelectedValue == null)
+ {
+ MessageBox.Show("Выберите компонент", "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairView/FormWorkComponent.resx b/PlumbingRepair/PlumbingRepairView/FormWorkComponent.resx
new file mode 100644
index 0000000..a395bff
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormWorkComponent.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormWorks.Designer.cs b/PlumbingRepair/PlumbingRepairView/FormWorks.Designer.cs
new file mode 100644
index 0000000..5231cdb
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormWorks.Designer.cs
@@ -0,0 +1,114 @@
+namespace PlumbingRepairView
+{
+ partial class FormWorks
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.dataGridView = new System.Windows.Forms.DataGridView();
+ this.buttonAdd = new System.Windows.Forms.Button();
+ this.buttonUpd = new System.Windows.Forms.Button();
+ this.buttonDel = new System.Windows.Forms.Button();
+ this.buttonRef = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(1, 0);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowHeadersWidth = 51;
+ this.dataGridView.RowTemplate.Height = 29;
+ this.dataGridView.Size = new System.Drawing.Size(611, 449);
+ this.dataGridView.TabIndex = 0;
+ //
+ // buttonAdd
+ //
+ this.buttonAdd.Location = new System.Drawing.Point(670, 23);
+ this.buttonAdd.Name = "buttonAdd";
+ this.buttonAdd.Size = new System.Drawing.Size(94, 29);
+ this.buttonAdd.TabIndex = 1;
+ this.buttonAdd.Text = "Добавить";
+ this.buttonAdd.UseVisualStyleBackColor = true;
+ this.buttonAdd.Click += new System.EventHandler(this.AddButton_Click);
+ //
+ // buttonUpd
+ //
+ this.buttonUpd.Location = new System.Drawing.Point(670, 75);
+ this.buttonUpd.Name = "buttonUpd";
+ this.buttonUpd.Size = new System.Drawing.Size(94, 29);
+ this.buttonUpd.TabIndex = 2;
+ this.buttonUpd.Text = "Изменить";
+ this.buttonUpd.UseVisualStyleBackColor = true;
+ this.buttonUpd.Click += new System.EventHandler(this.ChangeButton_Click);
+ //
+ // buttonDel
+ //
+ this.buttonDel.Location = new System.Drawing.Point(670, 132);
+ this.buttonDel.Name = "buttonDel";
+ this.buttonDel.Size = new System.Drawing.Size(94, 29);
+ this.buttonDel.TabIndex = 3;
+ this.buttonDel.Text = "Удалить";
+ this.buttonDel.UseVisualStyleBackColor = true;
+ this.buttonDel.Click += new System.EventHandler(this.DeleteButton_Click);
+ //
+ // buttonRef
+ //
+ this.buttonRef.Location = new System.Drawing.Point(670, 188);
+ this.buttonRef.Name = "buttonRef";
+ this.buttonRef.Size = new System.Drawing.Size(94, 29);
+ this.buttonRef.TabIndex = 4;
+ this.buttonRef.Text = "Обновить";
+ this.buttonRef.UseVisualStyleBackColor = true;
+ this.buttonRef.Click += new System.EventHandler(this.UpdateButton_Click);
+ //
+ // FormWorks
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.buttonRef);
+ this.Controls.Add(this.buttonDel);
+ this.Controls.Add(this.buttonUpd);
+ this.Controls.Add(this.buttonAdd);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormWorks";
+ this.Text = "Работы";
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button buttonAdd;
+ private Button buttonUpd;
+ private Button buttonDel;
+ private Button buttonRef;
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormWorks.cs b/PlumbingRepair/PlumbingRepairView/FormWorks.cs
new file mode 100644
index 0000000..b09fdda
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormWorks.cs
@@ -0,0 +1,120 @@
+using Microsoft.Extensions.Logging;
+using PlumbingRepairContracts.BindingModels;
+using PlumbingRepairContracts.BusinessLogicsContracts;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace PlumbingRepairView
+{
+ public partial class FormWorks : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IWorkLogic _logic;
+
+ public FormWorks(ILogger logger, IWorkLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormComponents_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+
+ private void LoadData()
+ {
+ try
+ {
+ var list = _logic.ReadList(null);
+
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ dataGridView.Columns["Id"].Visible = false;
+ dataGridView.Columns["WorkName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ dataGridView.Columns["WorkComponents"].Visible = false;
+ }
+
+ _logger.LogInformation("Загрузка изделий");
+
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки изделий");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void AddButton_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormWork));
+
+ if (service is FormWork form)
+ {
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+ private void ChangeButton_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormWork));
+
+ if (service is FormWork form)
+ {
+ form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+ }
+ private void DeleteButton_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation("Удаление изделия");
+
+ try
+ {
+ if (!_logic.Delete(new WorkBindingModel
+ {
+ Id = id
+ }))
+ {
+ throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
+ }
+
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка удаления изделия");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+ private void UpdateButton_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ }
+}
diff --git a/PlumbingRepair/PlumbingRepairView/FormWorks.resx b/PlumbingRepair/PlumbingRepairView/FormWorks.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/FormWorks.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/PlumbingRepairView.csproj b/PlumbingRepair/PlumbingRepairView/PlumbingRepairView.csproj
new file mode 100644
index 0000000..4194bad
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/PlumbingRepairView.csproj
@@ -0,0 +1,22 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/Program.cs b/PlumbingRepair/PlumbingRepairView/Program.cs
new file mode 100644
index 0000000..9aa4ced
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepairView/Program.cs
@@ -0,0 +1,53 @@
+using PlumbingRepairContracts.BusinessLogicsContracts;
+using PlumbingRepairContracts.StoragesContracts;
+using PlumbingRepairListImplement.Implements;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using NLog.Extensions.Logging;
+using PlumbingRepairBusinessLogic.BusinessLogics;
+
+namespace PlumbingRepairView
+{
+ internal static class Program
+ {
+ private static ServiceProvider? _serviceProvider;
+ public static ServiceProvider? ServiceProvider => _serviceProvider;
+ ///
+ /// The main entry point for the application.
+ ///
+ [STAThread]
+ static void Main()
+ {
+ // To customize application configuration such as set high DPI settings or default font,
+ // see https://aka.ms/applicationconfiguration.
+ ApplicationConfiguration.Initialize();
+ var services = new ServiceCollection();
+ ConfigureServices(services);
+ _serviceProvider = services.BuildServiceProvider();
+ Application.Run(_serviceProvider.GetRequiredService());
+ }
+ private static void ConfigureServices(ServiceCollection services)
+ {
+ services.AddLogging(option =>
+ {
+ option.SetMinimumLevel(LogLevel.Information);
+ option.AddNLog("nlog.config");
+ });
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ }
+ }
+}
\ No newline at end of file
--
2.25.1
From 81d6e6a941218d4f263e882de5a7d82c9cb7ad91 Mon Sep 17 00:00:00 2001
From: DyCTaTOR <125912249+DyCTaTOR@users.noreply.github.com>
Date: Wed, 28 Feb 2024 10:45:27 +0400
Subject: [PATCH 8/8] =?UTF-8?q?=D1=81=D0=B4=D0=B0=D0=BD=D0=B0=20=D0=BB?=
=?UTF-8?q?=D0=B0=D0=B11?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
PlumbingRepair/PlumbingRepair.sln | 10 +-
.../PlumbingRepair/Form1.Designer.cs | 39 ---
PlumbingRepair/PlumbingRepair/Form1.cs | 10 -
PlumbingRepair/PlumbingRepair/Form1.resx | 120 --------
.../FormComponent.Designer.cs | 0
.../FormComponent.cs | 0
.../FormComponent.resx | 0
.../FormComponents.Designer.cs | 156 +++++-----
.../FormComponents.cs | 6 +-
.../FormComponents.resx | 238 +++++++--------
.../FormCreateOrder.Designer.cs | 143 ++++++++++
.../FormCreateOrder.cs | 0
.../PlumbingRepair/FormCreateOrder.resx | 120 ++++++++
.../FormMain.Designer.cs | 270 +++++++++---------
.../FormMain.cs | 0
.../FormMain.resx | 244 ++++++++--------
.../FormWork.Designer.cs | 0
.../FormWork.cs | 0
.../FormWork.resx | 0
.../FormWorkComponent.Designer.cs | 171 +++++------
.../FormWorkComponent.cs | 3 +-
.../FormWorkComponent.resx | 238 +++++++--------
.../FormWorks.Designer.cs | 0
.../FormWorks.cs | 0
.../FormWorks.resx | 0
.../PlumbingRepair/PlumbingRepair.csproj | 15 -
.../PlumbingRepair/PlumbingRepairView.csproj | 45 +++
PlumbingRepair/PlumbingRepair/Program.cs | 40 ++-
.../BindingModels/OrderBindingModel.cs | 2 +-
.../ViewModels/OrderViewModel.cs | 2 +-
.../ViewModels/WorkViewModel.cs | 2 +-
.../Models/Order.cs | 3 +
.../FormCreateOrder.Designer.cs | 144 ----------
.../PlumbingRepairView/FormCreateOrder.resx | 120 --------
34 files changed, 1021 insertions(+), 1120 deletions(-)
delete mode 100644 PlumbingRepair/PlumbingRepair/Form1.Designer.cs
delete mode 100644 PlumbingRepair/PlumbingRepair/Form1.cs
delete mode 100644 PlumbingRepair/PlumbingRepair/Form1.resx
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormComponent.Designer.cs (100%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormComponent.cs (100%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormComponent.resx (100%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormComponents.Designer.cs (72%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormComponents.cs (94%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormComponents.resx (97%)
create mode 100644 PlumbingRepair/PlumbingRepair/FormCreateOrder.Designer.cs
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormCreateOrder.cs (100%)
create mode 100644 PlumbingRepair/PlumbingRepair/FormCreateOrder.resx
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormMain.Designer.cs (82%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormMain.cs (100%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormMain.resx (97%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormWork.Designer.cs (100%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormWork.cs (100%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormWork.resx (100%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormWorkComponent.Designer.cs (71%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormWorkComponent.cs (97%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormWorkComponent.resx (97%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormWorks.Designer.cs (100%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormWorks.cs (100%)
rename PlumbingRepair/{PlumbingRepairView => PlumbingRepair}/FormWorks.resx (100%)
delete mode 100644 PlumbingRepair/PlumbingRepair/PlumbingRepair.csproj
create mode 100644 PlumbingRepair/PlumbingRepair/PlumbingRepairView.csproj
delete mode 100644 PlumbingRepair/PlumbingRepairView/FormCreateOrder.Designer.cs
delete mode 100644 PlumbingRepair/PlumbingRepairView/FormCreateOrder.resx
diff --git a/PlumbingRepair/PlumbingRepair.sln b/PlumbingRepair/PlumbingRepair.sln
index f5fba87..52166b3 100644
--- a/PlumbingRepair/PlumbingRepair.sln
+++ b/PlumbingRepair/PlumbingRepair.sln
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33801.468
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepair", "PlumbingRepair\PlumbingRepair.csproj", "{16CDF38C-189C-4BED-AB66-DB3C212C4047}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairView", "PlumbingRepair\PlumbingRepairView.csproj", "{16CDF38C-189C-4BED-AB66-DB3C212C4047}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairDataModels", "PlumbingRepairDataModels\PlumbingRepairDataModels.csproj", "{F62B3ADF-0FE7-4066-BEF7-5DB0AE1A53A9}"
EndProject
@@ -11,9 +11,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairContracts", "
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairBusinessLogic", "PlumbingRepairBusinessLogic\PlumbingRepairBusinessLogic.csproj", "{B960E476-E516-4BAA-B5D7-55F29B376993}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairListImplement", "PlumbingRepairListImplement\PlumbingRepairListImplement.csproj", "{E89CA82F-2FEA-4235-93A2-E5A412D0116F}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlumbingRepairView", "PlumbingRepairView\PlumbingRepairView.csproj", "{4FB885A2-56C9-4267-84B0-A2161EB314C2}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlumbingRepairListImplement", "PlumbingRepairListImplement\PlumbingRepairListImplement.csproj", "{E89CA82F-2FEA-4235-93A2-E5A412D0116F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -41,10 +39,6 @@ Global
{E89CA82F-2FEA-4235-93A2-E5A412D0116F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E89CA82F-2FEA-4235-93A2-E5A412D0116F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E89CA82F-2FEA-4235-93A2-E5A412D0116F}.Release|Any CPU.Build.0 = Release|Any CPU
- {4FB885A2-56C9-4267-84B0-A2161EB314C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4FB885A2-56C9-4267-84B0-A2161EB314C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4FB885A2-56C9-4267-84B0-A2161EB314C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4FB885A2-56C9-4267-84B0-A2161EB314C2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/PlumbingRepair/PlumbingRepair/Form1.Designer.cs b/PlumbingRepair/PlumbingRepair/Form1.Designer.cs
deleted file mode 100644
index 0bf1336..0000000
--- a/PlumbingRepair/PlumbingRepair/Form1.Designer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace PlumbingRepair
-{
- partial class Form1
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
- this.Text = "Form1";
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepair/Form1.cs b/PlumbingRepair/PlumbingRepair/Form1.cs
deleted file mode 100644
index 24cdd22..0000000
--- a/PlumbingRepair/PlumbingRepair/Form1.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace PlumbingRepair
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- }
-}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepair/Form1.resx b/PlumbingRepair/PlumbingRepair/Form1.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/PlumbingRepair/PlumbingRepair/Form1.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormComponent.Designer.cs b/PlumbingRepair/PlumbingRepair/FormComponent.Designer.cs
similarity index 100%
rename from PlumbingRepair/PlumbingRepairView/FormComponent.Designer.cs
rename to PlumbingRepair/PlumbingRepair/FormComponent.Designer.cs
diff --git a/PlumbingRepair/PlumbingRepairView/FormComponent.cs b/PlumbingRepair/PlumbingRepair/FormComponent.cs
similarity index 100%
rename from PlumbingRepair/PlumbingRepairView/FormComponent.cs
rename to PlumbingRepair/PlumbingRepair/FormComponent.cs
diff --git a/PlumbingRepair/PlumbingRepairView/FormComponent.resx b/PlumbingRepair/PlumbingRepair/FormComponent.resx
similarity index 100%
rename from PlumbingRepair/PlumbingRepairView/FormComponent.resx
rename to PlumbingRepair/PlumbingRepair/FormComponent.resx
diff --git a/PlumbingRepair/PlumbingRepairView/FormComponents.Designer.cs b/PlumbingRepair/PlumbingRepair/FormComponents.Designer.cs
similarity index 72%
rename from PlumbingRepair/PlumbingRepairView/FormComponents.Designer.cs
rename to PlumbingRepair/PlumbingRepair/FormComponents.Designer.cs
index 583fc0f..5e091c0 100644
--- a/PlumbingRepair/PlumbingRepairView/FormComponents.Designer.cs
+++ b/PlumbingRepair/PlumbingRepair/FormComponents.Designer.cs
@@ -26,80 +26,90 @@
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
- private void InitializeComponent()
- {
- dataGridView = new DataGridView();
- buttonAdd = new Button();
- buttonDel = new Button();
- buttonChange = new Button();
- buttonRef = new Button();
- ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
- SuspendLayout();
- //
- // dataGridView
- //
- dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- dataGridView.Location = new Point(12, 10);
- dataGridView.Name = "dataGridView";
- dataGridView.RowHeadersWidth = 62;
- dataGridView.RowTemplate.Height = 33;
- dataGridView.Size = new Size(640, 505);
- dataGridView.TabIndex = 0;
- //
- // buttonAdd
- //
- buttonAdd.Location = new Point(684, 41);
- buttonAdd.Name = "buttonAdd";
- buttonAdd.Size = new Size(135, 34);
- buttonAdd.TabIndex = 1;
- buttonAdd.Text = "Добавить";
- buttonAdd.UseVisualStyleBackColor = true;
- //
- // buttonDel
- //
- buttonDel.Location = new Point(684, 106);
- buttonDel.Name = "buttonDel";
- buttonDel.Size = new Size(135, 34);
- buttonDel.TabIndex = 2;
- buttonDel.Text = "Удалить";
- buttonDel.UseVisualStyleBackColor = true;
- //
- // buttonChange
- //
- buttonChange.Location = new Point(684, 184);
- buttonChange.Name = "buttonChange";
- buttonChange.Size = new Size(135, 34);
- buttonChange.TabIndex = 3;
- buttonChange.Text = "Изменить";
- buttonChange.UseVisualStyleBackColor = true;
- //
- // buttonRef
- //
- buttonRef.Location = new Point(684, 261);
- buttonRef.Name = "buttonRef";
- buttonRef.Size = new Size(135, 34);
- buttonRef.TabIndex = 4;
- buttonRef.Text = "Обновить";
- buttonRef.UseVisualStyleBackColor = true;
- //
- // FormComponents
- //
- AutoScaleDimensions = new SizeF(10F, 25F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(848, 527);
- Controls.Add(buttonRef);
- Controls.Add(buttonChange);
- Controls.Add(buttonDel);
- Controls.Add(buttonAdd);
- Controls.Add(dataGridView);
- Name = "FormComponents";
- Text = "Компоненты";
- ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
- ResumeLayout(false);
- }
-
+ private void InitializeComponent()
+ {
+ dataGridView = new DataGridView();
+ buttonAdd = new Button();
+ buttonDel = new Button();
+ buttonChange = new Button();
+ buttonRef = new Button();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // dataGridView
+ //
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Location = new Point(10, 8);
+ dataGridView.Margin = new Padding(2, 2, 2, 2);
+ dataGridView.Name = "dataGridView";
+ dataGridView.RowHeadersWidth = 62;
+ dataGridView.RowTemplate.Height = 33;
+ dataGridView.Size = new Size(512, 404);
+ dataGridView.TabIndex = 0;
+ //
+ // buttonAdd
+ //
+ buttonAdd.Location = new Point(547, 33);
+ buttonAdd.Margin = new Padding(2, 2, 2, 2);
+ buttonAdd.Name = "buttonAdd";
+ buttonAdd.Size = new Size(108, 27);
+ buttonAdd.TabIndex = 1;
+ buttonAdd.Text = "Добавить";
+ buttonAdd.UseVisualStyleBackColor = true;
+ buttonAdd.Click += ButtonAdd_Click;
+ //
+ // buttonDel
+ //
+ buttonDel.Location = new Point(547, 85);
+ buttonDel.Margin = new Padding(2, 2, 2, 2);
+ buttonDel.Name = "buttonDel";
+ buttonDel.Size = new Size(108, 27);
+ buttonDel.TabIndex = 2;
+ buttonDel.Text = "Удалить";
+ buttonDel.UseVisualStyleBackColor = true;
+ buttonDel.Click += ButtonDel_Click;
+ //
+ // buttonChange
+ //
+ buttonChange.Location = new Point(547, 147);
+ buttonChange.Margin = new Padding(2, 2, 2, 2);
+ buttonChange.Name = "buttonChange";
+ buttonChange.Size = new Size(108, 27);
+ buttonChange.TabIndex = 3;
+ buttonChange.Text = "Изменить";
+ buttonChange.UseVisualStyleBackColor = true;
+ buttonChange.Click += ButtonUpd_Click;
+ //
+ // buttonRef
+ //
+ buttonRef.Location = new Point(547, 209);
+ buttonRef.Margin = new Padding(2, 2, 2, 2);
+ buttonRef.Name = "buttonRef";
+ buttonRef.Size = new Size(108, 27);
+ buttonRef.TabIndex = 4;
+ buttonRef.Text = "Обновить";
+ buttonRef.UseVisualStyleBackColor = true;
+ buttonRef.Click += ButtonRef_Click;
+ //
+ // FormComponents
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(678, 422);
+ Controls.Add(buttonRef);
+ Controls.Add(buttonChange);
+ Controls.Add(buttonDel);
+ Controls.Add(buttonAdd);
+ Controls.Add(dataGridView);
+ Margin = new Padding(2, 2, 2, 2);
+ Name = "FormComponents";
+ Text = "Компоненты";
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ }
+
#endregion
-
+
private DataGridView dataGridView;
private Button buttonAdd;
private Button buttonDel;
diff --git a/PlumbingRepair/PlumbingRepairView/FormComponents.cs b/PlumbingRepair/PlumbingRepair/FormComponents.cs
similarity index 94%
rename from PlumbingRepair/PlumbingRepairView/FormComponents.cs
rename to PlumbingRepair/PlumbingRepair/FormComponents.cs
index 4cc2bcc..3b86239 100644
--- a/PlumbingRepair/PlumbingRepairView/FormComponents.cs
+++ b/PlumbingRepair/PlumbingRepair/FormComponents.cs
@@ -57,8 +57,7 @@ namespace PlumbingRepairView
var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
if (service is FormComponent form)
{
- form.Id =
- Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
@@ -73,8 +72,7 @@ namespace PlumbingRepairView
if (MessageBox.Show("Удалить запись?", "Вопрос",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
- int id =
- Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
_logger.LogInformation("Удаление компонента");
try
{
diff --git a/PlumbingRepair/PlumbingRepairView/FormComponents.resx b/PlumbingRepair/PlumbingRepair/FormComponents.resx
similarity index 97%
rename from PlumbingRepair/PlumbingRepairView/FormComponents.resx
rename to PlumbingRepair/PlumbingRepair/FormComponents.resx
index a395bff..0f362c9 100644
--- a/PlumbingRepair/PlumbingRepairView/FormComponents.resx
+++ b/PlumbingRepair/PlumbingRepair/FormComponents.resx
@@ -1,120 +1,120 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepair/FormCreateOrder.Designer.cs b/PlumbingRepair/PlumbingRepair/FormCreateOrder.Designer.cs
new file mode 100644
index 0000000..564b4b3
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepair/FormCreateOrder.Designer.cs
@@ -0,0 +1,143 @@
+namespace PlumbingRepairView
+{
+ partial class FormCreateOrder
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ label1 = new Label();
+ label2 = new Label();
+ label3 = new Label();
+ buttonCancel = new Button();
+ buttonSave = new Button();
+ textBoxCount = new TextBox();
+ textBoxSum = new TextBox();
+ comboBoxWork = new ComboBox();
+ SuspendLayout();
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Location = new Point(23, 18);
+ label1.Name = "label1";
+ label1.Size = new Size(60, 20);
+ label1.TabIndex = 0;
+ label1.Text = "Работа:";
+ //
+ // label2
+ //
+ label2.AutoSize = true;
+ label2.Location = new Point(23, 55);
+ label2.Name = "label2";
+ label2.Size = new Size(93, 20);
+ label2.TabIndex = 1;
+ label2.Text = "Количество:";
+ //
+ // label3
+ //
+ label3.AutoSize = true;
+ label3.Location = new Point(23, 92);
+ label3.Name = "label3";
+ label3.Size = new Size(58, 20);
+ label3.TabIndex = 2;
+ label3.Text = "Сумма:";
+ //
+ // buttonCancel
+ //
+ buttonCancel.Location = new Point(389, 139);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(94, 29);
+ buttonCancel.TabIndex = 3;
+ buttonCancel.Text = "Отмена";
+ buttonCancel.UseVisualStyleBackColor = true;
+ buttonCancel.Click += buttonCancel_Click;
+ //
+ // buttonSave
+ //
+ buttonSave.Location = new Point(289, 139);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(94, 29);
+ buttonSave.TabIndex = 4;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = true;
+ buttonSave.Click += buttonSave_Click;
+ //
+ // textBoxCount
+ //
+ textBoxCount.Location = new Point(142, 55);
+ textBoxCount.Name = "textBoxCount";
+ textBoxCount.Size = new Size(341, 27);
+ textBoxCount.TabIndex = 5;
+ textBoxCount.TextChanged += textBoxCount_TextChanged;
+ //
+ // textBoxSum
+ //
+ textBoxSum.Location = new Point(142, 92);
+ textBoxSum.Name = "textBoxSum";
+ textBoxSum.Size = new Size(341, 27);
+ textBoxSum.TabIndex = 6;
+ //
+ // comboBoxWork
+ //
+ comboBoxWork.FormattingEnabled = true;
+ comboBoxWork.Location = new Point(142, 18);
+ comboBoxWork.Name = "comboBoxWork";
+ comboBoxWork.Size = new Size(341, 28);
+ comboBoxWork.TabIndex = 7;
+ comboBoxWork.SelectedIndexChanged += comboBoxWork_SelectedIndexChanged;
+ //
+ // FormCreateOrder
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(495, 180);
+ Controls.Add(comboBoxWork);
+ Controls.Add(textBoxSum);
+ Controls.Add(textBoxCount);
+ Controls.Add(buttonSave);
+ Controls.Add(buttonCancel);
+ Controls.Add(label3);
+ Controls.Add(label2);
+ Controls.Add(label1);
+ Name = "FormCreateOrder";
+ Text = "Заказ";
+ Load += FormCreateOrder_Load;
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private Label label1;
+ private Label label2;
+ private Label label3;
+ private Button buttonCancel;
+ private Button buttonSave;
+ private TextBox textBoxCount;
+ private TextBox textBoxSum;
+ private ComboBox comboBoxWork;
+ }
+}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormCreateOrder.cs b/PlumbingRepair/PlumbingRepair/FormCreateOrder.cs
similarity index 100%
rename from PlumbingRepair/PlumbingRepairView/FormCreateOrder.cs
rename to PlumbingRepair/PlumbingRepair/FormCreateOrder.cs
diff --git a/PlumbingRepair/PlumbingRepair/FormCreateOrder.resx b/PlumbingRepair/PlumbingRepair/FormCreateOrder.resx
new file mode 100644
index 0000000..0f362c9
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepair/FormCreateOrder.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormMain.Designer.cs b/PlumbingRepair/PlumbingRepair/FormMain.Designer.cs
similarity index 82%
rename from PlumbingRepair/PlumbingRepairView/FormMain.Designer.cs
rename to PlumbingRepair/PlumbingRepair/FormMain.Designer.cs
index c3cf2cb..d0970cd 100644
--- a/PlumbingRepair/PlumbingRepairView/FormMain.Designer.cs
+++ b/PlumbingRepair/PlumbingRepair/FormMain.Designer.cs
@@ -26,146 +26,138 @@
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
- private void InitializeComponent()
- {
- menuStrip1 = new MenuStrip();
- справочникиToolStripMenuItem = new ToolStripMenuItem();
- компонентыToolStripMenuItem = new ToolStripMenuItem();
- работыToolStripMenuItem = new ToolStripMenuItem();
- dataGridView = new DataGridView();
- buttonCreateOrder = new Button();
- buttonTakeOrderInWork = new Button();
- buttonOrderReady = new Button();
- buttonIssuedOrder = new Button();
- buttonUpdateList = new Button();
- menuStrip1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
- SuspendLayout();
- //
- // menuStrip1
- //
- menuStrip1.ImageScalingSize = new Size(20, 20);
- menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem });
- menuStrip1.Location = new Point(0, 0);
- menuStrip1.Name = "menuStrip1";
- menuStrip1.Padding = new Padding(8, 2, 0, 2);
- menuStrip1.Size = new Size(992, 33);
- menuStrip1.TabIndex = 0;
- menuStrip1.Text = "menuStrip1";
- //
- // справочникиToolStripMenuItem
- //
- справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, работыToolStripMenuItem });
- справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
- справочникиToolStripMenuItem.Size = new Size(139, 29);
- справочникиToolStripMenuItem.Text = "Справочники";
- //
- // компонентыToolStripMenuItem
- //
- компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
- компонентыToolStripMenuItem.Size = new Size(218, 34);
- компонентыToolStripMenuItem.Text = "Компоненты";
- компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click;
- //
- // работыToolStripMenuItem
- //
- работыToolStripMenuItem.Name = "работыToolStripMenuItem";
- работыToolStripMenuItem.Size = new Size(218, 34);
- работыToolStripMenuItem.Text = "Работы";
- работыToolStripMenuItem.Click += работыToolStripMenuItem_Click;
- //
- // dataGridView
- //
- dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- dataGridView.Location = new Point(0, 39);
- dataGridView.Margin = new Padding(4, 4, 4, 4);
- dataGridView.Name = "dataGridView";
- dataGridView.RowHeadersWidth = 51;
- dataGridView.RowTemplate.Height = 29;
- dataGridView.Size = new Size(732, 525);
- dataGridView.TabIndex = 1;
- //
- // buttonCreateOrder
- //
- buttonCreateOrder.Location = new Point(760, 55);
- buttonCreateOrder.Margin = new Padding(4, 4, 4, 4);
- buttonCreateOrder.Name = "buttonCreateOrder";
- buttonCreateOrder.Size = new Size(212, 36);
- buttonCreateOrder.TabIndex = 2;
- buttonCreateOrder.Text = "Создать заказ";
- buttonCreateOrder.UseVisualStyleBackColor = true;
- buttonCreateOrder.Click += buttonCreateOrder_Click;
- //
- // buttonTakeOrderInWork
- //
- buttonTakeOrderInWork.Location = new Point(760, 165);
- buttonTakeOrderInWork.Margin = new Padding(4, 4, 4, 4);
- buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
- buttonTakeOrderInWork.Size = new Size(212, 36);
- buttonTakeOrderInWork.TabIndex = 3;
- buttonTakeOrderInWork.Text = "Отдать на выполнение";
- buttonTakeOrderInWork.UseVisualStyleBackColor = true;
- buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click;
- //
- // buttonOrderReady
- //
- buttonOrderReady.Location = new Point(760, 279);
- buttonOrderReady.Margin = new Padding(4, 4, 4, 4);
- buttonOrderReady.Name = "buttonOrderReady";
- buttonOrderReady.Size = new Size(212, 36);
- buttonOrderReady.TabIndex = 4;
- buttonOrderReady.Text = "Заказ готов";
- buttonOrderReady.UseVisualStyleBackColor = true;
- buttonOrderReady.Click += buttonOrderReady_Click;
- //
- // buttonIssuedOrder
- //
- buttonIssuedOrder.Location = new Point(760, 391);
- buttonIssuedOrder.Margin = new Padding(4, 4, 4, 4);
- buttonIssuedOrder.Name = "buttonIssuedOrder";
- buttonIssuedOrder.Size = new Size(212, 36);
- buttonIssuedOrder.TabIndex = 5;
- buttonIssuedOrder.Text = "Заказ выдан";
- buttonIssuedOrder.UseVisualStyleBackColor = true;
- buttonIssuedOrder.Click += buttonIssuedOrder_Click;
- //
- // buttonUpdateList
- //
- buttonUpdateList.Location = new Point(760, 480);
- buttonUpdateList.Margin = new Padding(4, 4, 4, 4);
- buttonUpdateList.Name = "buttonUpdateList";
- buttonUpdateList.Size = new Size(212, 36);
- buttonUpdateList.TabIndex = 6;
- buttonUpdateList.Text = "Обновить список";
- buttonUpdateList.UseVisualStyleBackColor = true;
- buttonUpdateList.Click += buttonUpdateList_Click;
- //
- // FormMain
- //
- AutoScaleDimensions = new SizeF(10F, 25F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(992, 562);
- Controls.Add(buttonUpdateList);
- Controls.Add(buttonIssuedOrder);
- Controls.Add(buttonOrderReady);
- Controls.Add(buttonTakeOrderInWork);
- Controls.Add(buttonCreateOrder);
- Controls.Add(dataGridView);
- Controls.Add(menuStrip1);
- MainMenuStrip = menuStrip1;
- Margin = new Padding(4, 4, 4, 4);
- Name = "FormMain";
- Text = "Ремонт сантехники";
- Load += FormMain_Load;
- menuStrip1.ResumeLayout(false);
- menuStrip1.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
- ResumeLayout(false);
- PerformLayout();
- }
-
+ private void InitializeComponent()
+ {
+ menuStrip1 = new MenuStrip();
+ справочникиToolStripMenuItem = new ToolStripMenuItem();
+ компонентыToolStripMenuItem = new ToolStripMenuItem();
+ работыToolStripMenuItem = new ToolStripMenuItem();
+ dataGridView = new DataGridView();
+ buttonCreateOrder = new Button();
+ buttonTakeOrderInWork = new Button();
+ buttonOrderReady = new Button();
+ buttonIssuedOrder = new Button();
+ buttonUpdateList = new Button();
+ menuStrip1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
+ SuspendLayout();
+ //
+ // menuStrip1
+ //
+ menuStrip1.ImageScalingSize = new Size(20, 20);
+ menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem });
+ menuStrip1.Location = new Point(0, 0);
+ menuStrip1.Name = "menuStrip1";
+ menuStrip1.Size = new Size(819, 28);
+ menuStrip1.TabIndex = 0;
+ menuStrip1.Text = "menuStrip1";
+ //
+ // справочникиToolStripMenuItem
+ //
+ справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, работыToolStripMenuItem });
+ справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
+ справочникиToolStripMenuItem.Size = new Size(117, 24);
+ справочникиToolStripMenuItem.Text = "Справочники";
+ //
+ // компонентыToolStripMenuItem
+ //
+ компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
+ компонентыToolStripMenuItem.Size = new Size(182, 26);
+ компонентыToolStripMenuItem.Text = "Компоненты";
+ компонентыToolStripMenuItem.Click += компонентыToolStripMenuItem_Click;
+ //
+ // работыToolStripMenuItem
+ //
+ работыToolStripMenuItem.Name = "работыToolStripMenuItem";
+ работыToolStripMenuItem.Size = new Size(182, 26);
+ работыToolStripMenuItem.Text = "Работы";
+ работыToolStripMenuItem.Click += работыToolStripMenuItem_Click;
+ //
+ // dataGridView
+ //
+ dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridView.Location = new Point(0, 31);
+ dataGridView.Name = "dataGridView";
+ dataGridView.RowHeadersWidth = 51;
+ dataGridView.RowTemplate.Height = 29;
+ dataGridView.Size = new Size(586, 420);
+ dataGridView.TabIndex = 1;
+ //
+ // buttonCreateOrder
+ //
+ buttonCreateOrder.Location = new Point(608, 44);
+ buttonCreateOrder.Name = "buttonCreateOrder";
+ buttonCreateOrder.Size = new Size(170, 29);
+ buttonCreateOrder.TabIndex = 2;
+ buttonCreateOrder.Text = "Создать заказ";
+ buttonCreateOrder.UseVisualStyleBackColor = true;
+ buttonCreateOrder.Click += buttonCreateOrder_Click;
+ //
+ // buttonTakeOrderInWork
+ //
+ buttonTakeOrderInWork.Location = new Point(608, 132);
+ buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
+ buttonTakeOrderInWork.Size = new Size(170, 29);
+ buttonTakeOrderInWork.TabIndex = 3;
+ buttonTakeOrderInWork.Text = "Отдать на выполнение";
+ buttonTakeOrderInWork.UseVisualStyleBackColor = true;
+ buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click;
+ //
+ // buttonOrderReady
+ //
+ buttonOrderReady.Location = new Point(608, 223);
+ buttonOrderReady.Name = "buttonOrderReady";
+ buttonOrderReady.Size = new Size(170, 29);
+ buttonOrderReady.TabIndex = 4;
+ buttonOrderReady.Text = "Заказ готов";
+ buttonOrderReady.UseVisualStyleBackColor = true;
+ buttonOrderReady.Click += buttonOrderReady_Click;
+ //
+ // buttonIssuedOrder
+ //
+ buttonIssuedOrder.Location = new Point(608, 313);
+ buttonIssuedOrder.Name = "buttonIssuedOrder";
+ buttonIssuedOrder.Size = new Size(170, 29);
+ buttonIssuedOrder.TabIndex = 5;
+ buttonIssuedOrder.Text = "Заказ выдан";
+ buttonIssuedOrder.UseVisualStyleBackColor = true;
+ buttonIssuedOrder.Click += buttonIssuedOrder_Click;
+ //
+ // buttonUpdateList
+ //
+ buttonUpdateList.Location = new Point(608, 384);
+ buttonUpdateList.Name = "buttonUpdateList";
+ buttonUpdateList.Size = new Size(170, 29);
+ buttonUpdateList.TabIndex = 6;
+ buttonUpdateList.Text = "Обновить список";
+ buttonUpdateList.UseVisualStyleBackColor = true;
+ buttonUpdateList.Click += buttonUpdateList_Click;
+ //
+ // FormMain
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(819, 474);
+ Controls.Add(buttonUpdateList);
+ Controls.Add(buttonIssuedOrder);
+ Controls.Add(buttonOrderReady);
+ Controls.Add(buttonTakeOrderInWork);
+ Controls.Add(buttonCreateOrder);
+ Controls.Add(dataGridView);
+ Controls.Add(menuStrip1);
+ MainMenuStrip = menuStrip1;
+ Name = "FormMain";
+ Text = "Ремонт сантехники";
+ Load += FormMain_Load;
+ menuStrip1.ResumeLayout(false);
+ menuStrip1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
#endregion
-
+
private MenuStrip menuStrip1;
private ToolStripMenuItem справочникиToolStripMenuItem;
private DataGridView dataGridView;
diff --git a/PlumbingRepair/PlumbingRepairView/FormMain.cs b/PlumbingRepair/PlumbingRepair/FormMain.cs
similarity index 100%
rename from PlumbingRepair/PlumbingRepairView/FormMain.cs
rename to PlumbingRepair/PlumbingRepair/FormMain.cs
diff --git a/PlumbingRepair/PlumbingRepairView/FormMain.resx b/PlumbingRepair/PlumbingRepair/FormMain.resx
similarity index 97%
rename from PlumbingRepair/PlumbingRepairView/FormMain.resx
rename to PlumbingRepair/PlumbingRepair/FormMain.resx
index 5203d24..069f056 100644
--- a/PlumbingRepair/PlumbingRepairView/FormMain.resx
+++ b/PlumbingRepair/PlumbingRepair/FormMain.resx
@@ -1,123 +1,123 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 17, 17
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormWork.Designer.cs b/PlumbingRepair/PlumbingRepair/FormWork.Designer.cs
similarity index 100%
rename from PlumbingRepair/PlumbingRepairView/FormWork.Designer.cs
rename to PlumbingRepair/PlumbingRepair/FormWork.Designer.cs
diff --git a/PlumbingRepair/PlumbingRepairView/FormWork.cs b/PlumbingRepair/PlumbingRepair/FormWork.cs
similarity index 100%
rename from PlumbingRepair/PlumbingRepairView/FormWork.cs
rename to PlumbingRepair/PlumbingRepair/FormWork.cs
diff --git a/PlumbingRepair/PlumbingRepairView/FormWork.resx b/PlumbingRepair/PlumbingRepair/FormWork.resx
similarity index 100%
rename from PlumbingRepair/PlumbingRepairView/FormWork.resx
rename to PlumbingRepair/PlumbingRepair/FormWork.resx
diff --git a/PlumbingRepair/PlumbingRepairView/FormWorkComponent.Designer.cs b/PlumbingRepair/PlumbingRepair/FormWorkComponent.Designer.cs
similarity index 71%
rename from PlumbingRepair/PlumbingRepairView/FormWorkComponent.Designer.cs
rename to PlumbingRepair/PlumbingRepair/FormWorkComponent.Designer.cs
index 000d6e3..7ae6a31 100644
--- a/PlumbingRepair/PlumbingRepairView/FormWorkComponent.Designer.cs
+++ b/PlumbingRepair/PlumbingRepair/FormWorkComponent.Designer.cs
@@ -26,91 +26,100 @@
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
- private void InitializeComponent()
- {
- comboBoxComponent = new ComboBox();
- labelComponent = new Label();
- labelCount = new Label();
- textBoxCount = new TextBox();
- buttonSave = new Button();
- buttonCancel = new Button();
- SuspendLayout();
- //
- // comboBoxComponent
- //
- comboBoxComponent.FormattingEnabled = true;
- comboBoxComponent.Location = new Point(138, 12);
- comboBoxComponent.Name = "comboBoxComponent";
- comboBoxComponent.Size = new Size(295, 33);
- comboBoxComponent.TabIndex = 0;
- //
- // labelComponent
- //
- labelComponent.AutoSize = true;
- labelComponent.Location = new Point(12, 15);
- labelComponent.Name = "labelComponent";
- labelComponent.Size = new Size(107, 25);
- labelComponent.TabIndex = 1;
- labelComponent.Text = "Компонент:";
- //
- // labelCount
- //
- labelCount.AutoSize = true;
- labelCount.Location = new Point(12, 69);
- labelCount.Name = "labelCount";
- labelCount.Size = new Size(111, 25);
- labelCount.TabIndex = 2;
- labelCount.Text = "Количество:";
- //
- // textBoxCount
- //
- textBoxCount.Location = new Point(140, 69);
- textBoxCount.Name = "textBoxCount";
- textBoxCount.Size = new Size(293, 31);
- textBoxCount.TabIndex = 3;
- //
- // buttonSave
- //
- buttonSave.Location = new Point(177, 106);
- buttonSave.Name = "buttonSave";
- buttonSave.Size = new Size(112, 34);
- buttonSave.TabIndex = 4;
- buttonSave.Text = "Сохранить";
- buttonSave.UseVisualStyleBackColor = true;
- //
- // buttonCancel
- //
- buttonCancel.Location = new Point(295, 106);
- buttonCancel.Name = "buttonCancel";
- buttonCancel.Size = new Size(82, 34);
- buttonCancel.TabIndex = 5;
- buttonCancel.Text = "Отмена";
- buttonCancel.UseVisualStyleBackColor = true;
- //
- // FormWorkComponent
- //
- AutoScaleDimensions = new SizeF(10F, 25F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(445, 146);
- Controls.Add(buttonCancel);
- Controls.Add(buttonSave);
- Controls.Add(textBoxCount);
- Controls.Add(labelCount);
- Controls.Add(labelComponent);
- Controls.Add(comboBoxComponent);
- Name = "FormWorkComponent";
- Text = "Компонент Изделия";
- ResumeLayout(false);
- PerformLayout();
- }
-
+ private void InitializeComponent()
+ {
+ comboBoxComponent = new ComboBox();
+ labelComponent = new Label();
+ labelCount = new Label();
+ textBoxCount = new TextBox();
+ buttonSave = new Button();
+ buttonCancel = new Button();
+ SuspendLayout();
+ //
+ // comboBoxComponent
+ //
+ comboBoxComponent.FormattingEnabled = true;
+ comboBoxComponent.Location = new Point(110, 10);
+ comboBoxComponent.Margin = new Padding(2, 2, 2, 2);
+ comboBoxComponent.Name = "comboBoxComponent";
+ comboBoxComponent.Size = new Size(237, 28);
+ comboBoxComponent.TabIndex = 0;
+ //
+ // labelComponent
+ //
+ labelComponent.AutoSize = true;
+ labelComponent.Location = new Point(10, 12);
+ labelComponent.Margin = new Padding(2, 0, 2, 0);
+ labelComponent.Name = "labelComponent";
+ labelComponent.Size = new Size(91, 20);
+ labelComponent.TabIndex = 1;
+ labelComponent.Text = "Компонент:";
+ //
+ // labelCount
+ //
+ labelCount.AutoSize = true;
+ labelCount.Location = new Point(10, 55);
+ labelCount.Margin = new Padding(2, 0, 2, 0);
+ labelCount.Name = "labelCount";
+ labelCount.Size = new Size(93, 20);
+ labelCount.TabIndex = 2;
+ labelCount.Text = "Количество:";
+ //
+ // textBoxCount
+ //
+ textBoxCount.Location = new Point(112, 55);
+ textBoxCount.Margin = new Padding(2, 2, 2, 2);
+ textBoxCount.Name = "textBoxCount";
+ textBoxCount.Size = new Size(235, 27);
+ textBoxCount.TabIndex = 3;
+ //
+ // buttonSave
+ //
+ buttonSave.Location = new Point(142, 85);
+ buttonSave.Margin = new Padding(2, 2, 2, 2);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(90, 27);
+ buttonSave.TabIndex = 4;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = true;
+ buttonSave.Click += ButtonSave_Click;
+ //
+ // buttonCancel
+ //
+ buttonCancel.Location = new Point(236, 85);
+ buttonCancel.Margin = new Padding(2);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(66, 27);
+ buttonCancel.TabIndex = 5;
+ buttonCancel.Text = "Отмена";
+ buttonCancel.UseVisualStyleBackColor = true;
+ buttonCancel.Click += ButtonCancel_Click;
+ //
+ // FormWorkComponent
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(356, 117);
+ Controls.Add(buttonCancel);
+ Controls.Add(buttonSave);
+ Controls.Add(textBoxCount);
+ Controls.Add(labelCount);
+ Controls.Add(labelComponent);
+ Controls.Add(comboBoxComponent);
+ Margin = new Padding(2, 2, 2, 2);
+ Name = "FormWorkComponent";
+ Text = "Компонент Изделия";
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
#endregion
-
+
private ComboBox comboBoxComponent;
private Label labelComponent;
private Label labelCount;
private TextBox textBoxCount;
- private Button buttonSave;
- private Button buttonCancel;
+ private Button buttonSave;
+ private Button buttonCancel;
}
}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormWorkComponent.cs b/PlumbingRepair/PlumbingRepair/FormWorkComponent.cs
similarity index 97%
rename from PlumbingRepair/PlumbingRepairView/FormWorkComponent.cs
rename to PlumbingRepair/PlumbingRepair/FormWorkComponent.cs
index 9e2a11f..38771b3 100644
--- a/PlumbingRepair/PlumbingRepairView/FormWorkComponent.cs
+++ b/PlumbingRepair/PlumbingRepair/FormWorkComponent.cs
@@ -48,8 +48,7 @@ namespace PlumbingRepairView
public int Count
{
get { return Convert.ToInt32(textBoxCount.Text); }
- set
- { textBoxCount.Text = value.ToString(); }
+ set { textBoxCount.Text = value.ToString(); }
}
public FormWorkComponent(IComponentLogic logic)
{
diff --git a/PlumbingRepair/PlumbingRepairView/FormWorkComponent.resx b/PlumbingRepair/PlumbingRepair/FormWorkComponent.resx
similarity index 97%
rename from PlumbingRepair/PlumbingRepairView/FormWorkComponent.resx
rename to PlumbingRepair/PlumbingRepair/FormWorkComponent.resx
index a395bff..0f362c9 100644
--- a/PlumbingRepair/PlumbingRepairView/FormWorkComponent.resx
+++ b/PlumbingRepair/PlumbingRepair/FormWorkComponent.resx
@@ -1,120 +1,120 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormWorks.Designer.cs b/PlumbingRepair/PlumbingRepair/FormWorks.Designer.cs
similarity index 100%
rename from PlumbingRepair/PlumbingRepairView/FormWorks.Designer.cs
rename to PlumbingRepair/PlumbingRepair/FormWorks.Designer.cs
diff --git a/PlumbingRepair/PlumbingRepairView/FormWorks.cs b/PlumbingRepair/PlumbingRepair/FormWorks.cs
similarity index 100%
rename from PlumbingRepair/PlumbingRepairView/FormWorks.cs
rename to PlumbingRepair/PlumbingRepair/FormWorks.cs
diff --git a/PlumbingRepair/PlumbingRepairView/FormWorks.resx b/PlumbingRepair/PlumbingRepair/FormWorks.resx
similarity index 100%
rename from PlumbingRepair/PlumbingRepairView/FormWorks.resx
rename to PlumbingRepair/PlumbingRepair/FormWorks.resx
diff --git a/PlumbingRepair/PlumbingRepair/PlumbingRepair.csproj b/PlumbingRepair/PlumbingRepair/PlumbingRepair.csproj
deleted file mode 100644
index e60bd40..0000000
--- a/PlumbingRepair/PlumbingRepair/PlumbingRepair.csproj
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
- WinExe
- net6.0-windows
- enable
- true
- enable
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepair/PlumbingRepairView.csproj b/PlumbingRepair/PlumbingRepair/PlumbingRepairView.csproj
new file mode 100644
index 0000000..777ae54
--- /dev/null
+++ b/PlumbingRepair/PlumbingRepair/PlumbingRepairView.csproj
@@ -0,0 +1,45 @@
+
+
+
+ WinExe
+ net6.0-windows
+ enable
+ true
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ Form
+
+
+ Form
+
+
+ Form
+
+
+ Form
+
+
+ Form
+
+
+ Form
+
+
+
+
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepair/Program.cs b/PlumbingRepair/PlumbingRepair/Program.cs
index 1d4535b..e7dd925 100644
--- a/PlumbingRepair/PlumbingRepair/Program.cs
+++ b/PlumbingRepair/PlumbingRepair/Program.cs
@@ -1,7 +1,17 @@
-namespace PlumbingRepair
+using PlumbingRepairContracts.BusinessLogicsContracts;
+using PlumbingRepairContracts.StoragesContracts;
+using PlumbingRepairListImplement.Implements;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using NLog.Extensions.Logging;
+using PlumbingRepairBusinessLogic.BusinessLogics;
+
+namespace PlumbingRepairView
{
internal static class Program
{
+ private static ServiceProvider? _serviceProvider;
+ public static ServiceProvider? ServiceProvider => _serviceProvider;
///
/// The main entry point for the application.
///
@@ -11,7 +21,33 @@ namespace PlumbingRepair
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new FormComponent());
+ var services = new ServiceCollection();
+ ConfigureServices(services);
+ _serviceProvider = services.BuildServiceProvider();
+ Application.Run(_serviceProvider.GetRequiredService());
+ }
+ private static void ConfigureServices(ServiceCollection services)
+ {
+ services.AddLogging(option =>
+ {
+ option.SetMinimumLevel(LogLevel.Information);
+ option.AddNLog("nlog.config");
+ });
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
}
}
}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs b/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs
index 780a29e..42ed7cb 100644
--- a/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/BindingModels/OrderBindingModel.cs
@@ -12,11 +12,11 @@ namespace PlumbingRepairContracts.BindingModels
{
public int Id { get; set; }
public int WorkId { get; set; }
+ public String WorkName { get; set; } = string.Empty;
public int Count { get; set; }
public double Sum { get; set; }
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
public DateTime DateCreate { get; set; } = DateTime.Now;
public DateTime? DateImplement { get; set; }
- public string WorkName { get; set; } = string.Empty;
}
}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs b/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs
index 5b54828..7b1a30e 100644
--- a/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/ViewModels/OrderViewModel.cs
@@ -14,7 +14,7 @@ namespace PlumbingRepairContracts.ViewModels
[DisplayName("Номер")]
public int Id { get; set; }
public int WorkId { get; set; }
- [DisplayName("Изделие")]
+ [DisplayName("Работа")]
public string WorkName { get; set; } = string.Empty;
[DisplayName("Количество")]
public int Count { get; set; }
diff --git a/PlumbingRepair/PlumbingRepairContracts/ViewModels/WorkViewModel.cs b/PlumbingRepair/PlumbingRepairContracts/ViewModels/WorkViewModel.cs
index 2ff0250..68caa32 100644
--- a/PlumbingRepair/PlumbingRepairContracts/ViewModels/WorkViewModel.cs
+++ b/PlumbingRepair/PlumbingRepairContracts/ViewModels/WorkViewModel.cs
@@ -11,7 +11,7 @@ namespace PlumbingRepairContracts.ViewModels
public class WorkViewModel : IWorkModel
{
public int Id { get; set; }
- [DisplayName("Название изделия")]
+ [DisplayName("Название работы")]
public string WorkName { get; set; } = string.Empty;
[DisplayName("Цена")]
public double Price { get; set; }
diff --git a/PlumbingRepair/PlumbingRepairListImplement/Models/Order.cs b/PlumbingRepair/PlumbingRepairListImplement/Models/Order.cs
index a350881..1a2420e 100644
--- a/PlumbingRepair/PlumbingRepairListImplement/Models/Order.cs
+++ b/PlumbingRepair/PlumbingRepairListImplement/Models/Order.cs
@@ -14,6 +14,7 @@ namespace PlumbingRepairListImplement.Models
{
public int Id { get; private set; }
public int WorkId { get; private set; }
+ public String WorkName { get; private set; } = string.Empty;
public int Count { get; private set; }
public double Sum { get; private set; }
public OrderStatus Status { get; private set; }
@@ -29,6 +30,7 @@ namespace PlumbingRepairListImplement.Models
{
Id = model.Id,
WorkId = model.WorkId,
+ WorkName = model.WorkName,
Count = model.Count,
Sum = model.Sum,
Status = model.Status,
@@ -52,6 +54,7 @@ namespace PlumbingRepairListImplement.Models
{
Id = Id,
WorkId = WorkId,
+ WorkName = WorkName,
Count = Count,
Sum = Sum,
Status = Status,
diff --git a/PlumbingRepair/PlumbingRepairView/FormCreateOrder.Designer.cs b/PlumbingRepair/PlumbingRepairView/FormCreateOrder.Designer.cs
deleted file mode 100644
index 4a7df40..0000000
--- a/PlumbingRepair/PlumbingRepairView/FormCreateOrder.Designer.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-namespace PlumbingRepairView
-{
- partial class FormCreateOrder
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.label1 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.buttonCancel = new System.Windows.Forms.Button();
- this.buttonSave = new System.Windows.Forms.Button();
- this.textBoxCount = new System.Windows.Forms.TextBox();
- this.textBoxSum = new System.Windows.Forms.TextBox();
- this.comboBoxWork = new System.Windows.Forms.ComboBox();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(23, 18);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(60, 20);
- this.label1.TabIndex = 0;
- this.label1.Text = "Работа:";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(23, 55);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(93, 20);
- this.label2.TabIndex = 1;
- this.label2.Text = "Количество:";
- //
- // label3
- //
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(23, 92);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(58, 20);
- this.label3.TabIndex = 2;
- this.label3.Text = "Сумма:";
- //
- // buttonCancel
- //
- this.buttonCancel.Location = new System.Drawing.Point(389, 139);
- this.buttonCancel.Name = "buttonCancel";
- this.buttonCancel.Size = new System.Drawing.Size(94, 29);
- this.buttonCancel.TabIndex = 3;
- this.buttonCancel.Text = "Отмена";
- this.buttonCancel.UseVisualStyleBackColor = true;
- this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
- //
- // buttonSave
- //
- this.buttonSave.Location = new System.Drawing.Point(289, 139);
- this.buttonSave.Name = "buttonSave";
- this.buttonSave.Size = new System.Drawing.Size(94, 29);
- this.buttonSave.TabIndex = 4;
- this.buttonSave.Text = "Сохранить";
- this.buttonSave.UseVisualStyleBackColor = true;
- this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
- //
- // textBoxCount
- //
- this.textBoxCount.Location = new System.Drawing.Point(142, 55);
- this.textBoxCount.Name = "textBoxCount";
- this.textBoxCount.Size = new System.Drawing.Size(341, 27);
- this.textBoxCount.TabIndex = 5;
- this.textBoxCount.TextChanged += new System.EventHandler(this.textBoxCount_TextChanged);
- //
- // textBoxSum
- //
- this.textBoxSum.Location = new System.Drawing.Point(142, 92);
- this.textBoxSum.Name = "textBoxSum";
- this.textBoxSum.Size = new System.Drawing.Size(341, 27);
- this.textBoxSum.TabIndex = 6;
- //
- // comboBoxWork
- //
- this.comboBoxWork.FormattingEnabled = true;
- this.comboBoxWork.Location = new System.Drawing.Point(142, 18);
- this.comboBoxWork.Name = "comboBoxWork";
- this.comboBoxWork.Size = new System.Drawing.Size(341, 28);
- this.comboBoxWork.TabIndex = 7;
- this.comboBoxWork.SelectedIndexChanged += new System.EventHandler(this.comboBoxWork_SelectedIndexChanged);
- //
- // FormCreateOrder
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(495, 180);
- this.Controls.Add(this.comboBoxWork);
- this.Controls.Add(this.textBoxSum);
- this.Controls.Add(this.textBoxCount);
- this.Controls.Add(this.buttonSave);
- this.Controls.Add(this.buttonCancel);
- this.Controls.Add(this.label3);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.label1);
- this.Name = "FormCreateOrder";
- this.Text = "Заказ";
- this.Load += new System.EventHandler(this.FormCreateOrder_Load);
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private Label label1;
- private Label label2;
- private Label label3;
- private Button buttonCancel;
- private Button buttonSave;
- private TextBox textBoxCount;
- private TextBox textBoxSum;
- private ComboBox comboBoxWork;
- }
-}
\ No newline at end of file
diff --git a/PlumbingRepair/PlumbingRepairView/FormCreateOrder.resx b/PlumbingRepair/PlumbingRepairView/FormCreateOrder.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/PlumbingRepair/PlumbingRepairView/FormCreateOrder.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
--
2.25.1