Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
3be2cec4fd | |||
ed453fca44 | |||
289b42dd9b | |||
42c60c7e0d |
28
Workshop/Entities/Cheque.cs
Normal file
28
Workshop/Entities/Cheque.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Entities;
|
||||
|
||||
public class Cheque
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public DateTime Date { get; private set; }
|
||||
public double Sum { get; private set; }
|
||||
public IEnumerable<ChequeProduct> ChequeProduct { get; private set; } = [];
|
||||
|
||||
public static Cheque CreateOperation(int id, int sum, IEnumerable<ChequeProduct> products)
|
||||
{
|
||||
return new Cheque()
|
||||
{
|
||||
Id = id,
|
||||
Sum = sum,
|
||||
Date = DateTime.Now,
|
||||
ChequeProduct = products
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
22
Workshop/Entities/ChequeProduct.cs
Normal file
22
Workshop/Entities/ChequeProduct.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Entities;
|
||||
public class ChequeProduct
|
||||
{
|
||||
public int ProductId { get; private set; }
|
||||
public int ChequeId { get; private set; }
|
||||
public int Amount { get; private set; }
|
||||
public static ChequeProduct CreateEntity(int productid, int chequeid, int amount)
|
||||
{
|
||||
return new ChequeProduct
|
||||
{
|
||||
ProductId = productid,
|
||||
ChequeId = chequeid,
|
||||
Amount = amount
|
||||
};
|
||||
}
|
||||
}
|
14
Workshop/Entities/Enums/MasterPosition.cs
Normal file
14
Workshop/Entities/Enums/MasterPosition.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Entities.Enums;
|
||||
|
||||
public enum MasterPosition
|
||||
{
|
||||
None = 0,
|
||||
Intern = 1,
|
||||
Master = 2
|
||||
}
|
16
Workshop/Entities/Enums/ProductCategory.cs
Normal file
16
Workshop/Entities/Enums/ProductCategory.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Entities.Enums;
|
||||
[Flags]
|
||||
public enum ProductCategory
|
||||
{
|
||||
None = 0,
|
||||
Furniture = 1,
|
||||
Gifts = 2,
|
||||
Kitchenware = 4,
|
||||
Tools = 8
|
||||
}
|
29
Workshop/Entities/Master.cs
Normal file
29
Workshop/Entities/Master.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Workshop.Entities.Enums;
|
||||
|
||||
namespace Workshop.Entities;
|
||||
|
||||
public class Master
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public string LastName { get; private set; } = string.Empty;
|
||||
public int Age { get; private set; }
|
||||
public MasterPosition Position { get; private set; }
|
||||
|
||||
public static Master CreateEntity(int id, string name, string lastName, int age, MasterPosition position)
|
||||
{
|
||||
return new Master
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
LastName = lastName,
|
||||
Age = age,
|
||||
Position = position
|
||||
};
|
||||
}
|
||||
}
|
25
Workshop/Entities/Material.cs
Normal file
25
Workshop/Entities/Material.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Entities;
|
||||
|
||||
public class Material
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public int WarehouseAmount { get; private set; }
|
||||
public double Price { get; private set; }
|
||||
public static Material CreateEntity(int id, string name, int warehouseAmount, double price)
|
||||
{
|
||||
return new Material
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
WarehouseAmount = warehouseAmount,
|
||||
Price = price
|
||||
};
|
||||
}
|
||||
}
|
27
Workshop/Entities/Product.cs
Normal file
27
Workshop/Entities/Product.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Workshop.Entities;
|
||||
using Workshop.Entities.Enums;
|
||||
|
||||
public class Product
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public double Price { get; private set; }
|
||||
public int WarehouseAmount { get; private set; }
|
||||
public ProductCategory Category { get; private set; }
|
||||
public IEnumerable<ProductMaterial> Materials { get; private set; } = [];
|
||||
public static Product CreateEntity(int id, string name, double price, int warehouseAmount,
|
||||
ProductCategory category, IEnumerable<ProductMaterial> materials)
|
||||
{
|
||||
return new Product {
|
||||
Id = id,
|
||||
Name = name,
|
||||
Price = price,
|
||||
WarehouseAmount = warehouseAmount,
|
||||
Category = category,
|
||||
Materials = materials
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
27
Workshop/Entities/ProductCreate.cs
Normal file
27
Workshop/Entities/ProductCreate.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Workshop.Entities.Enums;
|
||||
|
||||
namespace Workshop.Entities;
|
||||
|
||||
public class ProductCreate
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int ProductId { get; private set; }
|
||||
public int MasterId { get; private set; }
|
||||
public DateTime CreatingDate { get; private set; }
|
||||
public static ProductCreate CreateOperation(int id, int productid, int masterid)
|
||||
{
|
||||
return new ProductCreate
|
||||
{
|
||||
Id = id,
|
||||
ProductId = productid,
|
||||
MasterId = masterid,
|
||||
CreatingDate = DateTime.Now
|
||||
};
|
||||
}
|
||||
|
||||
}
|
23
Workshop/Entities/ProductMaterial.cs
Normal file
23
Workshop/Entities/ProductMaterial.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Entities;
|
||||
|
||||
public class ProductMaterial
|
||||
{
|
||||
public int ProductId { get; private set; }
|
||||
public int MaterialId { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
public static ProductMaterial CreateEntity(int productId, int materialId, int count)
|
||||
{
|
||||
return new ProductMaterial
|
||||
{
|
||||
ProductId = productId,
|
||||
MaterialId = materialId,
|
||||
Count = count
|
||||
};
|
||||
}
|
||||
}
|
137
Workshop/FormWorkshop.Designer.cs
generated
Normal file
137
Workshop/FormWorkshop.Designer.cs
generated
Normal file
@ -0,0 +1,137 @@
|
||||
namespace Workshop
|
||||
{
|
||||
partial class FormWorkshop
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
menuStrip = new MenuStrip();
|
||||
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||
ProductstoolStripMenuItem = new ToolStripMenuItem();
|
||||
MastersToolStripMenuItem = new ToolStripMenuItem();
|
||||
MaterialsToolStripMenuItem = new ToolStripMenuItem();
|
||||
операцииToolStripMenuItem = new ToolStripMenuItem();
|
||||
ProductCreateToolStripMenuItem = new ToolStripMenuItem();
|
||||
ChequeToolStripMenuItem = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
menuStrip.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// menuStrip
|
||||
//
|
||||
menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
|
||||
menuStrip.Location = new Point(0, 0);
|
||||
menuStrip.Name = "menuStrip";
|
||||
menuStrip.Size = new Size(784, 24);
|
||||
menuStrip.TabIndex = 0;
|
||||
menuStrip.Text = "menuStrip";
|
||||
//
|
||||
// справочникиToolStripMenuItem
|
||||
//
|
||||
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ProductstoolStripMenuItem, MastersToolStripMenuItem, MaterialsToolStripMenuItem });
|
||||
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||
справочникиToolStripMenuItem.Size = new Size(94, 20);
|
||||
справочникиToolStripMenuItem.Text = "Справочники";
|
||||
//
|
||||
// ProductstoolStripMenuItem
|
||||
//
|
||||
ProductstoolStripMenuItem.Name = "ProductstoolStripMenuItem";
|
||||
ProductstoolStripMenuItem.Size = new Size(180, 22);
|
||||
ProductstoolStripMenuItem.Text = "Изделия";
|
||||
ProductstoolStripMenuItem.Click += ProductstoolStripMenuItem_Click;
|
||||
//
|
||||
// MastersToolStripMenuItem
|
||||
//
|
||||
MastersToolStripMenuItem.Name = "MastersToolStripMenuItem";
|
||||
MastersToolStripMenuItem.Size = new Size(180, 22);
|
||||
MastersToolStripMenuItem.Text = "Мастера";
|
||||
MastersToolStripMenuItem.Click += MastersToolStripMenuItem_Click;
|
||||
//
|
||||
// MaterialsToolStripMenuItem
|
||||
//
|
||||
MaterialsToolStripMenuItem.Name = "MaterialsToolStripMenuItem";
|
||||
MaterialsToolStripMenuItem.Size = new Size(180, 22);
|
||||
MaterialsToolStripMenuItem.Text = "Материалы";
|
||||
MaterialsToolStripMenuItem.Click += MaterialsToolStripMenuItem_Click;
|
||||
//
|
||||
// операцииToolStripMenuItem
|
||||
//
|
||||
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ProductCreateToolStripMenuItem, ChequeToolStripMenuItem });
|
||||
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
|
||||
операцииToolStripMenuItem.Size = new Size(75, 20);
|
||||
операцииToolStripMenuItem.Text = "Операции";
|
||||
//
|
||||
// ProductCreateToolStripMenuItem
|
||||
//
|
||||
ProductCreateToolStripMenuItem.Name = "ProductCreateToolStripMenuItem";
|
||||
ProductCreateToolStripMenuItem.Size = new Size(203, 22);
|
||||
ProductCreateToolStripMenuItem.Text = "Создание изделия";
|
||||
ProductCreateToolStripMenuItem.Click += ProductCreateToolStripMenuItem_Click;
|
||||
//
|
||||
// ChequeToolStripMenuItem
|
||||
//
|
||||
ChequeToolStripMenuItem.Name = "ChequeToolStripMenuItem";
|
||||
ChequeToolStripMenuItem.Size = new Size(203, 22);
|
||||
ChequeToolStripMenuItem.Text = "Продажа изделий (Чек)";
|
||||
ChequeToolStripMenuItem.Click += ChequeToolStripMenuItem_Click;
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// FormWorkshop
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackgroundImage = Properties.Resources.st4_1;
|
||||
BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ClientSize = new Size(784, 411);
|
||||
Controls.Add(menuStrip);
|
||||
MainMenuStrip = menuStrip;
|
||||
Name = "FormWorkshop";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "Мастерская";
|
||||
menuStrip.ResumeLayout(false);
|
||||
menuStrip.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MenuStrip menuStrip;
|
||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||
private ToolStripMenuItem ProductstoolStripMenuItem;
|
||||
private ToolStripMenuItem операцииToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem MastersToolStripMenuItem;
|
||||
private ToolStripMenuItem MaterialsToolStripMenuItem;
|
||||
private ToolStripMenuItem ProductCreateToolStripMenuItem;
|
||||
private ToolStripMenuItem ChequeToolStripMenuItem;
|
||||
}
|
||||
}
|
77
Workshop/FormWorkshop.cs
Normal file
77
Workshop/FormWorkshop.cs
Normal file
@ -0,0 +1,77 @@
|
||||
using Unity;
|
||||
using Workshop.Forms;
|
||||
|
||||
namespace Workshop
|
||||
{
|
||||
public partial class FormWorkshop : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
public FormWorkshop(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
private void ProductstoolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormProducts>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void MastersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormMasters>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void MaterialsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormMaterials>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ProductCreateToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormProductCreatings>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ChequeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormCheques>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
123
Workshop/FormWorkshop.resx
Normal file
123
Workshop/FormWorkshop.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?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>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
172
Workshop/Forms/FormCheque.Designer.cs
generated
Normal file
172
Workshop/Forms/FormCheque.Designer.cs
generated
Normal file
@ -0,0 +1,172 @@
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
partial class FormCheque
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dateTimePickerDate = new DateTimePicker();
|
||||
labelData = new Label();
|
||||
labelSum = new Label();
|
||||
numericUpDownSum = new NumericUpDown();
|
||||
groupBoxProdCheq = new GroupBox();
|
||||
dataGridViewProducts = new DataGridView();
|
||||
ColumnProductName = new DataGridViewComboBoxColumn();
|
||||
ProductAmount = new DataGridViewTextBoxColumn();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSum).BeginInit();
|
||||
groupBoxProdCheq.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProducts).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dateTimePickerDate
|
||||
//
|
||||
dateTimePickerDate.Enabled = false;
|
||||
dateTimePickerDate.Location = new Point(144, 25);
|
||||
dateTimePickerDate.Name = "dateTimePickerDate";
|
||||
dateTimePickerDate.Size = new Size(121, 23);
|
||||
dateTimePickerDate.TabIndex = 5;
|
||||
//
|
||||
// labelData
|
||||
//
|
||||
labelData.AutoSize = true;
|
||||
labelData.Location = new Point(38, 31);
|
||||
labelData.Name = "labelData";
|
||||
labelData.Size = new Size(35, 15);
|
||||
labelData.TabIndex = 4;
|
||||
labelData.Text = "Дата:";
|
||||
//
|
||||
// labelSum
|
||||
//
|
||||
labelSum.AutoSize = true;
|
||||
labelSum.Location = new Point(38, 77);
|
||||
labelSum.Name = "labelSum";
|
||||
labelSum.Size = new Size(45, 15);
|
||||
labelSum.TabIndex = 6;
|
||||
labelSum.Text = "Сумма";
|
||||
//
|
||||
// numericUpDownSum
|
||||
//
|
||||
numericUpDownSum.Location = new Point(144, 75);
|
||||
numericUpDownSum.Name = "numericUpDownSum";
|
||||
numericUpDownSum.Size = new Size(121, 23);
|
||||
numericUpDownSum.TabIndex = 7;
|
||||
//
|
||||
// groupBoxProdCheq
|
||||
//
|
||||
groupBoxProdCheq.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
groupBoxProdCheq.Controls.Add(dataGridViewProducts);
|
||||
groupBoxProdCheq.Location = new Point(38, 128);
|
||||
groupBoxProdCheq.Name = "groupBoxProdCheq";
|
||||
groupBoxProdCheq.Size = new Size(275, 251);
|
||||
groupBoxProdCheq.TabIndex = 8;
|
||||
groupBoxProdCheq.TabStop = false;
|
||||
groupBoxProdCheq.Text = "Изделия";
|
||||
//
|
||||
// dataGridViewProducts
|
||||
//
|
||||
dataGridViewProducts.AllowUserToResizeColumns = false;
|
||||
dataGridViewProducts.AllowUserToResizeRows = false;
|
||||
dataGridViewProducts.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewProducts.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewProducts.Columns.AddRange(new DataGridViewColumn[] { ColumnProductName, ProductAmount });
|
||||
dataGridViewProducts.Dock = DockStyle.Fill;
|
||||
dataGridViewProducts.Location = new Point(3, 19);
|
||||
dataGridViewProducts.MultiSelect = false;
|
||||
dataGridViewProducts.Name = "dataGridViewProducts";
|
||||
dataGridViewProducts.RowHeadersVisible = false;
|
||||
dataGridViewProducts.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewProducts.Size = new Size(269, 229);
|
||||
dataGridViewProducts.TabIndex = 0;
|
||||
//
|
||||
// ColumnProductName
|
||||
//
|
||||
ColumnProductName.HeaderText = "Изделие";
|
||||
ColumnProductName.Name = "ColumnProductName";
|
||||
//
|
||||
// ProductAmount
|
||||
//
|
||||
ProductAmount.HeaderText = "Количество";
|
||||
ProductAmount.Name = "ProductAmount";
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonSave.Location = new Point(72, 398);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 9;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonCancel.Location = new Point(216, 398);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 10;
|
||||
buttonCancel.Text = "Отменить";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// FormCheque
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(359, 436);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(groupBoxProdCheq);
|
||||
Controls.Add(numericUpDownSum);
|
||||
Controls.Add(labelSum);
|
||||
Controls.Add(dateTimePickerDate);
|
||||
Controls.Add(labelData);
|
||||
Name = "FormCheque";
|
||||
Text = "Продажа";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSum).EndInit();
|
||||
groupBoxProdCheq.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProducts).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DateTimePicker dateTimePickerDate;
|
||||
private Label labelData;
|
||||
private Label labelSum;
|
||||
private NumericUpDown numericUpDownSum;
|
||||
private GroupBox groupBoxProdCheq;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private DataGridView dataGridViewProducts;
|
||||
private DataGridViewComboBoxColumn ColumnProductName;
|
||||
private DataGridViewTextBoxColumn ProductAmount;
|
||||
}
|
||||
}
|
61
Workshop/Forms/FormCheque.cs
Normal file
61
Workshop/Forms/FormCheque.cs
Normal file
@ -0,0 +1,61 @@
|
||||
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 Workshop.Entities;
|
||||
using Workshop.Repositories;
|
||||
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
public partial class FormCheque : Form
|
||||
{
|
||||
private IChequeRepository _chequeRepository;
|
||||
public FormCheque(IChequeRepository chequeRepository, IProductRepository productRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_chequeRepository = chequeRepository ??
|
||||
throw new ArgumentNullException(nameof(chequeRepository));
|
||||
ColumnProductName.DataSource = productRepository.ReadProducts();
|
||||
ColumnProductName.DisplayMember = "Name";
|
||||
ColumnProductName.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (dataGridViewProducts.RowCount < 2)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_chequeRepository.CreateCheque(Cheque.CreateOperation(0, Convert.ToInt32(numericUpDownSum.Value), CreateListChequeProductsFromDataGrid()));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
private List<ChequeProduct> CreateListChequeProductsFromDataGrid()
|
||||
{
|
||||
var list = new List<ChequeProduct>();
|
||||
foreach (DataGridViewRow row in dataGridViewProducts.Rows)
|
||||
{
|
||||
if (row.Cells["ColumnProductName"].Value == null || row.Cells["ColumnAmount"].Value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.Add(ChequeProduct.CreateEntity(Convert.ToInt32(row.Cells["ColumnProductName"].Value), 0,
|
||||
Convert.ToInt32(row.Cells["ColumnAmount"].Value)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
126
Workshop/Forms/FormCheque.resx
Normal file
126
Workshop/Forms/FormCheque.resx
Normal file
@ -0,0 +1,126 @@
|
||||
<?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>
|
||||
<metadata name="ColumnProductName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ProductAmount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
98
Workshop/Forms/FormCheques.Designer.cs
generated
Normal file
98
Workshop/Forms/FormCheques.Designer.cs
generated
Normal file
@ -0,0 +1,98 @@
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
partial class FormCheques
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonAdd = new Button();
|
||||
dataGridProductCreatings = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridProductCreatings).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(600, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(200, 450);
|
||||
panel.TabIndex = 0;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(55, 39);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 75);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// dataGridProductCreatings
|
||||
//
|
||||
dataGridProductCreatings.AllowUserToAddRows = false;
|
||||
dataGridProductCreatings.AllowUserToDeleteRows = false;
|
||||
dataGridProductCreatings.AllowUserToResizeColumns = false;
|
||||
dataGridProductCreatings.AllowUserToResizeRows = false;
|
||||
dataGridProductCreatings.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridProductCreatings.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridProductCreatings.Dock = DockStyle.Fill;
|
||||
dataGridProductCreatings.Location = new Point(0, 0);
|
||||
dataGridProductCreatings.MultiSelect = false;
|
||||
dataGridProductCreatings.Name = "dataGridProductCreatings";
|
||||
dataGridProductCreatings.ReadOnly = true;
|
||||
dataGridProductCreatings.RowHeadersVisible = false;
|
||||
dataGridProductCreatings.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridProductCreatings.Size = new Size(600, 450);
|
||||
dataGridProductCreatings.TabIndex = 1;
|
||||
//
|
||||
// FormCheques
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridProductCreatings);
|
||||
Controls.Add(panel);
|
||||
Name = "FormCheques";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Изделия";
|
||||
Load += FormCheques_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridProductCreatings).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridProductCreatings;
|
||||
}
|
||||
}
|
55
Workshop/Forms/FormCheques.cs
Normal file
55
Workshop/Forms/FormCheques.cs
Normal file
@ -0,0 +1,55 @@
|
||||
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;
|
||||
using Workshop.Repositories;
|
||||
using Workshop.Repositories.Implementations;
|
||||
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
public partial class FormCheques : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IChequeRepository _chequeRepository;
|
||||
public FormCheques(IUnityContainer container, IChequeRepository chequeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_chequeRepository = chequeRepository ??
|
||||
throw new ArgumentNullException(nameof(chequeRepository));
|
||||
}
|
||||
private void FormCheques_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<FormCheque>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridProductCreatings.DataSource = _chequeRepository.ReadCheques();
|
||||
}
|
||||
}
|
120
Workshop/Forms/FormCheques.resx
Normal file
120
Workshop/Forms/FormCheques.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>
|
177
Workshop/Forms/FormMaster.Designer.cs
generated
Normal file
177
Workshop/Forms/FormMaster.Designer.cs
generated
Normal file
@ -0,0 +1,177 @@
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
partial class FormMaster
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
labelCategory = new Label();
|
||||
labelAge = new Label();
|
||||
labelLastName = new Label();
|
||||
labelName = new Label();
|
||||
textBoxName = new TextBox();
|
||||
textBoxLastName = new TextBox();
|
||||
numericUpDownAge = new NumericUpDown();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
label1 = new Label();
|
||||
comboBoxPosition = new ComboBox();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownAge).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelCategory
|
||||
//
|
||||
labelCategory.AutoSize = true;
|
||||
labelCategory.Location = new Point(35, 143);
|
||||
labelCategory.Name = "labelCategory";
|
||||
labelCategory.Size = new Size(0, 15);
|
||||
labelCategory.TabIndex = 7;
|
||||
//
|
||||
// labelAge
|
||||
//
|
||||
labelAge.AutoSize = true;
|
||||
labelAge.Location = new Point(35, 108);
|
||||
labelAge.Name = "labelAge";
|
||||
labelAge.Size = new Size(50, 15);
|
||||
labelAge.TabIndex = 6;
|
||||
labelAge.Text = "Возраст";
|
||||
//
|
||||
// labelLastName
|
||||
//
|
||||
labelLastName.AutoSize = true;
|
||||
labelLastName.Location = new Point(35, 72);
|
||||
labelLastName.Name = "labelLastName";
|
||||
labelLastName.Size = new Size(58, 15);
|
||||
labelLastName.TabIndex = 5;
|
||||
labelLastName.Text = "Фамилия";
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(35, 37);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(31, 15);
|
||||
labelName.TabIndex = 4;
|
||||
labelName.Text = "Имя";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(177, 34);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(100, 23);
|
||||
textBoxName.TabIndex = 8;
|
||||
//
|
||||
// textBoxLastName
|
||||
//
|
||||
textBoxLastName.Location = new Point(177, 69);
|
||||
textBoxLastName.Name = "textBoxLastName";
|
||||
textBoxLastName.Size = new Size(100, 23);
|
||||
textBoxLastName.TabIndex = 9;
|
||||
//
|
||||
// numericUpDownAge
|
||||
//
|
||||
numericUpDownAge.Location = new Point(177, 106);
|
||||
numericUpDownAge.Minimum = new decimal(new int[] { 14, 0, 0, 0 });
|
||||
numericUpDownAge.Name = "numericUpDownAge";
|
||||
numericUpDownAge.Size = new Size(100, 23);
|
||||
numericUpDownAge.TabIndex = 10;
|
||||
numericUpDownAge.Value = new decimal(new int[] { 14, 0, 0, 0 });
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(164, 196);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 12;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(50, 196);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 11;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(35, 143);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(69, 15);
|
||||
label1.TabIndex = 13;
|
||||
label1.Text = "Должность";
|
||||
//
|
||||
// comboBoxPosition
|
||||
//
|
||||
comboBoxPosition.FormattingEnabled = true;
|
||||
comboBoxPosition.Location = new Point(177, 140);
|
||||
comboBoxPosition.Name = "comboBoxPosition";
|
||||
comboBoxPosition.Size = new Size(121, 23);
|
||||
comboBoxPosition.TabIndex = 14;
|
||||
//
|
||||
// FormMaster
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(339, 244);
|
||||
Controls.Add(comboBoxPosition);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(numericUpDownAge);
|
||||
Controls.Add(textBoxLastName);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelCategory);
|
||||
Controls.Add(labelAge);
|
||||
Controls.Add(labelLastName);
|
||||
Controls.Add(labelName);
|
||||
Name = "FormMaster";
|
||||
Text = "FormMaster";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownAge).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelCategory;
|
||||
private Label labelAge;
|
||||
private Label labelLastName;
|
||||
private Label labelName;
|
||||
private TextBox textBoxName;
|
||||
private TextBox textBoxLastName;
|
||||
private NumericUpDown numericUpDownAge;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private Label label1;
|
||||
private ComboBox comboBoxPosition;
|
||||
}
|
||||
}
|
87
Workshop/Forms/FormMaster.cs
Normal file
87
Workshop/Forms/FormMaster.cs
Normal file
@ -0,0 +1,87 @@
|
||||
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 Workshop.Entities;
|
||||
using Workshop.Entities.Enums;
|
||||
using Workshop.Repositories;
|
||||
using Workshop.Repositories.Implementations;
|
||||
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
public partial class FormMaster : Form
|
||||
{
|
||||
private readonly IMasterRepository _masterRepository;
|
||||
private int? _masterId;
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var master = _masterRepository.ReadMasterById(value);
|
||||
if (master == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(master));
|
||||
}
|
||||
textBoxName.Text = master.Name;
|
||||
textBoxLastName.Text = master.LastName;
|
||||
numericUpDownAge.Value = master.Age;
|
||||
comboBoxPosition.SelectedItem = master.Position;
|
||||
_masterId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormMaster(IMasterRepository masterRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_masterRepository = masterRepository ??
|
||||
throw new ArgumentNullException(nameof(masterRepository));
|
||||
comboBoxPosition.DataSource = Enum.GetValues(typeof(MasterPosition));
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text) || string.IsNullOrWhiteSpace(textBoxLastName.Text) ||
|
||||
comboBoxPosition.SelectedIndex < 1)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
if (_masterId.HasValue)
|
||||
{
|
||||
_masterRepository.UpdateMaster(CreateMaster(_masterId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_masterRepository.CreateMaster(CreateMaster(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private Master CreateMaster(int id)
|
||||
{
|
||||
return Master.CreateEntity(id,
|
||||
textBoxName.Text,
|
||||
textBoxLastName.Text,
|
||||
Convert.ToInt32(numericUpDownAge.Value), (MasterPosition)comboBoxPosition.SelectedItem!);
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
}
|
||||
}
|
120
Workshop/Forms/FormMaster.resx
Normal file
120
Workshop/Forms/FormMaster.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>
|
126
Workshop/Forms/FormMasters.Designer.cs
generated
Normal file
126
Workshop/Forms/FormMasters.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
partial class FormMasters
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonEdit = new Button();
|
||||
buttonRemove = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewMasters = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewMasters).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonEdit);
|
||||
panel.Controls.Add(buttonRemove);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(600, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(200, 450);
|
||||
panel.TabIndex = 0;
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
buttonEdit.BackgroundImage = Properties.Resources.Edit;
|
||||
buttonEdit.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonEdit.Location = new Point(55, 248);
|
||||
buttonEdit.Name = "buttonEdit";
|
||||
buttonEdit.Size = new Size(75, 75);
|
||||
buttonEdit.TabIndex = 2;
|
||||
buttonEdit.UseVisualStyleBackColor = true;
|
||||
buttonEdit.Click += buttonEdit_Click;
|
||||
//
|
||||
// buttonRemove
|
||||
//
|
||||
buttonRemove.BackgroundImage = Properties.Resources.Remove;
|
||||
buttonRemove.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonRemove.Location = new Point(55, 142);
|
||||
buttonRemove.Name = "buttonRemove";
|
||||
buttonRemove.Size = new Size(75, 75);
|
||||
buttonRemove.TabIndex = 1;
|
||||
buttonRemove.UseVisualStyleBackColor = true;
|
||||
buttonRemove.Click += buttonRemove_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(55, 39);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 75);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// dataGridViewMasters
|
||||
//
|
||||
dataGridViewMasters.AllowUserToAddRows = false;
|
||||
dataGridViewMasters.AllowUserToDeleteRows = false;
|
||||
dataGridViewMasters.AllowUserToResizeColumns = false;
|
||||
dataGridViewMasters.AllowUserToResizeRows = false;
|
||||
dataGridViewMasters.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewMasters.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewMasters.Dock = DockStyle.Fill;
|
||||
dataGridViewMasters.Location = new Point(0, 0);
|
||||
dataGridViewMasters.MultiSelect = false;
|
||||
dataGridViewMasters.Name = "dataGridViewMasters";
|
||||
dataGridViewMasters.ReadOnly = true;
|
||||
dataGridViewMasters.RowHeadersVisible = false;
|
||||
dataGridViewMasters.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewMasters.Size = new Size(600, 450);
|
||||
dataGridViewMasters.TabIndex = 1;
|
||||
//
|
||||
// FormMasters
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewMasters);
|
||||
Controls.Add(panel);
|
||||
Name = "FormMasters";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Изделия";
|
||||
Load += FormMasters_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewMasters).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonEdit;
|
||||
private Button buttonRemove;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewMasters;
|
||||
}
|
||||
}
|
109
Workshop/Forms/FormMasters.cs
Normal file
109
Workshop/Forms/FormMasters.cs
Normal file
@ -0,0 +1,109 @@
|
||||
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;
|
||||
using Workshop.Repositories;
|
||||
using Workshop.Repositories.Implementations;
|
||||
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
public partial class FormMasters : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IMasterRepository _masterRepository;
|
||||
public FormMasters(IUnityContainer container, IMasterRepository masterRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_masterRepository = masterRepository ??
|
||||
throw new ArgumentNullException(nameof(masterRepository));
|
||||
}
|
||||
private void FormMasters_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<FormMaster>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление",
|
||||
MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
}
|
||||
try
|
||||
{
|
||||
_masterRepository.DeleteMaster(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormMaster>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewMasters.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewMasters.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
private void LoadList() => dataGridViewMasters.DataSource = _masterRepository.ReadMasters();
|
||||
|
||||
|
||||
}
|
||||
}
|
120
Workshop/Forms/FormMasters.resx
Normal file
120
Workshop/Forms/FormMasters.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>
|
146
Workshop/Forms/FormMaterial.Designer.cs
generated
Normal file
146
Workshop/Forms/FormMaterial.Designer.cs
generated
Normal file
@ -0,0 +1,146 @@
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
partial class FormMaterial
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
numericUpDownAmount = new NumericUpDown();
|
||||
numericUpDownPrice = new NumericUpDown();
|
||||
textBoxName = new TextBox();
|
||||
labelWHamount = new Label();
|
||||
labelPrice = new Label();
|
||||
labelName = new Label();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownAmount).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// numericUpDownAmount
|
||||
//
|
||||
numericUpDownAmount.Location = new Point(201, 95);
|
||||
numericUpDownAmount.Name = "numericUpDownAmount";
|
||||
numericUpDownAmount.Size = new Size(120, 23);
|
||||
numericUpDownAmount.TabIndex = 12;
|
||||
//
|
||||
// numericUpDownPrice
|
||||
//
|
||||
numericUpDownPrice.DecimalPlaces = 2;
|
||||
numericUpDownPrice.Location = new Point(201, 59);
|
||||
numericUpDownPrice.Minimum = new decimal(new int[] { 1, 0, 0, 65536 });
|
||||
numericUpDownPrice.Name = "numericUpDownPrice";
|
||||
numericUpDownPrice.Size = new Size(120, 23);
|
||||
numericUpDownPrice.TabIndex = 11;
|
||||
numericUpDownPrice.Value = new decimal(new int[] { 1, 0, 0, 65536 });
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(201, 23);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(100, 23);
|
||||
textBoxName.TabIndex = 10;
|
||||
//
|
||||
// labelWHamount
|
||||
//
|
||||
labelWHamount.AutoSize = true;
|
||||
labelWHamount.Location = new Point(34, 97);
|
||||
labelWHamount.Name = "labelWHamount";
|
||||
labelWHamount.Size = new Size(128, 15);
|
||||
labelWHamount.TabIndex = 9;
|
||||
labelWHamount.Text = "Количество на складе";
|
||||
//
|
||||
// labelPrice
|
||||
//
|
||||
labelPrice.AutoSize = true;
|
||||
labelPrice.Location = new Point(34, 61);
|
||||
labelPrice.Name = "labelPrice";
|
||||
labelPrice.Size = new Size(35, 15);
|
||||
labelPrice.TabIndex = 8;
|
||||
labelPrice.Text = "Цена";
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(34, 26);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(59, 15);
|
||||
labelName.TabIndex = 7;
|
||||
labelName.Text = "Название";
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(191, 147);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 14;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(77, 147);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 13;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// FormMaterial
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(360, 198);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(numericUpDownAmount);
|
||||
Controls.Add(numericUpDownPrice);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelWHamount);
|
||||
Controls.Add(labelPrice);
|
||||
Controls.Add(labelName);
|
||||
Name = "FormMaterial";
|
||||
Text = "FormMaterial";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownAmount).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private NumericUpDown numericUpDownAmount;
|
||||
private NumericUpDown numericUpDownPrice;
|
||||
private TextBox textBoxName;
|
||||
private Label labelWHamount;
|
||||
private Label labelPrice;
|
||||
private Label labelName;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
}
|
||||
}
|
83
Workshop/Forms/FormMaterial.cs
Normal file
83
Workshop/Forms/FormMaterial.cs
Normal file
@ -0,0 +1,83 @@
|
||||
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 Workshop.Entities;
|
||||
using Workshop.Entities.Enums;
|
||||
using Workshop.Repositories;
|
||||
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
public partial class FormMaterial : Form
|
||||
{
|
||||
private readonly IMaterialRepository _materialRepository;
|
||||
private int? _materialId;
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var material = _materialRepository.ReadMaterialById(value);
|
||||
if (material == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(material));
|
||||
}
|
||||
textBoxName.Text = material.Name;
|
||||
numericUpDownPrice.Value = (decimal)material.Price;
|
||||
numericUpDownAmount.Value = material.WarehouseAmount;
|
||||
_materialId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormMaterial(IMaterialRepository materialRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_materialRepository = materialRepository ??
|
||||
throw new ArgumentNullException(nameof(materialRepository));
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text))
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
if (_materialId.HasValue)
|
||||
{
|
||||
_materialRepository.UpdateMaterial(CreateMaterial(_materialId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_materialRepository.CreateMaterial(CreateMaterial(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private Material CreateMaterial(int id)
|
||||
{
|
||||
return Material.CreateEntity(id,
|
||||
textBoxName.Text,
|
||||
Convert.ToInt32(numericUpDownAmount.Value),
|
||||
Convert.ToDouble(numericUpDownPrice.Value));
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
}
|
||||
}
|
120
Workshop/Forms/FormMaterial.resx
Normal file
120
Workshop/Forms/FormMaterial.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>
|
126
Workshop/Forms/FormMaterials.Designer.cs
generated
Normal file
126
Workshop/Forms/FormMaterials.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
partial class FormMaterials
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonEdit = new Button();
|
||||
buttonRemove = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewMaterials = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewMaterials).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonEdit);
|
||||
panel.Controls.Add(buttonRemove);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(600, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(200, 450);
|
||||
panel.TabIndex = 0;
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
buttonEdit.BackgroundImage = Properties.Resources.Edit;
|
||||
buttonEdit.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonEdit.Location = new Point(55, 248);
|
||||
buttonEdit.Name = "buttonEdit";
|
||||
buttonEdit.Size = new Size(75, 75);
|
||||
buttonEdit.TabIndex = 2;
|
||||
buttonEdit.UseVisualStyleBackColor = true;
|
||||
buttonEdit.Click += buttonEdit_Click;
|
||||
//
|
||||
// buttonRemove
|
||||
//
|
||||
buttonRemove.BackgroundImage = Properties.Resources.Remove;
|
||||
buttonRemove.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonRemove.Location = new Point(55, 142);
|
||||
buttonRemove.Name = "buttonRemove";
|
||||
buttonRemove.Size = new Size(75, 75);
|
||||
buttonRemove.TabIndex = 1;
|
||||
buttonRemove.UseVisualStyleBackColor = true;
|
||||
buttonRemove.Click += buttonRemove_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(55, 39);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 75);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// dataGridViewMaterials
|
||||
//
|
||||
dataGridViewMaterials.AllowUserToAddRows = false;
|
||||
dataGridViewMaterials.AllowUserToDeleteRows = false;
|
||||
dataGridViewMaterials.AllowUserToResizeColumns = false;
|
||||
dataGridViewMaterials.AllowUserToResizeRows = false;
|
||||
dataGridViewMaterials.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewMaterials.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewMaterials.Dock = DockStyle.Fill;
|
||||
dataGridViewMaterials.Location = new Point(0, 0);
|
||||
dataGridViewMaterials.MultiSelect = false;
|
||||
dataGridViewMaterials.Name = "dataGridViewMaterials";
|
||||
dataGridViewMaterials.ReadOnly = true;
|
||||
dataGridViewMaterials.RowHeadersVisible = false;
|
||||
dataGridViewMaterials.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewMaterials.Size = new Size(600, 450);
|
||||
dataGridViewMaterials.TabIndex = 1;
|
||||
//
|
||||
// FormMaterials
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewMaterials);
|
||||
Controls.Add(panel);
|
||||
Name = "FormMaterials";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Изделия";
|
||||
Load += FormMaterials_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewMaterials).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonEdit;
|
||||
private Button buttonRemove;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewMaterials;
|
||||
}
|
||||
}
|
107
Workshop/Forms/FormMaterials.cs
Normal file
107
Workshop/Forms/FormMaterials.cs
Normal file
@ -0,0 +1,107 @@
|
||||
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 Unity;
|
||||
using Workshop.Entities;
|
||||
using Workshop.Repositories;
|
||||
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
public partial class FormMaterials : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IMaterialRepository _materialRepository;
|
||||
public FormMaterials(IUnityContainer container, IMaterialRepository materialRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_materialRepository = materialRepository ??
|
||||
throw new ArgumentNullException(nameof(materialRepository));
|
||||
}
|
||||
private void FormMaterials_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<FormMaterial>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление",
|
||||
MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
}
|
||||
try
|
||||
{
|
||||
_materialRepository.DeleteMaterial(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormMaterial>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewMaterials.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewMaterials.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
private void LoadList() => dataGridViewMaterials.DataSource = _materialRepository.ReadMaterials();
|
||||
|
||||
}
|
||||
}
|
120
Workshop/Forms/FormMaterials.resx
Normal file
120
Workshop/Forms/FormMaterials.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>
|
220
Workshop/Forms/FormProduct.Designer.cs
generated
Normal file
220
Workshop/Forms/FormProduct.Designer.cs
generated
Normal file
@ -0,0 +1,220 @@
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
partial class FormProduct
|
||||
{
|
||||
/// <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();
|
||||
labelPrice = new Label();
|
||||
labelWHamount = new Label();
|
||||
labelCategory = new Label();
|
||||
textBoxName = new TextBox();
|
||||
numericUpDownPrice = new NumericUpDown();
|
||||
numericUpDownAmount = new NumericUpDown();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
checkedListBoxCategory = new CheckedListBox();
|
||||
groupBoxMaterials = new GroupBox();
|
||||
dataGridViewMaterials = new DataGridView();
|
||||
ColumnMaterial = new DataGridViewComboBoxColumn();
|
||||
ColumnAmount = new DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownAmount).BeginInit();
|
||||
groupBoxMaterials.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewMaterials).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// labelName
|
||||
//
|
||||
labelName.AutoSize = true;
|
||||
labelName.Location = new Point(30, 24);
|
||||
labelName.Name = "labelName";
|
||||
labelName.Size = new Size(59, 15);
|
||||
labelName.TabIndex = 0;
|
||||
labelName.Text = "Название";
|
||||
//
|
||||
// labelPrice
|
||||
//
|
||||
labelPrice.AutoSize = true;
|
||||
labelPrice.Location = new Point(30, 59);
|
||||
labelPrice.Name = "labelPrice";
|
||||
labelPrice.Size = new Size(35, 15);
|
||||
labelPrice.TabIndex = 1;
|
||||
labelPrice.Text = "Цена";
|
||||
//
|
||||
// labelWHamount
|
||||
//
|
||||
labelWHamount.AutoSize = true;
|
||||
labelWHamount.Location = new Point(30, 95);
|
||||
labelWHamount.Name = "labelWHamount";
|
||||
labelWHamount.Size = new Size(128, 15);
|
||||
labelWHamount.TabIndex = 2;
|
||||
labelWHamount.Text = "Количество на складе";
|
||||
//
|
||||
// labelCategory
|
||||
//
|
||||
labelCategory.AutoSize = true;
|
||||
labelCategory.Location = new Point(30, 130);
|
||||
labelCategory.Name = "labelCategory";
|
||||
labelCategory.Size = new Size(63, 15);
|
||||
labelCategory.TabIndex = 3;
|
||||
labelCategory.Text = "Категория";
|
||||
//
|
||||
// textBoxName
|
||||
//
|
||||
textBoxName.Location = new Point(197, 21);
|
||||
textBoxName.Name = "textBoxName";
|
||||
textBoxName.Size = new Size(100, 23);
|
||||
textBoxName.TabIndex = 4;
|
||||
//
|
||||
// numericUpDownPrice
|
||||
//
|
||||
numericUpDownPrice.DecimalPlaces = 2;
|
||||
numericUpDownPrice.Location = new Point(197, 57);
|
||||
numericUpDownPrice.Minimum = new decimal(new int[] { 1, 0, 0, 65536 });
|
||||
numericUpDownPrice.Name = "numericUpDownPrice";
|
||||
numericUpDownPrice.Size = new Size(120, 23);
|
||||
numericUpDownPrice.TabIndex = 5;
|
||||
numericUpDownPrice.Value = new decimal(new int[] { 1, 0, 0, 65536 });
|
||||
//
|
||||
// numericUpDownAmount
|
||||
//
|
||||
numericUpDownAmount.Location = new Point(197, 93);
|
||||
numericUpDownAmount.Name = "numericUpDownAmount";
|
||||
numericUpDownAmount.Size = new Size(120, 23);
|
||||
numericUpDownAmount.TabIndex = 6;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(108, 223);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 8;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(222, 223);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(75, 23);
|
||||
buttonCancel.TabIndex = 9;
|
||||
buttonCancel.Text = "Отмена";
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += buttonCancel_Click;
|
||||
//
|
||||
// checkedListBoxCategory
|
||||
//
|
||||
checkedListBoxCategory.FormattingEnabled = true;
|
||||
checkedListBoxCategory.Location = new Point(197, 122);
|
||||
checkedListBoxCategory.Name = "checkedListBoxCategory";
|
||||
checkedListBoxCategory.Size = new Size(187, 76);
|
||||
checkedListBoxCategory.TabIndex = 10;
|
||||
//
|
||||
// groupBoxMaterials
|
||||
//
|
||||
groupBoxMaterials.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
groupBoxMaterials.Controls.Add(dataGridViewMaterials);
|
||||
groupBoxMaterials.Location = new Point(418, 12);
|
||||
groupBoxMaterials.Name = "groupBoxMaterials";
|
||||
groupBoxMaterials.Size = new Size(408, 233);
|
||||
groupBoxMaterials.TabIndex = 11;
|
||||
groupBoxMaterials.TabStop = false;
|
||||
groupBoxMaterials.Text = "Материалы";
|
||||
//
|
||||
// dataGridViewMaterials
|
||||
//
|
||||
dataGridViewMaterials.AllowUserToResizeColumns = false;
|
||||
dataGridViewMaterials.AllowUserToResizeRows = false;
|
||||
dataGridViewMaterials.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewMaterials.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewMaterials.Columns.AddRange(new DataGridViewColumn[] { ColumnMaterial, ColumnAmount });
|
||||
dataGridViewMaterials.Dock = DockStyle.Fill;
|
||||
dataGridViewMaterials.Location = new Point(3, 19);
|
||||
dataGridViewMaterials.MultiSelect = false;
|
||||
dataGridViewMaterials.Name = "dataGridViewMaterials";
|
||||
dataGridViewMaterials.RowHeadersVisible = false;
|
||||
dataGridViewMaterials.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewMaterials.Size = new Size(402, 211);
|
||||
dataGridViewMaterials.TabIndex = 0;
|
||||
//
|
||||
// ColumnMaterial
|
||||
//
|
||||
ColumnMaterial.HeaderText = "Материал";
|
||||
ColumnMaterial.Name = "ColumnMaterial";
|
||||
//
|
||||
// ColumnAmount
|
||||
//
|
||||
ColumnAmount.HeaderText = "Количество";
|
||||
ColumnAmount.Name = "ColumnAmount";
|
||||
//
|
||||
// FormProduct
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(882, 257);
|
||||
Controls.Add(groupBoxMaterials);
|
||||
Controls.Add(checkedListBoxCategory);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(numericUpDownAmount);
|
||||
Controls.Add(numericUpDownPrice);
|
||||
Controls.Add(textBoxName);
|
||||
Controls.Add(labelCategory);
|
||||
Controls.Add(labelWHamount);
|
||||
Controls.Add(labelPrice);
|
||||
Controls.Add(labelName);
|
||||
Name = "FormProduct";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "FormProduct";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownAmount).EndInit();
|
||||
groupBoxMaterials.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewMaterials).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label labelName;
|
||||
private Label labelPrice;
|
||||
private Label labelWHamount;
|
||||
private Label labelCategory;
|
||||
private TextBox textBoxName;
|
||||
private NumericUpDown numericUpDownPrice;
|
||||
private NumericUpDown numericUpDownAmount;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private CheckedListBox checkedListBoxCategory;
|
||||
private GroupBox groupBoxMaterials;
|
||||
private DataGridView dataGridViewMaterials;
|
||||
private DataGridViewComboBoxColumn ColumnMaterial;
|
||||
private DataGridViewTextBoxColumn ColumnAmount;
|
||||
}
|
||||
}
|
120
Workshop/Forms/FormProduct.cs
Normal file
120
Workshop/Forms/FormProduct.cs
Normal file
@ -0,0 +1,120 @@
|
||||
using Microsoft.VisualBasic.FileIO;
|
||||
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 Workshop.Entities;
|
||||
using Workshop.Entities.Enums;
|
||||
using Workshop.Repositories;
|
||||
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
public partial class FormProduct : Form
|
||||
{
|
||||
private readonly IProductRepository _productRepository;
|
||||
private int? _productId;
|
||||
public int Id
|
||||
{
|
||||
set
|
||||
{
|
||||
try
|
||||
{
|
||||
var product = _productRepository.ReadProductById(value);
|
||||
if (product == null)
|
||||
{
|
||||
throw new InvalidDataException(nameof(product));
|
||||
}
|
||||
foreach (ProductCategory elem in Enum.GetValues(typeof(ProductCategory)))
|
||||
{
|
||||
if ((elem & product.Category) != 0)
|
||||
{
|
||||
checkedListBoxCategory.SetItemChecked(checkedListBoxCategory.Items.IndexOf(elem), true);
|
||||
}
|
||||
}
|
||||
textBoxName.Text = product.Name;
|
||||
numericUpDownPrice.Value = (decimal)product.Price;
|
||||
numericUpDownAmount.Value = product.WarehouseAmount;
|
||||
_productId = value;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
public FormProduct(IProductRepository productRepository, IMaterialRepository materialRepos)
|
||||
{
|
||||
InitializeComponent();
|
||||
_productRepository = productRepository ??
|
||||
throw new ArgumentNullException(nameof(productRepository));
|
||||
foreach (var el in Enum.GetValues(typeof(ProductCategory)))
|
||||
{
|
||||
checkedListBoxCategory.Items.Add(el);
|
||||
}
|
||||
ColumnMaterial.DataSource = materialRepos.ReadMaterials();
|
||||
ColumnMaterial.DisplayMember = "Name";
|
||||
ColumnMaterial.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxName.Text) || checkedListBoxCategory.CheckedItems.Count == 0
|
||||
|| dataGridViewMaterials.RowCount < 2)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
if (_productId.HasValue)
|
||||
{
|
||||
_productRepository.UpdateProduct(CreateProduct(_productId.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
_productRepository.CreateProduct(CreateProduct(0));
|
||||
}
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private Product CreateProduct(int id)
|
||||
{
|
||||
ProductCategory productCategory = ProductCategory.None;
|
||||
foreach (var el in checkedListBoxCategory.CheckedItems)
|
||||
{
|
||||
productCategory |= (ProductCategory)el;
|
||||
}
|
||||
return Product.CreateEntity(id,
|
||||
textBoxName.Text,
|
||||
Convert.ToDouble(numericUpDownPrice.Value),
|
||||
Convert.ToInt32(numericUpDownAmount.Value),
|
||||
productCategory,
|
||||
CreateListFromGridMaterial());
|
||||
}
|
||||
private List<ProductMaterial> CreateListFromGridMaterial()
|
||||
{
|
||||
var list = new List<ProductMaterial>();
|
||||
foreach (DataGridViewRow row in dataGridViewMaterials.Rows)
|
||||
{
|
||||
if (row.Cells["ColumnMaterial"].Value == null || row.Cells["ColumnAmount"].Value == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.Add(ProductMaterial.CreateEntity(0, Convert.ToInt32(row.Cells["ColumnMaterial"].Value),
|
||||
Convert.ToInt32(row.Cells["ColumnAmount"].Value)));
|
||||
}
|
||||
return list;
|
||||
|
||||
}
|
||||
private void buttonCancel_Click(object sender, EventArgs e) => Close();
|
||||
}
|
||||
}
|
126
Workshop/Forms/FormProduct.resx
Normal file
126
Workshop/Forms/FormProduct.resx
Normal file
@ -0,0 +1,126 @@
|
||||
<?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>
|
||||
<metadata name="ColumnMaterial.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnAmount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
144
Workshop/Forms/FormProductCreate.Designer.cs
generated
Normal file
144
Workshop/Forms/FormProductCreate.Designer.cs
generated
Normal file
@ -0,0 +1,144 @@
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
partial class FormProductCreate
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
dateTimePickerDate = new DateTimePicker();
|
||||
comboBoxProduct = new ComboBox();
|
||||
comboBoxMaster = new ComboBox();
|
||||
buttonSave = new Button();
|
||||
buttonDel = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(47, 33);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(53, 15);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "Изделие";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(47, 77);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(48, 15);
|
||||
label2.TabIndex = 1;
|
||||
label2.Text = "Мастер";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(47, 122);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(35, 15);
|
||||
label3.TabIndex = 2;
|
||||
label3.Text = "Дата:";
|
||||
//
|
||||
// dateTimePickerDate
|
||||
//
|
||||
dateTimePickerDate.Enabled = false;
|
||||
dateTimePickerDate.Location = new Point(153, 116);
|
||||
dateTimePickerDate.Name = "dateTimePickerDate";
|
||||
dateTimePickerDate.Size = new Size(121, 23);
|
||||
dateTimePickerDate.TabIndex = 3;
|
||||
//
|
||||
// comboBoxProduct
|
||||
//
|
||||
comboBoxProduct.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxProduct.FormattingEnabled = true;
|
||||
comboBoxProduct.Location = new Point(153, 30);
|
||||
comboBoxProduct.Name = "comboBoxProduct";
|
||||
comboBoxProduct.Size = new Size(121, 23);
|
||||
comboBoxProduct.TabIndex = 4;
|
||||
//
|
||||
// comboBoxMaster
|
||||
//
|
||||
comboBoxMaster.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxMaster.FormattingEnabled = true;
|
||||
comboBoxMaster.Location = new Point(153, 74);
|
||||
comboBoxMaster.Name = "comboBoxMaster";
|
||||
comboBoxMaster.Size = new Size(121, 23);
|
||||
comboBoxMaster.TabIndex = 5;
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(61, 192);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(75, 23);
|
||||
buttonSave.TabIndex = 6;
|
||||
buttonSave.Text = "Сохранить";
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
buttonDel.Location = new Point(177, 192);
|
||||
buttonDel.Name = "buttonDel";
|
||||
buttonDel.Size = new Size(75, 23);
|
||||
buttonDel.TabIndex = 7;
|
||||
buttonDel.Text = "Отмена";
|
||||
buttonDel.UseVisualStyleBackColor = true;
|
||||
buttonDel.Click += buttonDel_Click;
|
||||
//
|
||||
// FormProductCreate
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(315, 259);
|
||||
Controls.Add(buttonDel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(comboBoxMaster);
|
||||
Controls.Add(comboBoxProduct);
|
||||
Controls.Add(dateTimePickerDate);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Name = "FormProductCreate";
|
||||
Text = "FormProductCreate";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private DateTimePicker dateTimePickerDate;
|
||||
private ComboBox comboBoxProduct;
|
||||
private ComboBox comboBoxMaster;
|
||||
private Button buttonSave;
|
||||
private Button buttonDel;
|
||||
}
|
||||
}
|
57
Workshop/Forms/FormProductCreate.cs
Normal file
57
Workshop/Forms/FormProductCreate.cs
Normal file
@ -0,0 +1,57 @@
|
||||
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 Workshop.Entities;
|
||||
using Workshop.Repositories;
|
||||
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
public partial class FormProductCreate : Form
|
||||
{
|
||||
private readonly IProductCreateRepository _createProductRepository;
|
||||
public FormProductCreate(IProductCreateRepository productCreateRepository, IProductRepository productRepository,
|
||||
IMasterRepository masterRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_createProductRepository = productCreateRepository ??
|
||||
throw new ArgumentNullException(nameof(productCreateRepository));
|
||||
comboBoxProduct.DataSource = productRepository.ReadProducts();
|
||||
comboBoxProduct.DisplayMember = "Name";
|
||||
comboBoxProduct.ValueMember = "Id";
|
||||
|
||||
comboBoxMaster.DataSource = masterRepository.ReadMasters();
|
||||
comboBoxMaster.DisplayMember = "Name";
|
||||
comboBoxMaster.ValueMember = "Id";
|
||||
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxProduct.SelectedIndex < 0 || comboBoxMaster.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_createProductRepository.CreateProductCreate(ProductCreate.CreateOperation(
|
||||
0,
|
||||
(int)comboBoxProduct.SelectedValue!,
|
||||
(int)comboBoxMaster.SelectedValue!));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buttonDel_Click(object sender, EventArgs e) => Close();
|
||||
}
|
||||
}
|
120
Workshop/Forms/FormProductCreate.resx
Normal file
120
Workshop/Forms/FormProductCreate.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>
|
112
Workshop/Forms/FormProductCreatings.Designer.cs
generated
Normal file
112
Workshop/Forms/FormProductCreatings.Designer.cs
generated
Normal file
@ -0,0 +1,112 @@
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
partial class FormProductCreatings
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonRemove = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridProductCreatings = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridProductCreatings).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonRemove);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(600, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(200, 450);
|
||||
panel.TabIndex = 0;
|
||||
//
|
||||
// buttonRemove
|
||||
//
|
||||
buttonRemove.BackgroundImage = Properties.Resources.Remove;
|
||||
buttonRemove.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonRemove.Location = new Point(55, 142);
|
||||
buttonRemove.Name = "buttonRemove";
|
||||
buttonRemove.Size = new Size(75, 75);
|
||||
buttonRemove.TabIndex = 1;
|
||||
buttonRemove.UseVisualStyleBackColor = true;
|
||||
buttonRemove.Click += buttonRemove_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(55, 39);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 75);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// dataGridProductCreatings
|
||||
//
|
||||
dataGridProductCreatings.AllowUserToAddRows = false;
|
||||
dataGridProductCreatings.AllowUserToDeleteRows = false;
|
||||
dataGridProductCreatings.AllowUserToResizeColumns = false;
|
||||
dataGridProductCreatings.AllowUserToResizeRows = false;
|
||||
dataGridProductCreatings.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridProductCreatings.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridProductCreatings.Dock = DockStyle.Fill;
|
||||
dataGridProductCreatings.Location = new Point(0, 0);
|
||||
dataGridProductCreatings.MultiSelect = false;
|
||||
dataGridProductCreatings.Name = "dataGridProductCreatings";
|
||||
dataGridProductCreatings.ReadOnly = true;
|
||||
dataGridProductCreatings.RowHeadersVisible = false;
|
||||
dataGridProductCreatings.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridProductCreatings.Size = new Size(600, 450);
|
||||
dataGridProductCreatings.TabIndex = 1;
|
||||
//
|
||||
// FormProductCreatings
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridProductCreatings);
|
||||
Controls.Add(panel);
|
||||
Name = "FormProductCreatings";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Изделия";
|
||||
Load += FormProductCreatings_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridProductCreatings).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonRemove;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridProductCreatings;
|
||||
}
|
||||
}
|
85
Workshop/Forms/FormProductCreatings.cs
Normal file
85
Workshop/Forms/FormProductCreatings.cs
Normal file
@ -0,0 +1,85 @@
|
||||
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 Unity;
|
||||
using Workshop.Repositories;
|
||||
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
public partial class FormProductCreatings : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IProductCreateRepository _productCreateRepository;
|
||||
public FormProductCreatings(IUnityContainer container, IProductCreateRepository productCreateRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_productCreateRepository = productCreateRepository ??
|
||||
throw new ArgumentNullException(nameof(productCreateRepository));
|
||||
}
|
||||
private void FormProductCreatings_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<FormProductCreate>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_productCreateRepository.DeleteProductCreate(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridProductCreatings.DataSource = _productCreateRepository.ReadProductCreates();
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridProductCreatings.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridProductCreatings.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
120
Workshop/Forms/FormProductCreatings.resx
Normal file
120
Workshop/Forms/FormProductCreatings.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>
|
126
Workshop/Forms/FormProducts.Designer.cs
generated
Normal file
126
Workshop/Forms/FormProducts.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
partial class FormProducts
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel = new Panel();
|
||||
buttonEdit = new Button();
|
||||
buttonRemove = new Button();
|
||||
buttonAdd = new Button();
|
||||
dataGridViewProducts = new DataGridView();
|
||||
panel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProducts).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel
|
||||
//
|
||||
panel.Controls.Add(buttonEdit);
|
||||
panel.Controls.Add(buttonRemove);
|
||||
panel.Controls.Add(buttonAdd);
|
||||
panel.Dock = DockStyle.Right;
|
||||
panel.Location = new Point(600, 0);
|
||||
panel.Name = "panel";
|
||||
panel.Size = new Size(200, 450);
|
||||
panel.TabIndex = 0;
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
buttonEdit.BackgroundImage = Properties.Resources.Edit;
|
||||
buttonEdit.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonEdit.Location = new Point(55, 248);
|
||||
buttonEdit.Name = "buttonEdit";
|
||||
buttonEdit.Size = new Size(75, 75);
|
||||
buttonEdit.TabIndex = 2;
|
||||
buttonEdit.UseVisualStyleBackColor = true;
|
||||
buttonEdit.Click += buttonEdit_Click;
|
||||
//
|
||||
// buttonRemove
|
||||
//
|
||||
buttonRemove.BackgroundImage = Properties.Resources.Remove;
|
||||
buttonRemove.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonRemove.Location = new Point(55, 142);
|
||||
buttonRemove.Name = "buttonRemove";
|
||||
buttonRemove.Size = new Size(75, 75);
|
||||
buttonRemove.TabIndex = 1;
|
||||
buttonRemove.UseVisualStyleBackColor = true;
|
||||
buttonRemove.Click += buttonRemove_Click;
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
buttonAdd.BackgroundImage = Properties.Resources.Add;
|
||||
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
buttonAdd.Location = new Point(55, 39);
|
||||
buttonAdd.Name = "buttonAdd";
|
||||
buttonAdd.Size = new Size(75, 75);
|
||||
buttonAdd.TabIndex = 0;
|
||||
buttonAdd.UseVisualStyleBackColor = true;
|
||||
buttonAdd.Click += buttonAdd_Click;
|
||||
//
|
||||
// dataGridViewProducts
|
||||
//
|
||||
dataGridViewProducts.AllowUserToAddRows = false;
|
||||
dataGridViewProducts.AllowUserToDeleteRows = false;
|
||||
dataGridViewProducts.AllowUserToResizeColumns = false;
|
||||
dataGridViewProducts.AllowUserToResizeRows = false;
|
||||
dataGridViewProducts.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewProducts.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewProducts.Dock = DockStyle.Fill;
|
||||
dataGridViewProducts.Location = new Point(0, 0);
|
||||
dataGridViewProducts.MultiSelect = false;
|
||||
dataGridViewProducts.Name = "dataGridViewProducts";
|
||||
dataGridViewProducts.ReadOnly = true;
|
||||
dataGridViewProducts.RowHeadersVisible = false;
|
||||
dataGridViewProducts.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewProducts.Size = new Size(600, 450);
|
||||
dataGridViewProducts.TabIndex = 1;
|
||||
//
|
||||
// FormProducts
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(dataGridViewProducts);
|
||||
Controls.Add(panel);
|
||||
Name = "FormProducts";
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
Text = "Изделия";
|
||||
Load += FormProducts_Load;
|
||||
panel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProducts).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel;
|
||||
private Button buttonEdit;
|
||||
private Button buttonRemove;
|
||||
private Button buttonAdd;
|
||||
private DataGridView dataGridViewProducts;
|
||||
}
|
||||
}
|
105
Workshop/Forms/FormProducts.cs
Normal file
105
Workshop/Forms/FormProducts.cs
Normal file
@ -0,0 +1,105 @@
|
||||
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 Unity;
|
||||
using Workshop.Repositories;
|
||||
|
||||
namespace Workshop.Forms
|
||||
{
|
||||
public partial class FormProducts : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IProductRepository _productRepository;
|
||||
public FormProducts(IUnityContainer container, IProductRepository productRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ??
|
||||
throw new ArgumentNullException(nameof(container));
|
||||
_productRepository = productRepository ??
|
||||
throw new ArgumentNullException(nameof(productRepository));
|
||||
}
|
||||
private void FormProducts_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<FormProduct>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MessageBox.Show("Удалить запись?", "Удаление",
|
||||
MessageBoxButtons.YesNo) != DialogResult.Yes)
|
||||
{
|
||||
}
|
||||
try
|
||||
{
|
||||
_productRepository.DeleteProduct(findId);
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!TryGetIdentifierFromSelectedRow(out var findId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var form = _container.Resolve<FormProduct>();
|
||||
form.Id = findId;
|
||||
form.ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
if (dataGridViewProducts.SelectedRows.Count < 1)
|
||||
{
|
||||
MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return false;
|
||||
}
|
||||
id = Convert.ToInt32(dataGridViewProducts.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
private void LoadList() => dataGridViewProducts.DataSource = _productRepository.ReadProducts();
|
||||
}
|
||||
}
|
120
Workshop/Forms/FormProducts.resx
Normal file
120
Workshop/Forms/FormProducts.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>
|
31
Workshop/Program.cs
Normal file
31
Workshop/Program.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using Unity;
|
||||
using Unity.Lifetime;
|
||||
using Workshop.Repositories;
|
||||
using Workshop.Repositories.Implementations;
|
||||
namespace Workshop
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(CreateContainer().Resolve<FormWorkshop>());
|
||||
}
|
||||
private static IUnityContainer CreateContainer()
|
||||
{
|
||||
var container = new UnityContainer();
|
||||
container.RegisterType<IChequeRepository, ChequeRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IMasterRepository, MasterRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IProductCreateRepository, ProductCreateRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IProductRepository, ProductRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IMaterialRepository, MaterialRepository>(new TransientLifetimeManager());
|
||||
return container;
|
||||
}
|
||||
}
|
||||
}
|
103
Workshop/Properties/Resources.Designer.cs
generated
Normal file
103
Workshop/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Workshop.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Workshop.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Add {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Add", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Edit {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Edit", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Remove {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Remove", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap st4_1 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("st4-1", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
Workshop/Properties/Resources.resx
Normal file
133
Workshop/Properties/Resources.resx
Normal file
@ -0,0 +1,133 @@
|
||||
<?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>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="st4-1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\st4-1.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Add" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Edit" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Edit.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Remove" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Remove1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
15
Workshop/Repositories/IChequeRepository.cs
Normal file
15
Workshop/Repositories/IChequeRepository.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Workshop.Entities;
|
||||
|
||||
namespace Workshop.Repositories;
|
||||
|
||||
public interface IChequeRepository
|
||||
{
|
||||
IEnumerable<Cheque> ReadCheques(DateTime? dateFrom = null, DateTime? dateTo = null, int? chequeId = null);
|
||||
void CreateCheque(Cheque cheque);
|
||||
void DeleteCheque(int id);
|
||||
}
|
17
Workshop/Repositories/IMasterRepository.cs
Normal file
17
Workshop/Repositories/IMasterRepository.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Workshop.Entities;
|
||||
|
||||
namespace Workshop.Repositories;
|
||||
|
||||
public interface IMasterRepository
|
||||
{
|
||||
IEnumerable<Master> ReadMasters();
|
||||
Master ReadMasterById(int id);
|
||||
void CreateMaster(Master Master);
|
||||
void UpdateMaster(Master Master);
|
||||
void DeleteMaster(int id);
|
||||
}
|
17
Workshop/Repositories/IMaterialRepository.cs
Normal file
17
Workshop/Repositories/IMaterialRepository.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Workshop.Entities;
|
||||
|
||||
namespace Workshop.Repositories;
|
||||
|
||||
public interface IMaterialRepository
|
||||
{
|
||||
IEnumerable<Material> ReadMaterials();
|
||||
Material ReadMaterialById(int id);
|
||||
void CreateMaterial(Material Material);
|
||||
void UpdateMaterial(Material Material);
|
||||
void DeleteMaterial(int id);
|
||||
}
|
15
Workshop/Repositories/IProductCreateRepository.cs
Normal file
15
Workshop/Repositories/IProductCreateRepository.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Workshop.Entities;
|
||||
|
||||
namespace Workshop.Repositories;
|
||||
|
||||
public interface IProductCreateRepository
|
||||
{
|
||||
IEnumerable<ProductCreate> ReadProductCreates(DateTime? dateFrom = null, DateTime? dateTo = null, int? productId = null, int? masterId = null);
|
||||
void CreateProductCreate(ProductCreate productCreate);
|
||||
void DeleteProductCreate(int id);
|
||||
}
|
17
Workshop/Repositories/IProductRepository.cs
Normal file
17
Workshop/Repositories/IProductRepository.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Repositories;
|
||||
|
||||
public interface IProductRepository
|
||||
{
|
||||
IEnumerable<Product> ReadProducts();
|
||||
Product ReadProductById(int id);
|
||||
void CreateProduct(Product product);
|
||||
void UpdateProduct(Product product);
|
||||
void DeleteProduct(int id);
|
||||
|
||||
}
|
25
Workshop/Repositories/Implementations/ChequeRepository.cs
Normal file
25
Workshop/Repositories/Implementations/ChequeRepository.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Workshop.Entities;
|
||||
using Workshop.Repositories;
|
||||
|
||||
namespace Workshop.Repositories.Implementations;
|
||||
|
||||
internal class ChequeRepository : IChequeRepository
|
||||
{
|
||||
public void CreateCheque(Cheque cheque)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteCheque(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<Cheque> ReadCheques(DateTime? dateFrom = null, DateTime? dateTo = null, int? chequeId = null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
34
Workshop/Repositories/Implementations/MasterRepository.cs
Normal file
34
Workshop/Repositories/Implementations/MasterRepository.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Workshop.Entities;
|
||||
using Workshop.Repositories;
|
||||
|
||||
namespace Workshop.Repositories.Implementations;
|
||||
|
||||
internal class MasterRepository : IMasterRepository
|
||||
{
|
||||
public void CreateMaster(Master Master)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteMaster(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Master ReadMasterById(int id)
|
||||
{
|
||||
return Master.CreateEntity(0, string.Empty, string.Empty, 0, Entities.Enums.MasterPosition.None);
|
||||
}
|
||||
|
||||
public IEnumerable<Master> ReadMasters()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateMaster(Master Master)
|
||||
{
|
||||
}
|
||||
}
|
34
Workshop/Repositories/Implementations/MaterialRepository.cs
Normal file
34
Workshop/Repositories/Implementations/MaterialRepository.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Workshop.Entities;
|
||||
using Workshop.Repositories;
|
||||
|
||||
namespace Workshop.Repositories.Implementations;
|
||||
|
||||
internal class MaterialRepository : IMaterialRepository
|
||||
{
|
||||
public void CreateMaterial(Material Material)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteMaterial(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Material ReadMaterialById(int id)
|
||||
{
|
||||
return Material.CreateEntity(0, string.Empty, 0, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Material> ReadMaterials()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateMaterial(Material Material)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Workshop.Entities;
|
||||
using Workshop.Repositories;
|
||||
|
||||
namespace Workshop.Repositories.Implementations;
|
||||
|
||||
internal class ProductCreateRepository : IProductCreateRepository
|
||||
{
|
||||
public void CreateProductCreate(ProductCreate productCreate)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteProductCreate(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<ProductCreate> ReadProductCreates(DateTime? dateFrom = null, DateTime? dateTo = null, int? productId = null, int? masterId = null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
33
Workshop/Repositories/Implementations/ProductRepository.cs
Normal file
33
Workshop/Repositories/Implementations/ProductRepository.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Workshop.Repositories;
|
||||
|
||||
namespace Workshop.Repositories.Implementations;
|
||||
|
||||
internal class ProductRepository : IProductRepository
|
||||
{
|
||||
public void CreateProduct(Product product)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteProduct(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Product ReadProductById(int id)
|
||||
{
|
||||
return Product.CreateEntity(0, string.Empty, 0, 0, Entities.Enums.ProductCategory.None, []);
|
||||
}
|
||||
|
||||
public IEnumerable<Product> ReadProducts()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateProduct(Product product)
|
||||
{
|
||||
}
|
||||
}
|
BIN
Workshop/Resources/Add.png
Normal file
BIN
Workshop/Resources/Add.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
Workshop/Resources/Edit.jpg
Normal file
BIN
Workshop/Resources/Edit.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
BIN
Workshop/Resources/Remove.png
Normal file
BIN
Workshop/Resources/Remove.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
BIN
Workshop/Resources/Remove1.png
Normal file
BIN
Workshop/Resources/Remove1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
BIN
Workshop/Resources/st4-1.jpg
Normal file
BIN
Workshop/Resources/st4-1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 333 KiB |
30
Workshop/Workshop.csproj
Normal file
30
Workshop/Workshop.csproj
Normal file
@ -0,0 +1,30 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
25
Workshop/Workshop.sln
Normal file
25
Workshop/Workshop.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.11.35327.3
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Workshop", "Workshop.csproj", "{52C743B8-8D2C-46A2-A657-F84992C58400}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{52C743B8-8D2C-46A2-A657-F84992C58400}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{52C743B8-8D2C-46A2-A657-F84992C58400}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{52C743B8-8D2C-46A2-A657-F84992C58400}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{52C743B8-8D2C-46A2-A657-F84992C58400}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {1F4B0F8C-0C4F-48A3-B32A-BC9187E66866}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Loading…
Reference in New Issue
Block a user