This commit is contained in:
Ino 2023-05-16 10:08:44 +04:00
parent 6d12916f30
commit 563b8c7aa3
5 changed files with 21 additions and 32 deletions

View File

@ -31,9 +31,8 @@ namespace IceCreamShopView
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки клиентов");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)

View File

@ -42,31 +42,27 @@ namespace IceCreamShopView
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки компонентов");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonAdd_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormComponent>();
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
LoadData();
}
private void buttonChange_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
{
var form = DependencyManager.Instance.Resolve<FormComponent>();
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
form.Id =
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
LoadData();
}
}
private void buttonDelete_Click(object sender, EventArgs e)

View File

@ -106,18 +106,15 @@ namespace IceCreamShopView
{
return;
}
_logger.LogInformation("Добавление нового компонента: { ComponentName}- { Count}",
form.ComponentModel.ComponentName, form.Count);
if (_iceCreamComponents.ContainsKey(form.Id))
_logger.LogInformation("Добавление нового компонента:{ ComponentName}- { Count}", form.ComponentModel.ComponentName, form.Count);
if (_iceCreamComponents.ContainsKey(form.Id))
{
_iceCreamComponents[form.Id] = (form.ComponentModel,
form.Count);
}
_iceCreamComponents[form.Id] = (form.ComponentModel, form.Count);
}
else
{
_iceCreamComponents.Add(form.Id, (form.ComponentModel,
form.Count));
}
_iceCreamComponents.Add(form.Id, (form.ComponentModel, form.Count));
}
LoadData();
}
}
@ -136,9 +133,8 @@ namespace IceCreamShopView
{
return;
}
_logger.LogInformation("Изменение компонента: { ComponentName} - { Count} ",
form.ComponentModel.ComponentName, form.Count);
_iceCreamComponents[id] = (form.ComponentModel, form.Count);
_logger.LogInformation("Изменение компонента:{ ComponentName}- { Count}", form.ComponentModel.ComponentName, form.Count);
_iceCreamComponents[id] = (form.ComponentModel, form.Count);
LoadData();
}
}

View File

@ -42,9 +42,8 @@ namespace IceCreamShopView
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка загрузки мороженого");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonAdd_Click(object sender, EventArgs e)

View File

@ -42,7 +42,6 @@ namespace IceCreamShopView
private void LoadData()
{
_logger.LogInformation("Загрузка заказов");
try
{
dataGridView.FillAndConfigGrid(_orderLogic.ReadList(null));