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": {