fix
This commit is contained in:
parent
655a9190c9
commit
1ee31d1267
@ -6,13 +6,13 @@ namespace FoodOrdersView
|
||||
public partial class FormDeliveryDishes : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDishLogic _logicC;
|
||||
private readonly IDishLogic _logicD;
|
||||
private readonly IShopLogic _logicS;
|
||||
public FormDeliveryDishes(ILogger<FormDeliveryDishes> logger, IDishLogic logicC, IShopLogic logicS)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicC = logicC;
|
||||
_logicD = logicC;
|
||||
_logicS = logicS;
|
||||
}
|
||||
private void FormDeliveryDishes_Load(object sender, EventArgs e)
|
||||
@ -37,7 +37,7 @@ namespace FoodOrdersView
|
||||
_logger.LogInformation("Загрузка блюд");
|
||||
try
|
||||
{
|
||||
var list = _logicC.ReadList(null);
|
||||
var list = _logicD.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
comboBoxDish.DisplayMember = "DishName";
|
||||
@ -72,24 +72,23 @@ namespace FoodOrdersView
|
||||
_logger.LogInformation("Пополнение магазина");
|
||||
try
|
||||
{
|
||||
var operationResult = _logicS.DeliveryDishes(new ShopSearchModel
|
||||
{
|
||||
ShopName = comboBoxShop.Text,
|
||||
}, _logicC.ReadElement(new DishSearchModel{ DishName = comboBoxDish.Text })!, Convert.ToInt32(textBoxCount.Text));
|
||||
var operationResult = _logicS.DeliveryDishes(
|
||||
new ShopSearchModel { ShopName = comboBoxShop.Text,},
|
||||
_logicD.ReadElement(new DishSearchModel{ DishName = comboBoxDish.Text })!,
|
||||
Convert.ToInt32(textBoxCount.Text)
|
||||
);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при пополнении магазина. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Пополнение прошло успешно", "Сообщение",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
MessageBox.Show("Пополнение прошло успешно", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка пополнения магазина");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace FoodOrdersBusinessLogic.BusinessLogics
|
||||
}
|
||||
if (element.ShopDishes.ContainsKey(dish.Id))
|
||||
{
|
||||
element.ShopDishes[dish.Id] = (element.ShopDishes[dish.Id].Item1, element.ShopDishes[dish.Id].Item2 + count);
|
||||
element.ShopDishes[dish.Id] = (dish, element.ShopDishes[dish.Id].Item2 + count);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -34,9 +34,7 @@ namespace FoodOrdersListImplement.Implements
|
||||
}
|
||||
foreach (var shop in _source.Shops)
|
||||
{
|
||||
if ((!string.IsNullOrEmpty(model.ShopName) &&
|
||||
shop.ShopName == model.ShopName) ||
|
||||
(model.Id.HasValue && shop.Id == model.Id))
|
||||
if ((!string.IsNullOrEmpty(model.ShopName) && shop.ShopName == model.ShopName) || (model.Id.HasValue && shop.Id == model.Id))
|
||||
{
|
||||
return shop.GetViewModel;
|
||||
}
|
||||
|
@ -8,15 +8,11 @@ namespace FoodOrdersListImplement.Models
|
||||
{
|
||||
public class Shop : IShopModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string ShopName { get; private set; } = string.Empty;
|
||||
public string Address { get; private set; } = string.Empty;
|
||||
public DateTime DateOfOpening { get; private set; } = DateTime.Now;
|
||||
public int Id { get; private set; }
|
||||
public Dictionary<int, (IDishModel, int)> ShopDishes
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = new Dictionary<int, (IDishModel, int)>();
|
||||
public Dictionary<int, (IDishModel, int)> ShopDishes { get; private set; } = new Dictionary<int, (IDishModel, int)>();
|
||||
public static Shop? Create(ShopBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
|
Loading…
x
Reference in New Issue
Block a user