75%
This commit is contained in:
parent
ef9e4ae9b7
commit
0e4a9e7594
20
ProjectWorkshop/Entities/AssemblerShift.cs
Normal file
20
ProjectWorkshop/Entities/AssemblerShift.cs
Normal file
@ -0,0 +1,20 @@
|
||||
namespace ProjectWorkshop.Entities;
|
||||
|
||||
public class AssemblerShift
|
||||
{
|
||||
public int WorkHours { get; private set; }
|
||||
|
||||
public int AssemblerID { get; private set; }
|
||||
|
||||
public int ShiftID { get; private set; }
|
||||
|
||||
public static AssemblerShift CreateOperation(int workHours, int assemblerID, int shiftID)
|
||||
{
|
||||
return new AssemblerShift
|
||||
{
|
||||
WorkHours = workHours,
|
||||
AssemblerID = assemblerID,
|
||||
ShiftID = shiftID
|
||||
};
|
||||
}
|
||||
}
|
@ -4,17 +4,17 @@ public class Assembly
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public DateTime AssemblyDate { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
|
||||
public int AssemblerID { get; private set; }
|
||||
public string ProductType { get; private set; } = string.Empty;
|
||||
|
||||
public static Assembly CreateEntity(int id, int assemblerID)
|
||||
public static Assembly CreateEntity(int id, int count, string productType)
|
||||
{
|
||||
return new Assembly()
|
||||
{
|
||||
Id = id,
|
||||
AssemblyDate = DateTime.Now,
|
||||
AssemblerID = assemblerID
|
||||
Count = count,
|
||||
ProductType = productType
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -8,16 +8,19 @@ public class Product
|
||||
|
||||
public double Price { get; private set; }
|
||||
|
||||
public int ProductTypeID { get; private set; }
|
||||
public DateTime AssemblyDate { get; private set; }
|
||||
|
||||
public static Product CreateEntity(int id, string productName, double price, int productTypeID)
|
||||
public int AssemblerID { get; private set; }
|
||||
|
||||
public static Product CreateEntity(int id, string productName, double price, int assemblerID)
|
||||
{
|
||||
return new Product
|
||||
{
|
||||
Id = id,
|
||||
ProductName = productName ?? string.Empty,
|
||||
Price = price,
|
||||
ProductTypeID = productTypeID
|
||||
AssemblyDate = DateTime.Now,
|
||||
AssemblerID = assemblerID
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ public class ProductAssembly
|
||||
|
||||
public int Count { get; private set; }
|
||||
|
||||
public static ProductAssembly CreateElement (int productID, int assemblyID, int count)
|
||||
public static ProductAssembly CreateOperation(int productID, int assemblyID, int count)
|
||||
{
|
||||
return new ProductAssembly()
|
||||
{
|
||||
|
@ -1,21 +0,0 @@
|
||||
using ProjectWorkshop.Entities.Enums;
|
||||
namespace ProjectWorkshop.Entities;
|
||||
|
||||
public class ProductTypeEntity
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
|
||||
public ProductType ProductType { get; private set; }
|
||||
|
||||
public static ProductTypeEntity CreateElement(int id, string name, ProductType productType)
|
||||
{
|
||||
return new ProductTypeEntity
|
||||
{
|
||||
Id = id,
|
||||
Name = name ?? string.Empty,
|
||||
ProductType = productType
|
||||
};
|
||||
}
|
||||
}
|
17
ProjectWorkshop/Entities/Shift.cs
Normal file
17
ProjectWorkshop/Entities/Shift.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace ProjectWorkshop.Entities;
|
||||
|
||||
public class Shift
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public DateTime ShiftDate { get; private set; }
|
||||
|
||||
public static Shift CreateEntity(int id)
|
||||
{
|
||||
return new Shift
|
||||
{
|
||||
Id = id,
|
||||
ShiftDate = DateTime.Now
|
||||
};
|
||||
}
|
||||
}
|
70
ProjectWorkshop/FormWorkshop.Designer.cs
generated
70
ProjectWorkshop/FormWorkshop.Designer.cs
generated
@ -30,13 +30,13 @@
|
||||
{
|
||||
menuStrip = new MenuStrip();
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
сборщикиToolStripMenuItem = new ToolStripMenuItem();
|
||||
сборкиToolStripMenuItem = new ToolStripMenuItem();
|
||||
изделияToolStripMenuItem = new ToolStripMenuItem();
|
||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
||||
сборкаToolStripMenuItem = new ToolStripMenuItem();
|
||||
назначитьСборщикаToolStripMenuItem = new ToolStripMenuItem();
|
||||
ВыйтиНаСменуToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
@ -56,49 +56,49 @@
|
||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// сборщикиToolStripMenuItem
|
||||
//
|
||||
сборщикиToolStripMenuItem.Name = "сборщикиToolStripMenuItem";
|
||||
сборщикиToolStripMenuItem.Size = new Size(134, 22);
|
||||
сборщикиToolStripMenuItem.Text = "Сборщики";
|
||||
//
|
||||
// сборкиToolStripMenuItem
|
||||
//
|
||||
сборкиToolStripMenuItem.Name = "сборкиToolStripMenuItem";
|
||||
сборкиToolStripMenuItem.Size = new Size(134, 22);
|
||||
сборкиToolStripMenuItem.Text = "Сборки";
|
||||
//
|
||||
// изделияToolStripMenuItem
|
||||
//
|
||||
изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
|
||||
изделияToolStripMenuItem.Size = new Size(134, 22);
|
||||
изделияToolStripMenuItem.Text = "Изделия";
|
||||
//
|
||||
// операцииToolStripMenuItem
|
||||
//
|
||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { сборкаToolStripMenuItem, назначитьСборщикаToolStripMenuItem });
|
||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { сборкаToolStripMenuItem, ВыйтиНаСменуToolStripMenuItem });
|
||||
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
||||
операцииToolStripMenuItem.Size = new Size(75, 20);
|
||||
операцииToolStripMenuItem.Text = "Операции";
|
||||
//
|
||||
// сборкаToolStripMenuItem
|
||||
//
|
||||
сборкаToolStripMenuItem.Name = "сборкаToolStripMenuItem";
|
||||
сборкаToolStripMenuItem.Size = new Size(192, 22);
|
||||
сборкаToolStripMenuItem.Text = "Сборка";
|
||||
//
|
||||
// ВыйтиНаСменуToolStripMenuItem
|
||||
//
|
||||
ВыйтиНаСменуToolStripMenuItem.Name = "ВыйтиНаСменуToolStripMenuItem";
|
||||
ВыйтиНаСменуToolStripMenuItem.Size = new Size(180, 22);
|
||||
ВыйтиНаСменуToolStripMenuItem.Text = "Выйти на Смену";
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// сборщикиToolStripMenuItem
|
||||
//
|
||||
сборщикиToolStripMenuItem.Name = "сборщикиToolStripMenuItem";
|
||||
сборщикиToolStripMenuItem.Size = new Size(180, 22);
|
||||
сборщикиToolStripMenuItem.Text = "Сборщики";
|
||||
//
|
||||
// сборкиToolStripMenuItem
|
||||
//
|
||||
сборкиToolStripMenuItem.Name = "сборкиToolStripMenuItem";
|
||||
сборкиToolStripMenuItem.Size = new Size(180, 22);
|
||||
сборкиToolStripMenuItem.Text = "Сборки";
|
||||
//
|
||||
// изделияToolStripMenuItem
|
||||
//
|
||||
изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
|
||||
изделияToolStripMenuItem.Size = new Size(180, 22);
|
||||
изделияToolStripMenuItem.Text = "Изделия";
|
||||
//
|
||||
// сборкаToolStripMenuItem
|
||||
//
|
||||
сборкаToolStripMenuItem.Name = "сборкаToolStripMenuItem";
|
||||
сборкаToolStripMenuItem.Size = new Size(180, 22);
|
||||
сборкаToolStripMenuItem.Text = "Сборка";
|
||||
//
|
||||
// назначитьСборщикаToolStripMenuItem
|
||||
//
|
||||
назначитьСборщикаToolStripMenuItem.Name = "назначитьСборщикаToolStripMenuItem";
|
||||
назначитьСборщикаToolStripMenuItem.Size = new Size(192, 22);
|
||||
назначитьСборщикаToolStripMenuItem.Text = "Назначить сборщика";
|
||||
//
|
||||
// FormWorkshop
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
@ -127,6 +127,6 @@
|
||||
private ToolStripMenuItem операцииToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem сборкаToolStripMenuItem;
|
||||
private ToolStripMenuItem назначитьСборщикаToolStripMenuItem;
|
||||
private ToolStripMenuItem ВыйтиНаСменуToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
5
ProjectWorkshop/Forms/FormAssembler.Designer.cs
generated
5
ProjectWorkshop/Forms/FormAssembler.Designer.cs
generated
@ -87,7 +87,7 @@
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
@ -97,10 +97,11 @@
|
||||
buttonCancel.TabIndex = 7;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// comboBoxRank
|
||||
//
|
||||
comboBoxRank.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxRank.FormattingEnabled = true;
|
||||
comboBoxRank.Location = new Point(133, 85);
|
||||
comboBoxRank.Name = "comboBoxRank";
|
||||
|
@ -53,7 +53,7 @@ namespace ProjectWorkshop.Forms
|
||||
throw new ArgumentNullException(nameof(assemblerRepository));
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -80,9 +80,9 @@ namespace ProjectWorkshop.Forms
|
||||
}
|
||||
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
private Assembler CreateAssembler(int id) => Assembler.CreateEntity(id,
|
||||
|
75
ProjectWorkshop/Forms/FormAssemblers.Designer.cs
generated
75
ProjectWorkshop/Forms/FormAssemblers.Designer.cs
generated
@ -29,9 +29,9 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
buttonPencil = new Button();
|
||||
buttonMinus = new Button();
|
||||
buttonPlus = new Button();
|
||||
buttonUpd = new Button();
|
||||
buttonDel = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridView = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
@ -39,47 +39,47 @@
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonPencil);
|
||||
panel1.Controls.Add(buttonMinus);
|
||||
panel1.Controls.Add(buttonPlus);
|
||||
panel1.Controls.Add(buttonUpd);
|
||||
panel1.Controls.Add(buttonDel);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(618, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(153, 441);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// buttonPencil
|
||||
// buttonUpd
|
||||
//
|
||||
buttonPencil.BackgroundImage = Properties.Resources.pencil;
|
||||
buttonPencil.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonPencil.Location = new Point(28, 148);
|
||||
buttonPencil.Name = "buttonPencil";
|
||||
buttonPencil.Size = new Size(100, 93);
|
||||
buttonPencil.TabIndex = 1;
|
||||
buttonPencil.UseVisualStyleBackColor = true;
|
||||
buttonPencil.Click += buttonPencil_Click;
|
||||
buttonUpd.BackgroundImage = Properties.Resources.pencil;
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpd.Location = new Point(28, 148);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(100, 93);
|
||||
buttonUpd.TabIndex = 1;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonMinus
|
||||
// buttonDel
|
||||
//
|
||||
buttonMinus.BackgroundImage = Properties.Resources.minus;
|
||||
buttonMinus.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonMinus.Location = new Point(28, 278);
|
||||
buttonMinus.Name = "buttonMinus";
|
||||
buttonMinus.Size = new Size(100, 95);
|
||||
buttonMinus.TabIndex = 1;
|
||||
buttonMinus.UseVisualStyleBackColor = true;
|
||||
buttonMinus.Click += buttonMinus_Click;
|
||||
buttonDel.BackgroundImage = Properties.Resources.minus;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(28, 278);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(100, 95);
|
||||
buttonDel.TabIndex = 1;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonPlus
|
||||
// buttonAdd
|
||||
//
|
||||
buttonPlus.BackgroundImage = Properties.Resources.plus1;
|
||||
buttonPlus.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonPlus.Location = new Point(28, 25);
|
||||
buttonPlus.Name = "buttonPlus";
|
||||
buttonPlus.Size = new Size(100, 86);
|
||||
buttonPlus.TabIndex = 0;
|
||||
buttonPlus.UseVisualStyleBackColor = true;
|
||||
buttonPlus.Click += buttonPlus_Click;
|
||||
buttonAdd.BackgroundImage = Properties.Resources.plus1;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(28, 25);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(100, 86);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
@ -108,7 +108,8 @@
|
||||
Controls.Add(panel1);
|
||||
Name = "FormAssemblers";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "FormAssemblers";
|
||||
Text = "Сборщики";
|
||||
Load += FormAssemblers_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
@ -117,9 +118,9 @@
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonPencil;
|
||||
private Button buttonMinus;
|
||||
private Button buttonPlus;
|
||||
private Button buttonUpd;
|
||||
private Button buttonDel;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
@ -27,19 +27,93 @@ namespace ProjectWorkshop.Forms
|
||||
throw new ArgumentNullException(nameof(assemblerRepository));
|
||||
}
|
||||
|
||||
private void ButtonPlus_Click(object sender, EventArgs e)
|
||||
private void FormAssemblers_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<FormAssembler>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonPencil_Click(object sender, EventArgs e)
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormAssembler>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonMinus_Click(object sender, EventArgs e)
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление",
|
||||
MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_assemblerRepository.DeleteAssembler(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridView.DataSource = _assemblerRepository.ReadAssemblers();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridView.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
|
||||
id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
126
ProjectWorkshop/Forms/FormAssemblies.Designer.cs
generated
Normal file
126
ProjectWorkshop/Forms/FormAssemblies.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
namespace ProjectWorkshop.Forms
|
||||
{
|
||||
partial class FormAssemblies
|
||||
{
|
||||
/// <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();
|
||||
dataGridView = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(buttonDel);
|
||||
panel1.Controls.Add(buttonUpd);
|
||||
panel1.Controls.Add(buttonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(646, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(154, 450);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.BackgroundImage = Properties.Resources.minus;
|
||||
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonDel.Location = new Point(28, 288);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(100, 86);
|
||||
buttonDel.TabIndex = 2;
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
buttonUpd.BackgroundImage = Properties.Resources.pencil;
|
||||
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonUpd.Location = new Point(28, 159);
|
||||
buttonUpd.Name = "buttonUpd";
|
||||
buttonUpd.Size = new Size(100, 86);
|
||||
buttonUpd.TabIndex = 1;
|
||||
buttonUpd.UseVisualStyleBackColor = true;
|
||||
buttonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.plus;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(28, 25);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(100, 86);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.AllowUserToAddRows = false;
|
||||
dataGridView.AllowUserToDeleteRows = false;
|
||||
dataGridView.AllowUserToResizeColumns = false;
|
||||
dataGridView.AllowUserToResizeRows = false;
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Dock = DockStyle.Fill;
|
||||
dataGridView.Location = new Point(0, 0);
|
||||
dataGridView.MultiSelect = false;
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.ReadOnly = true;
|
||||
dataGridView.RowHeadersVisible = false;
|
||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridView.Size = new Size(646, 450);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// FormAssemblies
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridView);
|
||||
Controls.Add(panel1);
|
||||
Name = "FormAssemblies";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Сборки";
|
||||
Load += FormAssemblies_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button buttonAdd;
|
||||
private Button buttonDel;
|
||||
private Button buttonUpd;
|
||||
private DataGridView dataGridView;
|
||||
}
|
||||
}
|
106
ProjectWorkshop/Forms/FormAssemblies.cs
Normal file
106
ProjectWorkshop/Forms/FormAssemblies.cs
Normal file
@ -0,0 +1,106 @@
|
||||
using ProjectWorkshop.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectWorkshop.Forms
|
||||
{
|
||||
public partial class FormAssemblies : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
private readonly IAssemblyRepository _assemblyRepository;
|
||||
public FormAssemblies(IUnityContainer container, IAssemblyRepository employeeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_assemblyRepository = employeeRepository ??
|
||||
throw new ArgumentNullException(nameof(employeeRepository));
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormAssembly>().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<FormAssembly>();
|
||||
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
|
||||
{
|
||||
_assemblyRepository.DeleteAssembly(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void FormAssemblies_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridView.DataSource = _assemblyRepository.ReadAssemblies();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridView.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
120
ProjectWorkshop/Forms/FormAssemblies.resx
Normal file
120
ProjectWorkshop/Forms/FormAssemblies.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>
|
120
ProjectWorkshop/Forms/FormAssembly.Designer.cs
generated
Normal file
120
ProjectWorkshop/Forms/FormAssembly.Designer.cs
generated
Normal file
@ -0,0 +1,120 @@
|
||||
namespace ProjectWorkshop.Forms
|
||||
{
|
||||
partial class FormAssembly
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelCount = new Label();
|
||||
labelProductType = new Label();
|
||||
textBoxProductType = new TextBox();
|
||||
numericUpDownCount = new NumericUpDown();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCount).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelCount
|
||||
//
|
||||
labelCount.AutoSize = true;
|
||||
labelCount.Location = new Point(113, 101);
|
||||
labelCount.Name = "labelCount";
|
||||
labelCount.Size = new Size(46, 15);
|
||||
labelCount.TabIndex = 0;
|
||||
labelCount.Text = "Кол-во";
|
||||
//
|
||||
// labelProductType
|
||||
//
|
||||
labelProductType.AutoSize = true;
|
||||
labelProductType.Location = new Point(100, 51);
|
||||
labelProductType.Name = "labelProductType";
|
||||
labelProductType.Size = new Size(74, 15);
|
||||
labelProductType.TabIndex = 1;
|
||||
labelProductType.Text = "Тип изделия";
|
||||
//
|
||||
// textBoxProductType
|
||||
//
|
||||
textBoxProductType.Location = new Point(201, 48);
|
||||
textBoxProductType.Name = "textBoxProductType";
|
||||
textBoxProductType.Size = new Size(116, 23);
|
||||
textBoxProductType.TabIndex = 2;
|
||||
//
|
||||
// numericUpDownCount
|
||||
//
|
||||
numericUpDownCount.Location = new Point(201, 99);
|
||||
numericUpDownCount.Name = "numericUpDownCount";
|
||||
numericUpDownCount.Size = new Size(116, 23);
|
||||
numericUpDownCount.TabIndex = 3;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(100, 169);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 4;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(232, 169);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 5;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// FormAssembly
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(420, 220);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(numericUpDownCount);
|
||||
Controls.Add(textBoxProductType);
|
||||
Controls.Add(labelProductType);
|
||||
Controls.Add(labelCount);
|
||||
Name = "FormAssembly";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Сборка";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelCount;
|
||||
private Label labelProductType;
|
||||
private TextBox textBoxProductType;
|
||||
private NumericUpDown numericUpDownCount;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
}
|
||||
}
|
86
ProjectWorkshop/Forms/FormAssembly.cs
Normal file
86
ProjectWorkshop/Forms/FormAssembly.cs
Normal file
@ -0,0 +1,86 @@
|
||||
using ProjectWorkshop.Entities;
|
||||
using ProjectWorkshop.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ProjectWorkshop.Forms
|
||||
{
|
||||
public partial class FormAssembly : Form
|
||||
{
|
||||
private readonly IAssemblyRepository _assemblyRepository;
|
||||
|
||||
private int? _assemblyId;
|
||||
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var assembly = _assemblyRepository.ReadAssemblyByID(value);
|
||||
if (assembly == null)
|
||||
{
|
||||
throw new
|
||||
InvalidDataException(nameof(assembly));
|
||||
}
|
||||
textBoxProductType.Text = assembly.ProductType;
|
||||
numericUpDownCount.Value = assembly.Count;
|
||||
_assemblyId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormAssembly()
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeComponent();
|
||||
_assemblyRepository = _assemblyRepository ??
|
||||
throw new ArgumentNullException(nameof(_assemblyRepository));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxProductType.Text) || string.IsNullOrWhiteSpace(textBoxProductType.Text) || numericUpDownCount.Value < 1)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
if (_assemblyId.HasValue)
|
||||
{
|
||||
_assemblyRepository.UpdateAssembly(CreateAssembly(_assemblyId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_assemblyRepository.CreateAssembly(CreateAssembly(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private Assembly CreateAssembly(int id) =>
|
||||
Assembly.CreateEntity(id, (int)numericUpDownCount.Value, textBoxProductType.Text);
|
||||
}
|
||||
}
|
120
ProjectWorkshop/Forms/FormAssembly.resx
Normal file
120
ProjectWorkshop/Forms/FormAssembly.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>
|
@ -23,11 +23,11 @@ namespace ProjectWorkshop
|
||||
var container = new UnityContainer();
|
||||
|
||||
container.RegisterType<IAssemblerRepository, AssemblerRepository>();
|
||||
container.RegisterType<IAssemblerShiftRepository, AssemblerShiftRepository>();
|
||||
container.RegisterType<IAssemblyRepository, AssemblyRepository>();
|
||||
container.RegisterType<IProductAssemblyRepository, ProductAssemblyRepository>();
|
||||
container.RegisterType<IProductRepository, ProductRepository>();
|
||||
container.RegisterType<IProductTypeRepository, ProductTypeRepository>();
|
||||
|
||||
container.RegisterType<IShiftRepository, ShiftRepository>();
|
||||
return container;
|
||||
}
|
||||
}
|
||||
|
11
ProjectWorkshop/Repositories/IAssemblerShiftRepository.cs
Normal file
11
ProjectWorkshop/Repositories/IAssemblerShiftRepository.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using ProjectWorkshop.Entities;
|
||||
namespace ProjectWorkshop.Repositories;
|
||||
|
||||
public interface IAssemblerShiftRepository
|
||||
{
|
||||
IEnumerable<AssemblerShift> ReadProductAssembly(int? workHours = null, int? assemblerID = null, int? shiftID = null);
|
||||
|
||||
void CreateAssemblerShift(AssemblerShift assemblerShift);
|
||||
|
||||
void DeleteAssemblerShift(int id);
|
||||
}
|
@ -12,4 +12,5 @@ public interface IAssemblyRepository
|
||||
void UpdateAssembly(Assembly assembly);
|
||||
|
||||
void DeleteAssembly(int id);
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,4 @@
|
||||
using ProjectWorkshop.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectWorkshop.Repositories;
|
||||
|
||||
public interface IProductRepository
|
||||
|
@ -1,16 +0,0 @@
|
||||
using ProjectWorkshop.Entities;
|
||||
using ProjectWorkshop.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectWorkshop.Repositories;
|
||||
|
||||
public interface IProductTypeRepository
|
||||
{
|
||||
IEnumerable<ProductTypeEntity> ReadProductAssembly(int? id = null, string? name = null, ProductType? productType = null);
|
||||
|
||||
void CreateProductAssembly(ProductTypeEntity productAssembly);
|
||||
}
|
15
ProjectWorkshop/Repositories/IShiftRepository.cs
Normal file
15
ProjectWorkshop/Repositories/IShiftRepository.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using ProjectWorkshop.Entities;
|
||||
namespace ProjectWorkshop.Repositories;
|
||||
|
||||
public interface IShiftRepository
|
||||
{
|
||||
IEnumerable<Shift> ReadShifts();
|
||||
|
||||
Shift ReadShiftByID(int id);
|
||||
|
||||
void CreateShift(Shift shift);
|
||||
|
||||
void UpdateShift(Shift shift);
|
||||
|
||||
void DeleteShift(int id);
|
||||
}
|
@ -30,6 +30,5 @@ public class AssemblerRepository : IAssemblerRepository
|
||||
|
||||
public void UpdateAssembler(Assembler assembler)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
using ProjectWorkshop.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectWorkshop.Repositories.Implementation;
|
||||
|
||||
public class AssemblerShiftRepository : IAssemblerShiftRepository
|
||||
{
|
||||
public void CreateAssemblerShift(AssemblerShift assemblerShift)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteAssemblerShift(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<AssemblerShift> ReadProductAssembly(int? workHours = null, int? assemblerID = null, int? shiftID = null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
@ -11,26 +11,23 @@ public class AssemblyRepository : IAssemblyRepository
|
||||
{
|
||||
public void CreateAssembly(Assembly assembly)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void DeleteAssembly(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<Assembly> ReadAssemblies()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Assembly ReadAssemblyByID(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return Assembly.CreateEntity(0, 0, string.Empty);
|
||||
}
|
||||
|
||||
public IEnumerable<Assembly> ReadAssemblies()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateAssembly(Assembly assembly)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -11,26 +11,23 @@ public class ProductRepository : IProductRepository
|
||||
{
|
||||
public void CreateProduct(Product product)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void DeleteProduct(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Product ReadProductByID(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return Product.CreateEntity(0, string.Empty, 0, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Product> ReadProducts()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateProduct(Product product)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
using ProjectWorkshop.Entities;
|
||||
using ProjectWorkshop.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectWorkshop.Repositories.Implementation;
|
||||
|
||||
public class ProductTypeRepository : IProductTypeRepository
|
||||
{
|
||||
public void CreateProductAssembly(ProductTypeEntity productAssembly)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<ProductTypeEntity> ReadProductAssembly(int? id = null, string? name = null, ProductType? productType = null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
using ProjectWorkshop.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectWorkshop.Repositories.Implementation;
|
||||
|
||||
public class ShiftRepository : IShiftRepository
|
||||
{
|
||||
public void CreateShift(Shift shift)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteShift(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Shift ReadShiftByID(int id)
|
||||
{
|
||||
return Shift.CreateEntity(0);
|
||||
}
|
||||
|
||||
public IEnumerable<Shift> ReadShifts()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateShift(Shift shift)
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user