fix
This commit is contained in:
parent
512d2741d5
commit
33316f60a6
@ -8,7 +8,7 @@ namespace FoodOrdersView
|
||||
public partial class FormComponent : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IComponentLogic _logic;
|
||||
private readonly IComponentLogic _logicC;
|
||||
private int? _id;
|
||||
public int Id { set { _id = value; } }
|
||||
|
||||
@ -16,7 +16,7 @@ namespace FoodOrdersView
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
_logicC = logic;
|
||||
}
|
||||
|
||||
private void FormComponent_Load(object sender, EventArgs e)
|
||||
@ -26,7 +26,7 @@ namespace FoodOrdersView
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Получение блюда");
|
||||
var view = _logic.ReadElement(new ComponentSearchModel
|
||||
var view = _logicC.ReadElement(new ComponentSearchModel
|
||||
{
|
||||
Id = _id.Value
|
||||
});
|
||||
@ -61,7 +61,7 @@ namespace FoodOrdersView
|
||||
ComponentName = textBoxName.Text,
|
||||
Cost = Convert.ToDouble(textBoxCost.Text)
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
var operationResult = _id.HasValue ? _logicC.Update(model) : _logicC.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
|
@ -7,12 +7,12 @@ namespace FoodOrdersView
|
||||
public partial class FormComponents : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IComponentLogic _logic;
|
||||
private readonly IComponentLogic _logicC;
|
||||
public FormComponents(ILogger<FormComponents> logger, IComponentLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
_logicC = logic;
|
||||
}
|
||||
private void FormComponents_Load(object sender, EventArgs e)
|
||||
{
|
||||
@ -22,7 +22,7 @@ namespace FoodOrdersView
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
var list = _logicC.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
@ -74,7 +74,7 @@ namespace FoodOrdersView
|
||||
_logger.LogInformation("Удаление блюда");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new ComponentBindingModel { Id = id }))
|
||||
if (!_logicC.Delete(new ComponentBindingModel { Id = id }))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
|
@ -8,13 +8,13 @@ namespace FoodOrdersView
|
||||
public partial class FormCreateOrder : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDishLogic _logicS;
|
||||
private readonly IDishLogic _logicD;
|
||||
private readonly IOrderLogic _logicO;
|
||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, IDishLogic logicS, IOrderLogic logicO)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicS = logicS;
|
||||
_logicD = logicS;
|
||||
_logicO = logicO;
|
||||
}
|
||||
private void FormCreateOrder_Load(object sender, EventArgs e)
|
||||
@ -22,7 +22,7 @@ namespace FoodOrdersView
|
||||
_logger.LogInformation("Загрузка Набор блюд для заказа");
|
||||
try
|
||||
{
|
||||
var list = _logicS.ReadList(null);
|
||||
var list = _logicD.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
comboBoxDish.DisplayMember = "DishName";
|
||||
@ -45,7 +45,7 @@ namespace FoodOrdersView
|
||||
try
|
||||
{
|
||||
int id = Convert.ToInt32(comboBoxDish.SelectedValue);
|
||||
var product = _logicS.ReadElement(new DishSearchModel { Id = id });
|
||||
var product = _logicD.ReadElement(new DishSearchModel { Id = id });
|
||||
int count = Convert.ToInt32(textBoxCount.Text);
|
||||
textBoxSum.Text = Math.Round(count * (product?.Price ?? 0), 2).ToString();
|
||||
_logger.LogInformation("Расчет суммы заказа");
|
||||
|
@ -9,7 +9,7 @@ namespace FoodOrdersView
|
||||
public partial class FormDish : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDishLogic _logic;
|
||||
private readonly IDishLogic _logicD;
|
||||
private int? _id;
|
||||
private Dictionary<int, (IComponentModel, int)> _dishComponents;
|
||||
public int Id { set { _id = value; } }
|
||||
@ -17,7 +17,7 @@ namespace FoodOrdersView
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
_logicD = logic;
|
||||
_dishComponents = new Dictionary<int, (IComponentModel, int)>();
|
||||
}
|
||||
private void FormDish_Load(object sender, EventArgs e)
|
||||
@ -27,7 +27,7 @@ namespace FoodOrdersView
|
||||
_logger.LogInformation("Загрузка набор блюд");
|
||||
try
|
||||
{
|
||||
var view = _logic.ReadElement(new DishSearchModel
|
||||
var view = _logicD.ReadElement(new DishSearchModel
|
||||
{
|
||||
Id = _id.Value
|
||||
});
|
||||
@ -171,7 +171,7 @@ namespace FoodOrdersView
|
||||
Price = Convert.ToDouble(textBoxPrice.Text),
|
||||
DishComponents = _dishComponents
|
||||
};
|
||||
var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model);
|
||||
var operationResult = _id.HasValue ? _logicD.Update(model) : _logicD.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
|
@ -7,12 +7,12 @@ namespace FoodOrdersView
|
||||
public partial class FormDishes : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDishLogic _logic;
|
||||
private readonly IDishLogic _logicD;
|
||||
public FormDishes(ILogger<FormDishes> logger, IDishLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
_logicD = logic;
|
||||
}
|
||||
|
||||
private void FormDocuments_Load(object sender, EventArgs e)
|
||||
@ -23,7 +23,7 @@ namespace FoodOrdersView
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
var list = _logicD.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
@ -78,7 +78,7 @@ namespace FoodOrdersView
|
||||
_logger.LogInformation("Удаление набор блюд");
|
||||
try
|
||||
{
|
||||
if (!_logic.Delete(new DishBindingModel
|
||||
if (!_logicD.Delete(new DishBindingModel
|
||||
{
|
||||
Id = id
|
||||
}))
|
||||
|
@ -8,12 +8,12 @@ namespace FoodOrdersView
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderLogic _orderLogic;
|
||||
private readonly IOrderLogic _logicO;
|
||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_orderLogic = orderLogic;
|
||||
_logicO = orderLogic;
|
||||
}
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
@ -24,7 +24,7 @@ namespace FoodOrdersView
|
||||
_logger.LogInformation("Загрузка заказов");
|
||||
try
|
||||
{
|
||||
var list = _orderLogic.ReadList(null);
|
||||
var list = _logicO.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
@ -71,7 +71,7 @@ namespace FoodOrdersView
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel
|
||||
var operationResult = _logicO.TakeOrderInWork(new OrderBindingModel
|
||||
{
|
||||
Id = id,
|
||||
DishId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DishId"].Value),
|
||||
@ -101,7 +101,7 @@ namespace FoodOrdersView
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel
|
||||
var operationResult = _logicO.FinishOrder(new OrderBindingModel
|
||||
{
|
||||
Id = id,
|
||||
DishId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DishId"].Value),
|
||||
@ -131,7 +131,7 @@ namespace FoodOrdersView
|
||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
|
||||
try
|
||||
{
|
||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel
|
||||
var operationResult = _logicO.DeliveryOrder(new OrderBindingModel
|
||||
{
|
||||
Id = id,
|
||||
DishId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DishId"].Value),
|
||||
|
Loading…
Reference in New Issue
Block a user