From a44b0f052d109241fb53b47ee0b13c4ed18bffab Mon Sep 17 00:00:00 2001 From: Viltskaa Date: Tue, 14 Mar 2023 10:46:34 +0400 Subject: [PATCH] complete lab 2 hard --- SushiBar/SushiBar/FormStoreSell.cs | 2 +- SushiBar/SushiBar/Program.cs | 1 + SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs | 2 +- SushiBar/SushiBarBusinessLogic/BusinessLogics/StoreLogic.cs | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/SushiBar/SushiBar/FormStoreSell.cs b/SushiBar/SushiBar/FormStoreSell.cs index 7b7b53d..ae367f8 100644 --- a/SushiBar/SushiBar/FormStoreSell.cs +++ b/SushiBar/SushiBar/FormStoreSell.cs @@ -68,7 +68,7 @@ namespace SushiBar { var list = _logicSushi.ReadList(null); if (list == null) return; - SushiNames.DisplayMember = "DocumentName"; + SushiNames.DisplayMember = "SushiName"; SushiNames.ValueMember = "Id"; SushiNames.DataSource = list; SushiNames.SelectedItem = null; diff --git a/SushiBar/SushiBar/Program.cs b/SushiBar/SushiBar/Program.cs index 73ee17c..b89e7d7 100644 --- a/SushiBar/SushiBar/Program.cs +++ b/SushiBar/SushiBar/Program.cs @@ -47,6 +47,7 @@ namespace SushiBar services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs index c2ed8af..57a3e43 100644 --- a/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/OrderLogic.cs @@ -91,7 +91,7 @@ namespace SushiBarBusinessLogic.BusinessLogics _logger.LogWarning("Status update to " + status + " operation failed. Document not found."); return false; } - if (_storeLogic.CheckToSupply(sushi, model.Count) == false) + if (!_storeLogic.CheckToSupply(sushi, model.Count)) { _logger.LogWarning("Status update to " + status + " operation failed. Shop supply error."); return false; diff --git a/SushiBar/SushiBarBusinessLogic/BusinessLogics/StoreLogic.cs b/SushiBar/SushiBarBusinessLogic/BusinessLogics/StoreLogic.cs index 2f05ae1..75113b6 100644 --- a/SushiBar/SushiBarBusinessLogic/BusinessLogics/StoreLogic.cs +++ b/SushiBar/SushiBarBusinessLogic/BusinessLogics/StoreLogic.cs @@ -110,7 +110,7 @@ namespace SushiBarBusinessLogic.BusinessLogics _logger.LogInformation("Shop element found. ID: {0}, Name: {1}", store.Id, store.StoreName); int countSushi = store.Sushis.Sum(s => s.Value.Item2); - if (store.maxSushi + countSushi >= quantity) + if (store.maxSushi - countSushi >= quantity) { if (store.Sushis.TryGetValue(sushi.Id, out var pair)) {