Лабораторная работа №1

This commit is contained in:
Glliza 2024-11-28 19:51:58 +04:00
parent f967572121
commit 4546884a33
56 changed files with 4264 additions and 14 deletions

View File

@ -13,7 +13,7 @@ public class Employee
public int NumberStorage { get; private set; } public int NumberStorage { get; private set; }
public int StorageSize { get; private set; } public int StorageSize { get; private set; }
public Employee CreateEntity(int id, int numberStorage, int storageSize) public static Employee CreateEntity(int id, int numberStorage, int storageSize)
{ {
return new Employee return new Employee
{ {

View File

@ -12,16 +12,13 @@ public class Product
{ {
public int Id { get; private set; } public int Id { get; private set; }
public int StorageProductId { get; private set; } public int StorageProductId { get; private set; }
public string NameOfShoes { get; private set; } public string NameOfShoes { get; private set; }
public ManufacturingCompany ManufacturingCompany { get; private set; } public ManufacturingCompany ManufacturingCompany { get; private set; }
public int Price { get; private set; } public int Price { get; private set; }
public ProductType ProductType { get; private set; } public ProductType ProductType { get; private set; }
public int StorageSize { get; private set; } public int StorageSize { get; private set; }
public Product CreateEntity(int id, int storageProductId, string nameOfShoes, ManufacturingCompany manufacturingCompany, int price, public static Product CreateEntity(int id, int storageProductId, string nameOfShoes, ManufacturingCompany manufacturingCompany, int price,
ProductType productType, int storageSize) ProductType productType, int storageSize)
{ {
return new Product return new Product

View File

@ -12,7 +12,7 @@ public class ProductSale
public int SaleId { get; private set; } public int SaleId { get; private set; }
public int Amount { get; private set; } public int Amount { get; private set; }
public ProductSale CreateEntities(int productId, int saleId, int amount) public static ProductSale CreateEntities(int productId, int saleId, int amount)
{ {
return new ProductSale { return new ProductSale {
ProductId = productId, ProductId = productId,

View File

@ -9,17 +9,19 @@ namespace ShoeStore.Entities;
public class Receipt public class Receipt
{ {
public int Id { get; private set; } public int Id { get; private set; }
public int ProductId { get; private set; }
public int StorageProductId { get; private set; } public int StorageProductId { get; private set; }
public int ReceiptNumber {get; private set; } public int ReceiptNumber {get; private set; }
public DateTime DateOfReceipt { get; private set; } public DateTime DateOfReceipt { get; private set; }
public int NumberOfPairsReceived { get; private set; } public int NumberOfPairsReceived { get; private set; }
public int StorageSize { get; private set; } public int StorageSize { get; private set; }
public Receipt CreateOperation(int id, int storageProductId, int receiptNumber, int numberOfPairsReceived, int storageSize) public static Receipt CreateOperation(int id, int productId, int storageProductId, int receiptNumber, int numberOfPairsReceived, int storageSize)
{ {
return new Receipt return new Receipt
{ {
Id = id, Id = id,
ProductId = productId,
StorageProductId = storageProductId, StorageProductId = storageProductId,
ReceiptNumber = receiptNumber, ReceiptNumber = receiptNumber,
DateOfReceipt = DateTime.Now, DateOfReceipt = DateTime.Now,

View File

@ -20,7 +20,7 @@ public class Sale
private set; private set;
} = []; } = [];
public Sale CreateOperation (int id, int productId, int storageProductId, int salesNumber, int storageSize) public static Sale CreateOperation (int id, int productId, int storageProductId, int salesNumber, int storageSize)
{ {
return new Sale return new Sale
{ {

View File

@ -11,7 +11,7 @@ public class Storage
public int Size { get; private set; } public int Size { get; private set; }
public int QuantityInStock { get; private set; } public int QuantityInStock { get; private set; }
public int NumberStorage { get; private set; } public int NumberStorage { get; private set; }
public Storage CreateEntity(int size, int quantityInStock, int numberStorage) public static Storage CreateEntity(int size, int quantityInStock, int numberStorage)
{ {
return new Storage return new Storage
{ {

143
ShoeStore/Forms/FormEmployee.Designer.cs generated Normal file
View File

@ -0,0 +1,143 @@
namespace ShoeStore.Froms
{
partial class FormEmployee
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
dateTimePickerDate = new DateTimePicker();
label1 = new Label();
label2 = new Label();
label3 = new Label();
numericUpDownNumStorage = new NumericUpDown();
numericUpDownStorageSize = new NumericUpDown();
buttonSave = new Button();
buttonCancel = new Button();
((System.ComponentModel.ISupportInitialize)numericUpDownNumStorage).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownStorageSize).BeginInit();
SuspendLayout();
//
// dateTimePickerDate
//
dateTimePickerDate.Location = new Point(179, 41);
dateTimePickerDate.Name = "dateTimePickerDate";
dateTimePickerDate.Size = new Size(132, 23);
dateTimePickerDate.TabIndex = 0;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(40, 47);
label1.Name = "label1";
label1.Size = new Size(35, 15);
label1.TabIndex = 1;
label1.Text = "Дата:";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(40, 115);
label2.Name = "label2";
label2.Size = new Size(88, 15);
label2.TabIndex = 2;
label2.Text = "Номер склада:";
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(40, 178);
label3.Name = "label3";
label3.Size = new Size(106, 15);
label3.TabIndex = 3;
label3.Text = "Размер на складе:";
//
// numericUpDownNumStorage
//
numericUpDownNumStorage.Location = new Point(179, 107);
numericUpDownNumStorage.Name = "numericUpDownNumStorage";
numericUpDownNumStorage.Size = new Size(132, 23);
numericUpDownNumStorage.TabIndex = 4;
//
// numericUpDownStorageSize
//
numericUpDownStorageSize.Location = new Point(179, 176);
numericUpDownStorageSize.Name = "numericUpDownStorageSize";
numericUpDownStorageSize.Size = new Size(132, 23);
numericUpDownStorageSize.TabIndex = 5;
//
// buttonSave
//
buttonSave.Location = new Point(40, 251);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(106, 23);
buttonSave.TabIndex = 6;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click_1;
//
// buttonCancel
//
buttonCancel.Location = new Point(205, 251);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(106, 23);
buttonCancel.TabIndex = 7;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click_1;
//
// FormEmployee
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(352, 316);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(numericUpDownStorageSize);
Controls.Add(numericUpDownNumStorage);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(dateTimePickerDate);
Name = "FormEmployee";
Text = "Сотрудник";
((System.ComponentModel.ISupportInitialize)numericUpDownNumStorage).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDownStorageSize).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private DateTimePicker dateTimePickerDate;
private Label label1;
private Label label2;
private Label label3;
private NumericUpDown numericUpDownNumStorage;
private NumericUpDown numericUpDownStorageSize;
private Button buttonSave;
private Button buttonCancel;
}
}

View File

@ -0,0 +1,73 @@
using ShoeStore.Entities;
using ShoeStore.Repositories;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ShoeStore.Froms;
public partial class FormEmployee : Form
{
private readonly IEmployeeRepository _employeeRepository;
private int? _employeeId;
public int Id
{
set
{
try
{
var employee = _employeeRepository.ReadEmployeeById(value);
if (employee == null)
{
throw new InvalidDataException(nameof(employee));
}
numericUpDownNumStorage.Value = employee.NumberStorage;
numericUpDownStorageSize.Value = (decimal)employee.StorageSize;
_employeeId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormEmployee()
{
InitializeComponent();
}
private void ButtonSave_Click_1(object sender, EventArgs e)
{
try
{
if (_employeeId.HasValue)
{
_employeeRepository.UpdateEmployee(CreateEmployee(_employeeId.Value));
}
else
{
_employeeRepository.CreateEmployee(CreateEmployee(0));
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click_1(object sender, EventArgs e) => Close();
private Employee CreateEmployee(int id) => Employee.CreateEntity(id, Convert.ToInt32(numericUpDownNumStorage.Value),
Convert.ToInt32(numericUpDownStorageSize.Value));
}

View 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>

121
ShoeStore/Forms/FormEmployees.Designer.cs generated Normal file
View File

@ -0,0 +1,121 @@
namespace ShoeStore.Froms
{
partial class FormEmployees
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
dataGridViewData = new DataGridView();
panel1 = new Panel();
buttonDel = new Button();
buttonUpd = new Button();
buttonAdd = new Button();
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
panel1.SuspendLayout();
SuspendLayout();
//
// dataGridViewData
//
dataGridViewData.AllowUserToAddRows = false;
dataGridViewData.AllowUserToDeleteRows = false;
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewData.Dock = DockStyle.Fill;
dataGridViewData.Location = new Point(0, 0);
dataGridViewData.Name = "dataGridViewData";
dataGridViewData.ReadOnly = true;
dataGridViewData.Size = new Size(800, 450);
dataGridViewData.TabIndex = 0;
//
// panel1
//
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(676, 0);
panel1.Name = "panel1";
panel1.Size = new Size(124, 450);
panel1.TabIndex = 1;
//
// buttonDel
//
buttonDel.BackColor = SystemColors.ControlLightLight;
buttonDel.BackgroundImage = Properties.Resources.минус;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(14, 233);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(98, 86);
buttonDel.TabIndex = 2;
buttonDel.UseVisualStyleBackColor = false;
buttonDel.Click += ButtonDel_Click;
//
// buttonUpd
//
buttonUpd.BackColor = SystemColors.ControlLightLight;
buttonUpd.BackgroundImage = Properties.Resources.карандащ;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(14, 132);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(98, 86);
buttonUpd.TabIndex = 1;
buttonUpd.UseVisualStyleBackColor = false;
buttonUpd.Click += ButtonUpd_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.плюс;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(14, 31);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(98, 86);
buttonAdd.TabIndex = 0;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// FormEmployees
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(panel1);
Controls.Add(dataGridViewData);
Name = "FormEmployees";
Text = "FormEmployees";
Load += FormEmployees_Load;
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridViewData;
private Panel panel1;
private Button buttonAdd;
private Button buttonDel;
private Button buttonUpd;
}
}

View File

@ -0,0 +1,103 @@
using ShoeStore.Repositories;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Unity;
namespace ShoeStore.Froms;
public partial class FormEmployees : Form
{
private readonly IUnityContainer _container;
private readonly IEmployeeRepository _employeeRepository;
public FormEmployees(IUnityContainer container, IEmployeeRepository employeeRepository)
{
InitializeComponent();
_container = container;
_employeeRepository = employeeRepository;
}
private void FormEmployees_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormEmployee>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormEmployee>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_employeeRepository.DeleteEmployee(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewData.DataSource = _employeeRepository.ReadEmployees();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridViewData.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
return true;
}
}

View 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>

235
ShoeStore/Forms/FormProduct.Designer.cs generated Normal file
View File

@ -0,0 +1,235 @@
namespace ShoeStore.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()
{
label1 = new Label();
comboBoxProduct = new ComboBox();
comboBoxStorageProductId = new ComboBox();
label5 = new Label();
numericUpDownPrice = new NumericUpDown();
label2 = new Label();
label3 = new Label();
label4 = new Label();
comboBoxType = new ComboBox();
label6 = new Label();
label7 = new Label();
buttonCancel = new Button();
buttonSave = new Button();
checkedListBoxManufactoringCompany = new CheckedListBox();
textBoxNameShoe = new TextBox();
numericUpDownStorage = new NumericUpDown();
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownStorage).BeginInit();
SuspendLayout();
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(24, 38);
label1.Name = "label1";
label1.Size = new Size(76, 15);
label1.TabIndex = 10;
label1.Text = "ID Продукта:";
//
// comboBoxProduct
//
comboBoxProduct.FormattingEnabled = true;
comboBoxProduct.Location = new Point(244, 38);
comboBoxProduct.Name = "comboBoxProduct";
comboBoxProduct.Size = new Size(121, 23);
comboBoxProduct.TabIndex = 9;
//
// comboBoxStorageProductId
//
comboBoxStorageProductId.FormattingEnabled = true;
comboBoxStorageProductId.Location = new Point(244, 84);
comboBoxStorageProductId.Name = "comboBoxStorageProductId";
comboBoxStorageProductId.Size = new Size(121, 23);
comboBoxStorageProductId.TabIndex = 16;
//
// label5
//
label5.AutoSize = true;
label5.Location = new Point(24, 84);
label5.Name = "label5";
label5.Size = new Size(132, 15);
label5.TabIndex = 15;
label5.Text = "ID Продуктa на складе:";
//
// numericUpDownPrice
//
numericUpDownPrice.Location = new Point(241, 297);
numericUpDownPrice.Name = "numericUpDownPrice";
numericUpDownPrice.Size = new Size(120, 23);
numericUpDownPrice.TabIndex = 18;
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(24, 132);
label2.Name = "label2";
label2.Size = new Size(98, 15);
label2.TabIndex = 20;
label2.Text = "Название обуви:";
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(24, 182);
label3.Name = "label3";
label3.Size = new Size(154, 15);
label3.TabIndex = 21;
label3.Text = "Компания-производитель:";
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(20, 297);
label4.Name = "label4";
label4.Size = new Size(38, 15);
label4.TabIndex = 22;
label4.Text = "Цена:";
//
// comboBoxType
//
comboBoxType.FormattingEnabled = true;
comboBoxType.Location = new Point(240, 347);
comboBoxType.Name = "comboBox1";
comboBoxType.Size = new Size(121, 23);
comboBoxType.TabIndex = 23;
//
// label6
//
label6.AutoSize = true;
label6.Location = new Point(20, 355);
label6.Name = "label6";
label6.Size = new Size(83, 15);
label6.TabIndex = 25;
label6.Text = "Тип продукта:";
//
// label7
//
label7.AutoSize = true;
label7.Location = new Point(20, 403);
label7.Name = "label7";
label7.Size = new Size(106, 15);
label7.TabIndex = 26;
label7.Text = "Размер на складе:";
//
// buttonCancel
//
buttonCancel.Location = new Point(245, 464);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(102, 23);
buttonCancel.TabIndex = 28;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// buttonSave
//
buttonSave.Location = new Point(45, 464);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(100, 23);
buttonSave.TabIndex = 27;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// checkedListBoxManufactoringCompany
//
checkedListBoxManufactoringCompany.FormattingEnabled = true;
checkedListBoxManufactoringCompany.Location = new Point(240, 182);
checkedListBoxManufactoringCompany.Name = "checkedListBoxManufactoringCompany";
checkedListBoxManufactoringCompany.Size = new Size(120, 94);
checkedListBoxManufactoringCompany.TabIndex = 29;
//
// textBoxNameShoe
//
textBoxNameShoe.Location = new Point(128, 132);
textBoxNameShoe.Name = "textBoxNameShoe";
textBoxNameShoe.Size = new Size(237, 23);
textBoxNameShoe.TabIndex = 31;
//
// numericUpDownStorage
//
numericUpDownStorage.Location = new Point(240, 401);
numericUpDownStorage.Name = "numericUpDownStorage";
numericUpDownStorage.Size = new Size(120, 23);
numericUpDownStorage.TabIndex = 32;
//
// FormProduct
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(403, 545);
Controls.Add(numericUpDownStorage);
Controls.Add(textBoxNameShoe);
Controls.Add(checkedListBoxManufactoringCompany);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(label7);
Controls.Add(label6);
Controls.Add(comboBoxType);
Controls.Add(label4);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(numericUpDownPrice);
Controls.Add(comboBoxStorageProductId);
Controls.Add(label5);
Controls.Add(label1);
Controls.Add(comboBoxProduct);
Name = "FormProduct";
Text = "FormProduct";
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDownStorage).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label label1;
private ComboBox comboBoxProduct;
private ComboBox comboBoxStorageProductId;
private Label label5;
private NumericUpDown numericUpDownPrice;
private Label label2;
private Label label3;
private Label label4;
private ComboBox comboBoxType;
private Label label6;
private Label label7;
private Button buttonCancel;
private Button buttonSave;
private CheckedListBox checkedListBoxManufactoringCompany;
private TextBox textBoxNameShoe;
private NumericUpDown numericUpDownStorage;
}
}

View File

@ -0,0 +1,104 @@
using Microsoft.VisualBasic.FileIO;
using ShoeStore.Entities;
using ShoeStore.Entities.Enums;
using ShoeStore.Repositories;
using ShoeStore.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics.Eventing.Reader;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace ShoeStore.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 (ManufacturingCompany company in Enum.GetValues(typeof(ManufacturingCompany)))
{
if ((company & product.ManufacturingCompany) != 0)
{
checkedListBoxManufactoringCompany.SetItemChecked(
checkedListBoxManufactoringCompany.Items.IndexOf(company), true);
}
}
textBoxNameShoe.Text = product.NameOfShoes;
numericUpDownPrice.Value = product.Price;
comboBoxStorageProductId.SelectedItem = product.StorageProductId;
comboBoxType.SelectedItem = product.ProductType;
numericUpDownStorage.Value = product.StorageSize;
_productId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormProduct(IProductRepository productRepository)
{
InitializeComponent();
_productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
comboBoxType.DataSource = Enum.GetValues(typeof(ProductType));
foreach (var elem in Enum.GetValues(typeof(ManufacturingCompany)))
{
checkedListBoxManufactoringCompany.Items.Add(elem);
}
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if (comboBoxProduct.SelectedIndex < 0 || comboBoxStorageProductId.SelectedIndex < 0 || checkedListBoxManufactoringCompany.CheckedItems.Count == 0)
{
throw new Exception("Имеются незаполненные поля");
}
_productRepository.CreateProduct(CreateProduct(0));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e) => Close();
Product CreateProduct(int id)
{
ManufacturingCompany manufacturingCompany = ManufacturingCompany.None;
foreach (var elem in checkedListBoxManufactoringCompany.CheckedItems)
{
manufacturingCompany |= (ManufacturingCompany)elem;
}
return Product.CreateEntity(id, (int)comboBoxStorageProductId.SelectedValue!,
textBoxNameShoe.Text, manufacturingCompany, Convert.ToInt32(numericUpDownPrice.Value), (ProductType)comboBoxType.SelectedItem!, (int)numericUpDownStorage.Value!);
}
}
}

View 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>

117
ShoeStore/Forms/FormProducts.Designer.cs generated Normal file
View File

@ -0,0 +1,117 @@
namespace ShoeStore.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()
{
dataGridViewProduct = new DataGridView();
panel1 = new Panel();
buttonDel = new Button();
buttonUpd = new Button();
buttonAdd = new Button();
((System.ComponentModel.ISupportInitialize)dataGridViewProduct).BeginInit();
panel1.SuspendLayout();
SuspendLayout();
//
// dataGridViewProduct
//
dataGridViewProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewProduct.Dock = DockStyle.Fill;
dataGridViewProduct.Location = new Point(0, 0);
dataGridViewProduct.Name = "dataGridViewProduct";
dataGridViewProduct.Size = new Size(787, 450);
dataGridViewProduct.TabIndex = 0;
//
// panel1
//
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(611, 0);
panel1.Name = "panel1";
panel1.Size = new Size(176, 450);
panel1.TabIndex = 1;
//
// buttonDel
//
buttonDel.BackColor = SystemColors.ControlLightLight;
buttonDel.BackgroundImage = Properties.Resources.минус;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(42, 251);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(98, 86);
buttonDel.TabIndex = 5;
buttonDel.UseVisualStyleBackColor = false;
buttonDel.Click += buttonDel_Click;
//
// buttonUpd
//
buttonUpd.BackColor = SystemColors.ControlLightLight;
buttonUpd.BackgroundImage = Properties.Resources.карандащ;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(42, 150);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(98, 86);
buttonUpd.TabIndex = 4;
buttonUpd.UseVisualStyleBackColor = false;
buttonUpd.Click += buttonUpd_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.плюс1;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(42, 49);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(98, 86);
buttonAdd.TabIndex = 3;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += buttonAdd_Click;
//
// FormProducts
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(787, 450);
Controls.Add(panel1);
Controls.Add(dataGridViewProduct);
Name = "FormProducts";
Text = "FormProducts";
((System.ComponentModel.ISupportInitialize)dataGridViewProduct).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridViewProduct;
private Panel panel1;
private Button buttonDel;
private Button buttonUpd;
private Button buttonAdd;
}
}

View File

@ -0,0 +1,110 @@
using ShoeStore.Froms;
using ShoeStore.Repositories;
using ShoeStore.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using Unity;
namespace ShoeStore.Forms
{
public partial class FormProducts : Form
{
private readonly IUnityContainer _container;
private readonly IProductRepository _productRepository;
public FormProducts(IUnityContainer container, IProductRepository productRepository)
{
InitializeComponent();
_container = container;
_productRepository = productRepository;
}
private void FormEmployees_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormProduct>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonUpd_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormProduct>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_productRepository.DeleteProduct(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewProduct.DataSource = _productRepository.ReadProducts();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridViewProduct.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridViewProduct.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View 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>

191
ShoeStore/Forms/FormReceipt.Designer.cs generated Normal file
View File

@ -0,0 +1,191 @@
namespace ShoeStore.Froms
{
partial class FormReceipt
{
/// <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()
{
comboBoxProduct = new ComboBox();
label1 = new Label();
label2 = new Label();
label3 = new Label();
label4 = new Label();
numericUpDownStorageNumber = new NumericUpDown();
label5 = new Label();
comboBoxStorageProductId = new ComboBox();
numericUpDownStorageSize = new NumericUpDown();
numericUpDownNumOfPairs = new NumericUpDown();
buttonCancel = new Button();
buttonSave = new Button();
((System.ComponentModel.ISupportInitialize)numericUpDownStorageNumber).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownStorageSize).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownNumOfPairs).BeginInit();
SuspendLayout();
//
// comboBoxProduct
//
comboBoxProduct.FormattingEnabled = true;
comboBoxProduct.Location = new Point(232, 33);
comboBoxProduct.Name = "comboBoxProduct";
comboBoxProduct.Size = new Size(121, 23);
comboBoxProduct.TabIndex = 7;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(12, 36);
label1.Name = "label1";
label1.Size = new Size(56, 15);
label1.TabIndex = 8;
label1.Text = "Продукт:";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(12, 135);
label2.Name = "label2";
label2.Size = new Size(122, 15);
label2.TabIndex = 9;
label2.Text = "Номер поступления:";
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(12, 182);
label3.Name = "label3";
label3.Size = new Size(169, 15);
label3.TabIndex = 10;
label3.Text = "Колиество поступивших пар:";
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(12, 237);
label4.Name = "label4";
label4.Size = new Size(106, 15);
label4.TabIndex = 11;
label4.Text = "Размер на складе:";
//
// numericUpDownStorageNumber
//
numericUpDownStorageNumber.Location = new Point(232, 135);
numericUpDownStorageNumber.Name = "numericUpDownStorageNumber";
numericUpDownStorageNumber.Size = new Size(120, 23);
numericUpDownStorageNumber.TabIndex = 12;
//
// label5
//
label5.AutoSize = true;
label5.Location = new Point(12, 80);
label5.Name = "label5";
label5.Size = new Size(112, 15);
label5.TabIndex = 13;
label5.Text = "Продукт на складе:";
//
// comboBoxStorageProductId
//
comboBoxStorageProductId.FormattingEnabled = true;
comboBoxStorageProductId.Location = new Point(232, 80);
comboBoxStorageProductId.Name = "comboBoxStorageProductId";
comboBoxStorageProductId.Size = new Size(121, 23);
comboBoxStorageProductId.TabIndex = 14;
//
// numericUpDownStorageSize
//
numericUpDownStorageSize.Location = new Point(232, 237);
numericUpDownStorageSize.Name = "numericUpDownStorageSize";
numericUpDownStorageSize.Size = new Size(120, 23);
numericUpDownStorageSize.TabIndex = 15;
//
// numericUpDownNumOfPairs
//
numericUpDownNumOfPairs.Location = new Point(232, 182);
numericUpDownNumOfPairs.Name = "numericUpDownNumOfPairs";
numericUpDownNumOfPairs.Size = new Size(120, 23);
numericUpDownNumOfPairs.TabIndex = 16;
//
// buttonCancel
//
buttonCancel.Location = new Point(244, 301);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(102, 23);
buttonCancel.TabIndex = 18;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// buttonSave
//
buttonSave.Location = new Point(44, 301);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(100, 23);
buttonSave.TabIndex = 17;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// FormReceipt
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(398, 525);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(numericUpDownNumOfPairs);
Controls.Add(numericUpDownStorageSize);
Controls.Add(comboBoxStorageProductId);
Controls.Add(label5);
Controls.Add(numericUpDownStorageNumber);
Controls.Add(label4);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(comboBoxProduct);
Name = "FormReceipt";
Text = "FormReceipt";
((System.ComponentModel.ISupportInitialize)numericUpDownStorageNumber).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDownStorageSize).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDownNumOfPairs).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private ComboBox comboBoxProduct;
private Label label1;
private Label label2;
private Label label3;
private Label label4;
private NumericUpDown numericUpDownStorageNumber;
private Label label5;
private ComboBox comboBoxStorageProductId;
private NumericUpDown numericUpDownStorageSize;
private NumericUpDown numericUpDownNumOfPairs;
private Button buttonCancel;
private Button buttonSave;
}
}

View File

@ -0,0 +1,53 @@
using ShoeStore.Entities;
using ShoeStore.Repositories;
using ShoeStore.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ShoeStore.Froms
{
public partial class FormReceipt : Form
{
private readonly IReceiptRepository _receiptRepository;
//private int? _receiptId;
public FormReceipt()
{
InitializeComponent();
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if (comboBoxProduct.SelectedIndex < 0 ||
comboBoxStorageProductId.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
_receiptRepository.CreateReceipt(Receipt.CreateOperation(
0, (int)comboBoxProduct.SelectedValue!,
(int)comboBoxStorageProductId.SelectedValue!,
Convert.ToInt32(numericUpDownStorageNumber.Value), Convert.ToInt32(numericUpDownStorageSize.Value),
Convert.ToInt32(numericUpDownNumOfPairs.Value)));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e) =>
Close();
}
}

View 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>

90
ShoeStore/Forms/FormReceipts.Designer.cs generated Normal file
View File

@ -0,0 +1,90 @@
namespace ShoeStore.Froms
{
partial class FormReceipts
{
/// <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()
{
dataGridView1 = new DataGridView();
panel1 = new Panel();
buttonAdd = new Button();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
panel1.SuspendLayout();
SuspendLayout();
//
// dataGridView1
//
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(0, 0);
dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true;
dataGridView1.Size = new Size(800, 450);
dataGridView1.TabIndex = 0;
//
// panel1
//
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(644, 0);
panel1.Name = "panel1";
panel1.Size = new Size(156, 450);
panel1.TabIndex = 1;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.плюс;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(34, 24);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(98, 86);
buttonAdd.TabIndex = 1;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// FormReceipts
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(panel1);
Controls.Add(dataGridView1);
Name = "FormReceipts";
Text = "FormReceipts";
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView1;
private Panel panel1;
private Button buttonAdd;
}
}

View File

@ -0,0 +1,42 @@
using ShoeStore.Repositories;
using ShoeStore.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using Unity;
namespace ShoeStore.Froms;
public partial class FormReceipts : Form
{
private readonly IUnityContainer _container;
private readonly IReceiptRepository _receiptRepository;
public FormReceipts(IUnityContainer container, IReceiptRepository receiptRepository)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
_receiptRepository = receiptRepository;
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormReceipt>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView1.DataSource = _receiptRepository.ReadReceipts();
}

View 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>

193
ShoeStore/Forms/FormSale.Designer.cs generated Normal file
View File

@ -0,0 +1,193 @@
namespace ShoeStore.Froms
{
partial class FormSale
{
/// <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();
label4 = new Label();
label5 = new Label();
comboBoxProduct = new ComboBox();
comboBoxStorageProductId = new ComboBox();
numericUpDownStorageNumber = new NumericUpDown();
numericUpDownStorageSize = new NumericUpDown();
buttonSave = new Button();
buttonCancel = new Button();
dataGridView1 = new DataGridView();
panel1 = new Panel();
((System.ComponentModel.ISupportInitialize)numericUpDownStorageNumber).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownStorageSize).BeginInit();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
panel1.SuspendLayout();
SuspendLayout();
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(38, 37);
label1.Name = "label1";
label1.Size = new Size(56, 15);
label1.TabIndex = 0;
label1.Text = "Продукт:";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(38, 75);
label2.Name = "label2";
label2.Size = new Size(112, 15);
label2.TabIndex = 1;
label2.Text = "Продукт на складе:";
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(38, 128);
label4.Name = "label4";
label4.Size = new Size(100, 15);
label4.TabIndex = 3;
label4.Text = "Номер продажи:";
//
// label5
//
label5.AutoSize = true;
label5.Location = new Point(38, 173);
label5.Name = "label5";
label5.Size = new Size(106, 15);
label5.TabIndex = 4;
label5.Text = "Размер на складе:";
//
// comboBoxProduct
//
comboBoxProduct.FormattingEnabled = true;
comboBoxProduct.Location = new Point(206, 34);
comboBoxProduct.Name = "comboBoxProduct";
comboBoxProduct.Size = new Size(121, 23);
comboBoxProduct.TabIndex = 6;
//
// comboBoxStorageProductId
//
comboBoxStorageProductId.FormattingEnabled = true;
comboBoxStorageProductId.Location = new Point(206, 75);
comboBoxStorageProductId.Name = "comboBoxStorageProductId";
comboBoxStorageProductId.Size = new Size(121, 23);
comboBoxStorageProductId.TabIndex = 7;
//
// numericUpDownStorageNumber
//
numericUpDownStorageNumber.Location = new Point(207, 126);
numericUpDownStorageNumber.Name = "numericUpDownStorageNumber";
numericUpDownStorageNumber.Size = new Size(120, 23);
numericUpDownStorageNumber.TabIndex = 9;
//
// numericUpDownStorageSize
//
numericUpDownStorageSize.Location = new Point(207, 171);
numericUpDownStorageSize.Name = "numericUpDownStorageSize";
numericUpDownStorageSize.Size = new Size(120, 23);
numericUpDownStorageSize.TabIndex = 10;
//
// buttonSave
//
buttonSave.Location = new Point(25, 455);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(100, 23);
buttonSave.TabIndex = 11;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += ButtonSave_Click_1;
//
// buttonCancel
//
buttonCancel.Location = new Point(225, 455);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(102, 23);
buttonCancel.TabIndex = 12;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += ButtonCancel_Click_1;
//
// dataGridView1
//
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(0, 0);
dataGridView1.Name = "dataGridView1";
dataGridView1.Size = new Size(289, 249);
dataGridView1.TabIndex = 13;
//
// panel1
//
panel1.Controls.Add(dataGridView1);
panel1.Location = new Point(38, 200);
panel1.Name = "panel1";
panel1.Size = new Size(289, 249);
panel1.TabIndex = 14;
//
// FormSale
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(377, 497);
Controls.Add(panel1);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(numericUpDownStorageSize);
Controls.Add(numericUpDownStorageNumber);
Controls.Add(comboBoxStorageProductId);
Controls.Add(comboBoxProduct);
Controls.Add(label5);
Controls.Add(label4);
Controls.Add(label2);
Controls.Add(label1);
Name = "FormSale";
Text = "FormSale";
((System.ComponentModel.ISupportInitialize)numericUpDownStorageNumber).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDownStorageSize).EndInit();
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label label1;
private Label label2;
private Label label4;
private Label label5;
private ComboBox comboBoxProduct;
private ComboBox comboBoxStorageProductId;
private NumericUpDown numericUpDownStorageNumber;
private NumericUpDown numericUpDownStorageSize;
private Button buttonSave;
private Button buttonCancel;
private DataGridView dataGridView1;
private Panel panel1;
}
}

View File

@ -0,0 +1,58 @@
using ShoeStore.Entities;
using ShoeStore.Repositories;
using ShoeStore.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ShoeStore.Froms;
public partial class FormSale : Form
{
ISaleRepository _saleRepository;
public FormSale(ISaleRepository saleRepository, IProductRepository productRepository)
{
InitializeComponent();
_saleRepository = saleRepository ?? throw new ArgumentNullException(nameof(saleRepository));
comboBoxProduct.DataSource = productRepository.ReadProducts();
comboBoxProduct.DisplayMember = "NameOfShoes";
comboBoxProduct.ValueMember = "Id";
//?
}
private void ButtonSave_Click_1(object sender, EventArgs e)
{
try
{
if (comboBoxProduct.SelectedIndex < 0 ||
comboBoxStorageProductId.SelectedIndex < 0 ||
comboBoxProduct.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
_saleRepository.CreateSale(Sale.CreateOperation(
0,
(int)comboBoxProduct.SelectedValue!,
(int)comboBoxProduct.SelectedValue!,
Convert.ToInt32(numericUpDownStorageNumber.Value), Convert.ToInt32(numericUpDownStorageSize.Value)));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ButtonCancel_Click_1(object sender, EventArgs e) =>
Close();
}

View 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>

106
ShoeStore/Forms/FormSales.Designer.cs generated Normal file
View File

@ -0,0 +1,106 @@
namespace ShoeStore.Froms
{
partial class FormSales
{
/// <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()
{
dataGridView1 = new DataGridView();
panel1 = new Panel();
buttonDel = new Button();
buttonAdd = new Button();
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
panel1.SuspendLayout();
SuspendLayout();
//
// dataGridView1
//
dataGridView1.AllowUserToAddRows = false;
dataGridView1.AllowUserToDeleteRows = false;
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.Location = new Point(0, 0);
dataGridView1.Name = "dataGridView1";
dataGridView1.ReadOnly = true;
dataGridView1.Size = new Size(800, 450);
dataGridView1.TabIndex = 0;
//
// panel1
//
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(649, 0);
panel1.Name = "panel1";
panel1.Size = new Size(151, 450);
panel1.TabIndex = 1;
//
// buttonDel
//
buttonDel.BackColor = SystemColors.ControlLightLight;
buttonDel.BackgroundImage = Properties.Resources.минус;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(28, 156);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(98, 86);
buttonDel.TabIndex = 3;
buttonDel.UseVisualStyleBackColor = false;
buttonDel.Click += buttonDel_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.плюс;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(28, 30);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(98, 86);
buttonAdd.TabIndex = 1;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += ButtonAdd_Click;
//
// FormSales
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(panel1);
Controls.Add(dataGridView1);
Name = "FormSales";
Text = "FormSales";
Load += FormSales_Load;
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private DataGridView dataGridView1;
private Panel panel1;
private Button buttonAdd;
private Button buttonDel;
}
}

View File

@ -0,0 +1,90 @@
using ShoeStore.Repositories;
using ShoeStore.Repositories.Implementations;
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;
namespace ShoeStore.Froms
{
public partial class FormSales : Form
{
private readonly IUnityContainer _container;
private readonly ISaleRepository _saleRepository;
public FormSales(IUnityContainer container, ISaleRepository saleRepository)
{
InitializeComponent();
_container = container;
_saleRepository = saleRepository;
}
private void FormSales_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
public void ButtonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormSale>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridView1.DataSource = _saleRepository.ReadSales();
private void buttonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_saleRepository.DeleteSale(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridView1.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View 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>

145
ShoeStore/Forms/FormStorage.Designer.cs generated Normal file
View File

@ -0,0 +1,145 @@
namespace ShoeStore.Forms
{
partial class FormStorage
{
/// <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()
{
buttonCancel = new Button();
buttonSave = new Button();
numericUpDownNumStorage = new NumericUpDown();
label3 = new Label();
label2 = new Label();
label1 = new Label();
numericUpDownSize = new NumericUpDown();
comboBoxNalStorage = new ComboBox();
((System.ComponentModel.ISupportInitialize)numericUpDownNumStorage).BeginInit();
((System.ComponentModel.ISupportInitialize)numericUpDownSize).BeginInit();
SuspendLayout();
//
// buttonCancel
//
buttonCancel.Location = new Point(209, 252);
buttonCancel.Name = "buttonCancel";
buttonCancel.Size = new Size(106, 23);
buttonCancel.TabIndex = 15;
buttonCancel.Text = "Отмена";
buttonCancel.UseVisualStyleBackColor = true;
buttonCancel.Click += buttonCancel_Click;
//
// buttonSave
//
buttonSave.Location = new Point(44, 252);
buttonSave.Name = "buttonSave";
buttonSave.Size = new Size(106, 23);
buttonSave.TabIndex = 14;
buttonSave.Text = "Сохранить";
buttonSave.UseVisualStyleBackColor = true;
buttonSave.Click += buttonSave_Click;
//
// numericUpDownNumStorage
//
numericUpDownNumStorage.Location = new Point(183, 108);
numericUpDownNumStorage.Name = "numericUpDownNumStorage";
numericUpDownNumStorage.Size = new Size(132, 23);
numericUpDownNumStorage.TabIndex = 12;
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(44, 179);
label3.Name = "label3";
label3.Size = new Size(108, 15);
label3.TabIndex = 11;
label3.Text = "Налиие на складе:";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(44, 116);
label2.Name = "label2";
label2.Size = new Size(88, 15);
label2.TabIndex = 10;
label2.Text = "Номер склада:";
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(44, 48);
label1.Name = "label1";
label1.Size = new Size(50, 15);
label1.TabIndex = 9;
label1.Text = "Размер:";
//
// numericUpDownSize
//
numericUpDownSize.Location = new Point(183, 48);
numericUpDownSize.Name = "numericUpDownSize";
numericUpDownSize.Size = new Size(132, 23);
numericUpDownSize.TabIndex = 16;
//
// comboBoxNalStorage
//
comboBoxNalStorage.FormattingEnabled = true;
comboBoxNalStorage.Location = new Point(183, 176);
comboBoxNalStorage.Name = "comboBoxNalStorage";
comboBoxNalStorage.Size = new Size(121, 23);
comboBoxNalStorage.TabIndex = 17;
//
// FormStorage
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(355, 421);
Controls.Add(comboBoxNalStorage);
Controls.Add(numericUpDownSize);
Controls.Add(buttonCancel);
Controls.Add(buttonSave);
Controls.Add(numericUpDownNumStorage);
Controls.Add(label3);
Controls.Add(label2);
Controls.Add(label1);
Name = "FormStorage";
Text = "FormStorage";
((System.ComponentModel.ISupportInitialize)numericUpDownNumStorage).EndInit();
((System.ComponentModel.ISupportInitialize)numericUpDownSize).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Button buttonCancel;
private Button buttonSave;
private NumericUpDown numericUpDownStorageSize;
private NumericUpDown numericUpDownNumStorage;
private Label label3;
private Label label2;
private Label label1;
private NumericUpDown numericUpDownSize;
private ComboBox comboBoxNalStorage;
}
}

View File

@ -0,0 +1,89 @@
using ShoeStore.Entities;
using ShoeStore.Entities.Enums;
using ShoeStore.Repositories;
using ShoeStore.Repositories.Implementations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ShoeStore.Forms
{
public partial class FormStorage : Form
{
private readonly IStorageRepository _storageRepository;
private int? _productId;
public int Id
{
set
{
try
{
var storage = _storageRepository.ReadStorageById(value);
if (storage == null)
{
throw new InvalidDataException(nameof(storage));
}
/*foreach (ManufacturingCompany company in Enum.GetValues(typeof(ManufacturingCompany)))
{
if ((company & storage.ManufacturingCompany) != 0)
{
checkedListBoxManufactoringCompany.SetItemChecked(
checkedListBoxManufactoringCompany.Items.IndexOf(company), true);
}
}*/
numericUpDownSize.Value = storage.Size;
comboBoxNalStorage.SelectedItem = storage.QuantityInStock;
numericUpDownNumStorage.Value = storage.NumberStorage;
_productId = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
public FormStorage()
{
InitializeComponent();
}
private void buttonSave_Click(object sender, EventArgs e)
{
try
{
if (
comboBoxNalStorage.SelectedIndex < 0)
{
throw new Exception("Имеются незаполненные поля");
}
_storageRepository.CreateStorage(Storage.CreateEntity(
(int)comboBoxNalStorage.SelectedValue!,
Convert.ToInt32(numericUpDownSize.Value),
Convert.ToInt32(numericUpDownNumStorage.Value)));
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при сохранении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonCancel_Click(object sender, EventArgs e) => Close();
}
}

View 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>

117
ShoeStore/Forms/FormStorages.Designer.cs generated Normal file
View File

@ -0,0 +1,117 @@
namespace ShoeStore.Forms
{
partial class FormStorages
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
panel1 = new Panel();
buttonDel = new Button();
buttonUpd = new Button();
buttonAdd = new Button();
dataGridViewStorages = new DataGridView();
panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridViewStorages).BeginInit();
SuspendLayout();
//
// panel1
//
panel1.Controls.Add(buttonDel);
panel1.Controls.Add(buttonUpd);
panel1.Controls.Add(buttonAdd);
panel1.Dock = DockStyle.Right;
panel1.Location = new Point(600, 0);
panel1.Name = "panel1";
panel1.Size = new Size(200, 450);
panel1.TabIndex = 0;
//
// buttonDel
//
buttonDel.BackColor = SystemColors.ControlLightLight;
buttonDel.BackgroundImage = Properties.Resources.минус;
buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
buttonDel.Location = new Point(48, 256);
buttonDel.Name = "buttonDel";
buttonDel.Size = new Size(98, 86);
buttonDel.TabIndex = 8;
buttonDel.UseVisualStyleBackColor = false;
buttonDel.Click += buttonDel_Click;
//
// buttonUpd
//
buttonUpd.BackColor = SystemColors.ControlLightLight;
buttonUpd.BackgroundImage = Properties.Resources.карандащ;
buttonUpd.BackgroundImageLayout = ImageLayout.Stretch;
buttonUpd.Location = new Point(48, 155);
buttonUpd.Name = "buttonUpd";
buttonUpd.Size = new Size(98, 86);
buttonUpd.TabIndex = 7;
buttonUpd.UseVisualStyleBackColor = false;
buttonUpd.Click += buttonUpd_Click;
//
// buttonAdd
//
buttonAdd.BackgroundImage = Properties.Resources.плюс;
buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
buttonAdd.Location = new Point(48, 54);
buttonAdd.Name = "buttonAdd";
buttonAdd.Size = new Size(98, 86);
buttonAdd.TabIndex = 6;
buttonAdd.UseVisualStyleBackColor = true;
buttonAdd.Click += buttonAdd_Click;
//
// dataGridViewStorages
//
dataGridViewStorages.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridViewStorages.Dock = DockStyle.Fill;
dataGridViewStorages.Location = new Point(0, 0);
dataGridViewStorages.Name = "dataGridViewStorages";
dataGridViewStorages.Size = new Size(600, 450);
dataGridViewStorages.TabIndex = 1;
//
// FormStorages
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450);
Controls.Add(dataGridViewStorages);
Controls.Add(panel1);
Name = "FormStorages";
Text = "FormStorages";
panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)dataGridViewStorages).EndInit();
ResumeLayout(false);
}
#endregion
private Panel panel1;
private DataGridView dataGridViewStorages;
private Button buttonDel;
private Button buttonUpd;
private Button buttonAdd;
}
}

View File

@ -0,0 +1,99 @@
using ShoeStore.Repositories;
using Unity;
namespace ShoeStore.Forms
{
public partial class FormStorages : Form
{
private readonly IUnityContainer _container;
private readonly IStorageRepository _storageRepository;
public FormStorages(IUnityContainer container, IStorageRepository storageRepository)
{
InitializeComponent();
_container = container;
_storageRepository = storageRepository;
}
private void FormEmployees_Load(object sender, EventArgs e)
{
try
{
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonAdd_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormStorage>().ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при добавлении",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonUpd_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
try
{
var form = _container.Resolve<FormStorage>();
form.Id = findId;
form.ShowDialog();
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void buttonDel_Click(object sender, EventArgs e)
{
if (!TryGetIdentifierFromSelectedRow(out var findId))
{
return;
}
if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
{
return;
}
try
{
_storageRepository.DeleteStorage(findId);
LoadList();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void LoadList() => dataGridViewStorages.DataSource = _storageRepository.ReadStorages();
private bool TryGetIdentifierFromSelectedRow(out int id)
{
id = 0;
if (dataGridViewStorages.SelectedRows.Count < 1)
{
MessageBox.Show("Нет выбранной записи", "Ошибка",
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
id =
Convert.ToInt32(dataGridViewStorages.SelectedRows[0].Cells["Id"].Value);
return true;
}
}
}

View 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>

View File

@ -1,3 +1,8 @@
using ShoeStore.Repositories.Implementations;
using ShoeStore.Repositories;
using Unity.Lifetime;
using Unity;
namespace ShoeStore namespace ShoeStore
{ {
internal static class Program internal static class Program
@ -11,7 +16,18 @@ namespace ShoeStore
// To customize application configuration such as set high DPI settings or default font, // To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration. // see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize(); ApplicationConfiguration.Initialize();
Application.Run(new Form1()); Application.Run(CreateContainer().Resolve<ShoeStore>());
}
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<IEmployeeRepository, EmployeeRepository>(new TransientLifetimeManager());
container.RegisterType<IProductRepository, ProductRepository>(new TransientLifetimeManager());
container.RegisterType<IReceiptRepository, ReceiptRepository>(new TransientLifetimeManager());
container.RegisterType<ISaleRepository, SaleRepository>(new TransientLifetimeManager());
container.RegisterType<IStorageRepository, StorageRepository>(new TransientLifetimeManager());
return container;
} }
} }
} }

113
ShoeStore/Properties/Resources.Designer.cs generated Normal file
View File

@ -0,0 +1,113 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ShoeStore.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("ShoeStore.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 карандащ {
get {
object obj = ResourceManager.GetObject("карандащ", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap минус {
get {
object obj = ResourceManager.GetObject("минус", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap обувной {
get {
object obj = ResourceManager.GetObject("обувной", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap плюс {
get {
object obj = ResourceManager.GetObject("плюс", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap плюс1 {
get {
object obj = ResourceManager.GetObject("плюс1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,136 @@
<?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="плюс" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\плюс.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="плюс1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\плюс1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="карандащ" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\карандащ.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="минус" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\минус.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="обувной" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\обувной.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -10,7 +10,7 @@ namespace ShoeStore.Repositories;
public interface IProductRepository public interface IProductRepository
{ {
IEnumerable<Product> ReadProducts(); IEnumerable<Product> ReadProducts();
Employee ReadProductById(int id); Product ReadProductById(int id);
void CreateProduct(Product product); void CreateProduct(Product product);
void UpdateProduct(Product product); void UpdateProduct(Product product);
void DeleteProduct(int id); void DeleteProduct(int id);

View File

@ -11,6 +11,6 @@ public interface ISaleRepository
{ {
IEnumerable<Sale> ReadSales(DateTime? dateForm = null, DateTime? dateTo = null, int? productId = null, int? storageSize = null); IEnumerable<Sale> ReadSales(DateTime? dateForm = null, DateTime? dateTo = null, int? productId = null, int? storageSize = null);
void CreateSale(Sale sale); void CreateSale(Sale sale);
void DeleteSale(Sale sale); void DeleteSale(int id);
} }

View File

@ -0,0 +1,33 @@
using ShoeStore.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoeStore.Repositories.Implementations;
public class EmployeeRepository : IEmployeeRepository
{
public void CreateEmployee(Employee employee)
{
}
public void DeleteEmployee(int id)
{
}
public Employee ReadEmployeeById(int id)
{
return Employee.CreateEntity(0, 0, 0);
}
public IEnumerable<Employee> ReadEmployees()
{
return [];
}
public void UpdateEmployee(Employee employee)
{
}
}

View File

@ -0,0 +1,35 @@
using ShoeStore.Entities;
using ShoeStore.Entities.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoeStore.Repositories.Implementations;
public class ProductRepository : IProductRepository
{
public void CreateProduct(Product product)
{
}
public void DeleteProduct(int id)
{
}
public Product ReadProductById(int id)
{
return Product.CreateEntity(0, 0, String.Empty, ManufacturingCompany.None, 0, ProductType.None, 0);
}
public IEnumerable<Product> ReadProducts()
{
return [];
}
public void UpdateProduct(Product product)
{
}
}

View File

@ -0,0 +1,20 @@
using ShoeStore.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoeStore.Repositories.Implementations;
public class ReceiptRepository : IReceiptRepository
{
public void CreateReceipt(Receipt receipt)
{
}
public IEnumerable<Receipt> ReadReceipts(DateTime? dateForm = null, DateTime? dateTo = null, int? storageProductId = null, int? storageSize = null)
{
return [];
}
}

View File

@ -0,0 +1,24 @@
using ShoeStore.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoeStore.Repositories.Implementations;
public class SaleRepository : ISaleRepository
{
public void CreateSale(Sale sale)
{
}
public void DeleteSale(int id)
{
}
public IEnumerable<Sale> ReadSales(DateTime? dateForm = null, DateTime? dateTo = null, int? productId = null, int? storageSize = null)
{
return [];
}
}

View File

@ -0,0 +1,33 @@
using ShoeStore.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoeStore.Repositories.Implementations;
public class StorageRepository : IStorageRepository
{
public void CreateStorage(Storage storage)
{
}
public void DeleteStorage(int id)
{
}
public Storage ReadStorageById(int id)
{
return Storage.CreateEntity(0, 0, 0);
}
public IEnumerable<Storage> ReadStorages()
{
return [];
}
public void UpdateStorage(Storage storage)
{
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

137
ShoeStore/ShoeStore.Designer.cs generated Normal file
View File

@ -0,0 +1,137 @@
namespace ShoeStore
{
partial class ShoeStore
{
/// <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()
{
menuStrip1 = new MenuStrip();
справочникиToolStripMenuItem = new ToolStripMenuItem();
EployeesToolStripMenuItem = new ToolStripMenuItem();
ProdctsToolStripMenuItem = new ToolStripMenuItem();
StoragesToolStripMenuItem = new ToolStripMenuItem();
операцииToolStripMenuItem = new ToolStripMenuItem();
ReceiptsToolStripMenuItem = new ToolStripMenuItem();
SalesToolStripMenuItem = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// menuStrip1
//
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(800, 24);
menuStrip1.TabIndex = 0;
menuStrip1.Text = "menuStrip1";
//
// справочникиToolStripMenuItem
//
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { EployeesToolStripMenuItem, ProdctsToolStripMenuItem, StoragesToolStripMenuItem });
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
справочникиToolStripMenuItem.Size = new Size(94, 20);
справочникиToolStripMenuItem.Text = "Справочники";
//
// EployeesToolStripMenuItem
//
EployeesToolStripMenuItem.Name = "EployeesToolStripMenuItem";
EployeesToolStripMenuItem.Size = new Size(133, 22);
EployeesToolStripMenuItem.Text = "Сотрудник";
EployeesToolStripMenuItem.Click += EployeesToolStripMenuItem_Click;
//
// ProdctsToolStripMenuItem
//
ProdctsToolStripMenuItem.Name = "ProdctsToolStripMenuItem";
ProdctsToolStripMenuItem.Size = new Size(133, 22);
ProdctsToolStripMenuItem.Text = "Продукт";
ProdctsToolStripMenuItem.Click += ProdctsToolStripMenuItem_Click;
//
// StoragesToolStripMenuItem
//
StoragesToolStripMenuItem.Name = "StoragesToolStripMenuItem";
StoragesToolStripMenuItem.Size = new Size(133, 22);
StoragesToolStripMenuItem.Text = "Склад";
StoragesToolStripMenuItem.Click += StoragesToolStripMenuItem_Click;
//
// операцииToolStripMenuItem
//
операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ReceiptsToolStripMenuItem, SalesToolStripMenuItem });
операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
операцииToolStripMenuItem.Size = new Size(75, 20);
операцииToolStripMenuItem.Text = "Операции";
//
// ReceiptsToolStripMenuItem
//
ReceiptsToolStripMenuItem.Name = "ReceiptsToolStripMenuItem";
ReceiptsToolStripMenuItem.Size = new Size(147, 22);
ReceiptsToolStripMenuItem.Text = "Поступление";
ReceiptsToolStripMenuItem.Click += ReceiptsToolStripMenuItem_Click;
//
// SalesToolStripMenuItem
//
SalesToolStripMenuItem.Name = "SalesToolStripMenuItem";
SalesToolStripMenuItem.Size = new Size(147, 22);
SalesToolStripMenuItem.Text = "Продажа";
SalesToolStripMenuItem.Click += SalesToolStripMenuItem_Click;
//
// отчетыToolStripMenuItem
//
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(60, 20);
отчетыToolStripMenuItem.Text = "Отчеты";
//
// ShoeStore
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = SystemColors.ControlLightLight;
BackgroundImage = Properties.Resources.обувной;
BackgroundImageLayout = ImageLayout.Zoom;
ClientSize = new Size(800, 450);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
Name = "ShoeStore";
Text = "ShoeStore";
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private MenuStrip menuStrip1;
private ToolStripMenuItem справочникиToolStripMenuItem;
private ToolStripMenuItem EployeesToolStripMenuItem;
private ToolStripMenuItem ProdctsToolStripMenuItem;
private ToolStripMenuItem StoragesToolStripMenuItem;
private ToolStripMenuItem операцииToolStripMenuItem;
private ToolStripMenuItem ReceiptsToolStripMenuItem;
private ToolStripMenuItem SalesToolStripMenuItem;
private ToolStripMenuItem отчетыToolStripMenuItem;
}
}

87
ShoeStore/ShoeStore.cs Normal file
View File

@ -0,0 +1,87 @@
using ShoeStore.Forms;
using ShoeStore.Froms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
using Unity;
namespace ShoeStore
{
public partial class ShoeStore : Form
{
private readonly IUnityContainer _container;
public ShoeStore(IUnityContainer container)
{
InitializeComponent();
_container = container ?? throw new ArgumentNullException(nameof(container));
}
private void EployeesToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormEmployees>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ProdctsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormProducts>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void StoragesToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormStorages>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ReceiptsToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormReceipts>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void SalesToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
_container.Resolve<FormSales>().ShowDialog();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

@ -9,7 +9,22 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Repositories\Implementations\" /> <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> </ItemGroup>
</Project> </Project>

123
ShoeStore/ShoeStore.resx Normal file
View 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="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.11.35327.3 VisualStudioVersion = 17.11.35327.3
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShoeStore", "ShoeStore.csproj", "{0BCD96CD-E5CD-4591-8C0A-5140514BCD51}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ShoeStore", "ShoeStore.csproj", "{0BCD96CD-E5CD-4591-8C0A-5140514BCD51}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution