исправлен FormComponents

This commit is contained in:
Данияр Аглиуллов 2023-02-05 20:48:18 +04:00
parent 9fd6e03690
commit 50364962ec
2 changed files with 5 additions and 10 deletions

View File

@ -64,18 +64,15 @@ namespace ConfectioneryView
{
if (dataGridView.SelectedRows.Count == 1)
{
var service =
Program.ServiceProvider?.GetService(typeof(FormComponent));
var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
if (service is FormComponent form)
{
form.Id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
LoadData();
}
}
private void ButtonDel_Click(object sender, EventArgs e)

View File

@ -102,8 +102,7 @@ namespace ConfectioneryView
{
if (dataGridView.SelectedRows.Count == 1)
{
var service =
Program.ServiceProvider?.GetService(typeof(FormPastryComponent));
var service = Program.ServiceProvider?.GetService(typeof(FormPastryComponent));
if (service is FormPastryComponent form)
{
int id =
@ -118,8 +117,7 @@ namespace ConfectioneryView
}
_logger.LogInformation("Изменение компонента: { ComponentName} - { Count} ",
form.ComponentModel.ComponentName, form.Count);
_pastryComponents[form.Id] = (form.ComponentModel,
form.Count);
_pastryComponents[form.Id] = (form.ComponentModel, form.Count);
LoadData();
}
}