Доработка
This commit is contained in:
parent
c24f03fe0c
commit
8db2a5443e
@ -2,18 +2,18 @@
|
|||||||
|
|
||||||
public class Components_Production
|
public class Components_Production
|
||||||
{
|
{
|
||||||
public int ComponentsID { get; private set; }
|
public int Id { get; set; }
|
||||||
|
|
||||||
public int ProductionID { get; private set; }
|
public int ComponentsID { get; private set; }
|
||||||
|
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
|
|
||||||
public static Components_Production CreateElement(int componentsID, int productionID, int count)
|
public static Components_Production CreateElement(int id, int componentsID, int count)
|
||||||
{
|
{
|
||||||
return new Components_Production
|
return new Components_Production
|
||||||
{
|
{
|
||||||
|
Id = id,
|
||||||
ComponentsID = componentsID,
|
ComponentsID = componentsID,
|
||||||
ProductionID = productionID,
|
|
||||||
Count = count
|
Count = count
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
26
ProjectWarehouse/ProjectWarehouse/Entities/Employee.cs
Normal file
26
ProjectWarehouse/ProjectWarehouse/Entities/Employee.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using ProjectWarehouse.Entities.Enums;
|
||||||
|
|
||||||
|
namespace ProjectWarehouse.Entities;
|
||||||
|
|
||||||
|
public class Employee
|
||||||
|
{
|
||||||
|
public int Id { get; private set; }
|
||||||
|
|
||||||
|
public string FirstName { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public string LastName { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
public EmployeePost EmployeePost { get; private set; }
|
||||||
|
|
||||||
|
public static Employee CreateEntity(int id, string first, string last,
|
||||||
|
EmployeePost employeePost)
|
||||||
|
{
|
||||||
|
return new Employee
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
FirstName = first ?? string.Empty,
|
||||||
|
LastName = last ?? string.Empty,
|
||||||
|
EmployeePost = employeePost
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
namespace ProjectWarehouse.Entities.Enums;
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum EmployeePost
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
|
||||||
|
Ordinary = 1,
|
||||||
|
|
||||||
|
Senior = 2,
|
||||||
|
|
||||||
|
Head = 4
|
||||||
|
}
|
@ -1,24 +1,21 @@
|
|||||||
namespace ProjectWarehouse.Entities;
|
namespace ProjectWarehouse.Entities;
|
||||||
|
|
||||||
public class Movement_Components
|
public class Inventory
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
|
||||||
public double Quantity { get; private set; }
|
public double Quantity { get; private set; }
|
||||||
|
|
||||||
public DateTime DateMove { get; private set; }
|
|
||||||
|
|
||||||
public bool IsDefect { get; private set; }
|
public bool IsDefect { get; private set; }
|
||||||
|
|
||||||
public int ComponentsID { get; private set; }
|
public int ComponentsID { get; private set; }
|
||||||
|
|
||||||
public static Movement_Components CreateEntity(int id, double quantity, bool isDefect, int ComponentsID)
|
public static Inventory CreateEntity(int id, double quantity, bool isDefect, int ComponentsID)
|
||||||
{
|
{
|
||||||
return new Movement_Components
|
return new Inventory
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
Quantity = quantity,
|
Quantity = quantity,
|
||||||
DateMove = DateTime.Now,
|
|
||||||
IsDefect = isDefect,
|
IsDefect = isDefect,
|
||||||
ComponentsID = ComponentsID
|
ComponentsID = ComponentsID
|
||||||
};
|
};
|
@ -4,13 +4,13 @@ public class OrderRequest
|
|||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
|
|
||||||
public int Quantity { get; private set; }
|
public double Quantity { get; private set; }
|
||||||
|
|
||||||
public DateTime DateOrder { get; private set; }
|
public DateTime DateOrder { get; private set; }
|
||||||
|
|
||||||
public int ComponentsID { get; private set; }
|
public int ComponentsID { get; private set; }
|
||||||
|
|
||||||
public static OrderRequest CreateEntity(int id, int quantity, int componentsID)
|
public static OrderRequest CreateEntity(int id, double quantity, int componentsID)
|
||||||
{
|
{
|
||||||
return new OrderRequest
|
return new OrderRequest
|
||||||
{
|
{
|
||||||
|
@ -8,13 +8,19 @@ public class Production
|
|||||||
|
|
||||||
public string Description { get; private set; } = string.Empty;
|
public string Description { get; private set; } = string.Empty;
|
||||||
|
|
||||||
public static Production CreateEntity(int id, string name, string description)
|
public int EmployeeId { get; private set; }
|
||||||
|
|
||||||
|
public IEnumerable<Components_Production> Components_Productions { get; private set; } = [];
|
||||||
|
|
||||||
|
public static Production CreateEntity(int id, string name, string description, int employeeId, IEnumerable<Components_Production> components_Productions)
|
||||||
{
|
{
|
||||||
return new Production
|
return new Production
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
Name = name,
|
Name = name,
|
||||||
Description = description ?? string.Empty
|
Description = description ?? string.Empty,
|
||||||
|
EmployeeId = employeeId,
|
||||||
|
Components_Productions = components_Productions
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,15 +31,17 @@
|
|||||||
menuStrip = new MenuStrip();
|
menuStrip = new MenuStrip();
|
||||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ComponentToolStripMenuItem = new ToolStripMenuItem();
|
ComponentToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ProductionToolStripMenuItem = new ToolStripMenuItem();
|
EmployeeToolStripMenuItem = new ToolStripMenuItem();
|
||||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
операцииToolStripMenuItem = new ToolStripMenuItem();
|
||||||
MovementToolStripMenuItem = new ToolStripMenuItem();
|
InventoryToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
Components_ProductionToolStripMenuItem = new ToolStripMenuItem();
|
||||||
заявкиToolStripMenuItem = new ToolStripMenuItem();
|
заявкиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
menuStrip.SuspendLayout();
|
menuStrip.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// menuStrip
|
// menuStrip
|
||||||
//
|
//
|
||||||
|
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, заявкиToolStripMenuItem });
|
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, заявкиToolStripMenuItem });
|
||||||
menuStrip.Location = new Point(0, 0);
|
menuStrip.Location = new Point(0, 0);
|
||||||
menuStrip.Name = "menuStrip";
|
menuStrip.Name = "menuStrip";
|
||||||
@ -49,38 +51,45 @@
|
|||||||
//
|
//
|
||||||
// справочникиToolStripMenuItem
|
// справочникиToolStripMenuItem
|
||||||
//
|
//
|
||||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ComponentToolStripMenuItem, ProductionToolStripMenuItem });
|
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ComponentToolStripMenuItem, EmployeeToolStripMenuItem });
|
||||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
||||||
справочникиToolStripMenuItem.Text = "Справочники";
|
справочникиToolStripMenuItem.Text = "Справочники";
|
||||||
//
|
//
|
||||||
// ComponenttoolStripMenuItem
|
// ComponentToolStripMenuItem
|
||||||
//
|
//
|
||||||
ComponentToolStripMenuItem.Name = "ComponenttoolStripMenuItem";
|
ComponentToolStripMenuItem.Name = "ComponentToolStripMenuItem";
|
||||||
ComponentToolStripMenuItem.Size = new Size(180, 22);
|
ComponentToolStripMenuItem.Size = new Size(180, 22);
|
||||||
ComponentToolStripMenuItem.Text = "Комплектующие";
|
ComponentToolStripMenuItem.Text = "Комплектующие";
|
||||||
ComponentToolStripMenuItem.Click += ComponentToolStripMenuItem_Click;
|
ComponentToolStripMenuItem.Click += ComponentToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// типыКомплектующихToolStripMenuItem
|
// EmployeeToolStripMenuItem
|
||||||
//
|
//
|
||||||
ProductionToolStripMenuItem.Name = "ProductionToolStripMenuItem";
|
EmployeeToolStripMenuItem.Name = "EmployeeToolStripMenuItem";
|
||||||
ProductionToolStripMenuItem.Size = new Size(180, 22);
|
EmployeeToolStripMenuItem.Size = new Size(180, 22);
|
||||||
ProductionToolStripMenuItem.Text = "Продукция";
|
EmployeeToolStripMenuItem.Text = "Работники";
|
||||||
ProductionToolStripMenuItem.Click += ProductionToolStripMenuItem_Click;
|
EmployeeToolStripMenuItem.Click += EmployeeToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// операцииToolStripMenuItem
|
// операцииToolStripMenuItem
|
||||||
//
|
//
|
||||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { MovementToolStripMenuItem });
|
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { InventoryToolStripMenuItem, Components_ProductionToolStripMenuItem });
|
||||||
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
||||||
операцииToolStripMenuItem.Size = new Size(75, 20);
|
операцииToolStripMenuItem.Size = new Size(75, 20);
|
||||||
операцииToolStripMenuItem.Text = "Операции";
|
операцииToolStripMenuItem.Text = "Операции";
|
||||||
//
|
//
|
||||||
// отправкаНаПроизводствоToolStripMenuItem
|
// InventoryToolStripMenuItem
|
||||||
//
|
//
|
||||||
MovementToolStripMenuItem.Name = "MovementToolStripMenuItem";
|
InventoryToolStripMenuItem.Name = "InventoryToolStripMenuItem";
|
||||||
MovementToolStripMenuItem.Size = new Size(221, 22);
|
InventoryToolStripMenuItem.Size = new Size(204, 22);
|
||||||
MovementToolStripMenuItem.Text = "Отправка на производство";
|
InventoryToolStripMenuItem.Text = "Добавление на склад";
|
||||||
MovementToolStripMenuItem.Click += MovementToolStripMenuItem_Click;
|
InventoryToolStripMenuItem.Click += InventoryToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
|
// Components_ProductionToolStripMenuItem
|
||||||
|
//
|
||||||
|
Components_ProductionToolStripMenuItem.Name = "Components_ProductionToolStripMenuItem";
|
||||||
|
Components_ProductionToolStripMenuItem.Size = new Size(204, 22);
|
||||||
|
Components_ProductionToolStripMenuItem.Text = "Добавление продукции";
|
||||||
|
Components_ProductionToolStripMenuItem.Click += Components_ProductionToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// заявкиToolStripMenuItem
|
// заявкиToolStripMenuItem
|
||||||
//
|
//
|
||||||
@ -114,7 +123,8 @@
|
|||||||
private ToolStripMenuItem операцииToolStripMenuItem;
|
private ToolStripMenuItem операцииToolStripMenuItem;
|
||||||
private ToolStripMenuItem заявкиToolStripMenuItem;
|
private ToolStripMenuItem заявкиToolStripMenuItem;
|
||||||
private ToolStripMenuItem ComponentToolStripMenuItem;
|
private ToolStripMenuItem ComponentToolStripMenuItem;
|
||||||
private ToolStripMenuItem MovementToolStripMenuItem;
|
private ToolStripMenuItem InventoryToolStripMenuItem;
|
||||||
private ToolStripMenuItem ProductionToolStripMenuItem;
|
private ToolStripMenuItem EmployeeToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem Components_ProductionToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,11 @@ namespace ProjectWarehouse
|
|||||||
throw new ArgumentNullException(nameof(container));
|
throw new ArgumentNullException(nameof(container));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MovementToolStripMenuItem_Click(object sender, EventArgs e)
|
private void InventoryToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_container.Resolve<FormMovements>().ShowDialog();
|
_container.Resolve<FormInventorys>().ShowDialog();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -61,5 +61,29 @@ namespace ProjectWarehouse
|
|||||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EmployeeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormEmployees>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Components_ProductionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormProductions>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -150,6 +150,7 @@
|
|||||||
Controls.Add(labelName);
|
Controls.Add(labelName);
|
||||||
Controls.Add(comboBoxType);
|
Controls.Add(comboBoxType);
|
||||||
Name = "FormComponent";
|
Name = "FormComponent";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
Text = "Компонент";
|
Text = "Компонент";
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
||||||
|
@ -48,7 +48,7 @@ namespace ProjectWarehouse.Forms
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(textBoxName.Text) || comboBoxType.SelectedIndex < 1)
|
if (string.IsNullOrWhiteSpace(textBoxName.Text) || comboBoxType.SelectedIndex < 0)
|
||||||
{
|
{
|
||||||
throw new Exception("Имеются не заполненные поля");
|
throw new Exception("Имеются не заполненные поля");
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,7 @@
|
|||||||
Controls.Add(dataGridViewData);
|
Controls.Add(dataGridViewData);
|
||||||
Controls.Add(panel1);
|
Controls.Add(panel1);
|
||||||
Name = "FormComponents";
|
Name = "FormComponents";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
Text = "Компоненты";
|
Text = "Компоненты";
|
||||||
Load += FormComponents_Load;
|
Load += FormComponents_Load;
|
||||||
panel1.ResumeLayout(false);
|
panel1.ResumeLayout(false);
|
||||||
|
147
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployee.Designer.cs
generated
Normal file
147
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployee.Designer.cs
generated
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
namespace ProjectWarehouse.Forms
|
||||||
|
{
|
||||||
|
partial class FormEmployee
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
labelName = new Label();
|
||||||
|
labelLastName = new Label();
|
||||||
|
labelPost = new Label();
|
||||||
|
textBoxFirstName = new TextBox();
|
||||||
|
textBoxLastName = new TextBox();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
|
checkedListBoxPost = new CheckedListBox();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// labelName
|
||||||
|
//
|
||||||
|
labelName.AutoSize = true;
|
||||||
|
labelName.Location = new Point(60, 28);
|
||||||
|
labelName.Name = "labelName";
|
||||||
|
labelName.Size = new Size(31, 15);
|
||||||
|
labelName.TabIndex = 0;
|
||||||
|
labelName.Text = "Имя";
|
||||||
|
//
|
||||||
|
// labelLastName
|
||||||
|
//
|
||||||
|
labelLastName.AutoSize = true;
|
||||||
|
labelLastName.Location = new Point(60, 67);
|
||||||
|
labelLastName.Name = "labelLastName";
|
||||||
|
labelLastName.Size = new Size(58, 15);
|
||||||
|
labelLastName.TabIndex = 1;
|
||||||
|
labelLastName.Text = "Фамилия";
|
||||||
|
//
|
||||||
|
// labelPost
|
||||||
|
//
|
||||||
|
labelPost.AutoSize = true;
|
||||||
|
labelPost.Location = new Point(60, 108);
|
||||||
|
labelPost.Name = "labelPost";
|
||||||
|
labelPost.Size = new Size(69, 15);
|
||||||
|
labelPost.TabIndex = 2;
|
||||||
|
labelPost.Text = "Должность";
|
||||||
|
//
|
||||||
|
// textBoxFirstName
|
||||||
|
//
|
||||||
|
textBoxFirstName.Location = new Point(177, 26);
|
||||||
|
textBoxFirstName.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
textBoxFirstName.Name = "textBoxFirstName";
|
||||||
|
textBoxFirstName.Size = new Size(133, 23);
|
||||||
|
textBoxFirstName.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// textBoxLastName
|
||||||
|
//
|
||||||
|
textBoxLastName.Location = new Point(177, 64);
|
||||||
|
textBoxLastName.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
textBoxLastName.Name = "textBoxLastName";
|
||||||
|
textBoxLastName.Size = new Size(133, 23);
|
||||||
|
textBoxLastName.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(60, 211);
|
||||||
|
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(93, 22);
|
||||||
|
buttonSave.TabIndex = 6;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(222, 211);
|
||||||
|
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(87, 22);
|
||||||
|
buttonCancel.TabIndex = 7;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// checkedListBoxPost
|
||||||
|
//
|
||||||
|
checkedListBoxPost.FormattingEnabled = true;
|
||||||
|
checkedListBoxPost.Location = new Point(172, 108);
|
||||||
|
checkedListBoxPost.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
checkedListBoxPost.Name = "checkedListBoxPost";
|
||||||
|
checkedListBoxPost.Size = new Size(137, 76);
|
||||||
|
checkedListBoxPost.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// FormEmployee
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(398, 253);
|
||||||
|
Controls.Add(checkedListBoxPost);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(textBoxLastName);
|
||||||
|
Controls.Add(textBoxFirstName);
|
||||||
|
Controls.Add(labelPost);
|
||||||
|
Controls.Add(labelLastName);
|
||||||
|
Controls.Add(labelName);
|
||||||
|
Margin = new Padding(3, 2, 3, 2);
|
||||||
|
Name = "FormEmployee";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Работник";
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label labelName;
|
||||||
|
private Label labelLastName;
|
||||||
|
private Label labelPost;
|
||||||
|
private TextBox textBoxFirstName;
|
||||||
|
private TextBox textBoxLastName;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
|
private CheckedListBox checkedListBoxPost;
|
||||||
|
}
|
||||||
|
}
|
102
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployee.cs
Normal file
102
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployee.cs
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
using Microsoft.VisualBasic.FileIO;
|
||||||
|
using ProjectWarehouse.Entities;
|
||||||
|
using ProjectWarehouse.Entities.Enums;
|
||||||
|
using ProjectWarehouse.Repositories;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ProjectWarehouse.Forms
|
||||||
|
{
|
||||||
|
public partial class FormEmployee : Form
|
||||||
|
{
|
||||||
|
private readonly IEmployeeRepository _employeeRepository;
|
||||||
|
|
||||||
|
private int? _employeeId;
|
||||||
|
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var employee = _employeeRepository.ReadEmployeeById(value);
|
||||||
|
if (employee == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException(nameof(employee));
|
||||||
|
}
|
||||||
|
|
||||||
|
textBoxFirstName.Text = employee.FirstName;
|
||||||
|
textBoxLastName.Text = employee.LastName;
|
||||||
|
foreach (EmployeePost elem in Enum.GetValues(typeof(EmployeePost)))
|
||||||
|
{
|
||||||
|
if ((elem & employee.EmployeePost) != 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
checkedListBoxPost.SetItemChecked(checkedListBoxPost.Items.IndexOf(elem), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_employeeId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormEmployee(IEmployeeRepository employeeRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_employeeRepository = employeeRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(employeeRepository));
|
||||||
|
|
||||||
|
foreach (var elem in Enum.GetValues(typeof(EmployeePost)))
|
||||||
|
{
|
||||||
|
checkedListBoxPost.Items.Add(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxFirstName.Text) || string.IsNullOrWhiteSpace(textBoxLastName.Text) || checkedListBoxPost.CheckedItems.Count == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_employeeId.HasValue)
|
||||||
|
{
|
||||||
|
|
||||||
|
_employeeRepository.UpdateEmployee(CreateEmployee(_employeeId.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
_employeeRepository.CreateEmployee(CreateEmployee(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
private Employee CreateEmployee(int id)
|
||||||
|
{
|
||||||
|
EmployeePost employeePost = EmployeePost.None;
|
||||||
|
foreach (var elem in checkedListBoxPost.CheckedItems)
|
||||||
|
{
|
||||||
|
employeePost |= (EmployeePost)elem;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Employee.CreateEntity(id, textBoxFirstName.Text, textBoxLastName.Text, employeePost);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
126
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployees.Designer.cs
generated
Normal file
126
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployees.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
namespace ProjectWarehouse.Forms
|
||||||
|
{
|
||||||
|
partial class FormEmployees
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
ButtonDel = new Button();
|
||||||
|
ButtonUpd = new Button();
|
||||||
|
ButtonAdd = new Button();
|
||||||
|
dataGridViewData = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(ButtonDel);
|
||||||
|
panel1.Controls.Add(ButtonUpd);
|
||||||
|
panel1.Controls.Add(ButtonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(685, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(115, 450);
|
||||||
|
panel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ButtonDel
|
||||||
|
//
|
||||||
|
ButtonDel.BackgroundImage = Properties.Resources.минус;
|
||||||
|
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonDel.Location = new Point(19, 264);
|
||||||
|
ButtonDel.Name = "ButtonDel";
|
||||||
|
ButtonDel.Size = new Size(75, 74);
|
||||||
|
ButtonDel.TabIndex = 2;
|
||||||
|
ButtonDel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonDel.Click += ButtonDel_Click;
|
||||||
|
//
|
||||||
|
// ButtonUpd
|
||||||
|
//
|
||||||
|
ButtonUpd.BackgroundImage = Properties.Resources.редактировать;
|
||||||
|
ButtonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonUpd.Location = new Point(19, 135);
|
||||||
|
ButtonUpd.Name = "ButtonUpd";
|
||||||
|
ButtonUpd.Size = new Size(75, 74);
|
||||||
|
ButtonUpd.TabIndex = 1;
|
||||||
|
ButtonUpd.UseVisualStyleBackColor = true;
|
||||||
|
ButtonUpd.Click += ButtonUpd_Click;
|
||||||
|
//
|
||||||
|
// ButtonAdd
|
||||||
|
//
|
||||||
|
ButtonAdd.BackgroundImage = Properties.Resources.плюс;
|
||||||
|
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonAdd.Location = new Point(19, 24);
|
||||||
|
ButtonAdd.Name = "ButtonAdd";
|
||||||
|
ButtonAdd.Size = new Size(75, 74);
|
||||||
|
ButtonAdd.TabIndex = 0;
|
||||||
|
ButtonAdd.UseVisualStyleBackColor = true;
|
||||||
|
ButtonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridViewData
|
||||||
|
//
|
||||||
|
dataGridViewData.AllowUserToAddRows = false;
|
||||||
|
dataGridViewData.AllowUserToDeleteRows = false;
|
||||||
|
dataGridViewData.AllowUserToResizeColumns = false;
|
||||||
|
dataGridViewData.AllowUserToResizeRows = false;
|
||||||
|
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewData.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewData.Location = new Point(0, 0);
|
||||||
|
dataGridViewData.MultiSelect = false;
|
||||||
|
dataGridViewData.Name = "dataGridViewData";
|
||||||
|
dataGridViewData.ReadOnly = true;
|
||||||
|
dataGridViewData.RowHeadersVisible = false;
|
||||||
|
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridViewData.Size = new Size(685, 450);
|
||||||
|
dataGridViewData.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// FormEmployees
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(dataGridViewData);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormEmployees";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Работники";
|
||||||
|
Load += FormEmployees_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button ButtonDel;
|
||||||
|
private Button ButtonUpd;
|
||||||
|
private Button ButtonAdd;
|
||||||
|
private DataGridView dataGridViewData;
|
||||||
|
}
|
||||||
|
}
|
104
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployees.cs
Normal file
104
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployees.cs
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
using ProjectWarehouse.Repositories;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectWarehouse.Forms
|
||||||
|
{
|
||||||
|
public partial class FormEmployees : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
|
private readonly IEmployeeRepository _employeeRepository;
|
||||||
|
|
||||||
|
public FormEmployees(IUnityContainer container, IEmployeeRepository employeeRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_employeeRepository = employeeRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(employeeRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormEmployees_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormEmployee>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<FormEmployee>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonDel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_employeeRepository.DeleteEmployee(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadList() => dataGridViewData.DataSource = _employeeRepository.ReadEmployees();
|
||||||
|
|
||||||
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridViewData.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
namespace ProjectWarehouse.Forms
|
namespace ProjectWarehouse.Forms
|
||||||
{
|
{
|
||||||
partial class FormMovement
|
partial class FormInventory
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@ -89,7 +89,7 @@
|
|||||||
//
|
//
|
||||||
buttonSave.Location = new Point(61, 162);
|
buttonSave.Location = new Point(61, 162);
|
||||||
buttonSave.Name = "buttonSave";
|
buttonSave.Name = "buttonSave";
|
||||||
buttonSave.Size = new Size(75, 23);
|
buttonSave.Size = new Size(87, 23);
|
||||||
buttonSave.TabIndex = 6;
|
buttonSave.TabIndex = 6;
|
||||||
buttonSave.Text = "Сохранить";
|
buttonSave.Text = "Сохранить";
|
||||||
buttonSave.UseVisualStyleBackColor = true;
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
@ -105,7 +105,7 @@
|
|||||||
buttonCancel.UseVisualStyleBackColor = true;
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
buttonCancel.Click += ButtonCancel_Click;
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
//
|
//
|
||||||
// FormMovement
|
// FormInventory
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
@ -117,8 +117,9 @@
|
|||||||
Controls.Add(comboBoxComponent);
|
Controls.Add(comboBoxComponent);
|
||||||
Controls.Add(labelCount);
|
Controls.Add(labelCount);
|
||||||
Controls.Add(labelComponent);
|
Controls.Add(labelComponent);
|
||||||
Name = "FormMovement";
|
Name = "FormInventory";
|
||||||
Text = "Перемещение";
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Добавление на склад";
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
83
ProjectWarehouse/ProjectWarehouse/Forms/FormInventory.cs
Normal file
83
ProjectWarehouse/ProjectWarehouse/Forms/FormInventory.cs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
using ProjectWarehouse.Entities;
|
||||||
|
using ProjectWarehouse.Entities.Enums;
|
||||||
|
using ProjectWarehouse.Repositories;
|
||||||
|
using ProjectWarehouse.Repositories.Implementations;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace ProjectWarehouse.Forms
|
||||||
|
{
|
||||||
|
public partial class FormInventory : Form
|
||||||
|
{
|
||||||
|
private readonly IInventoryRepository _inventoryRepository;
|
||||||
|
|
||||||
|
private int? _inventoryId;
|
||||||
|
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var inventory = _inventoryRepository.ReadInventoryById(value);
|
||||||
|
if (inventory == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException(nameof(inventory));
|
||||||
|
}
|
||||||
|
|
||||||
|
comboBoxComponent.SelectedValue = inventory.ComponentsID;
|
||||||
|
numericUpDownCount.Value = (decimal)inventory.Quantity;
|
||||||
|
checkBoxIsDefect.Checked = inventory.IsDefect;
|
||||||
|
|
||||||
|
_inventoryId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormInventory(IInventoryRepository inventoryRepository, IComponentsRepository componentsRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_inventoryRepository = inventoryRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(inventoryRepository));
|
||||||
|
|
||||||
|
comboBoxComponent.DataSource = componentsRepository.ReadComponents();
|
||||||
|
comboBoxComponent.DisplayMember = "Name";
|
||||||
|
comboBoxComponent.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (comboBoxComponent.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются не заполненные поля");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_inventoryId.HasValue)
|
||||||
|
{
|
||||||
|
_inventoryRepository.UpdateInventory(CreateInventory(_inventoryId.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_inventoryRepository.CreateInventory(CreateInventory(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
|
private Inventory CreateInventory(int id) =>
|
||||||
|
Inventory.CreateEntity(id, (double)numericUpDownCount.Value, checkBoxIsDefect.Checked, (int)comboBoxComponent.SelectedValue!);
|
||||||
|
}
|
||||||
|
}
|
120
ProjectWarehouse/ProjectWarehouse/Forms/FormInventory.resx
Normal file
120
ProjectWarehouse/ProjectWarehouse/Forms/FormInventory.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -1,6 +1,6 @@
|
|||||||
namespace ProjectWarehouse.Forms
|
namespace ProjectWarehouse.Forms
|
||||||
{
|
{
|
||||||
partial class FormMovements
|
partial class FormInventorys
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@ -31,13 +31,17 @@
|
|||||||
panel1 = new Panel();
|
panel1 = new Panel();
|
||||||
ButtonAdd = new Button();
|
ButtonAdd = new Button();
|
||||||
dataGridViewData = new DataGridView();
|
dataGridViewData = new DataGridView();
|
||||||
|
ButtonDel = new Button();
|
||||||
|
ButtonUpd = new Button();
|
||||||
panel1.SuspendLayout();
|
panel1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// panel1
|
// panel1
|
||||||
//
|
//
|
||||||
|
panel1.Controls.Add(ButtonDel);
|
||||||
panel1.Controls.Add(ButtonAdd);
|
panel1.Controls.Add(ButtonAdd);
|
||||||
|
panel1.Controls.Add(ButtonUpd);
|
||||||
panel1.Dock = DockStyle.Right;
|
panel1.Dock = DockStyle.Right;
|
||||||
panel1.Location = new Point(685, 0);
|
panel1.Location = new Point(685, 0);
|
||||||
panel1.Name = "panel1";
|
panel1.Name = "panel1";
|
||||||
@ -73,16 +77,39 @@
|
|||||||
dataGridViewData.Size = new Size(685, 450);
|
dataGridViewData.Size = new Size(685, 450);
|
||||||
dataGridViewData.TabIndex = 1;
|
dataGridViewData.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// FormMovements
|
// ButtonDel
|
||||||
|
//
|
||||||
|
ButtonDel.BackgroundImage = Properties.Resources.минус;
|
||||||
|
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonDel.Location = new Point(19, 284);
|
||||||
|
ButtonDel.Name = "ButtonDel";
|
||||||
|
ButtonDel.Size = new Size(75, 74);
|
||||||
|
ButtonDel.TabIndex = 4;
|
||||||
|
ButtonDel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonDel.Click += ButtonDel_Click;
|
||||||
|
//
|
||||||
|
// ButtonUpd
|
||||||
|
//
|
||||||
|
ButtonUpd.BackgroundImage = Properties.Resources.редактировать;
|
||||||
|
ButtonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonUpd.Location = new Point(19, 155);
|
||||||
|
ButtonUpd.Name = "ButtonUpd";
|
||||||
|
ButtonUpd.Size = new Size(75, 74);
|
||||||
|
ButtonUpd.TabIndex = 3;
|
||||||
|
ButtonUpd.UseVisualStyleBackColor = true;
|
||||||
|
ButtonUpd.Click += ButtonUpd_Click;
|
||||||
|
//
|
||||||
|
// FormInventorys
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(800, 450);
|
ClientSize = new Size(800, 450);
|
||||||
Controls.Add(dataGridViewData);
|
Controls.Add(dataGridViewData);
|
||||||
Controls.Add(panel1);
|
Controls.Add(panel1);
|
||||||
Name = "FormMovements";
|
Name = "FormInventorys";
|
||||||
Text = "Движение компонентов";
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
Load += FormMovements_Load;
|
Text = "Склад";
|
||||||
|
Load += FormInventorys_Load;
|
||||||
panel1.ResumeLayout(false);
|
panel1.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
@ -93,5 +120,7 @@
|
|||||||
private Panel panel1;
|
private Panel panel1;
|
||||||
private Button ButtonAdd;
|
private Button ButtonAdd;
|
||||||
private DataGridView dataGridViewData;
|
private DataGridView dataGridViewData;
|
||||||
|
private Button ButtonDel;
|
||||||
|
private Button ButtonUpd;
|
||||||
}
|
}
|
||||||
}
|
}
|
105
ProjectWarehouse/ProjectWarehouse/Forms/FormInventorys.cs
Normal file
105
ProjectWarehouse/ProjectWarehouse/Forms/FormInventorys.cs
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
using ProjectWarehouse.Repositories;
|
||||||
|
using ProjectWarehouse.Repositories.Implementations;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace ProjectWarehouse.Forms
|
||||||
|
{
|
||||||
|
public partial class FormInventorys : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
|
private readonly IInventoryRepository _inventoryRepository;
|
||||||
|
|
||||||
|
public FormInventorys(IUnityContainer container, IInventoryRepository inventoryRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_inventoryRepository = inventoryRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(inventoryRepository));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormInventorys_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormInventory>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadList() => dataGridViewData.DataSource = _inventoryRepository.ReadInventory();
|
||||||
|
|
||||||
|
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var form = _container.Resolve<FormInventory>();
|
||||||
|
form.Id = findId;
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonDel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_inventoryRepository.DeleteInventory(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||||
|
{
|
||||||
|
id = 0;
|
||||||
|
if (dataGridViewData.SelectedRows.Count < 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ProjectWarehouse/ProjectWarehouse/Forms/FormInventorys.resx
Normal file
120
ProjectWarehouse/ProjectWarehouse/Forms/FormInventorys.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -1,42 +0,0 @@
|
|||||||
using ProjectWarehouse.Entities;
|
|
||||||
using ProjectWarehouse.Repositories;
|
|
||||||
|
|
||||||
namespace ProjectWarehouse.Forms
|
|
||||||
{
|
|
||||||
public partial class FormMovement : Form
|
|
||||||
{
|
|
||||||
private readonly IMovement_ComponentsRepository _movementRepository;
|
|
||||||
|
|
||||||
public FormMovement(IMovement_ComponentsRepository movementRepository, IComponentsRepository componentsRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_movementRepository = movementRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(movementRepository));
|
|
||||||
|
|
||||||
comboBoxComponent.DataSource = componentsRepository.ReadComponents();
|
|
||||||
comboBoxComponent.DisplayMember = "Name";
|
|
||||||
comboBoxComponent.ValueMember = "Id";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonSave_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (comboBoxComponent.SelectedIndex < 1)
|
|
||||||
{
|
|
||||||
throw new Exception("Имеются не заполненные поля");
|
|
||||||
}
|
|
||||||
|
|
||||||
_movementRepository.CreateMovement(Movement_Components.CreateEntity(0, (double)numericUpDownCount.Value, checkBoxIsDefect.Checked, (int)comboBoxComponent.SelectedValue!));
|
|
||||||
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
using ProjectWarehouse.Repositories;
|
|
||||||
using Unity;
|
|
||||||
|
|
||||||
namespace ProjectWarehouse.Forms
|
|
||||||
{
|
|
||||||
public partial class FormMovements : Form
|
|
||||||
{
|
|
||||||
private readonly IUnityContainer _container;
|
|
||||||
|
|
||||||
private readonly IMovement_ComponentsRepository _movementRepository;
|
|
||||||
|
|
||||||
public FormMovements(IUnityContainer container, IMovement_ComponentsRepository movementRepository)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_container = container ??
|
|
||||||
throw new ArgumentNullException(nameof(container));
|
|
||||||
_movementRepository = movementRepository ??
|
|
||||||
throw new ArgumentNullException(nameof(movementRepository));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FormMovements_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_container.Resolve<FormMovement>().ShowDialog();
|
|
||||||
LoadList();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadList() => dataGridViewData.DataSource = _movementRepository.ReadMovement();
|
|
||||||
}
|
|
||||||
}
|
|
@ -32,6 +32,8 @@
|
|||||||
labelComponent = new Label();
|
labelComponent = new Label();
|
||||||
comboBoxComponent = new ComboBox();
|
comboBoxComponent = new ComboBox();
|
||||||
numericUpDownCount = new NumericUpDown();
|
numericUpDownCount = new NumericUpDown();
|
||||||
|
buttonSave = new Button();
|
||||||
|
buttonCancel = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownCount).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownCount).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -72,16 +74,41 @@
|
|||||||
numericUpDownCount.TabIndex = 3;
|
numericUpDownCount.TabIndex = 3;
|
||||||
numericUpDownCount.Value = new decimal(new int[] { 1, 0, 0, 131072 });
|
numericUpDownCount.Value = new decimal(new int[] { 1, 0, 0, 131072 });
|
||||||
//
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(51, 112);
|
||||||
|
buttonSave.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(92, 22);
|
||||||
|
buttonSave.TabIndex = 4;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(218, 112);
|
||||||
|
buttonCancel.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(82, 22);
|
||||||
|
buttonCancel.TabIndex = 5;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
// FormOrderRequest
|
// FormOrderRequest
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(375, 151);
|
ClientSize = new Size(375, 151);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
Controls.Add(numericUpDownCount);
|
Controls.Add(numericUpDownCount);
|
||||||
Controls.Add(comboBoxComponent);
|
Controls.Add(comboBoxComponent);
|
||||||
Controls.Add(labelComponent);
|
Controls.Add(labelComponent);
|
||||||
Controls.Add(labelCount);
|
Controls.Add(labelCount);
|
||||||
Name = "FormOrderRequest";
|
Name = "FormOrderRequest";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
Text = "Заявка";
|
Text = "Заявка";
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
@ -94,5 +121,7 @@
|
|||||||
private Label labelComponent;
|
private Label labelComponent;
|
||||||
private ComboBox comboBoxComponent;
|
private ComboBox comboBoxComponent;
|
||||||
private NumericUpDown numericUpDownCount;
|
private NumericUpDown numericUpDownCount;
|
||||||
|
private Button buttonSave;
|
||||||
|
private Button buttonCancel;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,20 +1,42 @@
|
|||||||
using System;
|
using ProjectWarehouse.Entities;
|
||||||
using System.Collections.Generic;
|
using ProjectWarehouse.Repositories;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace ProjectWarehouse.Forms
|
namespace ProjectWarehouse.Forms
|
||||||
{
|
{
|
||||||
public partial class FormOrderRequest : Form
|
public partial class FormOrderRequest : Form
|
||||||
{
|
{
|
||||||
public FormOrderRequest()
|
private readonly IOrderRequestRepository _orderRepository;
|
||||||
|
|
||||||
|
public FormOrderRequest(IOrderRequestRepository orderRepository, IComponentsRepository componentsRepository)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_orderRepository = orderRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(orderRepository));
|
||||||
|
|
||||||
|
comboBoxComponent.DataSource = componentsRepository.ReadComponents();
|
||||||
|
comboBoxComponent.DisplayMember = "Name";
|
||||||
|
comboBoxComponent.ValueMember = "Id";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (comboBoxComponent.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются не заполненные поля");
|
||||||
|
}
|
||||||
|
|
||||||
|
_orderRepository.CreateOrderRequest(OrderRequest.CreateEntity(0, (double)numericUpDownCount.Value, (int)comboBoxComponent.SelectedValue!));
|
||||||
|
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,7 @@
|
|||||||
Controls.Add(dataGridViewData);
|
Controls.Add(dataGridViewData);
|
||||||
Controls.Add(panel1);
|
Controls.Add(panel1);
|
||||||
Name = "FormOrderRequests";
|
Name = "FormOrderRequests";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
Text = "Заявки";
|
Text = "Заявки";
|
||||||
Load += FormOrderRequests_Load;
|
Load += FormOrderRequests_Load;
|
||||||
panel1.ResumeLayout(false);
|
panel1.ResumeLayout(false);
|
||||||
|
@ -34,12 +34,20 @@
|
|||||||
textBoxDescription = new TextBox();
|
textBoxDescription = new TextBox();
|
||||||
buttonSave = new Button();
|
buttonSave = new Button();
|
||||||
buttonCancel = new Button();
|
buttonCancel = new Button();
|
||||||
|
labelEmployee = new Label();
|
||||||
|
comboBoxEmployee = new ComboBox();
|
||||||
|
groupBoxComponents = new GroupBox();
|
||||||
|
dataGridViewComponents = new DataGridView();
|
||||||
|
ColumnComponent = new DataGridViewComboBoxColumn();
|
||||||
|
ColumnCount = new DataGridViewTextBoxColumn();
|
||||||
|
groupBoxComponents.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewComponents).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// labelName
|
// labelName
|
||||||
//
|
//
|
||||||
labelName.AutoSize = true;
|
labelName.AutoSize = true;
|
||||||
labelName.Location = new Point(38, 50);
|
labelName.Location = new Point(38, 14);
|
||||||
labelName.Name = "labelName";
|
labelName.Name = "labelName";
|
||||||
labelName.Size = new Size(122, 15);
|
labelName.Size = new Size(122, 15);
|
||||||
labelName.TabIndex = 0;
|
labelName.TabIndex = 0;
|
||||||
@ -48,7 +56,7 @@
|
|||||||
// labelDescription
|
// labelDescription
|
||||||
//
|
//
|
||||||
labelDescription.AutoSize = true;
|
labelDescription.AutoSize = true;
|
||||||
labelDescription.Location = new Point(38, 121);
|
labelDescription.Location = new Point(36, 58);
|
||||||
labelDescription.Name = "labelDescription";
|
labelDescription.Name = "labelDescription";
|
||||||
labelDescription.Size = new Size(125, 15);
|
labelDescription.Size = new Size(125, 15);
|
||||||
labelDescription.TabIndex = 1;
|
labelDescription.TabIndex = 1;
|
||||||
@ -56,43 +64,108 @@
|
|||||||
//
|
//
|
||||||
// textBoxName
|
// textBoxName
|
||||||
//
|
//
|
||||||
textBoxName.Location = new Point(174, 47);
|
textBoxName.Location = new Point(191, 14);
|
||||||
textBoxName.Name = "textBoxName";
|
textBoxName.Name = "textBoxName";
|
||||||
textBoxName.Size = new Size(100, 23);
|
textBoxName.Size = new Size(165, 23);
|
||||||
textBoxName.TabIndex = 2;
|
textBoxName.TabIndex = 2;
|
||||||
//
|
//
|
||||||
// textBoxDescription
|
// textBoxDescription
|
||||||
//
|
//
|
||||||
textBoxDescription.Location = new Point(174, 118);
|
textBoxDescription.Location = new Point(191, 56);
|
||||||
textBoxDescription.Name = "textBoxDescription";
|
textBoxDescription.Name = "textBoxDescription";
|
||||||
textBoxDescription.Size = new Size(100, 23);
|
textBoxDescription.Size = new Size(165, 23);
|
||||||
textBoxDescription.TabIndex = 3;
|
textBoxDescription.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// buttonSave
|
// buttonSave
|
||||||
//
|
//
|
||||||
buttonSave.Location = new Point(85, 194);
|
buttonSave.Location = new Point(63, 380);
|
||||||
buttonSave.Name = "buttonSave";
|
buttonSave.Name = "buttonSave";
|
||||||
buttonSave.Size = new Size(75, 23);
|
buttonSave.Size = new Size(94, 23);
|
||||||
buttonSave.TabIndex = 4;
|
buttonSave.TabIndex = 4;
|
||||||
buttonSave.Text = "Сохранить";
|
buttonSave.Text = "Сохранить";
|
||||||
buttonSave.UseVisualStyleBackColor = true;
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
buttonSave.Click += buttonSave_Click;
|
buttonSave.Click += ButtonSave_Click;
|
||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
buttonCancel.Location = new Point(263, 194);
|
buttonCancel.Location = new Point(260, 380);
|
||||||
buttonCancel.Name = "buttonCancel";
|
buttonCancel.Name = "buttonCancel";
|
||||||
buttonCancel.Size = new Size(75, 23);
|
buttonCancel.Size = new Size(75, 23);
|
||||||
buttonCancel.TabIndex = 5;
|
buttonCancel.TabIndex = 5;
|
||||||
buttonCancel.Text = "Отмена";
|
buttonCancel.Text = "Отмена";
|
||||||
buttonCancel.UseVisualStyleBackColor = true;
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
buttonCancel.Click += buttonCancel_Click;
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// labelEmployee
|
||||||
|
//
|
||||||
|
labelEmployee.AutoSize = true;
|
||||||
|
labelEmployee.Location = new Point(63, 102);
|
||||||
|
labelEmployee.Name = "labelEmployee";
|
||||||
|
labelEmployee.Size = new Size(59, 15);
|
||||||
|
labelEmployee.TabIndex = 8;
|
||||||
|
labelEmployee.Text = "Работник";
|
||||||
|
//
|
||||||
|
// comboBoxEmployee
|
||||||
|
//
|
||||||
|
comboBoxEmployee.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxEmployee.FormattingEnabled = true;
|
||||||
|
comboBoxEmployee.Location = new Point(192, 102);
|
||||||
|
comboBoxEmployee.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
comboBoxEmployee.Name = "comboBoxEmployee";
|
||||||
|
comboBoxEmployee.Size = new Size(164, 23);
|
||||||
|
comboBoxEmployee.TabIndex = 7;
|
||||||
|
//
|
||||||
|
// groupBoxComponents
|
||||||
|
//
|
||||||
|
groupBoxComponents.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
groupBoxComponents.Controls.Add(dataGridViewComponents);
|
||||||
|
groupBoxComponents.Location = new Point(23, 144);
|
||||||
|
groupBoxComponents.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
groupBoxComponents.Name = "groupBoxComponents";
|
||||||
|
groupBoxComponents.Padding = new Padding(3, 2, 3, 2);
|
||||||
|
groupBoxComponents.Size = new Size(349, 220);
|
||||||
|
groupBoxComponents.TabIndex = 6;
|
||||||
|
groupBoxComponents.TabStop = false;
|
||||||
|
groupBoxComponents.Text = "Комплектующие";
|
||||||
|
//
|
||||||
|
// dataGridViewComponents
|
||||||
|
//
|
||||||
|
dataGridViewComponents.AllowUserToResizeColumns = false;
|
||||||
|
dataGridViewComponents.AllowUserToResizeRows = false;
|
||||||
|
dataGridViewComponents.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridViewComponents.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewComponents.Columns.AddRange(new DataGridViewColumn[] { ColumnComponent, ColumnCount });
|
||||||
|
dataGridViewComponents.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewComponents.Location = new Point(3, 18);
|
||||||
|
dataGridViewComponents.Margin = new Padding(3, 2, 3, 2);
|
||||||
|
dataGridViewComponents.MultiSelect = false;
|
||||||
|
dataGridViewComponents.Name = "dataGridViewComponents";
|
||||||
|
dataGridViewComponents.RowHeadersVisible = false;
|
||||||
|
dataGridViewComponents.RowHeadersWidth = 51;
|
||||||
|
dataGridViewComponents.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridViewComponents.Size = new Size(343, 200);
|
||||||
|
dataGridViewComponents.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ColumnComponent
|
||||||
|
//
|
||||||
|
ColumnComponent.HeaderText = "Компонент";
|
||||||
|
ColumnComponent.MinimumWidth = 6;
|
||||||
|
ColumnComponent.Name = "ColumnComponent";
|
||||||
|
//
|
||||||
|
// ColumnCount
|
||||||
|
//
|
||||||
|
ColumnCount.HeaderText = "Количество";
|
||||||
|
ColumnCount.MinimumWidth = 6;
|
||||||
|
ColumnCount.Name = "ColumnCount";
|
||||||
//
|
//
|
||||||
// FormProduction
|
// FormProduction
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(398, 251);
|
ClientSize = new Size(398, 415);
|
||||||
|
Controls.Add(labelEmployee);
|
||||||
|
Controls.Add(comboBoxEmployee);
|
||||||
|
Controls.Add(groupBoxComponents);
|
||||||
Controls.Add(buttonCancel);
|
Controls.Add(buttonCancel);
|
||||||
Controls.Add(buttonSave);
|
Controls.Add(buttonSave);
|
||||||
Controls.Add(textBoxDescription);
|
Controls.Add(textBoxDescription);
|
||||||
@ -102,6 +175,8 @@
|
|||||||
Name = "FormProduction";
|
Name = "FormProduction";
|
||||||
StartPosition = FormStartPosition.CenterParent;
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
Text = "Продукция";
|
Text = "Продукция";
|
||||||
|
groupBoxComponents.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewComponents).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
@ -114,5 +189,11 @@
|
|||||||
private TextBox textBoxDescription;
|
private TextBox textBoxDescription;
|
||||||
private Button buttonSave;
|
private Button buttonSave;
|
||||||
private Button buttonCancel;
|
private Button buttonCancel;
|
||||||
|
private Label labelEmployee;
|
||||||
|
private ComboBox comboBoxEmployee;
|
||||||
|
private GroupBox groupBoxComponents;
|
||||||
|
private DataGridView dataGridViewComponents;
|
||||||
|
private DataGridViewComboBoxColumn ColumnComponent;
|
||||||
|
private DataGridViewTextBoxColumn ColumnCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -33,18 +33,26 @@ namespace ProjectWarehouse.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public FormProduction(IProductionRepository productionRepository)
|
public FormProduction(IProductionRepository productionRepository, IEmployeeRepository employeeRepository, IComponentsRepository componentsRepository)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_productionRepository = productionRepository ??
|
_productionRepository = productionRepository ??
|
||||||
throw new ArgumentNullException(nameof(productionRepository));
|
throw new ArgumentNullException(nameof(productionRepository));
|
||||||
|
|
||||||
|
comboBoxEmployee.DataSource = employeeRepository.ReadEmployees();
|
||||||
|
comboBoxEmployee.DisplayMember = "FirstName";
|
||||||
|
comboBoxEmployee.ValueMember = "Id";
|
||||||
|
|
||||||
|
ColumnComponent.DataSource = componentsRepository.ReadComponents();
|
||||||
|
ColumnComponent.DisplayMember = "Name";
|
||||||
|
ColumnComponent.ValueMember = "Id";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonSave_Click(object sender, EventArgs e)
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(textBoxName.Text) || string.IsNullOrWhiteSpace(textBoxDescription.Text))
|
if (string.IsNullOrWhiteSpace(textBoxName.Text) || string.IsNullOrWhiteSpace(textBoxDescription.Text) || dataGridViewComponents.RowCount < 1 || comboBoxEmployee.SelectedIndex < 0)
|
||||||
{
|
{
|
||||||
throw new Exception("Имеются незаполненные поля");
|
throw new Exception("Имеются незаполненные поля");
|
||||||
}
|
}
|
||||||
@ -66,8 +74,26 @@ namespace ProjectWarehouse.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||||
|
|
||||||
private Production CreateProduction(int id) => Production.CreateEntity(id, textBoxName.Text, textBoxDescription.Text);
|
private List<Components_Production> CreateListComponents_ProductionsFromDataGrid()
|
||||||
|
{
|
||||||
|
var list = new List<Components_Production>();
|
||||||
|
foreach (DataGridViewRow row in dataGridViewComponents.Rows)
|
||||||
|
{
|
||||||
|
if (row.Cells["ColumnComponents"].Value == null ||
|
||||||
|
row.Cells["ColumnCount"].Value == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
list.Add(Components_Production.CreateElement(0,
|
||||||
|
Convert.ToInt32(row.Cells["ColumnComponents"].Value),
|
||||||
|
Convert.ToInt32(row.Cells["ColumnCount"].Value)));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Production CreateProduction(int id) => Production.CreateEntity(id, textBoxName.Text, textBoxDescription.Text, (int)comboBoxEmployee.SelectedItem!, CreateListComponents_ProductionsFromDataGrid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,4 +117,10 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<metadata name="ColumnComponent.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
@ -107,6 +107,7 @@
|
|||||||
Controls.Add(dataGridViewData);
|
Controls.Add(dataGridViewData);
|
||||||
Controls.Add(panel1);
|
Controls.Add(panel1);
|
||||||
Name = "FormProductions";
|
Name = "FormProductions";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
Text = "Продукция";
|
Text = "Продукция";
|
||||||
Load += FormProductions_Load;
|
Load += FormProductions_Load;
|
||||||
panel1.ResumeLayout(false);
|
panel1.ResumeLayout(false);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using ProjectWarehouse.Repositories;
|
using ProjectWarehouse.Repositories;
|
||||||
using ProjectWarehouse.Repositories.Implementations;
|
using ProjectWarehouse.Repositories.Implementations;
|
||||||
using Unity;
|
using Unity;
|
||||||
|
using Unity.Lifetime;
|
||||||
|
|
||||||
namespace ProjectWarehouse
|
namespace ProjectWarehouse
|
||||||
{
|
{
|
||||||
@ -22,10 +23,11 @@ namespace ProjectWarehouse
|
|||||||
{
|
{
|
||||||
var container = new UnityContainer();
|
var container = new UnityContainer();
|
||||||
|
|
||||||
container.RegisterType<IProductionRepository, ProductionRepository>();
|
container.RegisterType<IEmployeeRepository, EmployeeRepository>(new TransientLifetimeManager());
|
||||||
container.RegisterType<IComponentsRepository, ComponentsRepository>();
|
container.RegisterType<IProductionRepository, ProductionRepository>(new TransientLifetimeManager());
|
||||||
container.RegisterType<IOrderRequestRepository, OrderRequestRepository>();
|
container.RegisterType<IComponentsRepository, ComponentsRepository>(new TransientLifetimeManager());
|
||||||
container.RegisterType<IMovement_ComponentsRepository, Movement_ComponentsRepository>();
|
container.RegisterType<IOrderRequestRepository, OrderRequestRepository>(new TransientLifetimeManager());
|
||||||
|
container.RegisterType<IInventoryRepository, InventoryRepository>(new TransientLifetimeManager());
|
||||||
|
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,13 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Update="Forms\FormEmployees.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Forms\FormOrderRequests.cs">
|
<Compile Update="Forms\FormOrderRequests.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="Forms\FormMovements.cs">
|
<Compile Update="Forms\FormInventorys.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="Forms\FormComponents.cs">
|
<Compile Update="Forms\FormComponents.cs">
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
using ProjectWarehouse.Entities;
|
||||||
|
|
||||||
|
namespace ProjectWarehouse.Repositories;
|
||||||
|
|
||||||
|
public interface IEmployeeRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Employee> ReadEmployees();
|
||||||
|
|
||||||
|
Employee ReadEmployeeById(int id);
|
||||||
|
|
||||||
|
void CreateEmployee(Employee employee);
|
||||||
|
|
||||||
|
void UpdateEmployee(Employee employee);
|
||||||
|
|
||||||
|
void DeleteEmployee(int id);
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using ProjectWarehouse.Entities;
|
||||||
|
|
||||||
|
namespace ProjectWarehouse.Repositories;
|
||||||
|
|
||||||
|
public interface IInventoryRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Inventory> ReadInventory();
|
||||||
|
|
||||||
|
Inventory ReadInventoryById(int id);
|
||||||
|
|
||||||
|
void CreateInventory(Inventory inventory);
|
||||||
|
|
||||||
|
void UpdateInventory(Inventory inventory);
|
||||||
|
|
||||||
|
void DeleteInventory(int id);
|
||||||
|
}
|
@ -1,16 +0,0 @@
|
|||||||
using ProjectWarehouse.Entities;
|
|
||||||
|
|
||||||
namespace ProjectWarehouse.Repositories;
|
|
||||||
|
|
||||||
public interface IMovement_ComponentsRepository
|
|
||||||
{
|
|
||||||
IEnumerable<Movement_Components> ReadMovement();
|
|
||||||
|
|
||||||
Movement_Components ReadMovementByID(int id);
|
|
||||||
|
|
||||||
void CreateMovement(Movement_Components movement);
|
|
||||||
|
|
||||||
void UpdateMovement(Movement_Components movement);
|
|
||||||
|
|
||||||
void DeleteMovement(int id);
|
|
||||||
}
|
|
@ -4,7 +4,7 @@ namespace ProjectWarehouse.Repositories;
|
|||||||
|
|
||||||
public interface IOrderRequestRepository
|
public interface IOrderRequestRepository
|
||||||
{
|
{
|
||||||
IEnumerable<OrderRequest> ReadOrderRequest(DateTime? dateForm = null, DateTime? dateTo = null, int? componentsID = null);
|
IEnumerable<OrderRequest> ReadOrderRequest(DateTime? dateForm = null, DateTime? dateTo = null, double? quantity = null, int? componentsID = null);
|
||||||
|
|
||||||
void CreateOrderRequest(OrderRequest orderRequest);
|
void CreateOrderRequest(OrderRequest orderRequest);
|
||||||
}
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
using ProjectWarehouse.Entities.Enums;
|
||||||
|
using ProjectWarehouse.Entities;
|
||||||
|
|
||||||
|
namespace ProjectWarehouse.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class EmployeeRepository : IEmployeeRepository
|
||||||
|
{
|
||||||
|
public void CreateEmployee(Employee employee)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteEmployee(int id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Employee ReadEmployeeById(int id)
|
||||||
|
{
|
||||||
|
return Employee.CreateEntity(0, string.Empty, string.Empty,
|
||||||
|
EmployeePost.None);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Employee> ReadEmployees()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateEmployee(Employee employee)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
using ProjectWarehouse.Entities;
|
||||||
|
|
||||||
|
namespace ProjectWarehouse.Repositories.Implementations;
|
||||||
|
|
||||||
|
public class InventoryRepository : IInventoryRepository
|
||||||
|
{
|
||||||
|
public void CreateInventory(Inventory inventory)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteInventory(int id)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Inventory> ReadInventory()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Inventory ReadInventoryById(int id)
|
||||||
|
{
|
||||||
|
return Inventory.CreateEntity(0, 0, false, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateInventory(Inventory inventory)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -1,28 +0,0 @@
|
|||||||
using ProjectWarehouse.Entities;
|
|
||||||
|
|
||||||
namespace ProjectWarehouse.Repositories.Implementations;
|
|
||||||
|
|
||||||
public class Movement_ComponentsRepository : IMovement_ComponentsRepository
|
|
||||||
{
|
|
||||||
public void CreateMovement(Movement_Components movement)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteMovement(int id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Movement_Components> ReadMovement()
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public Movement_Components ReadMovementByID(int id)
|
|
||||||
{
|
|
||||||
return Movement_Components.CreateEntity(0, 0, false, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateMovement(Movement_Components movement)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,7 +8,7 @@ public class OrderRequestRepository : IOrderRequestRepository
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<OrderRequest> ReadOrderRequest(DateTime? dateForm = null, DateTime? dateTo = null, int? componentsID = null)
|
public IEnumerable<OrderRequest> ReadOrderRequest(DateTime? dateForm = null, DateTime? dateTo = null, double? quantity = null, int? componentsID = null)
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public class ProductionRepository : IProductionRepository
|
|||||||
|
|
||||||
public Production ReadProductionByID(int id)
|
public Production ReadProductionByID(int id)
|
||||||
{
|
{
|
||||||
return Production.CreateEntity(0, string.Empty, string.Empty);
|
return Production.CreateEntity(0, string.Empty, string.Empty, 0, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateProduction(Production production)
|
public void UpdateProduction(Production production)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user