From 881f1c8f5b94f858a4e6df91042b3e15e9eb13a8 Mon Sep 17 00:00:00 2001 From: "safiulova.k" Date: Tue, 12 Mar 2024 22:05:58 +0400 Subject: [PATCH] lab1... --- .../AbstractShopListImplement/Component.cs | 1 - .../AbstractShopListImplement/DataListSingleton.cs | 1 - AircraftPlant/AbstractShopListImplement/Order.cs | 2 -- .../AbstractShopListImplement/OrderStorage.cs | 13 +++---------- AircraftPlant/AbstractShopListImplement/Plane.cs | 6 ------ .../AbstractShopListImplement/PlaneStorage.cs | 7 ------- .../AircraftPlantBusinessLogic/ComponentLogic.cs | 1 - .../AircraftPlantBusinessLogic/OrderLogic.cs | 7 ------- .../AircraftPlantBusinessLogic/PlaneLogic.cs | 9 +-------- .../SearchModels/OrderSearchModel.cs | 1 - .../StoragesContracts/IComponentStorage.cs | 1 - .../ViewModels/ComponentViewModel.cs | 1 - AircraftPlant/AircraftPlantView/FormComponent.cs | 1 - AircraftPlant/AircraftPlantView/FormComponents.cs | 3 +-- AircraftPlant/AircraftPlantView/FormCreateOrder.cs | 12 ++---------- AircraftPlant/AircraftPlantView/FormMain.cs | 11 ----------- AircraftPlant/AircraftPlantView/FormPlane.cs | 13 ------------- AircraftPlant/AircraftPlantView/FormPlanes.cs | 6 ------ 18 files changed, 7 insertions(+), 89 deletions(-) diff --git a/AircraftPlant/AbstractShopListImplement/Component.cs b/AircraftPlant/AbstractShopListImplement/Component.cs index a47a44e..9c50f7f 100644 --- a/AircraftPlant/AbstractShopListImplement/Component.cs +++ b/AircraftPlant/AbstractShopListImplement/Component.cs @@ -58,7 +58,6 @@ namespace AircraftPlantListImplement.Models ComponentName = model.ComponentName; Cost = model.Cost; } - /// /// Получение модели компонента /// diff --git a/AircraftPlant/AbstractShopListImplement/DataListSingleton.cs b/AircraftPlant/AbstractShopListImplement/DataListSingleton.cs index 37a8bec..7754b68 100644 --- a/AircraftPlant/AbstractShopListImplement/DataListSingleton.cs +++ b/AircraftPlant/AbstractShopListImplement/DataListSingleton.cs @@ -41,7 +41,6 @@ namespace AircraftPlantListImplement Orders = new List(); Planes = new List(); } - /// /// Получить ссылку на класс /// diff --git a/AircraftPlant/AbstractShopListImplement/Order.cs b/AircraftPlant/AbstractShopListImplement/Order.cs index bac9930..e4778ca 100644 --- a/AircraftPlant/AbstractShopListImplement/Order.cs +++ b/AircraftPlant/AbstractShopListImplement/Order.cs @@ -73,7 +73,6 @@ namespace AircraftPlantListImplement.Models DateImplement = model.DateImplement }; } - /// /// Изменение модели заказа /// @@ -88,7 +87,6 @@ namespace AircraftPlantListImplement.Models Status = model.Status; DateImplement = model.DateImplement; } - /// /// Получение модели заказа /// diff --git a/AircraftPlant/AbstractShopListImplement/OrderStorage.cs b/AircraftPlant/AbstractShopListImplement/OrderStorage.cs index 3a5b908..2dd4cfc 100644 --- a/AircraftPlant/AbstractShopListImplement/OrderStorage.cs +++ b/AircraftPlant/AbstractShopListImplement/OrderStorage.cs @@ -28,7 +28,6 @@ namespace AircraftPlantListImplement.Implements { _source = DataListSingleton.GetInstance(); } - /// /// Получение полного списка /// @@ -42,7 +41,6 @@ namespace AircraftPlantListImplement.Implements } return result; } - /// /// Получение фильтрованного списка /// @@ -65,7 +63,6 @@ namespace AircraftPlantListImplement.Implements } return result; } - /// /// Получение элемента /// @@ -87,7 +84,6 @@ namespace AircraftPlantListImplement.Implements } return null; } - /// /// Добавление элемента /// @@ -113,7 +109,6 @@ namespace AircraftPlantListImplement.Implements _source.Orders.Add(newOrder); return GetViewModel(newOrder); } - /// /// Редактирование элемента /// @@ -131,7 +126,6 @@ namespace AircraftPlantListImplement.Implements } return null; } - /// /// Удаление элемента /// @@ -150,7 +144,6 @@ namespace AircraftPlantListImplement.Implements } return null; } - /// /// Получение модели заказа /// @@ -159,11 +152,11 @@ namespace AircraftPlantListImplement.Implements private OrderViewModel GetViewModel(Order order) { var viewModel = order.GetViewModel; - foreach (var sushi in _source.Planes) + foreach (var plane in _source.Planes) { - if (sushi.Id == order.PlaneId) + if (plane.Id == order.PlaneId) { - viewModel.PlaneName = sushi.PlaneName; + viewModel.PlaneName = plane.PlaneName; break; } } diff --git a/AircraftPlant/AbstractShopListImplement/Plane.cs b/AircraftPlant/AbstractShopListImplement/Plane.cs index f31183d..f040b3f 100644 --- a/AircraftPlant/AbstractShopListImplement/Plane.cs +++ b/AircraftPlant/AbstractShopListImplement/Plane.cs @@ -19,17 +19,14 @@ namespace AircraftPlantListImplement.Models /// Идентификатор /// public int Id { get; private set; } - /// /// Название изделия /// public string PlaneName { get; private set; } = string.Empty; - /// /// Стоимость изделия /// public double Price { get; private set; } - /// /// Коллекция компонентов изделия /// @@ -38,7 +35,6 @@ namespace AircraftPlantListImplement.Models get; private set; } = new Dictionary(); - /// /// Создание модели изделия /// @@ -59,7 +55,6 @@ namespace AircraftPlantListImplement.Models PlaneComponents = model.PlaneComponents }; } - /// /// Изменение модели изделия /// @@ -75,7 +70,6 @@ namespace AircraftPlantListImplement.Models Price = model.Price; PlaneComponents = model.PlaneComponents; } - /// /// Получение модели изделия /// diff --git a/AircraftPlant/AbstractShopListImplement/PlaneStorage.cs b/AircraftPlant/AbstractShopListImplement/PlaneStorage.cs index 1a41eb6..813adeb 100644 --- a/AircraftPlant/AbstractShopListImplement/PlaneStorage.cs +++ b/AircraftPlant/AbstractShopListImplement/PlaneStorage.cs @@ -28,7 +28,6 @@ namespace AircraftPlantListImplement.Implements { _source = DataListSingleton.GetInstance(); } - /// /// Получение полного списка /// @@ -42,7 +41,6 @@ namespace AircraftPlantListImplement.Implements } return result; } - /// /// Получение фильтрованного списка /// @@ -65,7 +63,6 @@ namespace AircraftPlantListImplement.Implements } return result; } - /// /// Получение элемента /// @@ -87,7 +84,6 @@ namespace AircraftPlantListImplement.Implements } return null; } - /// /// Добавление элемента /// @@ -103,7 +99,6 @@ namespace AircraftPlantListImplement.Implements model.Id = plane.Id + 1; } } - var newPlane = Plane.Create(model); if (newPlane == null) { @@ -113,7 +108,6 @@ namespace AircraftPlantListImplement.Implements _source.Planes.Add(newPlane); return newPlane.GetViewModel; } - /// /// Редактирование элемента /// @@ -131,7 +125,6 @@ namespace AircraftPlantListImplement.Implements } return null; } - /// /// Удаление элемента /// diff --git a/AircraftPlant/AircraftPlantBusinessLogic/ComponentLogic.cs b/AircraftPlant/AircraftPlantBusinessLogic/ComponentLogic.cs index d2e4334..5d96d20 100644 --- a/AircraftPlant/AircraftPlantBusinessLogic/ComponentLogic.cs +++ b/AircraftPlant/AircraftPlantBusinessLogic/ComponentLogic.cs @@ -10,7 +10,6 @@ using AircraftPlantContracts.StoragesContracts; using AircraftPlantContracts.ViewModels; using Microsoft.Extensions.Logging; - namespace AircraftPlantBusinessLogic.BusinessLogics { public class ComponentLogic : IComponentLogic diff --git a/AircraftPlant/AircraftPlantBusinessLogic/OrderLogic.cs b/AircraftPlant/AircraftPlantBusinessLogic/OrderLogic.cs index d59c278..f496482 100644 --- a/AircraftPlant/AircraftPlantBusinessLogic/OrderLogic.cs +++ b/AircraftPlant/AircraftPlantBusinessLogic/OrderLogic.cs @@ -38,7 +38,6 @@ namespace AircraftPlantBusinessLogic.BusinessLogics _logger = logger; _orderStorage = orderStorage; } - /// /// Получение списка /// @@ -58,7 +57,6 @@ namespace AircraftPlantBusinessLogic.BusinessLogics _logger.LogInformation("ReadList. Count:{Count}", list.Count); return list; } - /// /// Создание заказа /// @@ -82,7 +80,6 @@ namespace AircraftPlantBusinessLogic.BusinessLogics } return true; } - /// /// Смена статуса заказа (Выполняется) /// @@ -92,7 +89,6 @@ namespace AircraftPlantBusinessLogic.BusinessLogics { return StatusUpdate(model, OrderStatus.Выполняется); } - /// /// Смена статуса заказа (Выдан) /// @@ -102,7 +98,6 @@ namespace AircraftPlantBusinessLogic.BusinessLogics { return StatusUpdate(model, OrderStatus.Выдан); } - /// /// Смена статуса заказа (Готов) /// @@ -112,7 +107,6 @@ namespace AircraftPlantBusinessLogic.BusinessLogics { return StatusUpdate(model, OrderStatus.Готов); } - /// /// Проверка модели заказа /// @@ -142,7 +136,6 @@ namespace AircraftPlantBusinessLogic.BusinessLogics } _logger.LogInformation("Order. OrderID:{Id}.Sum:{ Sum}. PlaneId: { PlaneId}", model.Id, model.Sum, model.PlaneId); } - /// /// Смена статуса заказа /// diff --git a/AircraftPlant/AircraftPlantBusinessLogic/PlaneLogic.cs b/AircraftPlant/AircraftPlantBusinessLogic/PlaneLogic.cs index 82de87f..1ee8908 100644 --- a/AircraftPlant/AircraftPlantBusinessLogic/PlaneLogic.cs +++ b/AircraftPlant/AircraftPlantBusinessLogic/PlaneLogic.cs @@ -32,13 +32,11 @@ namespace AircraftPlantBusinessLogic.BusinessLogics /// /// /// - public PlaneLogic(ILogger logger, IPlaneStorage -planeStorage) + public PlaneLogic(ILogger logger, IPlaneStorage planeStorage) { _logger = logger; _planeStorage = planeStorage; } - /// /// Получение списка /// @@ -58,7 +56,6 @@ planeStorage) _logger.LogInformation("ReadList. Count:{Count}", list.Count); return list; } - /// /// Получение отдельной записи /// @@ -84,7 +81,6 @@ planeStorage) _logger.LogInformation("ReadElement find. Id:{Id}", element.Id); return element; } - /// /// Создание записи /// @@ -101,7 +97,6 @@ planeStorage) } return true; } - /// /// Изменение записи /// @@ -118,7 +113,6 @@ planeStorage) } return true; } - /// /// Удаление записи /// @@ -136,7 +130,6 @@ planeStorage) } return true; } - /// /// Проверка модели изделия /// diff --git a/AircraftPlant/AircraftPlantContracts»/SearchModels/OrderSearchModel.cs b/AircraftPlant/AircraftPlantContracts»/SearchModels/OrderSearchModel.cs index 872e436..1e8e05d 100644 --- a/AircraftPlant/AircraftPlantContracts»/SearchModels/OrderSearchModel.cs +++ b/AircraftPlant/AircraftPlantContracts»/SearchModels/OrderSearchModel.cs @@ -10,5 +10,4 @@ namespace AircraftPlantContracts.SearchModels { public int? Id { get; set; } } - } diff --git a/AircraftPlant/AircraftPlantContracts»/StoragesContracts/IComponentStorage.cs b/AircraftPlant/AircraftPlantContracts»/StoragesContracts/IComponentStorage.cs index 8725e3c..9766986 100644 --- a/AircraftPlant/AircraftPlantContracts»/StoragesContracts/IComponentStorage.cs +++ b/AircraftPlant/AircraftPlantContracts»/StoragesContracts/IComponentStorage.cs @@ -18,5 +18,4 @@ namespace AircraftPlantContracts.StoragesContracts ComponentViewModel? Update(ComponentBindingModel model); ComponentViewModel? Delete(ComponentBindingModel model); } - } diff --git a/AircraftPlant/AircraftPlantContracts»/ViewModels/ComponentViewModel.cs b/AircraftPlant/AircraftPlantContracts»/ViewModels/ComponentViewModel.cs index dec85b2..0e24d67 100644 --- a/AircraftPlant/AircraftPlantContracts»/ViewModels/ComponentViewModel.cs +++ b/AircraftPlant/AircraftPlantContracts»/ViewModels/ComponentViewModel.cs @@ -16,5 +16,4 @@ namespace AircraftPlantContracts.ViewModels [DisplayName("Цена")] public double Cost { get; set; } } - } diff --git a/AircraftPlant/AircraftPlantView/FormComponent.cs b/AircraftPlant/AircraftPlantView/FormComponent.cs index a287ef0..61d7b77 100644 --- a/AircraftPlant/AircraftPlantView/FormComponent.cs +++ b/AircraftPlant/AircraftPlantView/FormComponent.cs @@ -12,7 +12,6 @@ using AircraftPlantContracts.BusinessLogicsContracts; using AircraftPlantContracts.SearchModels; using Microsoft.Extensions.Logging; - namespace AircraftPlantView { public partial class FormComponent : Form diff --git a/AircraftPlant/AircraftPlantView/FormComponents.cs b/AircraftPlant/AircraftPlantView/FormComponents.cs index 9fc4a76..d3d16c5 100644 --- a/AircraftPlant/AircraftPlantView/FormComponents.cs +++ b/AircraftPlant/AircraftPlantView/FormComponents.cs @@ -85,8 +85,7 @@ namespace AircraftPlantView if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { - int id = - Convert.ToInt32(dataGridViewComponents.SelectedRows[0].Cells["Id"].Value); + int id = Convert.ToInt32(dataGridViewComponents.SelectedRows[0].Cells["Id"].Value); _logger.LogInformation("Удаление компонента"); try { diff --git a/AircraftPlant/AircraftPlantView/FormCreateOrder.cs b/AircraftPlant/AircraftPlantView/FormCreateOrder.cs index 77c1baf..0f79d5b 100644 --- a/AircraftPlant/AircraftPlantView/FormCreateOrder.cs +++ b/AircraftPlant/AircraftPlantView/FormCreateOrder.cs @@ -20,17 +20,14 @@ namespace AircraftPlantView /// Логгер /// private readonly ILogger _logger; - /// /// Бизнес-логика для изделий /// private readonly IPlaneLogic _logicP; - /// /// Бизнес-логика для заказов /// private readonly IOrderLogic _logicO; - /// /// Конструктор /// @@ -44,7 +41,6 @@ namespace AircraftPlantView _logicP = logicP; _logicO = logicO; } - /// /// Загрузка списка изделий для заказа /// @@ -71,7 +67,6 @@ namespace AircraftPlantView MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - /// /// Изменение поля "Количество" /// @@ -81,7 +76,6 @@ namespace AircraftPlantView { CalcSum(); } - /// /// Изменение значения в выпадающем списке /// @@ -91,7 +85,6 @@ namespace AircraftPlantView { CalcSum(); } - /// /// Кнопка "Сохранить" /// @@ -143,7 +136,6 @@ namespace AircraftPlantView DialogResult = DialogResult.Cancel; Close(); } - /// /// Подсчет суммы заказа /// @@ -154,9 +146,9 @@ namespace AircraftPlantView try { int id = Convert.ToInt32(comboBoxPlane.SelectedValue); - var product = _logicP.ReadElement(new PlaneSearchModel { Id = id }); + var plane = _logicP.ReadElement(new PlaneSearchModel { Id = id }); int count = Convert.ToInt32(textBoxCount.Text); - textBoxSum.Text = Math.Round(count * (product?.Price ?? 0), 2).ToString(); + textBoxSum.Text = Math.Round(count * (plane?.Price ?? 0), 2).ToString(); _logger.LogInformation("Расчет суммы заказа"); } catch (Exception ex) diff --git a/AircraftPlant/AircraftPlantView/FormMain.cs b/AircraftPlant/AircraftPlantView/FormMain.cs index 5ece09a..ce50e8d 100644 --- a/AircraftPlant/AircraftPlantView/FormMain.cs +++ b/AircraftPlant/AircraftPlantView/FormMain.cs @@ -23,12 +23,10 @@ namespace AircraftPlantView /// Логгер /// private readonly ILogger _logger; - /// /// Бизнес-логика для заказов /// private readonly IOrderLogic _orderLogic; - /// /// Конструктор /// @@ -40,7 +38,6 @@ namespace AircraftPlantView _logger = logger; _orderLogic = logic; } - /// /// Загрузка списка заказов /// @@ -50,7 +47,6 @@ namespace AircraftPlantView { LoadData(); } - /// /// Показать список всех компонентов /// @@ -64,7 +60,6 @@ namespace AircraftPlantView form.ShowDialog(); } } - /// /// Показать список всех изделий /// @@ -78,7 +73,6 @@ namespace AircraftPlantView form.ShowDialog(); } } - /// /// Кнопка "Создать заказ" /// @@ -93,7 +87,6 @@ namespace AircraftPlantView LoadData(); } } - /// /// Кнопка "Отдать на выполнение" /// @@ -121,7 +114,6 @@ namespace AircraftPlantView } } } - /// /// Кнопка "Заказ готов" /// @@ -149,7 +141,6 @@ namespace AircraftPlantView } } } - /// /// Кнопка "Заказ выдан" /// @@ -178,7 +169,6 @@ namespace AircraftPlantView } } } - /// /// Кнопка "Обновить список" /// @@ -188,7 +178,6 @@ namespace AircraftPlantView { LoadData(); } - /// /// Метод загрузки списка заказов /// diff --git a/AircraftPlant/AircraftPlantView/FormPlane.cs b/AircraftPlant/AircraftPlantView/FormPlane.cs index c777e3e..ca07dc0 100644 --- a/AircraftPlant/AircraftPlantView/FormPlane.cs +++ b/AircraftPlant/AircraftPlantView/FormPlane.cs @@ -24,23 +24,19 @@ namespace AircraftPlantView /// Логгер /// private readonly ILogger _logger; - /// /// Бизнес-логика для изделий /// private readonly IPlaneLogic _logic; - /// /// Идентификатор /// private int? _id; public int Id { set { _id = value; } } - /// /// Список компонентов изделия /// private Dictionary _planeComponents; - /// /// Конструктор /// @@ -53,7 +49,6 @@ namespace AircraftPlantView _logic = logic; _planeComponents = new Dictionary(); } - /// /// Загрузка списка компонентов изделия /// @@ -82,7 +77,6 @@ namespace AircraftPlantView } } } - /// /// Кнопка "Добавить" /// @@ -112,7 +106,6 @@ namespace AircraftPlantView } } } - /// /// Кнопка "Изменить" /// @@ -141,7 +134,6 @@ namespace AircraftPlantView } } } - /// /// Кнопка "Удалить" /// @@ -166,7 +158,6 @@ namespace AircraftPlantView } } } - /// /// Кнопка "Обновить" /// @@ -176,7 +167,6 @@ namespace AircraftPlantView { LoadData(); } - /// /// Кнопка "Сохранить" /// @@ -224,7 +214,6 @@ namespace AircraftPlantView MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - /// /// Кнопка "Отмена" /// @@ -235,7 +224,6 @@ namespace AircraftPlantView DialogResult = DialogResult.Cancel; Close(); } - /// /// Метод загрузки компонентов изделия /// @@ -266,7 +254,6 @@ namespace AircraftPlantView MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } - /// /// Метод для подсчета стоимости изделия /// diff --git a/AircraftPlant/AircraftPlantView/FormPlanes.cs b/AircraftPlant/AircraftPlantView/FormPlanes.cs index 2fb285c..9c3d5ca 100644 --- a/AircraftPlant/AircraftPlantView/FormPlanes.cs +++ b/AircraftPlant/AircraftPlantView/FormPlanes.cs @@ -39,7 +39,6 @@ namespace AircraftPlantView _logger = logger; _logic = logic; } - /// /// Загрузка списка изделий /// @@ -49,7 +48,6 @@ namespace AircraftPlantView { LoadData(); } - /// /// Кнопка "Добавить" /// @@ -66,7 +64,6 @@ namespace AircraftPlantView } } } - /// /// Кнопка "Изменить" /// @@ -87,7 +84,6 @@ namespace AircraftPlantView } } } - /// /// Кнопка "Удалить" /// @@ -120,7 +116,6 @@ namespace AircraftPlantView } } } - /// /// Кнопка "Обновить" /// @@ -130,7 +125,6 @@ namespace AircraftPlantView { LoadData(); } - /// /// Метод загрузки списка изделий ///