This commit is contained in:
the 2023-03-26 20:53:27 +04:00
parent 8a7abdd88c
commit b2f32aa6e4
4 changed files with 17 additions and 17 deletions

View File

@ -56,7 +56,7 @@ namespace ComputerShopBusinessLogic.BusinessLogics
return list; return list;
} }
public bool SupplyDocuments(ShopSearchModel model, IComputerModel computer, int count) public bool SupplyComputers(ShopSearchModel model, IComputerModel computer, int count)
{ {
if (model == null) if (model == null)
{ {
@ -81,15 +81,15 @@ namespace ComputerShopBusinessLogic.BusinessLogics
} }
_logger.LogInformation("Shop element found. ID: {0}, Name: {1}", shopElement.Id, shopElement.Name); _logger.LogInformation("Shop element found. ID: {0}, Name: {1}", shopElement.Id, shopElement.Name);
if (shopElement.ShopComputers.TryGetValue(computer.Id, out var sameDocument)) if (shopElement.ShopComputers.TryGetValue(computer.Id, out var sameComputer))
{ {
shopElement.ShopComputers[computer.Id] = (computer, sameDocument.Item2 + count); shopElement.ShopComputers[computer.Id] = (computer, sameComputer.Item2 + count);
_logger.LogInformation("Same document found by supply. Added {0} of {1} in {2} shop", count, computer.ComputerName, shopElement.Name); _logger.LogInformation("Same computer found by supply. Added {0} of {1} in {2} shop", count, computer.ComputerName, shopElement.Name);
} }
else else
{ {
shopElement.ShopComputers[computer.Id] = (computer, count); shopElement.ShopComputers[computer.Id] = (computer, count);
_logger.LogInformation("New document added by supply. Added {0} of {1} in {2} shop", count, computer.ComputerName, shopElement.Name); _logger.LogInformation("New computer added by supply. Added {0} of {1} in {2} shop", count, computer.ComputerName, shopElement.Name);
} }
_shopStorage.Update(new() _shopStorage.Update(new()

View File

@ -17,6 +17,6 @@ namespace ComputerShopContracts.BusinessLogicsContracts
bool Create(ShopBindingModel model); bool Create(ShopBindingModel model);
bool Update(ShopBindingModel model); bool Update(ShopBindingModel model);
bool Delete(ShopBindingModel model); bool Delete(ShopBindingModel model);
bool SupplyDocuments(ShopSearchModel model, IComputerModel computer, int count); bool SupplyComputers(ShopSearchModel model, IComputerModel computer, int count);
} }
} }

View File

@ -33,7 +33,7 @@
this.textBoxCount = new System.Windows.Forms.TextBox(); this.textBoxCount = new System.Windows.Forms.TextBox();
this.comboBoxComputer = new System.Windows.Forms.ComboBox(); this.comboBoxComputer = new System.Windows.Forms.ComboBox();
this.comboBoxShop = new System.Windows.Forms.ComboBox(); this.comboBoxShop = new System.Windows.Forms.ComboBox();
this.labelDocumentCount = new System.Windows.Forms.Label(); this.labelComputerCount = new System.Windows.Forms.Label();
this.labelComputer = new System.Windows.Forms.Label(); this.labelComputer = new System.Windows.Forms.Label();
this.labelShop = new System.Windows.Forms.Label(); this.labelShop = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
@ -86,14 +86,14 @@
this.comboBoxShop.Size = new System.Drawing.Size(220, 23); this.comboBoxShop.Size = new System.Drawing.Size(220, 23);
this.comboBoxShop.TabIndex = 13; this.comboBoxShop.TabIndex = 13;
// //
// labelDocumentCount // labelComputerCount
// //
this.labelDocumentCount.AutoSize = true; this.labelComputerCount.AutoSize = true;
this.labelDocumentCount.Location = new System.Drawing.Point(15, 89); this.labelComputerCount.Location = new System.Drawing.Point(15, 89);
this.labelDocumentCount.Name = "labelDocumentCount"; this.labelComputerCount.Name = "labelComputerCount";
this.labelDocumentCount.Size = new System.Drawing.Size(75, 15); this.labelComputerCount.Size = new System.Drawing.Size(75, 15);
this.labelDocumentCount.TabIndex = 12; this.labelComputerCount.TabIndex = 12;
this.labelDocumentCount.Text = "Количество:"; this.labelComputerCount.Text = "Количество:";
// //
// labelComputer // labelComputer
// //
@ -124,7 +124,7 @@
this.Controls.Add(this.textBoxCount); this.Controls.Add(this.textBoxCount);
this.Controls.Add(this.comboBoxComputer); this.Controls.Add(this.comboBoxComputer);
this.Controls.Add(this.comboBoxShop); this.Controls.Add(this.comboBoxShop);
this.Controls.Add(this.labelDocumentCount); this.Controls.Add(this.labelComputerCount);
this.Controls.Add(this.labelComputer); this.Controls.Add(this.labelComputer);
this.Controls.Add(this.labelShop); this.Controls.Add(this.labelShop);
this.Name = "FormShopSupply"; this.Name = "FormShopSupply";
@ -142,7 +142,7 @@
private TextBox textBoxCount; private TextBox textBoxCount;
private ComboBox comboBoxComputer; private ComboBox comboBoxComputer;
private ComboBox comboBoxShop; private ComboBox comboBoxShop;
private Label labelDocumentCount; private Label labelComputerCount;
private Label labelComputer; private Label labelComputer;
private Label labelShop; private Label labelShop;
} }

View File

@ -88,7 +88,7 @@ namespace ComputersShop
_logger.LogInformation("Создание поставки"); _logger.LogInformation("Создание поставки");
try try
{ {
var operationResult = _logicS.SupplyDocuments( var operationResult = _logicS.SupplyComputers(
new ShopSearchModel new ShopSearchModel
{ {
Id = Convert.ToInt32(comboBoxShop.SelectedValue), Id = Convert.ToInt32(comboBoxShop.SelectedValue),