This commit is contained in:
m1aksim1 2023-02-20 20:37:31 +04:00
parent d91170392e
commit c0bbf317eb
7 changed files with 50 additions and 55 deletions

View File

@ -39,12 +39,12 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogics
public bool DeliveryOrder(OrderBindingModel model)
{
model.DateImplement = DateTime.Now;
return SetOrderStatus(model, OrderStatus.Выдан);
}
public bool FinishOrder(OrderBindingModel model)
{
model.DateImplement = DateTime.Now;
return SetOrderStatus(model, OrderStatus.Готов);
}
@ -101,10 +101,10 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogics
$"Доступный статус: {(OrderStatus)((int)viewModel.Status + 1)}",
nameof(viewModel));
}
if (model.DateImplement == null) model.DateImplement = viewModel.DateImplement;
model.Status = orderStatus;
model.Sum = viewModel.Sum;
model.Count = viewModel.Count;
model.DateCreate = viewModel.DateCreate;
model.PackageId = viewModel.PackageId;
if (_orderStorage.Update(model) == null)
{

View File

@ -46,13 +46,8 @@ namespace SoftwareInstallationListImplement.Models
{
return;
}
PackageId = model.PackageId;
Count = model.Count;
Sum = model.Sum;
Status = model.Status;
DateCreate = model.DateCreate;
DateImplement = model.DateImplement;
Id = model.Id;
}
public OrderViewModel GetViewModel => new()

View File

@ -14,6 +14,7 @@ namespace SoftwareInstallationView
InitializeComponent();
_logger = logger;
_logic = logic;
LoadData();
}
private void FormComponents_Load(object sender, EventArgs e)
{

View File

@ -31,10 +31,7 @@ namespace SoftwareInstallationView
private void FormCreateOrder_Load(object sender, EventArgs e)
{
_logger.LogInformation("Загрузка изделий для заказа");
foreach (var el in _logicP.ReadList(null) ?? new())
{
comboBoxPackage.Items.Add(el.PackageName);
}
comboBoxPackage.DataSource = _logicP.ReadList(null) ?? new();
}
private void CalcSum()
{

View File

@ -32,9 +32,9 @@
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.packageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.componentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.button4 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.ButtonRef = new System.Windows.Forms.Button();
this.ButtonIssuedOrder = new System.Windows.Forms.Button();
this.ButtonOrderReady = new System.Windows.Forms.Button();
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
this.buttonCreateOrder = new System.Windows.Forms.Button();
this.dataGridView = new System.Windows.Forms.DataGridView();
@ -48,7 +48,7 @@
this.справочникиToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(584, 24);
this.menuStrip1.Size = new System.Drawing.Size(1125, 24);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1";
//
@ -64,54 +64,54 @@
// packageToolStripMenuItem
//
this.packageToolStripMenuItem.Name = "packageToolStripMenuItem";
this.packageToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.packageToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
this.packageToolStripMenuItem.Text = "Изделия";
this.packageToolStripMenuItem.Click += new System.EventHandler(this.PackagesToolStripMenuItem_Click);
//
// componentToolStripMenuItem
//
this.componentToolStripMenuItem.Name = "componentToolStripMenuItem";
this.componentToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.componentToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
this.componentToolStripMenuItem.Text = "Компоненты";
this.componentToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
//
// button4
// ButtonRef
//
this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button4.Location = new System.Drawing.Point(425, 374);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(147, 55);
this.button4.TabIndex = 12;
this.button4.Text = "Обновить список";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.ButtonRef_Click);
this.ButtonRef.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonRef.Location = new System.Drawing.Point(966, 374);
this.ButtonRef.Name = "ButtonRef";
this.ButtonRef.Size = new System.Drawing.Size(147, 55);
this.ButtonRef.TabIndex = 12;
this.ButtonRef.Text = "Обновить список";
this.ButtonRef.UseVisualStyleBackColor = true;
this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
//
// button3
// ButtonIssuedOrder
//
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button3.Location = new System.Drawing.Point(425, 284);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(147, 55);
this.button3.TabIndex = 11;
this.button3.Text = "Заказ выдан";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
this.ButtonIssuedOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonIssuedOrder.Location = new System.Drawing.Point(966, 284);
this.ButtonIssuedOrder.Name = "ButtonIssuedOrder";
this.ButtonIssuedOrder.Size = new System.Drawing.Size(147, 55);
this.ButtonIssuedOrder.TabIndex = 11;
this.ButtonIssuedOrder.Text = "Заказ выдан";
this.ButtonIssuedOrder.UseVisualStyleBackColor = true;
this.ButtonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
//
// button2
// ButtonOrderReady
//
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.button2.Location = new System.Drawing.Point(425, 194);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(147, 55);
this.button2.TabIndex = 10;
this.button2.Text = "Заказ готов";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.ButtonOrderReady_Click);
this.ButtonOrderReady.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ButtonOrderReady.Location = new System.Drawing.Point(966, 194);
this.ButtonOrderReady.Name = "ButtonOrderReady";
this.ButtonOrderReady.Size = new System.Drawing.Size(147, 55);
this.ButtonOrderReady.TabIndex = 10;
this.ButtonOrderReady.Text = "Заказ готов";
this.ButtonOrderReady.UseVisualStyleBackColor = true;
this.ButtonOrderReady.Click += new System.EventHandler(this.ButtonOrderReady_Click);
//
// buttonTakeOrderInWork
//
this.buttonTakeOrderInWork.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonTakeOrderInWork.Location = new System.Drawing.Point(425, 112);
this.buttonTakeOrderInWork.Location = new System.Drawing.Point(966, 112);
this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
this.buttonTakeOrderInWork.Size = new System.Drawing.Size(147, 55);
this.buttonTakeOrderInWork.TabIndex = 9;
@ -122,7 +122,7 @@
// buttonCreateOrder
//
this.buttonCreateOrder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCreateOrder.Location = new System.Drawing.Point(425, 27);
this.buttonCreateOrder.Location = new System.Drawing.Point(966, 27);
this.buttonCreateOrder.Name = "buttonCreateOrder";
this.buttonCreateOrder.Size = new System.Drawing.Size(147, 55);
this.buttonCreateOrder.TabIndex = 8;
@ -140,17 +140,17 @@
this.dataGridView.Location = new System.Drawing.Point(12, 27);
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowTemplate.Height = 25;
this.dataGridView.Size = new System.Drawing.Size(407, 402);
this.dataGridView.Size = new System.Drawing.Size(948, 402);
this.dataGridView.TabIndex = 7;
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 441);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.ClientSize = new System.Drawing.Size(1125, 441);
this.Controls.Add(this.ButtonRef);
this.Controls.Add(this.ButtonIssuedOrder);
this.Controls.Add(this.ButtonOrderReady);
this.Controls.Add(this.buttonTakeOrderInWork);
this.Controls.Add(this.buttonCreateOrder);
this.Controls.Add(this.dataGridView);
@ -171,9 +171,9 @@
private ToolStripMenuItem справочникиToolStripMenuItem;
private ToolStripMenuItem packageToolStripMenuItem;
private ToolStripMenuItem componentToolStripMenuItem;
private Button button4;
private Button button3;
private Button button2;
private Button ButtonRef;
private Button ButtonIssuedOrder;
private Button ButtonOrderReady;
private Button buttonTakeOrderInWork;
private Button buttonCreateOrder;
private DataGridView dataGridView;

View File

@ -26,7 +26,7 @@ namespace SoftwareInstallationView
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["PackageId"].Visible = false;
dataGridView.Columns["PackageName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
_logger.LogInformation("Загрузка заказов");

View File

@ -13,6 +13,7 @@ namespace SoftwareInstallationView
InitializeComponent();
_logger = logger;
_logic = logic;
LoadData();
}
private void FormViewPackage_Load(object sender, EventArgs e)
{
@ -27,6 +28,7 @@ namespace SoftwareInstallationView
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["PackageComponents"].Visible = false;
dataGridView.Columns["PackageName"].AutoSizeMode =
DataGridViewAutoSizeColumnMode.Fill;
}