Лабораторная работа №1
This commit is contained in:
parent
c24f03fe0c
commit
c9e2889202
@ -2,18 +2,24 @@
|
|||||||
|
|
||||||
public class Components_Production
|
public class Components_Production
|
||||||
{
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
public int ComponentsID { get; private set; }
|
public int ComponentsID { get; private set; }
|
||||||
|
|
||||||
public int ProductionID { get; private set; }
|
public int ProductionID { get; private set; }
|
||||||
|
|
||||||
|
public int EmployeeID { 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 productionID, int employeeID, int count)
|
||||||
{
|
{
|
||||||
return new Components_Production
|
return new Components_Production
|
||||||
{
|
{
|
||||||
|
Id = id,
|
||||||
ComponentsID = componentsID,
|
ComponentsID = componentsID,
|
||||||
ProductionID = productionID,
|
ProductionID = productionID,
|
||||||
|
EmployeeID = employeeID,
|
||||||
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
|
||||||
{
|
{
|
||||||
|
@ -32,15 +32,17 @@
|
|||||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ComponentToolStripMenuItem = new ToolStripMenuItem();
|
ComponentToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ProductionToolStripMenuItem = new ToolStripMenuItem();
|
ProductionToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
EmployeeToolStripMenuItem = new ToolStripMenuItem();
|
||||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
операцииToolStripMenuItem = new ToolStripMenuItem();
|
||||||
MovementToolStripMenuItem = new ToolStripMenuItem();
|
InventoryToolStripMenuItem = new ToolStripMenuItem();
|
||||||
заявкиToolStripMenuItem = new ToolStripMenuItem();
|
формированиеЗаявкиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
menuStrip.SuspendLayout();
|
menuStrip.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// menuStrip
|
// menuStrip
|
||||||
//
|
//
|
||||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, заявкиToolStripMenuItem });
|
menuStrip.ImageScalingSize = new Size(20, 20);
|
||||||
|
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem });
|
||||||
menuStrip.Location = new Point(0, 0);
|
menuStrip.Location = new Point(0, 0);
|
||||||
menuStrip.Name = "menuStrip";
|
menuStrip.Name = "menuStrip";
|
||||||
menuStrip.Size = new Size(784, 24);
|
menuStrip.Size = new Size(784, 24);
|
||||||
@ -49,45 +51,52 @@
|
|||||||
//
|
//
|
||||||
// справочникиToolStripMenuItem
|
// справочникиToolStripMenuItem
|
||||||
//
|
//
|
||||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ComponentToolStripMenuItem, ProductionToolStripMenuItem });
|
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ComponentToolStripMenuItem, ProductionToolStripMenuItem, 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
|
// ProductionToolStripMenuItem
|
||||||
//
|
//
|
||||||
ProductionToolStripMenuItem.Name = "ProductionToolStripMenuItem";
|
ProductionToolStripMenuItem.Name = "ProductionToolStripMenuItem";
|
||||||
ProductionToolStripMenuItem.Size = new Size(180, 22);
|
ProductionToolStripMenuItem.Size = new Size(180, 22);
|
||||||
ProductionToolStripMenuItem.Text = "Продукция";
|
ProductionToolStripMenuItem.Text = "Продукция";
|
||||||
ProductionToolStripMenuItem.Click += ProductionToolStripMenuItem_Click;
|
ProductionToolStripMenuItem.Click += ProductionToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
|
// EmployeeToolStripMenuItem
|
||||||
|
//
|
||||||
|
EmployeeToolStripMenuItem.Name = "EmployeeToolStripMenuItem";
|
||||||
|
EmployeeToolStripMenuItem.Size = new Size(180, 22);
|
||||||
|
EmployeeToolStripMenuItem.Text = "Работники";
|
||||||
|
EmployeeToolStripMenuItem.Click += EmployeeToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// операцииToolStripMenuItem
|
// операцииToolStripMenuItem
|
||||||
//
|
//
|
||||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { MovementToolStripMenuItem });
|
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { InventoryToolStripMenuItem, формированиеЗаявкиToolStripMenuItem });
|
||||||
операции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(198, 22);
|
||||||
MovementToolStripMenuItem.Text = "Отправка на производство";
|
InventoryToolStripMenuItem.Text = "Добавление на склад";
|
||||||
MovementToolStripMenuItem.Click += MovementToolStripMenuItem_Click;
|
InventoryToolStripMenuItem.Click += InventoryToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// заявкиToolStripMenuItem
|
// формированиеЗаявкиToolStripMenuItem
|
||||||
//
|
//
|
||||||
заявкиToolStripMenuItem.Name = "заявкиToolStripMenuItem";
|
формированиеЗаявкиToolStripMenuItem.Name = "формированиеЗаявкиToolStripMenuItem";
|
||||||
заявкиToolStripMenuItem.Size = new Size(57, 20);
|
формированиеЗаявкиToolStripMenuItem.Size = new Size(198, 22);
|
||||||
заявкиToolStripMenuItem.Text = "Заявки";
|
формированиеЗаявкиToolStripMenuItem.Text = "Формирование заявки";
|
||||||
заявкиToolStripMenuItem.Click += OrderRequestToolStripMenuItem_Click;
|
формированиеЗаявкиToolStripMenuItem.Click += OrderRequestToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// FormWarehouse
|
// FormWarehouse
|
||||||
//
|
//
|
||||||
@ -112,9 +121,10 @@
|
|||||||
private MenuStrip menuStrip;
|
private MenuStrip menuStrip;
|
||||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
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 ProductionToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem EmployeeToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem формированиеЗаявкиToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,17 @@ 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
140
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployee.Designer.cs
generated
Normal file
140
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployee.Designer.cs
generated
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
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(68, 38);
|
||||||
|
labelName.Name = "labelName";
|
||||||
|
labelName.Size = new Size(39, 20);
|
||||||
|
labelName.TabIndex = 0;
|
||||||
|
labelName.Text = "Имя";
|
||||||
|
//
|
||||||
|
// labelLastName
|
||||||
|
//
|
||||||
|
labelLastName.AutoSize = true;
|
||||||
|
labelLastName.Location = new Point(68, 89);
|
||||||
|
labelLastName.Name = "labelLastName";
|
||||||
|
labelLastName.Size = new Size(73, 20);
|
||||||
|
labelLastName.TabIndex = 1;
|
||||||
|
labelLastName.Text = "Фамилия";
|
||||||
|
//
|
||||||
|
// labelPost
|
||||||
|
//
|
||||||
|
labelPost.AutoSize = true;
|
||||||
|
labelPost.Location = new Point(68, 144);
|
||||||
|
labelPost.Name = "labelPost";
|
||||||
|
labelPost.Size = new Size(86, 20);
|
||||||
|
labelPost.TabIndex = 2;
|
||||||
|
labelPost.Text = "Должность";
|
||||||
|
//
|
||||||
|
// textBoxFirstName
|
||||||
|
//
|
||||||
|
textBoxFirstName.Location = new Point(202, 35);
|
||||||
|
textBoxFirstName.Name = "textBoxFirstName";
|
||||||
|
textBoxFirstName.Size = new Size(151, 27);
|
||||||
|
textBoxFirstName.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// textBoxLastName
|
||||||
|
//
|
||||||
|
textBoxLastName.Location = new Point(202, 86);
|
||||||
|
textBoxLastName.Name = "textBoxLastName";
|
||||||
|
textBoxLastName.Size = new Size(151, 27);
|
||||||
|
textBoxLastName.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// buttonSave
|
||||||
|
//
|
||||||
|
buttonSave.Location = new Point(68, 281);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(106, 29);
|
||||||
|
buttonSave.TabIndex = 6;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(254, 281);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(99, 29);
|
||||||
|
buttonCancel.TabIndex = 7;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// checkedListBoxPost
|
||||||
|
//
|
||||||
|
checkedListBoxPost.FormattingEnabled = true;
|
||||||
|
checkedListBoxPost.Location = new Point(196, 144);
|
||||||
|
checkedListBoxPost.Name = "checkedListBoxPost";
|
||||||
|
checkedListBoxPost.Size = new Size(156, 114);
|
||||||
|
checkedListBoxPost.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// FormEmployee
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(455, 337);
|
||||||
|
Controls.Add(checkedListBoxPost);
|
||||||
|
Controls.Add(buttonCancel);
|
||||||
|
Controls.Add(buttonSave);
|
||||||
|
Controls.Add(textBoxLastName);
|
||||||
|
Controls.Add(textBoxFirstName);
|
||||||
|
Controls.Add(labelPost);
|
||||||
|
Controls.Add(labelLastName);
|
||||||
|
Controls.Add(labelName);
|
||||||
|
Name = "FormEmployee";
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployee.resx
Normal file
120
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployee.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>
|
125
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployees.Designer.cs
generated
Normal file
125
ProjectWarehouse/ProjectWarehouse/Forms/FormEmployees.Designer.cs
generated
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
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;
|
||||||
|
//
|
||||||
|
// FormComponents
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(800, 450);
|
||||||
|
Controls.Add(dataGridViewData);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormEmployees";
|
||||||
|
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(83, 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,8 @@
|
|||||||
Controls.Add(comboBoxComponent);
|
Controls.Add(comboBoxComponent);
|
||||||
Controls.Add(labelCount);
|
Controls.Add(labelCount);
|
||||||
Controls.Add(labelComponent);
|
Controls.Add(labelComponent);
|
||||||
Name = "FormMovement";
|
Name = "FormInventory";
|
||||||
Text = "Перемещение";
|
Text = "Склад";
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
@ -3,15 +3,15 @@ using ProjectWarehouse.Repositories;
|
|||||||
|
|
||||||
namespace ProjectWarehouse.Forms
|
namespace ProjectWarehouse.Forms
|
||||||
{
|
{
|
||||||
public partial class FormMovement : Form
|
public partial class FormInventory : Form
|
||||||
{
|
{
|
||||||
private readonly IMovement_ComponentsRepository _movementRepository;
|
private readonly IInventoryRepository _inventoryRepository;
|
||||||
|
|
||||||
public FormMovement(IMovement_ComponentsRepository movementRepository, IComponentsRepository componentsRepository)
|
public FormInventory(IInventoryRepository inventoryRepository, IComponentsRepository componentsRepository)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_movementRepository = movementRepository ??
|
_inventoryRepository = inventoryRepository ??
|
||||||
throw new ArgumentNullException(nameof(movementRepository));
|
throw new ArgumentNullException(nameof(inventoryRepository));
|
||||||
|
|
||||||
comboBoxComponent.DataSource = componentsRepository.ReadComponents();
|
comboBoxComponent.DataSource = componentsRepository.ReadComponents();
|
||||||
comboBoxComponent.DisplayMember = "Name";
|
comboBoxComponent.DisplayMember = "Name";
|
||||||
@ -27,7 +27,7 @@ namespace ProjectWarehouse.Forms
|
|||||||
throw new Exception("Имеются не заполненные поля");
|
throw new Exception("Имеются не заполненные поля");
|
||||||
}
|
}
|
||||||
|
|
||||||
_movementRepository.CreateMovement(Movement_Components.CreateEntity(0, (double)numericUpDownCount.Value, checkBoxIsDefect.Checked, (int)comboBoxComponent.SelectedValue!));
|
_inventoryRepository.CreateInventory(Inventory.CreateEntity(0, (double)numericUpDownCount.Value, checkBoxIsDefect.Checked, (int)comboBoxComponent.SelectedValue!));
|
||||||
|
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
namespace ProjectWarehouse.Forms
|
namespace ProjectWarehouse.Forms
|
||||||
{
|
{
|
||||||
partial class FormMovements
|
partial class FormInventorys
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
@ -3,13 +3,13 @@ using Unity;
|
|||||||
|
|
||||||
namespace ProjectWarehouse.Forms
|
namespace ProjectWarehouse.Forms
|
||||||
{
|
{
|
||||||
public partial class FormMovements : Form
|
public partial class FormInventorys : Form
|
||||||
{
|
{
|
||||||
private readonly IUnityContainer _container;
|
private readonly IUnityContainer _container;
|
||||||
|
|
||||||
private readonly IMovement_ComponentsRepository _movementRepository;
|
private readonly IInventoryRepository _movementRepository;
|
||||||
|
|
||||||
public FormMovements(IUnityContainer container, IMovement_ComponentsRepository movementRepository)
|
public FormInventorys(IUnityContainer container, IInventoryRepository movementRepository)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_container = container ??
|
_container = container ??
|
||||||
@ -34,7 +34,7 @@ namespace ProjectWarehouse.Forms
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_container.Resolve<FormMovement>().ShowDialog();
|
_container.Resolve<FormInventory>().ShowDialog();
|
||||||
LoadList();
|
LoadList();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -43,6 +43,6 @@ namespace ProjectWarehouse.Forms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadList() => dataGridViewData.DataSource = _movementRepository.ReadMovement();
|
private void LoadList() => dataGridViewData.DataSource = _movementRepository.ReadInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
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>
|
@ -32,24 +32,26 @@
|
|||||||
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();
|
||||||
//
|
//
|
||||||
// labelCount
|
// labelCount
|
||||||
//
|
//
|
||||||
labelCount.AutoSize = true;
|
labelCount.AutoSize = true;
|
||||||
labelCount.Location = new Point(60, 71);
|
labelCount.Location = new Point(69, 95);
|
||||||
labelCount.Name = "labelCount";
|
labelCount.Name = "labelCount";
|
||||||
labelCount.Size = new Size(72, 15);
|
labelCount.Size = new Size(90, 20);
|
||||||
labelCount.TabIndex = 0;
|
labelCount.TabIndex = 0;
|
||||||
labelCount.Text = "Количество";
|
labelCount.Text = "Количество";
|
||||||
//
|
//
|
||||||
// labelComponent
|
// labelComponent
|
||||||
//
|
//
|
||||||
labelComponent.AutoSize = true;
|
labelComponent.AutoSize = true;
|
||||||
labelComponent.Location = new Point(60, 28);
|
labelComponent.Location = new Point(69, 37);
|
||||||
labelComponent.Name = "labelComponent";
|
labelComponent.Name = "labelComponent";
|
||||||
labelComponent.Size = new Size(69, 15);
|
labelComponent.Size = new Size(88, 20);
|
||||||
labelComponent.TabIndex = 1;
|
labelComponent.TabIndex = 1;
|
||||||
labelComponent.Text = "Компонент";
|
labelComponent.Text = "Компонент";
|
||||||
//
|
//
|
||||||
@ -57,30 +59,55 @@
|
|||||||
//
|
//
|
||||||
comboBoxComponent.DropDownStyle = ComboBoxStyle.DropDownList;
|
comboBoxComponent.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
comboBoxComponent.FormattingEnabled = true;
|
comboBoxComponent.FormattingEnabled = true;
|
||||||
comboBoxComponent.Location = new Point(167, 25);
|
comboBoxComponent.Location = new Point(191, 33);
|
||||||
|
comboBoxComponent.Margin = new Padding(3, 4, 3, 4);
|
||||||
comboBoxComponent.Name = "comboBoxComponent";
|
comboBoxComponent.Name = "comboBoxComponent";
|
||||||
comboBoxComponent.Size = new Size(121, 23);
|
comboBoxComponent.Size = new Size(138, 28);
|
||||||
comboBoxComponent.TabIndex = 2;
|
comboBoxComponent.TabIndex = 2;
|
||||||
//
|
//
|
||||||
// numericUpDownCount
|
// numericUpDownCount
|
||||||
//
|
//
|
||||||
numericUpDownCount.DecimalPlaces = 2;
|
numericUpDownCount.DecimalPlaces = 2;
|
||||||
numericUpDownCount.Location = new Point(168, 71);
|
numericUpDownCount.Location = new Point(192, 95);
|
||||||
|
numericUpDownCount.Margin = new Padding(3, 4, 3, 4);
|
||||||
numericUpDownCount.Minimum = new decimal(new int[] { 1, 0, 0, 131072 });
|
numericUpDownCount.Minimum = new decimal(new int[] { 1, 0, 0, 131072 });
|
||||||
numericUpDownCount.Name = "numericUpDownCount";
|
numericUpDownCount.Name = "numericUpDownCount";
|
||||||
numericUpDownCount.Size = new Size(120, 23);
|
numericUpDownCount.Size = new Size(137, 27);
|
||||||
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(58, 149);
|
||||||
|
buttonSave.Name = "buttonSave";
|
||||||
|
buttonSave.Size = new Size(105, 29);
|
||||||
|
buttonSave.TabIndex = 4;
|
||||||
|
buttonSave.Text = "Сохранить";
|
||||||
|
buttonSave.UseVisualStyleBackColor = true;
|
||||||
|
buttonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// buttonCancel
|
||||||
|
//
|
||||||
|
buttonCancel.Location = new Point(249, 149);
|
||||||
|
buttonCancel.Name = "buttonCancel";
|
||||||
|
buttonCancel.Size = new Size(94, 29);
|
||||||
|
buttonCancel.TabIndex = 5;
|
||||||
|
buttonCancel.Text = "Отмена";
|
||||||
|
buttonCancel.UseVisualStyleBackColor = true;
|
||||||
|
buttonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
// FormOrderRequest
|
// FormOrderRequest
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(375, 151);
|
ClientSize = new Size(429, 201);
|
||||||
|
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);
|
||||||
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
Name = "FormOrderRequest";
|
Name = "FormOrderRequest";
|
||||||
Text = "Заявка";
|
Text = "Заявка";
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
||||||
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
// labelName
|
// labelName
|
||||||
//
|
//
|
||||||
labelName.AutoSize = true;
|
labelName.AutoSize = true;
|
||||||
labelName.Location = new Point(38, 50);
|
labelName.Location = new Point(31, 47);
|
||||||
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 +48,7 @@
|
|||||||
// labelDescription
|
// labelDescription
|
||||||
//
|
//
|
||||||
labelDescription.AutoSize = true;
|
labelDescription.AutoSize = true;
|
||||||
labelDescription.Location = new Point(38, 121);
|
labelDescription.Location = new Point(29, 124);
|
||||||
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,23 +56,23 @@
|
|||||||
//
|
//
|
||||||
// textBoxName
|
// textBoxName
|
||||||
//
|
//
|
||||||
textBoxName.Location = new Point(174, 47);
|
textBoxName.Location = new Point(184, 47);
|
||||||
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(184, 122);
|
||||||
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(50, 192);
|
||||||
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;
|
||||||
@ -80,7 +80,7 @@
|
|||||||
//
|
//
|
||||||
// buttonCancel
|
// buttonCancel
|
||||||
//
|
//
|
||||||
buttonCancel.Location = new Point(263, 194);
|
buttonCancel.Location = new Point(247, 192);
|
||||||
buttonCancel.Name = "buttonCancel";
|
buttonCancel.Name = "buttonCancel";
|
||||||
buttonCancel.Size = new Size(75, 23);
|
buttonCancel.Size = new Size(75, 23);
|
||||||
buttonCancel.TabIndex = 5;
|
buttonCancel.TabIndex = 5;
|
||||||
@ -92,7 +92,7 @@
|
|||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(398, 251);
|
ClientSize = new Size(379, 238);
|
||||||
Controls.Add(buttonCancel);
|
Controls.Add(buttonCancel);
|
||||||
Controls.Add(buttonSave);
|
Controls.Add(buttonSave);
|
||||||
Controls.Add(textBoxDescription);
|
Controls.Add(textBoxDescription);
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<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);
|
|
||||||
}
|
|
@ -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)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user