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;
}
public bool SupplyDocuments(ShopSearchModel model, IComputerModel computer, int count)
public bool SupplyComputers(ShopSearchModel model, IComputerModel computer, int count)
{
if (model == null)
{
@ -81,15 +81,15 @@ namespace ComputerShopBusinessLogic.BusinessLogics
}
_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);
_logger.LogInformation("Same document found by supply. Added {0} of {1} in {2} shop", count, computer.ComputerName, shopElement.Name);
shopElement.ShopComputers[computer.Id] = (computer, sameComputer.Item2 + count);
_logger.LogInformation("Same computer found by supply. Added {0} of {1} in {2} shop", count, computer.ComputerName, shopElement.Name);
}
else
{
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()

View File

@ -17,6 +17,6 @@ namespace ComputerShopContracts.BusinessLogicsContracts
bool Create(ShopBindingModel model);
bool Update(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.comboBoxComputer = 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.labelShop = new System.Windows.Forms.Label();
this.SuspendLayout();
@ -86,14 +86,14 @@
this.comboBoxShop.Size = new System.Drawing.Size(220, 23);
this.comboBoxShop.TabIndex = 13;
//
// labelDocumentCount
// labelComputerCount
//
this.labelDocumentCount.AutoSize = true;
this.labelDocumentCount.Location = new System.Drawing.Point(15, 89);
this.labelDocumentCount.Name = "labelDocumentCount";
this.labelDocumentCount.Size = new System.Drawing.Size(75, 15);
this.labelDocumentCount.TabIndex = 12;
this.labelDocumentCount.Text = "Количество:";
this.labelComputerCount.AutoSize = true;
this.labelComputerCount.Location = new System.Drawing.Point(15, 89);
this.labelComputerCount.Name = "labelComputerCount";
this.labelComputerCount.Size = new System.Drawing.Size(75, 15);
this.labelComputerCount.TabIndex = 12;
this.labelComputerCount.Text = "Количество:";
//
// labelComputer
//
@ -124,7 +124,7 @@
this.Controls.Add(this.textBoxCount);
this.Controls.Add(this.comboBoxComputer);
this.Controls.Add(this.comboBoxShop);
this.Controls.Add(this.labelDocumentCount);
this.Controls.Add(this.labelComputerCount);
this.Controls.Add(this.labelComputer);
this.Controls.Add(this.labelShop);
this.Name = "FormShopSupply";
@ -142,7 +142,7 @@
private TextBox textBoxCount;
private ComboBox comboBoxComputer;
private ComboBox comboBoxShop;
private Label labelDocumentCount;
private Label labelComputerCount;
private Label labelComputer;
private Label labelShop;
}

View File

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