From 48cbed7babc217889a5c757f75cdda5253ebeebc Mon Sep 17 00:00:00 2001 From: dex_moth Date: Wed, 19 Jun 2024 13:54:56 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D0=BE=20=D0=B2?= =?UTF-8?q?=D1=81=D1=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FishFactory/Forms/FormComponents.cs | 3 +-- FishFactory/Forms/FormImplementers.cs | 15 ++++++--------- FishFactory/Forms/FormMain.cs | 1 + FishFactory/Program.cs | 2 -- .../BusinessLogic/OrderLogic.cs | 2 +- .../ViewModels/ComponentViewModel.cs | 2 +- .../ViewModels/OrderViewModel.cs | 8 ++++---- .../FishFactoryDatabaseImplement.csproj | 2 +- .../Implements/ImplementationExtension.cs | 2 +- .../Models/CannedComponent.cs | 16 +++++++++++----- .../FishFactoryFileImplement.csproj | 2 +- .../Implements/ImplementationExtension.cs | 2 +- .../FishFactoryListImplement.csproj | 2 +- .../Properties/launchSettings.json | 4 ++-- 14 files changed, 32 insertions(+), 31 deletions(-) diff --git a/FishFactory/Forms/FormComponents.cs b/FishFactory/Forms/FormComponents.cs index bc3e1f4..f562586 100644 --- a/FishFactory/Forms/FormComponents.cs +++ b/FishFactory/Forms/FormComponents.cs @@ -64,8 +64,7 @@ namespace FishFactory.Forms { 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/FishFactory/Forms/FormImplementers.cs b/FishFactory/Forms/FormImplementers.cs index dcffe7a..9ad5b9c 100644 --- a/FishFactory/Forms/FormImplementers.cs +++ b/FishFactory/Forms/FormImplementers.cs @@ -38,15 +38,12 @@ namespace FishFactory.Forms private void buttonAdd_Click(object sender, EventArgs e) { - var service = Program.ServiceProvider?.GetService(typeof(FormImplementer)); - if (service is FormImplementer form) - { - if (form.ShowDialog() == DialogResult.OK) - { - LoadData(); - } - } - } + var form = DependencyManager.Instance.Resolve(); + if (form.ShowDialog() == DialogResult.OK) + { + LoadData(); + } + } private void buttonUpd_Click(object sender, EventArgs e) { diff --git a/FishFactory/Forms/FormMain.cs b/FishFactory/Forms/FormMain.cs index 496793f..78fcbb6 100644 --- a/FishFactory/Forms/FormMain.cs +++ b/FishFactory/Forms/FormMain.cs @@ -39,6 +39,7 @@ namespace FishFactory.Forms catch (Exception ex) { _logger.LogError(ex, "Ошибка загрузки заказов"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } private void компонентыToolStripMenuItem_Click(object sender, EventArgs e) diff --git a/FishFactory/Program.cs b/FishFactory/Program.cs index c681537..32c8bfe 100644 --- a/FishFactory/Program.cs +++ b/FishFactory/Program.cs @@ -1,8 +1,6 @@ using FishFactory.Forms; using FishFactoryContracts.BusinessLogicsContracts; using FishFactoryBusinessLogic.BusinessLogic; -using FishFactoryContracts.StoragesContracts; -using FishFactoryDatabaseImplement.Implements; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NLog.Extensions.Logging; diff --git a/FishFactoryBusinessLogic/BusinessLogic/OrderLogic.cs b/FishFactoryBusinessLogic/BusinessLogic/OrderLogic.cs index ca2a6a9..e32bf5f 100644 --- a/FishFactoryBusinessLogic/BusinessLogic/OrderLogic.cs +++ b/FishFactoryBusinessLogic/BusinessLogic/OrderLogic.cs @@ -106,7 +106,7 @@ namespace FishFactoryBusinessLogic.BusinessLogic throw new ArgumentNullException(nameof(element)); } - model.CannedId = element.CannedId; + model.CannedId = element.CannedId; model.ClientId = element.ClientId; model.DateCreate = element.DateCreate; model.DateImplement = element.DateImplement; diff --git a/FishFactoryContracts/ViewModels/ComponentViewModel.cs b/FishFactoryContracts/ViewModels/ComponentViewModel.cs index 27a206f..6aa7b54 100644 --- a/FishFactoryContracts/ViewModels/ComponentViewModel.cs +++ b/FishFactoryContracts/ViewModels/ComponentViewModel.cs @@ -9,7 +9,7 @@ namespace FishFactoryContracts.ViewModels public int Id { get; set; } [Column(title: "Название компонента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] public string ComponentName { get; set; } = string.Empty; - [Column(title: "Цена", width: 150)] + [Column(title: "Цена", width: 130)] public double Cost { get; set; } } } diff --git a/FishFactoryContracts/ViewModels/OrderViewModel.cs b/FishFactoryContracts/ViewModels/OrderViewModel.cs index e4e8df8..9e91a48 100644 --- a/FishFactoryContracts/ViewModels/OrderViewModel.cs +++ b/FishFactoryContracts/ViewModels/OrderViewModel.cs @@ -1,13 +1,13 @@ using FishFactoryContracts.Attributes; using FishFactoryDataModel.Enums; -using System.ComponentModel; +using FishFactoryDataModel.Models; namespace FishFactoryContracts.ViewModels { - public class OrderViewModel + public class OrderViewModel : IOrderModel { - [DisplayName("Номер")] - public int Id { get; set; } + [Column(title: "Номер", width: 30)] + public int Id { get; set; } [Column(visible: false)] public int ClientId { get; set; } diff --git a/FishFactoryDatabaseImplement/FishFactoryDatabaseImplement.csproj b/FishFactoryDatabaseImplement/FishFactoryDatabaseImplement.csproj index 14e7c1f..9bac546 100644 --- a/FishFactoryDatabaseImplement/FishFactoryDatabaseImplement.csproj +++ b/FishFactoryDatabaseImplement/FishFactoryDatabaseImplement.csproj @@ -22,7 +22,7 @@ - + diff --git a/FishFactoryDatabaseImplement/Implements/ImplementationExtension.cs b/FishFactoryDatabaseImplement/Implements/ImplementationExtension.cs index b6b2762..1980526 100644 --- a/FishFactoryDatabaseImplement/Implements/ImplementationExtension.cs +++ b/FishFactoryDatabaseImplement/Implements/ImplementationExtension.cs @@ -3,7 +3,7 @@ using FishFactoryContracts.StoragesContracts; namespace FishFactoryDatabaseImplement.Implements { - public class ImplementationExtension + public class ImplementationExtension : IImplementationExtension { public int Priority => 2; diff --git a/FishFactoryDatabaseImplement/Models/CannedComponent.cs b/FishFactoryDatabaseImplement/Models/CannedComponent.cs index 785a669..c77f685 100644 --- a/FishFactoryDatabaseImplement/Models/CannedComponent.cs +++ b/FishFactoryDatabaseImplement/Models/CannedComponent.cs @@ -1,15 +1,21 @@ using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; namespace FishFactoryDatabaseImplement.Models { - public class CannedComponent + [DataContract] + public class CannedComponent { - public int Id { get; set; } - [Required] + [DataMember] + public int Id { get; set; } + [DataMember] + [Required] public int CannedId { get; set; } - [Required] + [DataMember] + [Required] public int ComponentId { get; set; } - [Required] + [DataMember] + [Required] public int Count { get; set; } public virtual Component Component { get; set; } = new(); public virtual Canned Canned { get; set; } = new(); diff --git a/FishFactoryFileImplement/FishFactoryFileImplement.csproj b/FishFactoryFileImplement/FishFactoryFileImplement.csproj index 6e9dfe2..aaaba0c 100644 --- a/FishFactoryFileImplement/FishFactoryFileImplement.csproj +++ b/FishFactoryFileImplement/FishFactoryFileImplement.csproj @@ -12,7 +12,7 @@ - + \ No newline at end of file diff --git a/FishFactoryFileImplement/Implements/ImplementationExtension.cs b/FishFactoryFileImplement/Implements/ImplementationExtension.cs index 8359cb8..e142b7f 100644 --- a/FishFactoryFileImplement/Implements/ImplementationExtension.cs +++ b/FishFactoryFileImplement/Implements/ImplementationExtension.cs @@ -5,7 +5,7 @@ namespace FishFactoryFileImplement.Implements { public class ImplementationExtension : IImplementationExtension { - public int Priority => 1; + public int Priority => 0; public void RegisterServices() { diff --git a/FishFactoryListImplement/FishFactoryListImplement.csproj b/FishFactoryListImplement/FishFactoryListImplement.csproj index b42bd05..99d19fb 100644 --- a/FishFactoryListImplement/FishFactoryListImplement.csproj +++ b/FishFactoryListImplement/FishFactoryListImplement.csproj @@ -13,6 +13,6 @@ - + diff --git a/FishFactoryRestApi/Properties/launchSettings.json b/FishFactoryRestApi/Properties/launchSettings.json index 0aabeb5..b94ec1e 100644 --- a/FishFactoryRestApi/Properties/launchSettings.json +++ b/FishFactoryRestApi/Properties/launchSettings.json @@ -12,7 +12,7 @@ "http": { "commandName": "Project", "dotnetRunMessages": true, - "launchBrowser": false, + "launchBrowser": true, "launchUrl": "swagger", "applicationUrl": "http://localhost:5284", "environmentVariables": { @@ -22,7 +22,7 @@ "https": { "commandName": "Project", "dotnetRunMessages": true, - "launchBrowser": false, + "launchBrowser": true, "launchUrl": "swagger", "applicationUrl": "https://localhost:7012;http://localhost:5284", "environmentVariables": {