PIbd-23. Elatomtsev L.K. Lab work 01 #2

Closed
DeerElk wants to merge 5 commits from lab1 into main
2 changed files with 21 additions and 4 deletions
Showing only changes of commit 08194a1632 - Show all commits

View File

@ -113,7 +113,7 @@
//
// referencesToolStripMenuItem
//
referencesToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { pastriesToolStripMenuItem, componentsToolStripMenuItem });
referencesToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, pastriesToolStripMenuItem });
referencesToolStripMenuItem.Name = "referencesToolStripMenuItem";
referencesToolStripMenuItem.Size = new Size(139, 29);
referencesToolStripMenuItem.Text = "Справочники";

View File

@ -79,7 +79,7 @@ namespace ConfectioneryView
try
{
var operationResult = _orderLogic.TakeOrderInWork(
new OrderBindingModel { Id = id });
CreateBindingModel(id));
if (!operationResult)
{
throw new Exception(
@ -107,7 +107,7 @@ namespace ConfectioneryView
try
{
var operationResult = _orderLogic.FinishOrder(
new OrderBindingModel { Id = id });
CreateBindingModel(id));
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. " +
@ -134,7 +134,7 @@ namespace ConfectioneryView
try
{
var operationResult = _orderLogic.DeliveryOrder(
new OrderBindingModel { Id = id });
CreateBindingModel(id));
if (!operationResult)
{
throw new Exception("Ошибка при сохранении. " +
@ -155,5 +155,22 @@ namespace ConfectioneryView
{
LoadData();
}
private OrderBindingModel CreateBindingModel(int id, bool isDone = false)
{
return new OrderBindingModel
Review

Не требуется каждый раз передавать все данные заказа

Не требуется каждый раз передавать все данные заказа
{
Id = id,
PastryId = Convert.ToInt32(dataGridView.SelectedRows[
0].Cells["PastryId"].Value),
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[
0].Cells["Status"].Value.ToString()),
Count = Convert.ToInt32(dataGridView.SelectedRows[
0].Cells["Count"].Value),
Sum = double.Parse(dataGridView.SelectedRows[
0].Cells["Sum"].Value.ToString()),
DateCreate = DateTime.Parse(dataGridView.SelectedRows[
0].Cells["DateCreate"].Value.ToString()),
};
}
}
}