This commit is contained in:
1yuee 2023-02-07 11:03:47 +04:00
parent 2cb3292cf8
commit 1262146e7a
8 changed files with 16 additions and 11 deletions

View File

@ -68,7 +68,6 @@ namespace ConfectioneryBusinessLogic
throw new ArgumentNullException("Нет названия магазина", throw new ArgumentNullException("Нет названия магазина",
nameof(model.Name)); nameof(model.Name));
} }
model.Pastries = new();
if (_shopStorage.Update(model) == null) if (_shopStorage.Update(model) == null)
{ {
_logger.LogWarning("Update operation failed"); _logger.LogWarning("Update operation failed");
@ -137,7 +136,7 @@ namespace ConfectioneryBusinessLogic
if (element.Pastries.TryGetValue(pastry.Id, out var pair)) if (element.Pastries.TryGetValue(pastry.Id, out var pair))
{ {
pair.Item2 += count; element.Pastries[pastry.Id] = (pastry, count + pair.Item2);
_logger.LogInformation( _logger.LogInformation(
"AddPastryInShop. Has been added {count} {pastry} in {ShopName}", "AddPastryInShop. Has been added {count} {pastry} in {ShopName}",
count, pastry.PastryName, element.Name); count, pastry.PastryName, element.Name);
@ -149,6 +148,14 @@ namespace ConfectioneryBusinessLogic
"AddPastryInShop. Has been added {count} new Pastry {pastry} in {ShopName}", "AddPastryInShop. Has been added {count} new Pastry {pastry} in {ShopName}",
count, pastry.PastryName, element.Name); count, pastry.PastryName, element.Name);
} }
_shopStorage.Update(new()
{
Id = element.Id,
Address = element.Address,
Name = element.Name,
DateOpening = element.DateOpening,
Pastries = element.Pastries
});
return true; return true;
} }
} }

View File

@ -33,7 +33,7 @@ namespace ConfectioneryListImplement
Name = model.Name, Name = model.Name,
Address = model.Address, Address = model.Address,
DateOpening = model.DateOpening, DateOpening = model.DateOpening,
Pastries = model.Pastries Pastries = new()
}; };
} }
public void Update(ShopBindingModel? model) public void Update(ShopBindingModel? model)

View File

@ -104,6 +104,7 @@
this.Controls.Add(this.dataGridView); this.Controls.Add(this.dataGridView);
this.Name = "FormComponents"; this.Name = "FormComponents";
this.Text = "Редактирование компонентов"; this.Text = "Редактирование компонентов";
this.Load += new System.EventHandler(this.FormComponents_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);

View File

@ -179,6 +179,7 @@
this.MainMenuStrip = this.menuStrip1; this.MainMenuStrip = this.menuStrip1;
this.Name = "FormMain"; this.Name = "FormMain";
this.Text = "Кондитерская"; this.Text = "Кондитерская";
this.Load += new System.EventHandler(this.FormMain_Load);
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();

View File

@ -29,7 +29,8 @@ namespace ConfectioneryView
if (list != null) if (list != null)
{ {
dataGridView.DataSource = list; dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false; dataGridView.Columns["Id"].HeaderText = "Íîìåð çàêàçà";
dataGridView.Columns["PastryId"].Visible = false;
dataGridView.Columns["PastryName"].AutoSizeMode = dataGridView.Columns["PastryName"].AutoSizeMode =
DataGridViewAutoSizeColumnMode.Fill; DataGridViewAutoSizeColumnMode.Fill;
} }

View File

@ -207,6 +207,7 @@
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Name = "FormPastry"; this.Name = "FormPastry";
this.Text = "Кондитерское изделие"; this.Text = "Кондитерское изделие";
this.Load += new System.EventHandler(this.FormPastry_Load);
this.groupBox1.ResumeLayout(false); this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);

View File

@ -70,13 +70,6 @@ namespace ConfectioneryView
comboBoxShop.Text = model.Name; comboBoxShop.Text = model.Name;
textBoxAddress.Text = model.Address; textBoxAddress.Text = model.Address;
textBoxDateOpening.Text = Convert.ToString(model.DateOpening); textBoxDateOpening.Text = Convert.ToString(model.DateOpening);
textBoxAddress.Text = vmodel.Address;
textBoxDateOpening.Text = Convert.ToString(vmodel.DateOpening);
}
textBoxAddress.Text = vmodel.Address;
textBoxDateOpening.Text = Convert.ToString(vmodel.DateOpening);
}
dataGridView.Rows.Clear(); dataGridView.Rows.Clear();
foreach (var el in model.Pastries.Values) foreach (var el in model.Pastries.Values)
{ {

View File

@ -104,6 +104,7 @@
this.Controls.Add(this.dataGridView); this.Controls.Add(this.dataGridView);
this.Name = "FormViewPastry"; this.Name = "FormViewPastry";
this.Text = "Редактирование изделий"; this.Text = "Редактирование изделий";
this.Load += new System.EventHandler(this.FormViewPastry_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);