ISEbd-21 Melnikov I. O. Lab work 01 Base #1

Closed
Igor-Melnikov wants to merge 13 commits from lab1 into main
32 changed files with 58 additions and 55 deletions
Showing only changes of commit dc78b899fd - Show all commits

View File

@ -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();
}
}
}
}

View File

@ -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();
}
}
}
}

View File

@ -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();
}
}
}
}

View File

@ -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);
}
}
}
}

View File

@ -75,4 +75,4 @@ namespace BlacksmithWorkshopView
Close();
}
}
}
}

View File

@ -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();
}
}
}
}

View 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>

View File

@ -104,4 +104,4 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
}
}
}
}
}

View File

@ -104,4 +104,4 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
}
}
}
}
}

View File

@ -141,4 +141,4 @@ namespace BlacksmithWorkShopBusinessLogic.BusinessLogics
}
}
}
}
}

View File

@ -8,4 +8,4 @@ namespace BlacksmithWorkshopContracts.BindingModels
public string ComponentName { get; set; } = string.Empty;
public double Cost { get; set; }
}
}
}

View File

@ -14,4 +14,4 @@ namespace BlacksmithWorkshopContracts.BindingModels
public DateTime DateCreate { get; set; } = DateTime.Now;
public DateTime? DateImplement { get; set; }
}
}
}

View File

@ -12,4 +12,4 @@ namespace BlacksmithWorkshopContracts.BusinessLogicContracts
bool Update(ComponentBindingModel model);
bool Delete(ComponentBindingModel model);
}
}
}

View File

@ -12,4 +12,4 @@ namespace BlacksmithWorkshopContracts.BusinessLogicContracts
bool Update(ManufactureBindingModel model);
bool Delete(ManufactureBindingModel model);
}
}
}

View File

@ -12,4 +12,4 @@ namespace BlacksmithWorkshopContracts.BusinessLogicContracts
bool FinishOrder(OrderBindingModel model);
bool DeliveryOrder(OrderBindingModel model);
}
}
}

View File

@ -5,4 +5,4 @@
public int? Id { get; set; }
public string? ComponentName { get; set; }
}
}
}

View File

@ -5,4 +5,4 @@
public int? Id { get; set; }
public string? ManufactureName { get; set; }
}
}
}

View File

@ -4,4 +4,4 @@
{
public int? Id { get; set; }
}
}
}

View File

@ -13,4 +13,4 @@ namespace BlacksmithWorkshopContracts.StoragesContracts
ComponentViewModel? Update(ComponentBindingModel model);
ComponentViewModel? Delete(ComponentBindingModel model);
}
}
}

View File

@ -13,4 +13,4 @@ namespace BlacksmithWorkshopContracts.StoragesContracts
ManufactureViewModel? Update(ManufactureBindingModel model);
ManufactureViewModel? Delete(ManufactureBindingModel model);
}
}
}

View File

@ -14,4 +14,4 @@ namespace BlacksmithWorkshopContracts.StoragesContracts
OrderViewModel? Delete(OrderBindingModel model);
OrderViewModel? UpdateOrderStatus(OrderBindingModel model);
}
}
}

View File

@ -11,4 +11,4 @@ namespace BlacksmithWorkshopContracts.ViewModels
[DisplayName("Цена")]
public double Cost { get; set; }
}
}
}

View File

@ -22,4 +22,4 @@ namespace BlacksmithWorkshopContracts.ViewModels
[DisplayName("Дата выполнения")]
public DateTime? DateImplement { get; set; }
}
}
}

View File

@ -8,4 +8,4 @@
Готов = 2,
Выдан = 3
}
}
}

View File

@ -4,4 +4,4 @@
{
int Id { get; }
}
}
}

View File

@ -5,4 +5,4 @@
string ComponentName { get; }
double Cost { get; }
}
}
}

View File

@ -6,4 +6,4 @@
double Price { get; }
Dictionary<int, (IComponentModel, int)> ManufactureComponents { get; }
}
}
}

View File

@ -11,4 +11,4 @@ namespace BlacksmithWorkshopDataModels.Models
DateTime DateCreate { get; }
DateTime? DateImplement { get; }
}
}
}

View File

@ -23,4 +23,4 @@ namespace BlacksmithWorkshopListImplement
return _instance;
}
}
}
}

View File

@ -38,4 +38,4 @@ namespace BlacksmithWorkshopListImplement.Models
Cost = Cost
};
}
}
}

View File

@ -42,4 +42,4 @@ namespace BlacksmithWorkshopListImplement.Models
ManufactureComponents = ManufactureComponents
};
}
}
}

View File

@ -71,4 +71,4 @@ namespace BlacksmithWorkshopListImplement.Models
DateImplement = DateImplement
};
}
}
}