From f45d08b012be365cf9c738e1da38503c6d854dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D0=BB=D0=B5=D1=80=D0=B8=D1=8F=20=D0=9D=D0=B8?= =?UTF-8?q?=D0=BA=D0=B8=D1=84=D0=BE=D1=80=D0=BE=D0=B2=D0=B0?= Date: Wed, 1 Feb 2023 05:56:10 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD=D0=BE=D0=B9=20=D1=84?= =?UTF-8?q?=D0=BE=D1=80=D0=BC=D1=8B.=20=D0=98=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1?= =?UTF-8?q?=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AircraftPlant/FormCreateOrder.cs | 1 + .../AircraftPlant/FormMain.Designer.cs | 141 ++++++++++++++- AircraftPlant/AircraftPlant/FormMain.cs | 170 +++++++++++++++++- AircraftPlant/AircraftPlant/FormMain.resx | 65 +------ .../AircraftPlant/FormPlane.Designer.cs | 50 ++++-- AircraftPlant/AircraftPlant/FormPlane.cs | 13 +- AircraftPlant/AircraftPlant/FormPlane.resx | 5 +- AircraftPlant/AircraftPlant/FormPlanes.cs | 1 + AircraftPlant/AircraftPlant/Program.cs | 2 +- .../AircraftPlantBusinessLogic/OrderLogic.cs | 1 + .../BindingModels/OrderBindingModel.cs | 2 + .../ViewModels/OrderViewModel.cs | 6 +- .../AircraftPlantDataModels/IOrderModel.cs | 1 + .../Models/Order.cs | 4 + 14 files changed, 370 insertions(+), 92 deletions(-) diff --git a/AircraftPlant/AircraftPlant/FormCreateOrder.cs b/AircraftPlant/AircraftPlant/FormCreateOrder.cs index 4a3d9c5..fbb33ec 100644 --- a/AircraftPlant/AircraftPlant/FormCreateOrder.cs +++ b/AircraftPlant/AircraftPlant/FormCreateOrder.cs @@ -102,6 +102,7 @@ namespace AircraftPlantView var operationResult = _logicO.CreateOrder(new OrderBindingModel { PlaneId = Convert.ToInt32(comboBoxPlane.SelectedValue), + PlaneName = comboBoxPlane.Text, Count = Convert.ToInt32(textBoxCount.Text), Sum = Convert.ToDouble(textBoxSum.Text) }); diff --git a/AircraftPlant/AircraftPlant/FormMain.Designer.cs b/AircraftPlant/AircraftPlant/FormMain.Designer.cs index f93bfa8..637a8c4 100644 --- a/AircraftPlant/AircraftPlant/FormMain.Designer.cs +++ b/AircraftPlant/AircraftPlant/FormMain.Designer.cs @@ -28,12 +28,149 @@ /// private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); + this.menuStrip = new System.Windows.Forms.MenuStrip(); + this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.комплектующиеToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.самолетыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.dataGridView = new System.Windows.Forms.DataGridView(); + this.buttonCreateOrder = new System.Windows.Forms.Button(); + this.buttonSetToWork = new System.Windows.Forms.Button(); + this.buttonSetToDone = new System.Windows.Forms.Button(); + this.buttonSetToFinish = new System.Windows.Forms.Button(); + this.buttonUpdate = new System.Windows.Forms.Button(); + this.menuStrip.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); + this.SuspendLayout(); + // + // menuStrip + // + this.menuStrip.ImageScalingSize = new System.Drawing.Size(20, 20); + this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.справочникиToolStripMenuItem}); + this.menuStrip.Location = new System.Drawing.Point(0, 0); + this.menuStrip.Name = "menuStrip"; + this.menuStrip.Size = new System.Drawing.Size(1078, 28); + this.menuStrip.TabIndex = 0; + this.menuStrip.Text = "menuStrip1"; + // + // справочникиToolStripMenuItem + // + this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.комплектующиеToolStripMenuItem, + this.самолетыToolStripMenuItem}); + this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; + this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24); + this.справочникиToolStripMenuItem.Text = "Справочники"; + // + // комплектующиеToolStripMenuItem + // + this.комплектующиеToolStripMenuItem.Name = "комплектующиеToolStripMenuItem"; + this.комплектующиеToolStripMenuItem.Size = new System.Drawing.Size(224, 26); + this.комплектующиеToolStripMenuItem.Text = "Комплектующие"; + this.комплектующиеToolStripMenuItem.Click += new System.EventHandler(this.комплектующиеToolStripMenuItem_Click); + // + // самолетыToolStripMenuItem + // + this.самолетыToolStripMenuItem.Name = "самолетыToolStripMenuItem"; + this.самолетыToolStripMenuItem.Size = new System.Drawing.Size(224, 26); + this.самолетыToolStripMenuItem.Text = "Самолеты"; + this.самолетыToolStripMenuItem.Click += new System.EventHandler(this.самолетыToolStripMenuItem_Click); + // + // dataGridView + // + this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridView.Location = new System.Drawing.Point(0, 31); + this.dataGridView.Name = "dataGridView"; + this.dataGridView.RowHeadersWidth = 51; + this.dataGridView.RowTemplate.Height = 29; + this.dataGridView.Size = new System.Drawing.Size(836, 341); + this.dataGridView.TabIndex = 1; + // + // buttonCreateOrder + // + this.buttonCreateOrder.Location = new System.Drawing.Point(863, 65); + this.buttonCreateOrder.Name = "buttonCreateOrder"; + this.buttonCreateOrder.Size = new System.Drawing.Size(189, 29); + this.buttonCreateOrder.TabIndex = 2; + this.buttonCreateOrder.Text = "Создать заказ"; + this.buttonCreateOrder.UseVisualStyleBackColor = true; + this.buttonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click); + // + // buttonSetToWork + // + this.buttonSetToWork.Location = new System.Drawing.Point(863, 126); + this.buttonSetToWork.Name = "buttonSetToWork"; + this.buttonSetToWork.Size = new System.Drawing.Size(189, 29); + this.buttonSetToWork.TabIndex = 3; + this.buttonSetToWork.Text = "Отдать на выполнение"; + this.buttonSetToWork.UseVisualStyleBackColor = true; + this.buttonSetToWork.Click += new System.EventHandler(this.ButtonSetToWork_Click); + // + // buttonSetToDone + // + this.buttonSetToDone.Location = new System.Drawing.Point(863, 186); + this.buttonSetToDone.Name = "buttonSetToDone"; + this.buttonSetToDone.Size = new System.Drawing.Size(189, 29); + this.buttonSetToDone.TabIndex = 4; + this.buttonSetToDone.Text = "Заказ готов"; + this.buttonSetToDone.UseVisualStyleBackColor = true; + this.buttonSetToDone.Click += new System.EventHandler(this.ButtonSetToDone_Click); + // + // buttonSetToFinish + // + this.buttonSetToFinish.Location = new System.Drawing.Point(863, 249); + this.buttonSetToFinish.Name = "buttonSetToFinish"; + this.buttonSetToFinish.Size = new System.Drawing.Size(189, 29); + this.buttonSetToFinish.TabIndex = 5; + this.buttonSetToFinish.Text = "Заказ выдан"; + this.buttonSetToFinish.UseVisualStyleBackColor = true; + this.buttonSetToFinish.Click += new System.EventHandler(this.ButtonSetToFinish_Click); + // + // buttonUpdate + // + this.buttonUpdate.Location = new System.Drawing.Point(863, 309); + this.buttonUpdate.Name = "buttonUpdate"; + this.buttonUpdate.Size = new System.Drawing.Size(189, 29); + this.buttonUpdate.TabIndex = 6; + this.buttonUpdate.Text = "Обновить список"; + this.buttonUpdate.UseVisualStyleBackColor = true; + this.buttonUpdate.Click += new System.EventHandler(this.ButtonUpdate_Click); + // + // FormMain + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); + this.ClientSize = new System.Drawing.Size(1078, 371); + this.Controls.Add(this.buttonUpdate); + this.Controls.Add(this.buttonSetToFinish); + this.Controls.Add(this.buttonSetToDone); + this.Controls.Add(this.buttonSetToWork); + this.Controls.Add(this.buttonCreateOrder); + this.Controls.Add(this.menuStrip); + this.Controls.Add(this.dataGridView); + this.MainMenuStrip = this.menuStrip; + this.Name = "FormMain"; this.Text = "FormMain"; + this.Load += new System.EventHandler(this.FormMain_Load); + this.menuStrip.ResumeLayout(false); + this.menuStrip.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion + + private MenuStrip menuStrip; + private ToolStripMenuItem справочникиToolStripMenuItem; + private ToolStripMenuItem комплектующиеToolStripMenuItem; + private ToolStripMenuItem самолетыToolStripMenuItem; + private DataGridView dataGridView; + private Button buttonCreateOrder; + private Button buttonSetToWork; + private Button buttonSetToDone; + private Button buttonSetToFinish; + private Button buttonUpdate; } } \ No newline at end of file diff --git a/AircraftPlant/AircraftPlant/FormMain.cs b/AircraftPlant/AircraftPlant/FormMain.cs index aa3aa2d..cc7dbec 100644 --- a/AircraftPlant/AircraftPlant/FormMain.cs +++ b/AircraftPlant/AircraftPlant/FormMain.cs @@ -1,4 +1,9 @@ -using System; +using AircraftPlant; +using AircraftPlantContracts.BindingModels; +using AircraftPlantContracts.BusinessLogicsContracts; +using AircraftPlantDataModels.Enums; +using Microsoft.Extensions.Logging; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -12,9 +17,170 @@ namespace AircraftPlantView { public partial class FormMain : Form { - public FormMain() + private readonly ILogger _logger; + private readonly IOrderLogic _orderLogic; + public FormMain(ILogger logger, IOrderLogic orderLogic) { InitializeComponent(); + _logger = logger; + _orderLogic = orderLogic; + } + + private void FormMain_Load(object sender, EventArgs e) + { + LoadData(); + } + + private void LoadData() + { + _logger.LogInformation("Загрузка заказов"); + try + { + var list = _orderLogic.ReadList(null); + if (list != null) + { + dataGridView.DataSource = list; + dataGridView.Columns["PlaneId"].Visible = false; + + } + _logger.LogInformation("Загрузка заказов"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка загрузки заказов"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void комплектующиеToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormComponents)); + if (service is FormComponents form) + { + form.ShowDialog(); + } + } + + private void самолетыToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormPlanes)); + if (service is FormPlanes form) + { + form.ShowDialog(); + } + } + + private void ButtonCreateOrder_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); + if (service is FormCreateOrder form) + { + form.ShowDialog(); + LoadData(); + } + } + + private void ButtonSetToWork_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id); + try + { + var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel + { //id,name,count,sum,status,start,end + Id = id, + PlaneId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["PlaneId"].Value), + PlaneName = dataGridView.SelectedRows[0].Cells["PlaneName"].Value.ToString(), + Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), + Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), + Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), + DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), + }); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка передачи заказа в работу"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, + MessageBoxIcon.Error); + } + } + } + + private void ButtonSetToDone_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id); + try + { + var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel + { + Id = id, + PlaneId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["PlaneId"].Value), + PlaneName = dataGridView.SelectedRows[0].Cells["PlaneName"].Value.ToString(), + Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), + Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), + Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), + DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), + }); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка отметки о готовности заказа"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + private void ButtonSetToFinish_Click(object sender, EventArgs e) + { + if (dataGridView.SelectedRows.Count == 1) + { + int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + _logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id); + try + { + var operationResult = _orderLogic.FinishOrder(new OrderBindingModel + { + Id = id, + PlaneId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["PlaneId"].Value), + PlaneName = dataGridView.SelectedRows[0].Cells["PlaneName"].Value.ToString(), + Status = Enum.Parse(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()), + Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value), + Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()), + DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()), + }); + if (!operationResult) + { + throw new Exception("Ошибка при сохранении. Дополнительная информация в логах."); + } + _logger.LogInformation("Заказ №{id} выдан", id); + LoadData(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Ошибка отметки о выдачи заказа"); + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + private void ButtonUpdate_Click(object sender, EventArgs e) + { + LoadData(); } } } diff --git a/AircraftPlant/AircraftPlant/FormMain.resx b/AircraftPlant/AircraftPlant/FormMain.resx index 1af7de1..81a9e3d 100644 --- a/AircraftPlant/AircraftPlant/FormMain.resx +++ b/AircraftPlant/AircraftPlant/FormMain.resx @@ -1,64 +1,4 @@ - - - + @@ -117,4 +57,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/AircraftPlant/AircraftPlant/FormPlane.Designer.cs b/AircraftPlant/AircraftPlant/FormPlane.Designer.cs index 27df4f4..d838eb9 100644 --- a/AircraftPlant/AircraftPlant/FormPlane.Designer.cs +++ b/AircraftPlant/AircraftPlant/FormPlane.Designer.cs @@ -38,10 +38,11 @@ this.buttonEdit = new System.Windows.Forms.Button(); this.buttonAdd = new System.Windows.Forms.Button(); this.dataGridView = new System.Windows.Forms.DataGridView(); - this.ColumnComponentName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.buttonSave = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); + this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnComponentName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.ColumnCount = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.groupBoxComponents.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); this.SuspendLayout(); @@ -136,6 +137,7 @@ // this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.ID, this.ColumnComponentName, this.ColumnCount}); this.dataGridView.Location = new System.Drawing.Point(6, 26); @@ -144,20 +146,7 @@ this.dataGridView.RowTemplate.Height = 29; this.dataGridView.Size = new System.Drawing.Size(508, 327); this.dataGridView.TabIndex = 0; - // - // ColumnComponentName - // - this.ColumnComponentName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.ColumnComponentName.HeaderText = "Комплектующий"; - this.ColumnComponentName.MinimumWidth = 6; - this.ColumnComponentName.Name = "ColumnComponentName"; - // - // ColumnCount - // - this.ColumnCount.HeaderText = "Количество"; - this.ColumnCount.MinimumWidth = 6; - this.ColumnCount.Name = "ColumnCount"; - this.ColumnCount.Width = 125; + this.dataGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellContentClick); // // buttonSave // @@ -179,6 +168,30 @@ this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); // + // ID + // + this.ID.HeaderText = "ID"; + this.ID.MinimumWidth = 6; + this.ID.Name = "ID"; + this.ID.Visible = false; + this.ID.Width = 125; + // + // ColumnComponentName + // + this.ColumnComponentName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; + this.ColumnComponentName.HeaderText = "Комплектующий"; + this.ColumnComponentName.MinimumWidth = 6; + this.ColumnComponentName.Name = "ColumnComponentName"; + this.ColumnComponentName.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.ColumnComponentName.Width = 331; + // + // ColumnCount + // + this.ColumnCount.HeaderText = "Количество"; + this.ColumnCount.MinimumWidth = 6; + this.ColumnCount.Name = "ColumnCount"; + this.ColumnCount.Width = 125; + // // FormPlane // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); @@ -213,9 +226,10 @@ private Button buttonEdit; private Button buttonAdd; private DataGridView dataGridView; - private DataGridViewTextBoxColumn ColumnComponentName; - private DataGridViewTextBoxColumn ColumnCount; private Button buttonSave; private Button buttonCancel; + private DataGridViewTextBoxColumn ID; + private DataGridViewTextBoxColumn ColumnComponentName; + private DataGridViewTextBoxColumn ColumnCount; } } \ No newline at end of file diff --git a/AircraftPlant/AircraftPlant/FormPlane.cs b/AircraftPlant/AircraftPlant/FormPlane.cs index 15cf1cc..9516c77 100644 --- a/AircraftPlant/AircraftPlant/FormPlane.cs +++ b/AircraftPlant/AircraftPlant/FormPlane.cs @@ -69,7 +69,13 @@ namespace AircraftPlantView dataGridView.Rows.Clear(); foreach (var pc in _planeComponents) { - dataGridView.Rows.Add(new object[] { pc.Key, pc.Value.Item1.ComponentName, pc.Value.Item2 }); + dataGridView.Rows.Add(new object[] + { + pc.Key, + pc.Value.Item1.ComponentName, + pc.Value.Item2 + } + ); } textBoxPrice.Text = CalcPrice().ToString(); } @@ -213,5 +219,10 @@ namespace AircraftPlantView DialogResult = DialogResult.Cancel; Close(); } + + private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } } } diff --git a/AircraftPlant/AircraftPlant/FormPlane.resx b/AircraftPlant/AircraftPlant/FormPlane.resx index a201790..8e6d533 100644 --- a/AircraftPlant/AircraftPlant/FormPlane.resx +++ b/AircraftPlant/AircraftPlant/FormPlane.resx @@ -57,10 +57,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - - + True diff --git a/AircraftPlant/AircraftPlant/FormPlanes.cs b/AircraftPlant/AircraftPlant/FormPlanes.cs index b89f6ab..6fa481d 100644 --- a/AircraftPlant/AircraftPlant/FormPlanes.cs +++ b/AircraftPlant/AircraftPlant/FormPlanes.cs @@ -40,6 +40,7 @@ namespace AircraftPlantView dataGridView.DataSource = list; dataGridView.Columns["Id"].Visible = false; dataGridView.Columns["PlaneName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.Columns["PlaneComponents"].Visible = false; } _logger.LogInformation("Загрузка самолетов"); } diff --git a/AircraftPlant/AircraftPlant/Program.cs b/AircraftPlant/AircraftPlant/Program.cs index 352d8e5..f3783fb 100644 --- a/AircraftPlant/AircraftPlant/Program.cs +++ b/AircraftPlant/AircraftPlant/Program.cs @@ -46,7 +46,7 @@ namespace AircraftPlant services.AddTransient(); services.AddTransient(); services.AddTransient(); - //services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/AircraftPlant/AircraftPlantBusinessLogic/OrderLogic.cs b/AircraftPlant/AircraftPlantBusinessLogic/OrderLogic.cs index d246f41..02aa6f0 100644 --- a/AircraftPlant/AircraftPlantBusinessLogic/OrderLogic.cs +++ b/AircraftPlant/AircraftPlantBusinessLogic/OrderLogic.cs @@ -51,6 +51,7 @@ namespace AircraftPlantBusinessLogic.BusinessLogics return false; } model.Status = newStatus; + if (model.Status == OrderStatus.Выдан) model.DateImplement = DateTime.Now; if (_orderStorage.Update(model) == null) { model.Status--; diff --git a/AircraftPlant/AircraftPlantContracts/BindingModels/OrderBindingModel.cs b/AircraftPlant/AircraftPlantContracts/BindingModels/OrderBindingModel.cs index 6025955..85643d3 100644 --- a/AircraftPlant/AircraftPlantContracts/BindingModels/OrderBindingModel.cs +++ b/AircraftPlant/AircraftPlantContracts/BindingModels/OrderBindingModel.cs @@ -12,6 +12,8 @@ namespace AircraftPlantContracts.BindingModels { public int PlaneId { get; set; } + public string PlaneName { get; set; } = string.Empty; + public int Count { get; set; } public double Sum { get; set; } diff --git a/AircraftPlant/AircraftPlantContracts/ViewModels/OrderViewModel.cs b/AircraftPlant/AircraftPlantContracts/ViewModels/OrderViewModel.cs index 828456f..a6f315d 100644 --- a/AircraftPlant/AircraftPlantContracts/ViewModels/OrderViewModel.cs +++ b/AircraftPlant/AircraftPlantContracts/ViewModels/OrderViewModel.cs @@ -13,6 +13,9 @@ namespace AircraftPlantContracts.ViewModels { public int PlaneId { get; set; } + [DisplayName("Номер")] + public int Id { get; set; } + [DisplayName("Самолет")] public string PlaneName { get; set; } = string.Empty; @@ -30,8 +33,5 @@ namespace AircraftPlantContracts.ViewModels [DisplayName("Дата выполнения")] public DateTime? DateImplement { get; set; } - - [DisplayName("Номер")] - public int Id { get; set; } } } diff --git a/AircraftPlant/AircraftPlantDataModels/IOrderModel.cs b/AircraftPlant/AircraftPlantDataModels/IOrderModel.cs index dcd2df3..9a09799 100644 --- a/AircraftPlant/AircraftPlantDataModels/IOrderModel.cs +++ b/AircraftPlant/AircraftPlantDataModels/IOrderModel.cs @@ -10,6 +10,7 @@ namespace AircraftPlantDataModels.Models public interface IOrderModel : IId { int PlaneId { get; } + string PlaneName { get; } int Count { get; } double Sum { get; } OrderStatus Status { get; } diff --git a/AircraftPlant/AircraftPlantListImplement/Models/Order.cs b/AircraftPlant/AircraftPlantListImplement/Models/Order.cs index a781f80..2964826 100644 --- a/AircraftPlant/AircraftPlantListImplement/Models/Order.cs +++ b/AircraftPlant/AircraftPlantListImplement/Models/Order.cs @@ -15,6 +15,8 @@ namespace AircraftPlantListImplement.Models { public int PlaneId { get; private set; } + public string PlaneName { get; private set; } = string.Empty; + public int Count { get; private set; } public double Sum { get; private set; } @@ -36,6 +38,7 @@ namespace AircraftPlantListImplement.Models return new Order { PlaneId = model.PlaneId, + PlaneName = model.PlaneName, Count = model.Count, Sum = model.Sum, Status = model.Status, @@ -63,6 +66,7 @@ namespace AircraftPlantListImplement.Models public OrderViewModel GetViewModel => new() { PlaneId = PlaneId, + PlaneName = PlaneName, Count = Count, Sum = Sum, DateCreate = DateCreate,