доработки
This commit is contained in:
parent
59188c766c
commit
e9c31dc67a
@ -56,16 +56,16 @@ namespace IceCreamBusinessLogic.BusinessLogics
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool SupplyDocuments(ShopSearchModel model, IIceCreamModel document, int count)
|
||||
public bool SupplyIceCreams(ShopSearchModel model, IIceCreamModel iceCream, int count)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
}
|
||||
|
||||
if (document == null)
|
||||
if (iceCream == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(document));
|
||||
throw new ArgumentNullException(nameof(iceCream));
|
||||
}
|
||||
|
||||
if (count <= 0)
|
||||
@ -81,15 +81,15 @@ namespace IceCreamBusinessLogic.BusinessLogics
|
||||
}
|
||||
_logger.LogInformation("Shop element found. ID: {0}, Name: {1}", shopElement.Id, shopElement.Name);
|
||||
|
||||
if (shopElement.ShopIceCreams.TryGetValue(document.Id, out var sameDocument))
|
||||
if (shopElement.ShopIceCreams.TryGetValue(iceCream.Id, out var sameDocument))
|
||||
{
|
||||
shopElement.ShopIceCreams[document.Id] = (document, sameDocument.Item2 + count);
|
||||
_logger.LogInformation("Same icecream found by supply. Added {0} of {1} in {2} shop", count, document.IceCreamName, shopElement.Name);
|
||||
shopElement.ShopIceCreams[iceCream.Id] = (iceCream, sameDocument.Item2 + count);
|
||||
_logger.LogInformation("Same icecream found by supply. Added {0} of {1} in {2} shop", count, iceCream.IceCreamName, shopElement.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
shopElement.ShopIceCreams[document.Id] = (document, count);
|
||||
_logger.LogInformation("New icecream added by supply. Added {0} of {1} in {2} shop", count, document.IceCreamName, shopElement.Name);
|
||||
shopElement.ShopIceCreams[iceCream.Id] = (iceCream, count);
|
||||
_logger.LogInformation("New icecream added by supply. Added {0} of {1} in {2} shop", count, iceCream.IceCreamName, shopElement.Name);
|
||||
}
|
||||
|
||||
_shopStorage.Update(new()
|
||||
|
33
IceCreamShop/IceCreamShop/FormComponent.Designer.cs
generated
33
IceCreamShop/IceCreamShop/FormComponent.Designer.cs
generated
@ -39,40 +39,43 @@
|
||||
// labelName
|
||||
//
|
||||
this.labelName.AutoSize = true;
|
||||
this.labelName.Location = new System.Drawing.Point(17, 10);
|
||||
this.labelName.Location = new System.Drawing.Point(19, 13);
|
||||
this.labelName.Name = "labelName";
|
||||
this.labelName.Size = new System.Drawing.Size(62, 15);
|
||||
this.labelName.Size = new System.Drawing.Size(80, 20);
|
||||
this.labelName.TabIndex = 0;
|
||||
this.labelName.Text = "Название:";
|
||||
//
|
||||
// labelCost
|
||||
//
|
||||
this.labelCost.AutoSize = true;
|
||||
this.labelCost.Location = new System.Drawing.Point(17, 42);
|
||||
this.labelCost.Location = new System.Drawing.Point(19, 56);
|
||||
this.labelCost.Name = "labelCost";
|
||||
this.labelCost.Size = new System.Drawing.Size(38, 15);
|
||||
this.labelCost.Size = new System.Drawing.Size(48, 20);
|
||||
this.labelCost.TabIndex = 1;
|
||||
this.labelCost.Text = "Цена:";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
this.textBoxName.Location = new System.Drawing.Point(85, 7);
|
||||
this.textBoxName.Location = new System.Drawing.Point(97, 9);
|
||||
this.textBoxName.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.textBoxName.Name = "textBoxName";
|
||||
this.textBoxName.Size = new System.Drawing.Size(223, 23);
|
||||
this.textBoxName.Size = new System.Drawing.Size(254, 27);
|
||||
this.textBoxName.TabIndex = 2;
|
||||
//
|
||||
// textBoxCost
|
||||
//
|
||||
this.textBoxCost.Location = new System.Drawing.Point(85, 39);
|
||||
this.textBoxCost.Location = new System.Drawing.Point(97, 52);
|
||||
this.textBoxCost.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.textBoxCost.Name = "textBoxCost";
|
||||
this.textBoxCost.Size = new System.Drawing.Size(100, 23);
|
||||
this.textBoxCost.Size = new System.Drawing.Size(114, 27);
|
||||
this.textBoxCost.TabIndex = 3;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
this.buttonSave.Location = new System.Drawing.Point(152, 73);
|
||||
this.buttonSave.Location = new System.Drawing.Point(163, 97);
|
||||
this.buttonSave.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonSave.Name = "buttonSave";
|
||||
this.buttonSave.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonSave.Size = new System.Drawing.Size(97, 31);
|
||||
this.buttonSave.TabIndex = 4;
|
||||
this.buttonSave.Text = "Сохранить";
|
||||
this.buttonSave.UseVisualStyleBackColor = true;
|
||||
@ -80,9 +83,10 @@
|
||||
//
|
||||
// buttonCancle
|
||||
//
|
||||
this.buttonCancle.Location = new System.Drawing.Point(233, 73);
|
||||
this.buttonCancle.Location = new System.Drawing.Point(266, 97);
|
||||
this.buttonCancle.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonCancle.Name = "buttonCancle";
|
||||
this.buttonCancle.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonCancle.Size = new System.Drawing.Size(86, 31);
|
||||
this.buttonCancle.TabIndex = 5;
|
||||
this.buttonCancle.Text = "Отмена";
|
||||
this.buttonCancle.UseVisualStyleBackColor = true;
|
||||
@ -90,15 +94,16 @@
|
||||
//
|
||||
// FormComponent
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(327, 108);
|
||||
this.ClientSize = new System.Drawing.Size(374, 144);
|
||||
this.Controls.Add(this.buttonCancle);
|
||||
this.Controls.Add(this.buttonSave);
|
||||
this.Controls.Add(this.textBoxCost);
|
||||
this.Controls.Add(this.textBoxName);
|
||||
this.Controls.Add(this.labelCost);
|
||||
this.Controls.Add(this.labelName);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "FormComponent";
|
||||
this.Text = "Компонент";
|
||||
this.Load += new System.EventHandler(this.FormComponent_Load);
|
||||
|
@ -45,6 +45,7 @@ namespace IceCreamShopView
|
||||
{
|
||||
textBoxName.Text = view.Name;
|
||||
textBoxAddress.Text = view.Adress;
|
||||
dateTimePicker.Text = view.OpeningDate.ToString();
|
||||
_shopIceCreams = view.ShopIceCreams ?? new Dictionary<int, (IIceCreamModel, int)>();
|
||||
LoadData();
|
||||
}
|
||||
|
44
IceCreamShop/IceCreamShop/FormShopSupply.Designer.cs
generated
44
IceCreamShop/IceCreamShop/FormShopSupply.Designer.cs
generated
@ -40,10 +40,9 @@
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Location = new System.Drawing.Point(252, 134);
|
||||
this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonCancel.Location = new System.Drawing.Point(288, 179);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(82, 22);
|
||||
this.buttonCancel.Size = new System.Drawing.Size(94, 29);
|
||||
this.buttonCancel.TabIndex = 17;
|
||||
this.buttonCancel.Text = "Отмена";
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
@ -51,10 +50,9 @@
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
this.buttonSave.Location = new System.Drawing.Point(164, 134);
|
||||
this.buttonSave.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonSave.Location = new System.Drawing.Point(187, 179);
|
||||
this.buttonSave.Name = "buttonSave";
|
||||
this.buttonSave.Size = new System.Drawing.Size(82, 22);
|
||||
this.buttonSave.Size = new System.Drawing.Size(94, 29);
|
||||
this.buttonSave.TabIndex = 16;
|
||||
this.buttonSave.Text = "Сохранить";
|
||||
this.buttonSave.UseVisualStyleBackColor = true;
|
||||
@ -62,63 +60,60 @@
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
this.textBoxCount.Location = new System.Drawing.Point(115, 89);
|
||||
this.textBoxCount.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.textBoxCount.Location = new System.Drawing.Point(131, 119);
|
||||
this.textBoxCount.Name = "textBoxCount";
|
||||
this.textBoxCount.Size = new System.Drawing.Size(110, 23);
|
||||
this.textBoxCount.Size = new System.Drawing.Size(125, 27);
|
||||
this.textBoxCount.TabIndex = 15;
|
||||
//
|
||||
// comboBoxDocument
|
||||
//
|
||||
this.comboBoxDocument.FormattingEnabled = true;
|
||||
this.comboBoxDocument.Location = new System.Drawing.Point(115, 49);
|
||||
this.comboBoxDocument.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.comboBoxDocument.Location = new System.Drawing.Point(131, 65);
|
||||
this.comboBoxDocument.Name = "comboBoxDocument";
|
||||
this.comboBoxDocument.Size = new System.Drawing.Size(220, 23);
|
||||
this.comboBoxDocument.Size = new System.Drawing.Size(251, 28);
|
||||
this.comboBoxDocument.TabIndex = 14;
|
||||
//
|
||||
// comboBoxShop
|
||||
//
|
||||
this.comboBoxShop.FormattingEnabled = true;
|
||||
this.comboBoxShop.Location = new System.Drawing.Point(115, 11);
|
||||
this.comboBoxShop.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.comboBoxShop.Location = new System.Drawing.Point(131, 15);
|
||||
this.comboBoxShop.Name = "comboBoxShop";
|
||||
this.comboBoxShop.Size = new System.Drawing.Size(220, 23);
|
||||
this.comboBoxShop.Size = new System.Drawing.Size(251, 28);
|
||||
this.comboBoxShop.TabIndex = 13;
|
||||
//
|
||||
// labelDocumentCount
|
||||
//
|
||||
this.labelDocumentCount.AutoSize = true;
|
||||
this.labelDocumentCount.Location = new System.Drawing.Point(8, 89);
|
||||
this.labelDocumentCount.Location = new System.Drawing.Point(9, 119);
|
||||
this.labelDocumentCount.Name = "labelDocumentCount";
|
||||
this.labelDocumentCount.Size = new System.Drawing.Size(75, 15);
|
||||
this.labelDocumentCount.Size = new System.Drawing.Size(93, 20);
|
||||
this.labelDocumentCount.TabIndex = 12;
|
||||
this.labelDocumentCount.Text = "Количество:";
|
||||
//
|
||||
// labelDocument
|
||||
//
|
||||
this.labelDocument.AutoSize = true;
|
||||
this.labelDocument.Location = new System.Drawing.Point(8, 51);
|
||||
this.labelDocument.Location = new System.Drawing.Point(9, 68);
|
||||
this.labelDocument.Name = "labelDocument";
|
||||
this.labelDocument.Size = new System.Drawing.Size(64, 15);
|
||||
this.labelDocument.Size = new System.Drawing.Size(97, 20);
|
||||
this.labelDocument.TabIndex = 11;
|
||||
this.labelDocument.Text = "Документ:";
|
||||
this.labelDocument.Text = "Мороженое:";
|
||||
//
|
||||
// labelShop
|
||||
//
|
||||
this.labelShop.AutoSize = true;
|
||||
this.labelShop.Location = new System.Drawing.Point(8, 11);
|
||||
this.labelShop.Location = new System.Drawing.Point(9, 15);
|
||||
this.labelShop.Name = "labelShop";
|
||||
this.labelShop.RightToLeft = System.Windows.Forms.RightToLeft.No;
|
||||
this.labelShop.Size = new System.Drawing.Size(57, 15);
|
||||
this.labelShop.Size = new System.Drawing.Size(72, 20);
|
||||
this.labelShop.TabIndex = 10;
|
||||
this.labelShop.Text = "Магазин:";
|
||||
//
|
||||
// FormShopSupply
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(354, 165);
|
||||
this.ClientSize = new System.Drawing.Size(405, 220);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonSave);
|
||||
this.Controls.Add(this.textBoxCount);
|
||||
@ -127,6 +122,7 @@
|
||||
this.Controls.Add(this.labelDocumentCount);
|
||||
this.Controls.Add(this.labelDocument);
|
||||
this.Controls.Add(this.labelShop);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "FormShopSupply";
|
||||
this.Text = "FormShopSupply";
|
||||
this.Load += new System.EventHandler(this.FormShopSupply_Load);
|
||||
|
@ -46,7 +46,7 @@ namespace IceCreamShopView
|
||||
_logger.LogInformation("Создание поставки");
|
||||
try
|
||||
{
|
||||
var operationResult = _logicS.SupplyDocuments(
|
||||
var operationResult = _logicS.SupplyIceCreams(
|
||||
new ShopSearchModel
|
||||
{
|
||||
Id = Convert.ToInt32(comboBoxShop.SelectedValue),
|
||||
|
@ -17,6 +17,6 @@ namespace IceCreamShopContracts.BusinessLogicsContracts
|
||||
bool Create(ShopBindingModel model);
|
||||
bool Update(ShopBindingModel model);
|
||||
bool Delete(ShopBindingModel model);
|
||||
bool SupplyDocuments(ShopSearchModel model, IIceCreamModel document, int count);
|
||||
bool SupplyIceCreams(ShopSearchModel model, IIceCreamModel iceCream, int count);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user