From c71a7e4f5120638b9d797712a0d0dda6841a5fa2 Mon Sep 17 00:00:00 2001 From: Danil Markov Date: Tue, 2 May 2023 14:41:26 +0400 Subject: [PATCH 1/2] fix --- .../BusinessLogics/ShopLogic.cs | 16 ++++++++-------- LawFirm/LawFirmView/FormAddDocument.cs | 4 ++-- LawFirm/LawFirmView/FormCreateOrder.cs | 4 ++-- LawFirm/LawFirmView/FormShop.cs | 4 ++-- LawFirm/LawFirmView/FormShops.cs | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/LawFirm/LawFirmBusinessLogic/BusinessLogics/ShopLogic.cs b/LawFirm/LawFirmBusinessLogic/BusinessLogics/ShopLogic.cs index e07d5bb..24e7e97 100644 --- a/LawFirm/LawFirmBusinessLogic/BusinessLogics/ShopLogic.cs +++ b/LawFirm/LawFirmBusinessLogic/BusinessLogics/ShopLogic.cs @@ -107,7 +107,7 @@ namespace LawFirmBusinessLogic.BusinessLogics } } - public bool AddDocument(ShopSearchModel model, IDocumentModel ship, int count) + public bool AddDocument(ShopSearchModel model, IDocumentModel document, int count) { if (model == null) { @@ -126,17 +126,17 @@ namespace LawFirmBusinessLogic.BusinessLogics } _logger.LogInformation("AddDocument find. Id:{Id}", element.Id); - if (element.ShopDocuments.TryGetValue(ship.Id, out var pair)) + if (element.ShopDocuments.TryGetValue(document.Id, out var pair)) { - element.ShopDocuments[ship.Id] = (ship, count + pair.Item2); - _logger.LogInformation("AddDocument. Added {count} {ship} to '{ShopName}' shop", - count, ship.DocumentName, element.ShopName); + element.ShopDocuments[document.Id] = (document, count + pair.Item2); + _logger.LogInformation("AddDocument. Added {count} {document} to '{ShopName}' shop", + count, document.DocumentName, element.ShopName); } else { - element.ShopDocuments[ship.Id] = (ship, count); - _logger.LogInformation("AddDocument. Added {count} new ship {ship} to '{ShopName}' shop", - count, ship.DocumentName, element.ShopName); + element.ShopDocuments[document.Id] = (document, count); + _logger.LogInformation("AddDocument. Added {count} new document {document} to '{ShopName}' shop", + count, document.DocumentName, element.ShopName); } _shopStorage.Update(new() { diff --git a/LawFirm/LawFirmView/FormAddDocument.cs b/LawFirm/LawFirmView/FormAddDocument.cs index 27add3d..10ad81f 100644 --- a/LawFirm/LawFirmView/FormAddDocument.cs +++ b/LawFirm/LawFirmView/FormAddDocument.cs @@ -19,7 +19,7 @@ namespace LawFirmView private void FormAddDocument_Load(object sender, EventArgs e) { - _logger.LogInformation("Загрузка списка кораблей для пополнения"); + _logger.LogInformation("Загрузка списка документов для пополнения"); try { var list = _logicDocument.ReadList(null); @@ -33,7 +33,7 @@ namespace LawFirmView } catch (Exception ex) { - _logger.LogError(ex, "Ошибка загрузки списка кораблей"); + _logger.LogError(ex, "Ошибка загрузки списка документов"); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } diff --git a/LawFirm/LawFirmView/FormCreateOrder.cs b/LawFirm/LawFirmView/FormCreateOrder.cs index e971622..f6097f4 100644 --- a/LawFirm/LawFirmView/FormCreateOrder.cs +++ b/LawFirm/LawFirmView/FormCreateOrder.cs @@ -45,12 +45,12 @@ namespace LawFirmView try { int id = Convert.ToInt32(comboBoxDocument.SelectedValue); - var product = _logicD.ReadElement(new DocumentSearchModel + var document = _logicD.ReadElement(new DocumentSearchModel { Id = id }); int count = Convert.ToInt32(textBoxCount.Text); - textBoxSum.Text = Math.Round(count * (product?.Price ?? 0), 2).ToString(); + textBoxSum.Text = Math.Round(count * (document?.Price ?? 0), 2).ToString(); _logger.LogInformation("Расчет суммы заказа"); } catch (Exception ex) diff --git a/LawFirm/LawFirmView/FormShop.cs b/LawFirm/LawFirmView/FormShop.cs index 4229ec1..68aaf92 100644 --- a/LawFirm/LawFirmView/FormShop.cs +++ b/LawFirm/LawFirmView/FormShop.cs @@ -50,7 +50,7 @@ namespace LawFirmView } private void LoadData() { - _logger.LogInformation("Загрузка кораблей магазина"); + _logger.LogInformation("Загрузка документов магазина"); try { if (_shopDocuments != null) @@ -64,7 +64,7 @@ namespace LawFirmView } catch (Exception ex) { - _logger.LogError(ex, "Ошибка загрузки кораблей магазина"); + _logger.LogError(ex, "Ошибка загрузки документов магазина"); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } diff --git a/LawFirm/LawFirmView/FormShops.cs b/LawFirm/LawFirmView/FormShops.cs index d685835..ed08f38 100644 --- a/LawFirm/LawFirmView/FormShops.cs +++ b/LawFirm/LawFirmView/FormShops.cs @@ -89,7 +89,7 @@ namespace LawFirmView } catch (Exception ex) { - _logger.LogError(ex, "Ошибка удаления кораблей"); + _logger.LogError(ex, "Ошибка удаления документов"); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } From 4b143d9d5527cee8e69777114dc295dbad001299 Mon Sep 17 00:00:00 2001 From: Danil Markov Date: Tue, 2 May 2023 14:43:37 +0400 Subject: [PATCH 2/2] fix --- LawFirm/LawFirmBusinessLogic/BusinessLogics/ShopLogic.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LawFirm/LawFirmBusinessLogic/BusinessLogics/ShopLogic.cs b/LawFirm/LawFirmBusinessLogic/BusinessLogics/ShopLogic.cs index 24e7e97..22a618a 100644 --- a/LawFirm/LawFirmBusinessLogic/BusinessLogics/ShopLogic.cs +++ b/LawFirm/LawFirmBusinessLogic/BusinessLogics/ShopLogic.cs @@ -115,7 +115,7 @@ namespace LawFirmBusinessLogic.BusinessLogics } if (count <= 0) { - throw new ArgumentException("Количество поездок должно быть больше 0", nameof(count)); + throw new ArgumentException("Количество документов должно быть больше 0", nameof(count)); } _logger.LogInformation("AddDocument. ShopName:{ShopName}. Id:{Id}", model.ShopName, model.Id); var element = _shopStorage.GetElement(model);