ISEbd-21 Melnikov I. O. Lab work 01 Base #1
@ -67,8 +67,7 @@ namespace BlacksmithWorkshopView
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
@ -97,4 +96,4 @@ namespace BlacksmithWorkshopView
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -41,8 +41,7 @@ namespace BlacksmithWorkshopView
|
||||
Id = id
|
||||
});
|
||||
int count = Convert.ToInt32(textBoxCount.Text);
|
||||
textBoxSum.Text = Math.Round(count * (manufacture?.Price ?? 0),
|
||||
2).ToString();
|
||||
textBoxSum.Text = Math.Round(count * (manufacture?.Price ?? 0), 2).ToString();
|
||||
_logger.LogInformation("Расчет суммы заказа");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -103,4 +102,4 @@ namespace BlacksmithWorkshopView
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -138,8 +138,7 @@ namespace BlacksmithWorkshopView
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -148,4 +147,4 @@ namespace BlacksmithWorkshopView
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -35,8 +35,7 @@ namespace BlacksmithWorkshopView
|
||||
{
|
||||
textBoxName.Text = view.ManufactureName;
|
||||
textBoxPrice.Text = view.Price.ToString();
|
||||
_manufactureComponents = view.ManufactureComponents ?? new
|
||||
Dictionary<int, (IComponentModel, int)>();
|
||||
_manufactureComponents = view.ManufactureComponents ?? new Dictionary<int, (IComponentModel, int)>();
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
@ -66,8 +65,7 @@ namespace BlacksmithWorkshopView
|
||||
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)
|
||||
@ -84,13 +82,11 @@ namespace BlacksmithWorkshopView
|
||||
_logger.LogInformation("Добавление нового компонента: { ComponentName} - { Count}", form.ComponentModel.ComponentName, form.Count);
|
||||
if (_manufactureComponents.ContainsKey(form.Id))
|
||||
{
|
||||
_manufactureComponents[form.Id] = (form.ComponentModel,
|
||||
form.Count);
|
||||
_manufactureComponents[form.Id] = (form.ComponentModel, form.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
_manufactureComponents.Add(form.Id, (form.ComponentModel,
|
||||
form.Count));
|
||||
_manufactureComponents.Add(form.Id, (form.ComponentModel, form.Count));
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
@ -133,8 +129,7 @@ namespace BlacksmithWorkshopView
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
@ -148,20 +143,17 @@ namespace BlacksmithWorkshopView
|
||||
{
|
||||
if (string.IsNullOrEmpty(textBoxName.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните название", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("Заполните название", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(textBoxPrice.Text))
|
||||
{
|
||||
MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
if (_manufactureComponents == null || _manufactureComponents.Count == 0)
|
||||
{
|
||||
MessageBox.Show("Заполните компоненты", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
MessageBox.Show("Заполните компоненты", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Сохранение изделия");
|
||||
@ -205,4 +197,4 @@ namespace BlacksmithWorkshopView
|
||||
return Math.Round(price * 1.1, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -75,4 +75,4 @@ namespace BlacksmithWorkshopView
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -68,8 +68,7 @@ namespace BlacksmithWorkshopView
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
int id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
@ -98,4 +97,4 @@ namespace BlacksmithWorkshopView
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
BlacksmithWorkshop/BlacksmithWorkshop/nlog.config
Normal file
15
BlacksmithWorkshop/BlacksmithWorkshop/nlog.config
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
autoReload="true" internalLogLevel="Info">
|
||||
|
||||
<targets>
|
||||
<target xsi:type="File" name="tofile" fileName="${basedir}/log-${shortdate}.log" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<logger name="*" minlevel="Debug" writeTo="tofile" />
|
||||
</rules>
|
||||
</nlog>
|
||||
</configuration>
|
@ -104,4 +104,4 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -104,4 +104,4 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -141,4 +141,4 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@ namespace BlacksmithWorkshopContracts.BindingModels
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -14,4 +14,4 @@ namespace BlacksmithWorkshopContracts.BindingModels
|
||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||
public DateTime? DateImplement { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -12,4 +12,4 @@ namespace BlacksmithWorkshopContracts.BusinessLogicContracts
|
||||
bool Update(ComponentBindingModel model);
|
||||
bool Delete(ComponentBindingModel model);
|
||||
}
|
||||
}
|
||||
}
|
@ -12,4 +12,4 @@ namespace BlacksmithWorkshopContracts.BusinessLogicContracts
|
||||
bool Update(ManufactureBindingModel model);
|
||||
bool Delete(ManufactureBindingModel model);
|
||||
}
|
||||
}
|
||||
}
|
@ -12,4 +12,4 @@ namespace BlacksmithWorkshopContracts.BusinessLogicContracts
|
||||
bool FinishOrder(OrderBindingModel model);
|
||||
bool DeliveryOrder(OrderBindingModel model);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,4 +5,4 @@
|
||||
public int? Id { get; set; }
|
||||
public string? ComponentName { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -5,4 +5,4 @@
|
||||
public int? Id { get; set; }
|
||||
public string? ManufactureName { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -4,4 +4,4 @@
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -13,4 +13,4 @@ namespace BlacksmithWorkshopContracts.StoragesContracts
|
||||
ComponentViewModel? Update(ComponentBindingModel model);
|
||||
ComponentViewModel? Delete(ComponentBindingModel model);
|
||||
}
|
||||
}
|
||||
}
|
@ -13,4 +13,4 @@ namespace BlacksmithWorkshopContracts.StoragesContracts
|
||||
ManufactureViewModel? Update(ManufactureBindingModel model);
|
||||
ManufactureViewModel? Delete(ManufactureBindingModel model);
|
||||
}
|
||||
}
|
||||
}
|
@ -14,4 +14,4 @@ namespace BlacksmithWorkshopContracts.StoragesContracts
|
||||
OrderViewModel? Delete(OrderBindingModel model);
|
||||
OrderViewModel? UpdateOrderStatus(OrderBindingModel model);
|
||||
}
|
||||
}
|
||||
}
|
@ -11,4 +11,4 @@ namespace BlacksmithWorkshopContracts.ViewModels
|
||||
[DisplayName("Цена")]
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -22,4 +22,4 @@ namespace BlacksmithWorkshopContracts.ViewModels
|
||||
[DisplayName("Дата выполнения")]
|
||||
public DateTime? DateImplement { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -8,4 +8,4 @@
|
||||
Готов = 2,
|
||||
Выдан = 3
|
||||
}
|
||||
}
|
||||
}
|
@ -4,4 +4,4 @@
|
||||
{
|
||||
int Id { get; }
|
||||
}
|
||||
}
|
||||
}
|
@ -5,4 +5,4 @@
|
||||
string ComponentName { get; }
|
||||
double Cost { get; }
|
||||
}
|
||||
}
|
||||
}
|
@ -6,4 +6,4 @@
|
||||
double Price { get; }
|
||||
Dictionary<int, (IComponentModel, int)> ManufactureComponents { get; }
|
||||
}
|
||||
}
|
||||
}
|
@ -11,4 +11,4 @@ namespace BlacksmithWorkshopDataModels.Models
|
||||
DateTime DateCreate { get; }
|
||||
DateTime? DateImplement { get; }
|
||||
}
|
||||
}
|
||||
}
|
@ -23,4 +23,4 @@ namespace BlacksmithWorkshopListImplement
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -38,4 +38,4 @@ namespace BlacksmithWorkshopListImplement.Models
|
||||
Cost = Cost
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -42,4 +42,4 @@ namespace BlacksmithWorkshopListImplement.Models
|
||||
ManufactureComponents = ManufactureComponents
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -71,4 +71,4 @@ namespace BlacksmithWorkshopListImplement.Models
|
||||
DateImplement = DateImplement
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user