Готово2
This commit is contained in:
parent
4b9b9046f0
commit
adbc7928e6
@ -47,13 +47,13 @@ namespace CarRepairShop
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
int id = Convert.ToInt32(comboBoxRepair.SelectedValue);
|
int id = Convert.ToInt32(comboBoxRepair.SelectedValue);
|
||||||
var product = _logicR.ReadElement(new RepairSearchModel
|
var repair = _logicR.ReadElement(new RepairSearchModel
|
||||||
{
|
{
|
||||||
Id
|
Id
|
||||||
= id
|
= id
|
||||||
});
|
});
|
||||||
int count = Convert.ToInt32(textBoxCount.Text);
|
int count = Convert.ToInt32(textBoxCount.Text);
|
||||||
textBoxSum.Text = Math.Round(count * (product?.Price ?? 0),
|
textBoxSum.Text = Math.Round(count * (repair?.Price ?? 0),
|
||||||
2).ToString();
|
2).ToString();
|
||||||
_logger.LogInformation("Расчет суммы заказа");
|
_logger.LogInformation("Расчет суммы заказа");
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ namespace CarRepairShop
|
|||||||
}
|
}
|
||||||
if (comboBoxRepair.SelectedValue == null)
|
if (comboBoxRepair.SelectedValue == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Выберите изделие", "Ошибка",
|
MessageBox.Show("Выберите ремонт", "Ошибка",
|
||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace CarRepairShop
|
|||||||
{
|
{
|
||||||
if (_id.HasValue)
|
if (_id.HasValue)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Загрузка изделия");
|
_logger.LogInformation("Загрузка ремонта");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var view = _logic.ReadElement(new RepairSearchModel
|
var view = _logic.ReadElement(new RepairSearchModel
|
||||||
@ -41,7 +41,7 @@ namespace CarRepairShop
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка загрузки изделия");
|
_logger.LogError(ex, "Ошибка загрузки ремонта");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
MessageBoxIcon.Error);
|
MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ namespace CarRepairShop
|
|||||||
}
|
}
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Загрузка компонент изделия");
|
_logger.LogInformation("Загрузка компонент ремонта");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_repairComponents != null)
|
if (_repairComponents != null)
|
||||||
@ -64,7 +64,7 @@ namespace CarRepairShop
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка загрузки компонент изделия");
|
_logger.LogError(ex, "Ошибка загрузки компонент ремонта");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
MessageBoxIcon.Error);
|
MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ namespace CarRepairShop
|
|||||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Сохранение изделия");
|
_logger.LogInformation("Сохранение ремонта");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var model = new RepairBindingModel
|
var model = new RepairBindingModel
|
||||||
@ -191,7 +191,7 @@ namespace CarRepairShop
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка сохранения изделия");
|
_logger.LogError(ex, "Ошибка сохранения ремонта");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
MessageBoxIcon.Error);
|
MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ namespace CarRepairShop
|
|||||||
dataGridView.Columns["RepairName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["RepairName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
dataGridView.Columns["RepairComponents"].Visible = false;
|
dataGridView.Columns["RepairComponents"].Visible = false;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузка компьютеров");
|
_logger.LogInformation("Загрузка ремонтов");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -92,12 +92,12 @@ namespace CarRepairShopBusinessLogic
|
|||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(model.RepairName))
|
if (string.IsNullOrEmpty(model.RepairName))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Нет названия мороженного",
|
throw new ArgumentNullException("Нет названия ремонта",
|
||||||
nameof(model.RepairName));
|
nameof(model.RepairName));
|
||||||
}
|
}
|
||||||
if (model.Price <= 0)
|
if (model.Price <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Цена мороженного должна быть больше 0", nameof(model.Price));
|
throw new ArgumentNullException("Цена ремонта должна быть больше 0", nameof(model.Price));
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Repair. Repair:{Repair}. Price:{ Price }. Id: { Id}", model.RepairName, model.Price, model.Id);
|
_logger.LogInformation("Repair. Repair:{Repair}. Price:{ Price }. Id: { Id}", model.RepairName, model.Price, model.Id);
|
||||||
var element = _repairStorage.GetElement(new RepairSearchModel
|
var element = _repairStorage.GetElement(new RepairSearchModel
|
||||||
|
@ -18,7 +18,7 @@ namespace CarRepairShopListImplement.Implements
|
|||||||
var result = new List<OrderViewModel>();
|
var result = new List<OrderViewModel>();
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
result.Add(AccessIceCreamStorage(order.GetViewModel));
|
result.Add(AccessRepairStorage(order.GetViewModel));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ namespace CarRepairShopListImplement.Implements
|
|||||||
{
|
{
|
||||||
if (order.Id == model.Id)
|
if (order.Id == model.Id)
|
||||||
{
|
{
|
||||||
result.Add(AccessIceCreamStorage(order.GetViewModel));
|
result.Add(AccessRepairStorage(order.GetViewModel));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -97,7 +97,7 @@ namespace CarRepairShopListImplement.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel AccessIceCreamStorage(OrderViewModel model)
|
public OrderViewModel AccessRepairStorage(OrderViewModel model)
|
||||||
{
|
{
|
||||||
foreach (var repair in _source.Repairs)
|
foreach (var repair in _source.Repairs)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user