/////
This commit is contained in:
parent
83a76cf83e
commit
a044cb7680
@ -13,14 +13,14 @@ public class Store
|
|||||||
public string StoreName { get; private set; } = string.Empty;
|
public string StoreName { get; private set; } = string.Empty;
|
||||||
public int Employees { get; private set; }
|
public int Employees { get; private set; }
|
||||||
public double Visitors { get; private set; }
|
public double Visitors { get; private set; }
|
||||||
public static Store CreateEntity(int id, string StoreType, string
|
public static Store CreateEntity(int id, string storeType, string
|
||||||
StoreName, int employees, double visitors)
|
storeName, int employees, double visitors)
|
||||||
{
|
{
|
||||||
return new Store
|
return new Store
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
StoreType = StoreType ?? string.Empty,
|
StoreType = storeType ?? string.Empty,
|
||||||
StoreName = StoreName ?? string.Empty,
|
StoreName = storeName ?? string.Empty,
|
||||||
Employees = employees,
|
Employees = employees,
|
||||||
Visitors = visitors
|
Visitors = visitors
|
||||||
};
|
};
|
||||||
|
15
ShoeStore/ShoeStore/FormStorage.Designer.cs
generated
15
ShoeStore/ShoeStore/FormStorage.Designer.cs
generated
@ -59,20 +59,23 @@
|
|||||||
// фабрикиToolStripMenuItem
|
// фабрикиToolStripMenuItem
|
||||||
//
|
//
|
||||||
фабрикиToolStripMenuItem.Name = "фабрикиToolStripMenuItem";
|
фабрикиToolStripMenuItem.Name = "фабрикиToolStripMenuItem";
|
||||||
фабрикиToolStripMenuItem.Size = new Size(130, 22);
|
фабрикиToolStripMenuItem.Size = new Size(180, 22);
|
||||||
фабрикиToolStripMenuItem.Text = "Фабрики";
|
фабрикиToolStripMenuItem.Text = "Фабрики";
|
||||||
|
фабрикиToolStripMenuItem.Click += фабрикиToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// магазиныToolStripMenuItem
|
// магазиныToolStripMenuItem
|
||||||
//
|
//
|
||||||
магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
|
магазиныToolStripMenuItem.Name = "магазиныToolStripMenuItem";
|
||||||
магазиныToolStripMenuItem.Size = new Size(130, 22);
|
магазиныToolStripMenuItem.Size = new Size(180, 22);
|
||||||
магазиныToolStripMenuItem.Text = "Магазины";
|
магазиныToolStripMenuItem.Text = "Магазины";
|
||||||
|
магазиныToolStripMenuItem.Click += магазиныToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// обувьToolStripMenuItem
|
// обувьToolStripMenuItem
|
||||||
//
|
//
|
||||||
обувьToolStripMenuItem.Name = "обувьToolStripMenuItem";
|
обувьToolStripMenuItem.Name = "обувьToolStripMenuItem";
|
||||||
обувьToolStripMenuItem.Size = new Size(130, 22);
|
обувьToolStripMenuItem.Size = new Size(180, 22);
|
||||||
обувьToolStripMenuItem.Text = "Обувь";
|
обувьToolStripMenuItem.Text = "Обувь";
|
||||||
|
обувьToolStripMenuItem.Click += обувьToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// операцииToolStripMenuItem
|
// операцииToolStripMenuItem
|
||||||
//
|
//
|
||||||
@ -84,14 +87,16 @@
|
|||||||
// продажаОбувиToolStripMenuItem
|
// продажаОбувиToolStripMenuItem
|
||||||
//
|
//
|
||||||
продажаОбувиToolStripMenuItem.Name = "продажаОбувиToolStripMenuItem";
|
продажаОбувиToolStripMenuItem.Name = "продажаОбувиToolStripMenuItem";
|
||||||
продажаОбувиToolStripMenuItem.Size = new Size(160, 22);
|
продажаОбувиToolStripMenuItem.Size = new Size(180, 22);
|
||||||
продажаОбувиToolStripMenuItem.Text = "Продажа обуви";
|
продажаОбувиToolStripMenuItem.Text = "Продажа обуви";
|
||||||
|
продажаОбувиToolStripMenuItem.Click += продажаОбувиToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// закупкаОбувиToolStripMenuItem
|
// закупкаОбувиToolStripMenuItem
|
||||||
//
|
//
|
||||||
закупкаОбувиToolStripMenuItem.Name = "закупкаОбувиToolStripMenuItem";
|
закупкаОбувиToolStripMenuItem.Name = "закупкаОбувиToolStripMenuItem";
|
||||||
закупкаОбувиToolStripMenuItem.Size = new Size(160, 22);
|
закупкаОбувиToolStripMenuItem.Size = new Size(180, 22);
|
||||||
закупкаОбувиToolStripMenuItem.Text = "Закупка обуви";
|
закупкаОбувиToolStripMenuItem.Text = "Закупка обуви";
|
||||||
|
закупкаОбувиToolStripMenuItem.Click += закупкаОбувиToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// отчетыToolStripMenuItem
|
// отчетыToolStripMenuItem
|
||||||
//
|
//
|
||||||
|
@ -1,10 +1,82 @@
|
|||||||
|
using ShoeStore.Forms;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
namespace ShoeStore
|
namespace ShoeStore
|
||||||
{
|
{
|
||||||
public partial class FormStorage : Form
|
public partial class FormStorage : Form
|
||||||
{
|
{
|
||||||
public FormStorage()
|
private readonly IUnityContainer _container; public FormStorage(IUnityContainer container)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ôàáðèêèToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormFactorys>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ìàãàçèíûToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormStores>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void îáóâüToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormShoess>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ïðîäàæàÎáóâèToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormShoesSales>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void çàêóïêàÎáóâèToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_container.Resolve<FormShoesReplenishments>().ShowDialog();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Îøèáêà ïðè çàãðóçêå",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
80
ShoeStore/ShoeStore/Forms/FormFactory.Designer.cs
generated
80
ShoeStore/ShoeStore/Forms/FormFactory.Designer.cs
generated
@ -28,22 +28,22 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
comboBox1 = new ComboBox();
|
comboBoxManufacturer = new ComboBox();
|
||||||
label1 = new Label();
|
label1 = new Label();
|
||||||
label2 = new Label();
|
label2 = new Label();
|
||||||
textBox1 = new TextBox();
|
textBoxFactoryName = new TextBox();
|
||||||
button1 = new Button();
|
ButtonSave = new Button();
|
||||||
button2 = new Button();
|
ButtonCancel = new Button();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// comboBox1
|
// comboBoxManufacturer
|
||||||
//
|
//
|
||||||
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
|
comboBoxManufacturer.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
comboBox1.FormattingEnabled = true;
|
comboBoxManufacturer.FormattingEnabled = true;
|
||||||
comboBox1.Location = new Point(74, 79);
|
comboBoxManufacturer.Location = new Point(74, 79);
|
||||||
comboBox1.Name = "comboBox1";
|
comboBoxManufacturer.Name = "comboBoxManufacturer";
|
||||||
comboBox1.Size = new Size(182, 23);
|
comboBoxManufacturer.Size = new Size(182, 23);
|
||||||
comboBox1.TabIndex = 0;
|
comboBoxManufacturer.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
@ -53,7 +53,6 @@
|
|||||||
label1.Size = new Size(59, 15);
|
label1.Size = new Size(59, 15);
|
||||||
label1.TabIndex = 1;
|
label1.TabIndex = 1;
|
||||||
label1.Text = "Название";
|
label1.Text = "Название";
|
||||||
label1.Click += label1_Click;
|
|
||||||
//
|
//
|
||||||
// label2
|
// label2
|
||||||
//
|
//
|
||||||
@ -64,55 +63,58 @@
|
|||||||
label2.TabIndex = 2;
|
label2.TabIndex = 2;
|
||||||
label2.Text = "Страна";
|
label2.Text = "Страна";
|
||||||
//
|
//
|
||||||
// textBox1
|
// textBoxFactoryName
|
||||||
//
|
//
|
||||||
textBox1.Location = new Point(87, 26);
|
textBoxFactoryName.Location = new Point(87, 26);
|
||||||
textBox1.Name = "textBox1";
|
textBoxFactoryName.Name = "textBoxFactoryName";
|
||||||
textBox1.Size = new Size(169, 23);
|
textBoxFactoryName.Size = new Size(169, 23);
|
||||||
textBox1.TabIndex = 3;
|
textBoxFactoryName.TabIndex = 3;
|
||||||
//
|
//
|
||||||
// button1
|
// ButtonSave
|
||||||
//
|
//
|
||||||
button1.Location = new Point(22, 140);
|
ButtonSave.Location = new Point(22, 140);
|
||||||
button1.Name = "button1";
|
ButtonSave.Name = "ButtonSave";
|
||||||
button1.Size = new Size(102, 23);
|
ButtonSave.Size = new Size(102, 23);
|
||||||
button1.TabIndex = 4;
|
ButtonSave.TabIndex = 4;
|
||||||
button1.Text = "Сохранить";
|
ButtonSave.Text = "Сохранить";
|
||||||
button1.UseVisualStyleBackColor = true;
|
ButtonSave.UseVisualStyleBackColor = true;
|
||||||
|
ButtonSave.Click += ButtonSave_Click;
|
||||||
//
|
//
|
||||||
// button2
|
// ButtonCancel
|
||||||
//
|
//
|
||||||
button2.Location = new Point(158, 140);
|
ButtonCancel.Location = new Point(158, 140);
|
||||||
button2.Name = "button2";
|
ButtonCancel.Name = "ButtonCancel";
|
||||||
button2.Size = new Size(98, 23);
|
ButtonCancel.Size = new Size(98, 23);
|
||||||
button2.TabIndex = 5;
|
ButtonCancel.TabIndex = 5;
|
||||||
button2.Text = "Отмена";
|
ButtonCancel.Text = "Отмена";
|
||||||
button2.UseVisualStyleBackColor = true;
|
ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonCancel.Click += ButtonCancel_Click;
|
||||||
//
|
//
|
||||||
// FormFactory
|
// FormFactory
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(280, 199);
|
ClientSize = new Size(280, 199);
|
||||||
Controls.Add(button2);
|
Controls.Add(ButtonCancel);
|
||||||
Controls.Add(button1);
|
Controls.Add(ButtonSave);
|
||||||
Controls.Add(textBox1);
|
Controls.Add(textBoxFactoryName);
|
||||||
Controls.Add(label2);
|
Controls.Add(label2);
|
||||||
Controls.Add(label1);
|
Controls.Add(label1);
|
||||||
Controls.Add(comboBox1);
|
Controls.Add(comboBoxManufacturer);
|
||||||
Name = "FormFactory";
|
Name = "FormFactory";
|
||||||
Text = "FormFactory";
|
Text = "FormFactory";
|
||||||
|
Load += FormFactory_Load;
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private ComboBox comboBox1;
|
private ComboBox comboBoxManufacturer;
|
||||||
private Label label1;
|
private Label label1;
|
||||||
private Label label2;
|
private Label label2;
|
||||||
private TextBox textBox1;
|
private TextBox textBoxFactoryName;
|
||||||
private Button button1;
|
private Button ButtonSave;
|
||||||
private Button button2;
|
private Button ButtonCancel;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,19 +7,84 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using ShoeStore.Entities;
|
||||||
|
using ShoeStore.Entities.Enums;
|
||||||
|
using ShoeStore.Repositories;
|
||||||
|
|
||||||
namespace ShoeStore.Forms
|
namespace ShoeStore.Forms
|
||||||
{
|
{
|
||||||
public partial class FormFactory : Form
|
public partial class FormFactory : Form
|
||||||
{
|
{
|
||||||
public FormFactory()
|
private readonly IFactoryRepository _factoryRepository;
|
||||||
|
private int? _factoryId;
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var factory =
|
||||||
|
_factoryRepository.ReadFactoryById(value);
|
||||||
|
if (factory == null)
|
||||||
|
{
|
||||||
|
throw new
|
||||||
|
InvalidDataException(nameof(factory));
|
||||||
|
}
|
||||||
|
textBoxFactoryName.Text = factory.FactoryName;
|
||||||
|
|
||||||
|
comboBoxManufacturer.SelectedItem =
|
||||||
|
factory.Manufacturer;
|
||||||
|
_factoryId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FormFactory(IFactoryRepository factoryRepository)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_factoryRepository = factoryRepository ??
|
||||||
|
throw new
|
||||||
|
ArgumentNullException(nameof(factoryRepository));
|
||||||
|
comboBoxManufacturer.DataSource =
|
||||||
|
Enum.GetValues(typeof(Manufacturer));
|
||||||
}
|
}
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
private void label1_Click(object sender, EventArgs e)
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxFactoryName.Text) || comboBoxManufacturer.SelectedIndex < 1)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
if (_factoryId.HasValue)
|
||||||
|
{
|
||||||
|
_factoryRepository.UpdateFactory(CreateFactory(_factoryId.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_factoryRepository.CreateFactory(CreateFactory(0));
|
||||||
|
}
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e) =>
|
||||||
|
Close();
|
||||||
|
private Factory CreateFactory(int id) =>
|
||||||
|
Factory.CreateEntity(id, textBoxFactoryName.Text, (Manufacturer)comboBoxManufacturer.SelectedItem!);
|
||||||
|
private void FormFactory_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
124
ShoeStore/ShoeStore/Forms/FormFactorys.Designer.cs
generated
Normal file
124
ShoeStore/ShoeStore/Forms/FormFactorys.Designer.cs
generated
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
namespace ShoeStore.Forms
|
||||||
|
{
|
||||||
|
partial class FormFactorys
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
ButtonDel = new Button();
|
||||||
|
ButtonUpd = new Button();
|
||||||
|
ButtonAdd = new Button();
|
||||||
|
dataGridViewData = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(ButtonDel);
|
||||||
|
panel1.Controls.Add(ButtonUpd);
|
||||||
|
panel1.Controls.Add(ButtonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(970, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(122, 450);
|
||||||
|
panel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ButtonDel
|
||||||
|
//
|
||||||
|
ButtonDel.BackgroundImage = Properties.Resources.Gradelink_cross_1;
|
||||||
|
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonDel.Location = new Point(16, 193);
|
||||||
|
ButtonDel.Name = "ButtonDel";
|
||||||
|
ButtonDel.Size = new Size(85, 78);
|
||||||
|
ButtonDel.TabIndex = 2;
|
||||||
|
ButtonDel.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// ButtonUpd
|
||||||
|
//
|
||||||
|
ButtonUpd.BackgroundImage = Properties.Resources.Simpleicons_Business_pencil_striped_symbol_for_interface_edit_buttons_svg;
|
||||||
|
ButtonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonUpd.Location = new Point(16, 110);
|
||||||
|
ButtonUpd.Name = "ButtonUpd";
|
||||||
|
ButtonUpd.Size = new Size(85, 77);
|
||||||
|
ButtonUpd.TabIndex = 1;
|
||||||
|
ButtonUpd.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// ButtonAdd
|
||||||
|
//
|
||||||
|
ButtonAdd.BackgroundImage = Properties.Resources.Ambox_plus_svg;
|
||||||
|
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonAdd.Location = new Point(16, 27);
|
||||||
|
ButtonAdd.Name = "ButtonAdd";
|
||||||
|
ButtonAdd.Size = new Size(85, 77);
|
||||||
|
ButtonAdd.TabIndex = 0;
|
||||||
|
ButtonAdd.UseVisualStyleBackColor = true;
|
||||||
|
ButtonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridViewData
|
||||||
|
//
|
||||||
|
dataGridViewData.AllowUserToAddRows = false;
|
||||||
|
dataGridViewData.AllowUserToResizeColumns = false;
|
||||||
|
dataGridViewData.AllowUserToResizeRows = false;
|
||||||
|
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewData.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewData.Location = new Point(0, 0);
|
||||||
|
dataGridViewData.MultiSelect = false;
|
||||||
|
dataGridViewData.Name = "dataGridViewData";
|
||||||
|
dataGridViewData.ReadOnly = true;
|
||||||
|
dataGridViewData.RowHeadersVisible = false;
|
||||||
|
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridViewData.Size = new Size(970, 450);
|
||||||
|
dataGridViewData.TabIndex = 1;
|
||||||
|
dataGridViewData.CellContentClick += dataGridViewData_CellContentClick;
|
||||||
|
//
|
||||||
|
// FormFactorys
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1092, 450);
|
||||||
|
Controls.Add(dataGridViewData);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormFactorys";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Фабрики";
|
||||||
|
Load += FormFactorys_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button ButtonDel;
|
||||||
|
private Button ButtonUpd;
|
||||||
|
private Button ButtonAdd;
|
||||||
|
private DataGridView dataGridViewData;
|
||||||
|
}
|
||||||
|
}
|
117
ShoeStore/ShoeStore/Forms/FormFactorys.cs
Normal file
117
ShoeStore/ShoeStore/Forms/FormFactorys.cs
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
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.Forms
|
||||||
|
{
|
||||||
|
public partial class FormFactorys : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly IFactoryRepository _factoryRepository;
|
||||||
|
public FormFactorys(IUnityContainer container, IFactoryRepository
|
||||||
|
factoryRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_factoryRepository = factoryRepository ??
|
||||||
|
throw new
|
||||||
|
ArgumentNullException(nameof(factoryRepository));
|
||||||
|
}
|
||||||
|
private void FormFactorys_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<FormFactory>().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<FormFactory>();
|
||||||
|
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
|
||||||
|
{
|
||||||
|
_factoryRepository.DeleteFactory(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridViewData.DataSource =
|
||||||
|
_factoryRepository.ReadFactorys();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
private void dataGridViewData_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
120
ShoeStore/ShoeStore/Forms/FormFactorys.resx
Normal file
120
ShoeStore/ShoeStore/Forms/FormFactorys.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
144
ShoeStore/ShoeStore/Forms/FormShoes.Designer.cs
generated
Normal file
144
ShoeStore/ShoeStore/Forms/FormShoes.Designer.cs
generated
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
namespace ShoeStore.Forms
|
||||||
|
{
|
||||||
|
partial class FormShoes
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
checkedListBoxShoesType = new CheckedListBox();
|
||||||
|
textBoxName = new TextBox();
|
||||||
|
textBoxDescription = new TextBox();
|
||||||
|
ButtonSave = new Button();
|
||||||
|
ButtonCancel = new Button();
|
||||||
|
label1 = new Label();
|
||||||
|
label2 = new Label();
|
||||||
|
label3 = new Label();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// checkedListBoxShoesType
|
||||||
|
//
|
||||||
|
checkedListBoxShoesType.FormattingEnabled = true;
|
||||||
|
checkedListBoxShoesType.Location = new Point(84, 21);
|
||||||
|
checkedListBoxShoesType.Name = "checkedListBoxShoesType";
|
||||||
|
checkedListBoxShoesType.Size = new Size(198, 94);
|
||||||
|
checkedListBoxShoesType.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// textBoxName
|
||||||
|
//
|
||||||
|
textBoxName.Location = new Point(84, 136);
|
||||||
|
textBoxName.Multiline = true;
|
||||||
|
textBoxName.Name = "textBoxName";
|
||||||
|
textBoxName.Size = new Size(198, 18);
|
||||||
|
textBoxName.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// textBoxDescription
|
||||||
|
//
|
||||||
|
textBoxDescription.Location = new Point(84, 179);
|
||||||
|
textBoxDescription.Multiline = true;
|
||||||
|
textBoxDescription.Name = "textBoxDescription";
|
||||||
|
textBoxDescription.Size = new Size(198, 82);
|
||||||
|
textBoxDescription.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// ButtonSave
|
||||||
|
//
|
||||||
|
ButtonSave.Location = new Point(84, 289);
|
||||||
|
ButtonSave.Name = "ButtonSave";
|
||||||
|
ButtonSave.Size = new Size(81, 23);
|
||||||
|
ButtonSave.TabIndex = 3;
|
||||||
|
ButtonSave.Text = "Сохранить";
|
||||||
|
ButtonSave.UseVisualStyleBackColor = true;
|
||||||
|
ButtonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
ButtonCancel.Location = new Point(203, 289);
|
||||||
|
ButtonCancel.Name = "ButtonCancel";
|
||||||
|
ButtonCancel.Size = new Size(79, 23);
|
||||||
|
ButtonCancel.TabIndex = 4;
|
||||||
|
ButtonCancel.Text = "Отмена";
|
||||||
|
ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(12, 21);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(66, 15);
|
||||||
|
label1.TabIndex = 5;
|
||||||
|
label1.Text = "Тип обуви:";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(12, 139);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(62, 15);
|
||||||
|
label2.TabIndex = 6;
|
||||||
|
label2.Text = "Название:";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new Point(12, 182);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(65, 15);
|
||||||
|
label3.TabIndex = 7;
|
||||||
|
label3.Text = "Описание:";
|
||||||
|
label3.Click += label3_Click;
|
||||||
|
//
|
||||||
|
// FormShoes
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(321, 344);
|
||||||
|
Controls.Add(label3);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Controls.Add(ButtonCancel);
|
||||||
|
Controls.Add(ButtonSave);
|
||||||
|
Controls.Add(textBoxDescription);
|
||||||
|
Controls.Add(textBoxName);
|
||||||
|
Controls.Add(checkedListBoxShoesType);
|
||||||
|
Name = "FormShoes";
|
||||||
|
Text = "FormShoes";
|
||||||
|
Load += FormShoes_Load;
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private CheckedListBox checkedListBoxShoesType;
|
||||||
|
private TextBox textBoxName;
|
||||||
|
private TextBox textBoxDescription;
|
||||||
|
private Button ButtonSave;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
private Label label1;
|
||||||
|
private Label label2;
|
||||||
|
private Label label3;
|
||||||
|
}
|
||||||
|
}
|
118
ShoeStore/ShoeStore/Forms/FormShoes.cs
Normal file
118
ShoeStore/ShoeStore/Forms/FormShoes.cs
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
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 Microsoft.VisualBasic.FileIO;
|
||||||
|
using ShoeStore.Entities;
|
||||||
|
using ShoeStore.Entities.Enums;
|
||||||
|
using ShoeStore.Repositories;
|
||||||
|
|
||||||
|
namespace ShoeStore.Forms
|
||||||
|
{
|
||||||
|
public partial class FormShoes : Form
|
||||||
|
{
|
||||||
|
private readonly IShoesRepository _shoesRepository;
|
||||||
|
private int? _shoesId;
|
||||||
|
public int Id
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var shoes = _shoesRepository.ReadShoesById(value);
|
||||||
|
if (shoes == null)
|
||||||
|
{
|
||||||
|
throw new
|
||||||
|
InvalidDataException(nameof(shoes));
|
||||||
|
}
|
||||||
|
foreach (ShoesType elem in
|
||||||
|
Enum.GetValues(typeof(ShoesType)))
|
||||||
|
{
|
||||||
|
if ((elem & shoes.ShoesType) != 0)
|
||||||
|
{
|
||||||
|
checkedListBoxShoesType.SetItemChecked(checkedListBoxShoesType.Items.IndexOf(
|
||||||
|
elem), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
textBoxName.Text = shoes.Name;
|
||||||
|
textBoxDescription.Text = shoes.Description;
|
||||||
|
_shoesId = value;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public FormShoes(IShoesRepository shoesRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_shoesRepository = shoesRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(shoesRepository));
|
||||||
|
foreach (var elem in Enum.GetValues(typeof(ShoesType)))
|
||||||
|
{
|
||||||
|
checkedListBoxShoesType.Items.Add(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(textBoxName.Text) ||
|
||||||
|
string.IsNullOrWhiteSpace(textBoxDescription.Text) ||
|
||||||
|
checkedListBoxShoesType.CheckedItems.Count == 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
if (_shoesId.HasValue)
|
||||||
|
{
|
||||||
|
_shoesRepository.UpdateShoes(CreateShoes(_shoesId.Value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_shoesRepository.CreateShoes(CreateShoes(0));
|
||||||
|
}
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e) =>
|
||||||
|
Close();
|
||||||
|
private Shoes CreateShoes(int id)
|
||||||
|
{
|
||||||
|
ShoesType shoesType = ShoesType.None;
|
||||||
|
foreach (var elem in checkedListBoxShoesType.CheckedItems)
|
||||||
|
{
|
||||||
|
shoesType |= (ShoesType)elem;
|
||||||
|
}
|
||||||
|
return Shoes.CreateEntity(id, shoesType, textBoxName.Text,
|
||||||
|
textBoxDescription.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void FormShoes_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void label3_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonCancel_Click_1(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
ShoeStore/ShoeStore/Forms/FormShoes.resx
Normal file
120
ShoeStore/ShoeStore/Forms/FormShoes.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
152
ShoeStore/ShoeStore/Forms/FormShoesReplenishment.Designer.cs
generated
Normal file
152
ShoeStore/ShoeStore/Forms/FormShoesReplenishment.Designer.cs
generated
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
namespace ShoeStore.Forms
|
||||||
|
{
|
||||||
|
partial class FormShoesReplenishment
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
label2 = new Label();
|
||||||
|
comboBoxFactory = new ComboBox();
|
||||||
|
groupBox1 = new GroupBox();
|
||||||
|
dataGridViewShoess = new DataGridView();
|
||||||
|
ColumnShoes = new DataGridViewComboBoxColumn();
|
||||||
|
Column2 = new DataGridViewTextBoxColumn();
|
||||||
|
ButtonSave = new Button();
|
||||||
|
ButtonCancel = new Button();
|
||||||
|
groupBox1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewShoess).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(15, 30);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(58, 15);
|
||||||
|
label2.TabIndex = 6;
|
||||||
|
label2.Text = "Фабрика:";
|
||||||
|
//
|
||||||
|
// comboBoxFactory
|
||||||
|
//
|
||||||
|
comboBoxFactory.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxFactory.FormattingEnabled = true;
|
||||||
|
comboBoxFactory.Location = new Point(79, 27);
|
||||||
|
comboBoxFactory.Name = "comboBoxFactory";
|
||||||
|
comboBoxFactory.Size = new Size(263, 23);
|
||||||
|
comboBoxFactory.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// groupBox1
|
||||||
|
//
|
||||||
|
groupBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
groupBox1.Controls.Add(dataGridViewShoess);
|
||||||
|
groupBox1.Location = new Point(12, 86);
|
||||||
|
groupBox1.Name = "groupBox1";
|
||||||
|
groupBox1.Size = new Size(329, 280);
|
||||||
|
groupBox1.TabIndex = 7;
|
||||||
|
groupBox1.TabStop = false;
|
||||||
|
groupBox1.Text = "groupBox1";
|
||||||
|
//
|
||||||
|
// dataGridViewShoess
|
||||||
|
//
|
||||||
|
dataGridViewShoess.AllowUserToResizeColumns = false;
|
||||||
|
dataGridViewShoess.AllowUserToResizeRows = false;
|
||||||
|
dataGridViewShoess.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewShoess.Columns.AddRange(new DataGridViewColumn[] { ColumnShoes, Column2 });
|
||||||
|
dataGridViewShoess.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewShoess.Location = new Point(3, 19);
|
||||||
|
dataGridViewShoess.MultiSelect = false;
|
||||||
|
dataGridViewShoess.Name = "dataGridViewShoess";
|
||||||
|
dataGridViewShoess.RowHeadersVisible = false;
|
||||||
|
dataGridViewShoess.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridViewShoess.Size = new Size(323, 258);
|
||||||
|
dataGridViewShoess.TabIndex = 8;
|
||||||
|
dataGridViewShoess.CellContentClick += dataGridViewShoess_CellContentClick;
|
||||||
|
//
|
||||||
|
// ColumnShoes
|
||||||
|
//
|
||||||
|
ColumnShoes.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
ColumnShoes.HeaderText = "Обувь";
|
||||||
|
ColumnShoes.Name = "ColumnShoes";
|
||||||
|
//
|
||||||
|
// Column2
|
||||||
|
//
|
||||||
|
Column2.HeaderText = "Количество";
|
||||||
|
Column2.Name = "Column2";
|
||||||
|
Column2.Width = 114;
|
||||||
|
//
|
||||||
|
// ButtonSave
|
||||||
|
//
|
||||||
|
ButtonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||||
|
ButtonSave.Location = new Point(35, 398);
|
||||||
|
ButtonSave.Name = "ButtonSave";
|
||||||
|
ButtonSave.Size = new Size(97, 36);
|
||||||
|
ButtonSave.TabIndex = 8;
|
||||||
|
ButtonSave.Text = "Сохранить";
|
||||||
|
ButtonSave.UseVisualStyleBackColor = true;
|
||||||
|
ButtonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
ButtonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
ButtonCancel.Location = new Point(216, 398);
|
||||||
|
ButtonCancel.Name = "ButtonCancel";
|
||||||
|
ButtonCancel.Size = new Size(97, 36);
|
||||||
|
ButtonCancel.TabIndex = 9;
|
||||||
|
ButtonCancel.Text = "Отмена";
|
||||||
|
ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// FormShoesReplenishment
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(353, 465);
|
||||||
|
Controls.Add(ButtonCancel);
|
||||||
|
Controls.Add(ButtonSave);
|
||||||
|
Controls.Add(groupBox1);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Controls.Add(comboBoxFactory);
|
||||||
|
Name = "FormShoesReplenishment";
|
||||||
|
Text = "FormShoesReplenishment";
|
||||||
|
Load += FormShoesReplenishment_Load;
|
||||||
|
groupBox1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewShoess).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Label label2;
|
||||||
|
private ComboBox comboBoxFactory;
|
||||||
|
private GroupBox groupBox1;
|
||||||
|
private DataGridView dataGridViewShoess;
|
||||||
|
private Button ButtonSave;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
private DataGridViewComboBoxColumn ColumnShoes;
|
||||||
|
private DataGridViewTextBoxColumn Column2;
|
||||||
|
}
|
||||||
|
}
|
84
ShoeStore/ShoeStore/Forms/FormShoesReplenishment.cs
Normal file
84
ShoeStore/ShoeStore/Forms/FormShoesReplenishment.cs
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
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 ShoeStore.Entities;
|
||||||
|
using ShoeStore.Repositories;
|
||||||
|
|
||||||
|
namespace ShoeStore.Forms
|
||||||
|
{
|
||||||
|
public partial class FormShoesReplenishment : Form
|
||||||
|
{
|
||||||
|
private readonly IShoesReplenishmentRepository _shoesReplenishmentRepository;
|
||||||
|
public FormShoesReplenishment(IShoesReplenishmentRepository shoesReplenishmentRepository,
|
||||||
|
IFactoryRepository factoryRepository,
|
||||||
|
IShoesRepository shoesRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_shoesReplenishmentRepository = shoesReplenishmentRepository ??
|
||||||
|
throw new
|
||||||
|
ArgumentNullException(nameof(shoesReplenishmentRepository));
|
||||||
|
comboBoxFactory.DataSource =
|
||||||
|
factoryRepository.ReadFactorys();
|
||||||
|
comboBoxFactory.DisplayMember = "FirstName";
|
||||||
|
comboBoxFactory.ValueMember = "Id";
|
||||||
|
ColumnShoes.DataSource = shoesRepository.ReadShoess();
|
||||||
|
ColumnShoes.DisplayMember = "Name";
|
||||||
|
ColumnShoes.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (dataGridViewShoess.RowCount < 1 || comboBoxFactory.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
_shoesReplenishmentRepository.CreateShoesReplenishment(ShoesReplenishment.CreateOpeartion(0,
|
||||||
|
(int)comboBoxFactory.SelectedValue!,
|
||||||
|
CreateListShoesShoesReplenishmentsFromDataGrid()));
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e) =>
|
||||||
|
Close();
|
||||||
|
private List<ShoesShoesReplenishment>
|
||||||
|
CreateListShoesShoesReplenishmentsFromDataGrid()
|
||||||
|
{
|
||||||
|
var list = new List<ShoesShoesReplenishment>();
|
||||||
|
foreach (DataGridViewRow row in dataGridViewShoess.Rows)
|
||||||
|
{
|
||||||
|
if (row.Cells["ColumnShoes"].Value == null ||
|
||||||
|
row.Cells["ColumnCount"].Value == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
list.Add(ShoesShoesReplenishment.CreateElement(0,
|
||||||
|
Convert.ToInt32(row.Cells["ColumnShoes"].Value),
|
||||||
|
Convert.ToInt32(row.Cells["ColumnCount"].Value)));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
|
||||||
|
}
|
||||||
|
private void dataGridViewShoess_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
private void FormShoesReplenishment_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
123
ShoeStore/ShoeStore/Forms/FormShoesReplenishment.resx
Normal file
123
ShoeStore/ShoeStore/Forms/FormShoesReplenishment.resx
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<value>True</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
115
ShoeStore/ShoeStore/Forms/FormShoesReplenishments.Designer.cs
generated
Normal file
115
ShoeStore/ShoeStore/Forms/FormShoesReplenishments.Designer.cs
generated
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
|
||||||
|
namespace ShoeStore.Forms
|
||||||
|
{
|
||||||
|
partial class FormShoesReplenishments
|
||||||
|
{
|
||||||
|
/// <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();
|
||||||
|
ButtonAdd = new Button();
|
||||||
|
dataGridViewData = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(ButtonDel);
|
||||||
|
panel1.Controls.Add(ButtonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(970, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(122, 450);
|
||||||
|
panel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ButtonDel
|
||||||
|
//
|
||||||
|
ButtonDel.BackgroundImage = Properties.Resources.Gradelink_cross_1;
|
||||||
|
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonDel.Location = new Point(16, 193);
|
||||||
|
ButtonDel.Name = "ButtonDel";
|
||||||
|
ButtonDel.Size = new Size(85, 78);
|
||||||
|
ButtonDel.TabIndex = 2;
|
||||||
|
ButtonDel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonDel.Click += ButtonDel_Click;
|
||||||
|
//
|
||||||
|
// ButtonAdd
|
||||||
|
//
|
||||||
|
ButtonAdd.BackgroundImage = Properties.Resources.Ambox_plus_svg;
|
||||||
|
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonAdd.Location = new Point(16, 27);
|
||||||
|
ButtonAdd.Name = "ButtonAdd";
|
||||||
|
ButtonAdd.Size = new Size(85, 77);
|
||||||
|
ButtonAdd.TabIndex = 0;
|
||||||
|
ButtonAdd.UseVisualStyleBackColor = true;
|
||||||
|
ButtonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridViewData
|
||||||
|
//
|
||||||
|
dataGridViewData.AllowUserToAddRows = false;
|
||||||
|
dataGridViewData.AllowUserToResizeColumns = false;
|
||||||
|
dataGridViewData.AllowUserToResizeRows = false;
|
||||||
|
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewData.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewData.Location = new Point(0, 0);
|
||||||
|
dataGridViewData.MultiSelect = false;
|
||||||
|
dataGridViewData.Name = "dataGridViewData";
|
||||||
|
dataGridViewData.ReadOnly = true;
|
||||||
|
dataGridViewData.RowHeadersVisible = false;
|
||||||
|
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridViewData.Size = new Size(970, 450);
|
||||||
|
dataGridViewData.TabIndex = 1;
|
||||||
|
dataGridViewData.CellContentClick += dataGridViewData_CellContentClick;
|
||||||
|
//
|
||||||
|
// FormShoesReplenishments
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1092, 450);
|
||||||
|
Controls.Add(dataGridViewData);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormShoesReplenishments";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Магазины";
|
||||||
|
Load += FormShoesReplenishments_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button ButtonDel;
|
||||||
|
private Button ButtonAdd;
|
||||||
|
private DataGridView dataGridViewData;
|
||||||
|
}
|
||||||
|
}
|
100
ShoeStore/ShoeStore/Forms/FormShoesReplenishments.cs
Normal file
100
ShoeStore/ShoeStore/Forms/FormShoesReplenishments.cs
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
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.Forms
|
||||||
|
{
|
||||||
|
public partial class FormShoesReplenishments : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly IShoesReplenishmentRepository
|
||||||
|
_shoesReplenishmentRepository;
|
||||||
|
public FormShoesReplenishments(IUnityContainer container,
|
||||||
|
IShoesReplenishmentRepository shoesReplenishmentRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_shoesReplenishmentRepository = shoesReplenishmentRepository ??
|
||||||
|
throw new
|
||||||
|
ArgumentNullException(nameof(shoesReplenishmentRepository));
|
||||||
|
}
|
||||||
|
private void FormShoesReplenishments_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<FormShoesReplenishment>().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
|
||||||
|
{
|
||||||
|
_shoesReplenishmentRepository.DeleteShoesReplenishment(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridViewData.DataSource =
|
||||||
|
_shoesReplenishmentRepository.ReadShoesReplenishment();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
private void dataGridViewData_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
120
ShoeStore/ShoeStore/Forms/FormShoesReplenishments.resx
Normal file
120
ShoeStore/ShoeStore/Forms/FormShoesReplenishments.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
173
ShoeStore/ShoeStore/Forms/FormShoesSale.Designer.cs
generated
Normal file
173
ShoeStore/ShoeStore/Forms/FormShoesSale.Designer.cs
generated
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
namespace ShoeStore.Forms
|
||||||
|
{
|
||||||
|
partial class FormShoesSale
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
comboBoxFactory = new ComboBox();
|
||||||
|
comboBoxShoes = new ComboBox();
|
||||||
|
comboBoxStore = new ComboBox();
|
||||||
|
label1 = new Label();
|
||||||
|
label2 = new Label();
|
||||||
|
label3 = new Label();
|
||||||
|
label4 = new Label();
|
||||||
|
ButtonSave = new Button();
|
||||||
|
ButtonCancel = new Button();
|
||||||
|
numericUpDownSpecificity = new NumericUpDown();
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownSpecificity).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// comboBoxFactory
|
||||||
|
//
|
||||||
|
comboBoxFactory.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxFactory.FormattingEnabled = true;
|
||||||
|
comboBoxFactory.Location = new Point(114, 36);
|
||||||
|
comboBoxFactory.Name = "comboBoxFactory";
|
||||||
|
comboBoxFactory.Size = new Size(211, 23);
|
||||||
|
comboBoxFactory.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// comboBoxShoes
|
||||||
|
//
|
||||||
|
comboBoxShoes.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxShoes.FormattingEnabled = true;
|
||||||
|
comboBoxShoes.Location = new Point(114, 86);
|
||||||
|
comboBoxShoes.Name = "comboBoxShoes";
|
||||||
|
comboBoxShoes.Size = new Size(211, 23);
|
||||||
|
comboBoxShoes.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// comboBoxStore
|
||||||
|
//
|
||||||
|
comboBoxStore.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
|
comboBoxStore.FormattingEnabled = true;
|
||||||
|
comboBoxStore.Location = new Point(114, 134);
|
||||||
|
comboBoxStore.Name = "comboBoxStore";
|
||||||
|
comboBoxStore.Size = new Size(211, 23);
|
||||||
|
comboBoxStore.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.AutoSize = true;
|
||||||
|
label1.Location = new Point(33, 39);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(44, 15);
|
||||||
|
label1.TabIndex = 3;
|
||||||
|
label1.Text = "Обувь:";
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.AutoSize = true;
|
||||||
|
label2.Location = new Point(33, 89);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(58, 15);
|
||||||
|
label2.TabIndex = 4;
|
||||||
|
label2.Text = "Фабрика:";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new Point(33, 137);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(57, 15);
|
||||||
|
label3.TabIndex = 5;
|
||||||
|
label3.Text = "Магазин:";
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.AutoSize = true;
|
||||||
|
label4.Location = new Point(33, 181);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(75, 15);
|
||||||
|
label4.TabIndex = 6;
|
||||||
|
label4.Text = "Количество:";
|
||||||
|
//
|
||||||
|
// ButtonSave
|
||||||
|
//
|
||||||
|
ButtonSave.Location = new Point(64, 233);
|
||||||
|
ButtonSave.Name = "ButtonSave";
|
||||||
|
ButtonSave.Size = new Size(75, 23);
|
||||||
|
ButtonSave.TabIndex = 7;
|
||||||
|
ButtonSave.Text = "Сохранить";
|
||||||
|
ButtonSave.UseVisualStyleBackColor = true;
|
||||||
|
ButtonSave.Click += ButtonSave_Click;
|
||||||
|
//
|
||||||
|
// ButtonCancel
|
||||||
|
//
|
||||||
|
ButtonCancel.Location = new Point(219, 233);
|
||||||
|
ButtonCancel.Name = "ButtonCancel";
|
||||||
|
ButtonCancel.Size = new Size(75, 23);
|
||||||
|
ButtonCancel.TabIndex = 8;
|
||||||
|
ButtonCancel.Text = "Отмена";
|
||||||
|
ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonCancel.Click += ButtonCancel_Click;
|
||||||
|
//
|
||||||
|
// numericUpDownSpecificity
|
||||||
|
//
|
||||||
|
numericUpDownSpecificity.Location = new Point(114, 179);
|
||||||
|
numericUpDownSpecificity.Maximum = new decimal(new int[] { 20, 0, 0, 0 });
|
||||||
|
numericUpDownSpecificity.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
numericUpDownSpecificity.Name = "numericUpDownSpecificity";
|
||||||
|
numericUpDownSpecificity.Size = new Size(104, 23);
|
||||||
|
numericUpDownSpecificity.TabIndex = 9;
|
||||||
|
numericUpDownSpecificity.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
||||||
|
//
|
||||||
|
// FormShoesSale
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(349, 293);
|
||||||
|
Controls.Add(numericUpDownSpecificity);
|
||||||
|
Controls.Add(ButtonCancel);
|
||||||
|
Controls.Add(ButtonSave);
|
||||||
|
Controls.Add(label4);
|
||||||
|
Controls.Add(label3);
|
||||||
|
Controls.Add(label2);
|
||||||
|
Controls.Add(label1);
|
||||||
|
Controls.Add(comboBoxStore);
|
||||||
|
Controls.Add(comboBoxShoes);
|
||||||
|
Controls.Add(comboBoxFactory);
|
||||||
|
Name = "FormShoesSale";
|
||||||
|
Text = "FormShoesSale";
|
||||||
|
Load += FormShoesSale_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)numericUpDownSpecificity).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private ComboBox comboBoxFactory;
|
||||||
|
private ComboBox comboBoxShoes;
|
||||||
|
private ComboBox comboBoxStore;
|
||||||
|
private Label label1;
|
||||||
|
private Label label2;
|
||||||
|
private Label label3;
|
||||||
|
private Label label4;
|
||||||
|
private Button ButtonSave;
|
||||||
|
private Button ButtonCancel;
|
||||||
|
private NumericUpDown numericUpDownSpecificity;
|
||||||
|
}
|
||||||
|
}
|
68
ShoeStore/ShoeStore/Forms/FormShoesSale.cs
Normal file
68
ShoeStore/ShoeStore/Forms/FormShoesSale.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
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 ShoeStore.Entities;
|
||||||
|
using ShoeStore.Repositories;
|
||||||
|
|
||||||
|
namespace ShoeStore.Forms
|
||||||
|
{
|
||||||
|
public partial class FormShoesSale : Form
|
||||||
|
{
|
||||||
|
private readonly IShoesSaleRepository _shoesSaleRepository;
|
||||||
|
public FormShoesSale(IShoesSaleRepository shoesSaleRepository, IShoesRepository shoesRepository, IFactoryRepository factoryRepository, IStoreRepository storeRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_shoesSaleRepository = shoesSaleRepository ??
|
||||||
|
throw new
|
||||||
|
ArgumentNullException(nameof(shoesSaleRepository));
|
||||||
|
comboBoxFactory.DataSource = factoryRepository.ReadFactorys();
|
||||||
|
comboBoxFactory.DisplayMember = "FactoryName";
|
||||||
|
comboBoxFactory.ValueMember = "Id";
|
||||||
|
comboBoxShoes.DataSource = shoesRepository.ReadShoess();
|
||||||
|
comboBoxShoes.DisplayMember = "Name";
|
||||||
|
comboBoxShoes.ValueMember = "Id";
|
||||||
|
comboBoxStore.DataSource = storeRepository.ReadStores();
|
||||||
|
comboBoxStore.DisplayMember = "StoreName";
|
||||||
|
comboBoxStore.ValueMember = "Id";
|
||||||
|
}
|
||||||
|
private void ButtonSave_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (comboBoxShoes.SelectedIndex < 0 ||
|
||||||
|
comboBoxFactory.SelectedIndex < 0 ||
|
||||||
|
comboBoxStore.SelectedIndex < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Имеются незаполненные поля");
|
||||||
|
}
|
||||||
|
_shoesSaleRepository.CreateShoesSale(ShoesSale.CreateOpeartion(
|
||||||
|
0,
|
||||||
|
(int)comboBoxShoes.SelectedValue!,
|
||||||
|
(int)comboBoxFactory.SelectedValue!,
|
||||||
|
(int)comboBoxStore.SelectedValue!,
|
||||||
|
Convert.ToInt32(numericUpDownSpecificity.Value)));
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при сохранении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonCancel_Click(object sender, EventArgs e) =>
|
||||||
|
Close();
|
||||||
|
private void FormShoesSale_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
120
ShoeStore/ShoeStore/Forms/FormShoesSale.resx
Normal file
120
ShoeStore/ShoeStore/Forms/FormShoesSale.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
98
ShoeStore/ShoeStore/Forms/FormShoesSales.Designer.cs
generated
Normal file
98
ShoeStore/ShoeStore/Forms/FormShoesSales.Designer.cs
generated
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
namespace ShoeStore.Forms
|
||||||
|
{
|
||||||
|
partial class FormShoesSales
|
||||||
|
{
|
||||||
|
/// <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();
|
||||||
|
ButtonAdd = new Button();
|
||||||
|
dataGridViewData = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(ButtonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(970, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(122, 450);
|
||||||
|
panel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// ButtonAdd
|
||||||
|
//
|
||||||
|
ButtonAdd.BackgroundImage = Properties.Resources.Ambox_plus_svg;
|
||||||
|
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonAdd.Location = new Point(16, 27);
|
||||||
|
ButtonAdd.Name = "ButtonAdd";
|
||||||
|
ButtonAdd.Size = new Size(85, 77);
|
||||||
|
ButtonAdd.TabIndex = 0;
|
||||||
|
ButtonAdd.UseVisualStyleBackColor = true;
|
||||||
|
ButtonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridViewData
|
||||||
|
//
|
||||||
|
dataGridViewData.AllowUserToAddRows = false;
|
||||||
|
dataGridViewData.AllowUserToResizeColumns = false;
|
||||||
|
dataGridViewData.AllowUserToResizeRows = false;
|
||||||
|
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewData.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewData.Location = new Point(0, 0);
|
||||||
|
dataGridViewData.MultiSelect = false;
|
||||||
|
dataGridViewData.Name = "dataGridViewData";
|
||||||
|
dataGridViewData.ReadOnly = true;
|
||||||
|
dataGridViewData.RowHeadersVisible = false;
|
||||||
|
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridViewData.Size = new Size(970, 450);
|
||||||
|
dataGridViewData.TabIndex = 1;
|
||||||
|
dataGridViewData.CellContentClick += dataGridViewData_CellContentClick;
|
||||||
|
//
|
||||||
|
// FormShoesSales
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1092, 450);
|
||||||
|
Controls.Add(dataGridViewData);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormShoesSales";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Фабрики";
|
||||||
|
Load += FormShoesSales_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button ButtonAdd;
|
||||||
|
private DataGridView dataGridViewData;
|
||||||
|
}
|
||||||
|
}
|
63
ShoeStore/ShoeStore/Forms/FormShoesSales.cs
Normal file
63
ShoeStore/ShoeStore/Forms/FormShoesSales.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
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.Forms
|
||||||
|
{
|
||||||
|
public partial class FormShoesSales : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly IShoesSaleRepository _ShoesSaleRepository;
|
||||||
|
public FormShoesSales(IUnityContainer container,
|
||||||
|
IShoesSaleRepository ShoesSaleRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_ShoesSaleRepository = ShoesSaleRepository ??
|
||||||
|
throw new
|
||||||
|
ArgumentNullException(nameof(ShoesSaleRepository));
|
||||||
|
}
|
||||||
|
private void FormShoesSales_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<FormShoesSale>().ShowDialog();
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridViewData.DataSource =
|
||||||
|
_ShoesSaleRepository.ReadShoesSales();
|
||||||
|
|
||||||
|
private void dataGridViewData_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
120
ShoeStore/ShoeStore/Forms/FormShoesSales.resx
Normal file
120
ShoeStore/ShoeStore/Forms/FormShoesSales.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
129
ShoeStore/ShoeStore/Forms/FormShoess.Designer.cs
generated
Normal file
129
ShoeStore/ShoeStore/Forms/FormShoess.Designer.cs
generated
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
|
||||||
|
namespace ShoeStore.Forms
|
||||||
|
{
|
||||||
|
partial class FormShoess
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
panel1 = new Panel();
|
||||||
|
ButtonDel = new Button();
|
||||||
|
ButtonUpd = new Button();
|
||||||
|
ButtonAdd = new Button();
|
||||||
|
dataGridViewData = new DataGridView();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(ButtonDel);
|
||||||
|
panel1.Controls.Add(ButtonUpd);
|
||||||
|
panel1.Controls.Add(ButtonAdd);
|
||||||
|
panel1.Dock = DockStyle.Right;
|
||||||
|
panel1.Location = new Point(970, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(122, 450);
|
||||||
|
panel1.TabIndex = 0;
|
||||||
|
panel1.Paint += panel1_Paint;
|
||||||
|
//
|
||||||
|
// ButtonDel
|
||||||
|
//
|
||||||
|
ButtonDel.BackgroundImage = Properties.Resources.Gradelink_cross_1;
|
||||||
|
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonDel.Location = new Point(16, 193);
|
||||||
|
ButtonDel.Name = "ButtonDel";
|
||||||
|
ButtonDel.Size = new Size(85, 78);
|
||||||
|
ButtonDel.TabIndex = 2;
|
||||||
|
ButtonDel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonDel.Click += ButtonDel_Click;
|
||||||
|
//
|
||||||
|
// ButtonUpd
|
||||||
|
//
|
||||||
|
ButtonUpd.BackgroundImage = Properties.Resources.Simpleicons_Business_pencil_striped_symbol_for_interface_edit_buttons_svg;
|
||||||
|
ButtonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonUpd.Location = new Point(16, 110);
|
||||||
|
ButtonUpd.Name = "ButtonUpd";
|
||||||
|
ButtonUpd.Size = new Size(85, 77);
|
||||||
|
ButtonUpd.TabIndex = 1;
|
||||||
|
ButtonUpd.UseVisualStyleBackColor = true;
|
||||||
|
ButtonUpd.Click += ButtonUpd_Click;
|
||||||
|
//
|
||||||
|
// ButtonAdd
|
||||||
|
//
|
||||||
|
ButtonAdd.BackgroundImage = Properties.Resources.Ambox_plus_svg;
|
||||||
|
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
|
ButtonAdd.Location = new Point(16, 27);
|
||||||
|
ButtonAdd.Name = "ButtonAdd";
|
||||||
|
ButtonAdd.Size = new Size(85, 77);
|
||||||
|
ButtonAdd.TabIndex = 0;
|
||||||
|
ButtonAdd.UseVisualStyleBackColor = true;
|
||||||
|
ButtonAdd.Click += ButtonAdd_Click;
|
||||||
|
//
|
||||||
|
// dataGridViewData
|
||||||
|
//
|
||||||
|
dataGridViewData.AllowUserToAddRows = false;
|
||||||
|
dataGridViewData.AllowUserToResizeColumns = false;
|
||||||
|
dataGridViewData.AllowUserToResizeRows = false;
|
||||||
|
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||||
|
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridViewData.Dock = DockStyle.Fill;
|
||||||
|
dataGridViewData.Location = new Point(0, 0);
|
||||||
|
dataGridViewData.MultiSelect = false;
|
||||||
|
dataGridViewData.Name = "dataGridViewData";
|
||||||
|
dataGridViewData.ReadOnly = true;
|
||||||
|
dataGridViewData.RowHeadersVisible = false;
|
||||||
|
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
|
dataGridViewData.Size = new Size(970, 450);
|
||||||
|
dataGridViewData.TabIndex = 1;
|
||||||
|
dataGridViewData.CellContentClick += dataGridViewData_CellContentClick;
|
||||||
|
//
|
||||||
|
// FormShoess
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1092, 450);
|
||||||
|
Controls.Add(dataGridViewData);
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "FormShoess";
|
||||||
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
|
Text = "Обувь";
|
||||||
|
Load += FormStores_Load;
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private Panel panel1;
|
||||||
|
private Button ButtonDel;
|
||||||
|
private Button ButtonUpd;
|
||||||
|
private Button ButtonAdd;
|
||||||
|
private DataGridView dataGridViewData;
|
||||||
|
}
|
||||||
|
}
|
127
ShoeStore/ShoeStore/Forms/FormShoess.cs
Normal file
127
ShoeStore/ShoeStore/Forms/FormShoess.cs
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
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.Forms
|
||||||
|
{
|
||||||
|
public partial class FormShoess : Form
|
||||||
|
{
|
||||||
|
private readonly IUnityContainer _container;
|
||||||
|
private readonly IShoesRepository _shoesRepository;
|
||||||
|
public FormShoess(IUnityContainer container, IShoesRepository
|
||||||
|
shoesRepository)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_container = container ??
|
||||||
|
throw new ArgumentNullException(nameof(container));
|
||||||
|
_shoesRepository = shoesRepository ??
|
||||||
|
throw new ArgumentNullException(nameof(shoesRepository));
|
||||||
|
}
|
||||||
|
private void FormShoess_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<FormShoes>().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<FormShoes>();
|
||||||
|
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
|
||||||
|
{
|
||||||
|
_shoesRepository.DeleteShoes(findId);
|
||||||
|
LoadList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка при удалении",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void LoadList() => dataGridViewData.DataSource =
|
||||||
|
_shoesRepository.ReadShoess();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dataGridViewData_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void panel1_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
private void FormStores_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
120
ShoeStore/ShoeStore/Forms/FormShoess.resx
Normal file
120
ShoeStore/ShoeStore/Forms/FormShoess.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
42
ShoeStore/ShoeStore/Forms/FormStore.Designer.cs
generated
42
ShoeStore/ShoeStore/Forms/FormStore.Designer.cs
generated
@ -37,8 +37,8 @@
|
|||||||
numericUpDownEmployees = new NumericUpDown();
|
numericUpDownEmployees = new NumericUpDown();
|
||||||
label5 = new Label();
|
label5 = new Label();
|
||||||
numericUpDownVisitors = new NumericUpDown();
|
numericUpDownVisitors = new NumericUpDown();
|
||||||
button1 = new Button();
|
ButtonSave = new Button();
|
||||||
button2 = new Button();
|
ButtonCancel = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownEmployees).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownEmployees).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)numericUpDownVisitors).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numericUpDownVisitors).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@ -119,31 +119,33 @@
|
|||||||
numericUpDownVisitors.Size = new Size(60, 23);
|
numericUpDownVisitors.Size = new Size(60, 23);
|
||||||
numericUpDownVisitors.TabIndex = 9;
|
numericUpDownVisitors.TabIndex = 9;
|
||||||
//
|
//
|
||||||
// button1
|
// ButtonSave
|
||||||
//
|
//
|
||||||
button1.Location = new Point(39, 234);
|
ButtonSave.Location = new Point(39, 234);
|
||||||
button1.Name = "button1";
|
ButtonSave.Name = "ButtonSave";
|
||||||
button1.Size = new Size(125, 23);
|
ButtonSave.Size = new Size(125, 23);
|
||||||
button1.TabIndex = 10;
|
ButtonSave.TabIndex = 10;
|
||||||
button1.Text = "Сохраить";
|
ButtonSave.Text = "Сохраить";
|
||||||
button1.UseVisualStyleBackColor = true;
|
ButtonSave.UseVisualStyleBackColor = true;
|
||||||
|
ButtonSave.Click += ButtonSave_Click;
|
||||||
//
|
//
|
||||||
// button2
|
// ButtonCancel
|
||||||
//
|
//
|
||||||
button2.Location = new Point(214, 234);
|
ButtonCancel.Location = new Point(214, 234);
|
||||||
button2.Name = "button2";
|
ButtonCancel.Name = "ButtonCancel";
|
||||||
button2.Size = new Size(125, 23);
|
ButtonCancel.Size = new Size(125, 23);
|
||||||
button2.TabIndex = 11;
|
ButtonCancel.TabIndex = 11;
|
||||||
button2.Text = "Отмена";
|
ButtonCancel.Text = "Отмена";
|
||||||
button2.UseVisualStyleBackColor = true;
|
ButtonCancel.UseVisualStyleBackColor = true;
|
||||||
|
ButtonCancel.Click += ButtonCancel_Click;
|
||||||
//
|
//
|
||||||
// FormStore
|
// FormStore
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(392, 304);
|
ClientSize = new Size(392, 304);
|
||||||
Controls.Add(button2);
|
Controls.Add(ButtonCancel);
|
||||||
Controls.Add(button1);
|
Controls.Add(ButtonSave);
|
||||||
Controls.Add(numericUpDownVisitors);
|
Controls.Add(numericUpDownVisitors);
|
||||||
Controls.Add(label5);
|
Controls.Add(label5);
|
||||||
Controls.Add(numericUpDownEmployees);
|
Controls.Add(numericUpDownEmployees);
|
||||||
@ -174,7 +176,7 @@
|
|||||||
private NumericUpDown numericUpDownEmployees;
|
private NumericUpDown numericUpDownEmployees;
|
||||||
private Label label5;
|
private Label label5;
|
||||||
private NumericUpDown numericUpDownVisitors;
|
private NumericUpDown numericUpDownVisitors;
|
||||||
private Button button1;
|
private Button ButtonSave;
|
||||||
private Button button2;
|
private Button ButtonCancel;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -84,4 +84,6 @@ public partial class FormStore : Form
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
68
ShoeStore/ShoeStore/Forms/FormStores.Designer.cs
generated
68
ShoeStore/ShoeStore/Forms/FormStores.Designer.cs
generated
@ -29,9 +29,9 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
panel1 = new Panel();
|
panel1 = new Panel();
|
||||||
button3 = new Button();
|
ButtonDel = new Button();
|
||||||
button2 = new Button();
|
ButtonUpd = new Button();
|
||||||
button1 = new Button();
|
ButtonAdd = new Button();
|
||||||
dataGridViewData = new DataGridView();
|
dataGridViewData = new DataGridView();
|
||||||
panel1.SuspendLayout();
|
panel1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||||
@ -39,44 +39,46 @@
|
|||||||
//
|
//
|
||||||
// panel1
|
// panel1
|
||||||
//
|
//
|
||||||
panel1.Controls.Add(button3);
|
panel1.Controls.Add(ButtonDel);
|
||||||
panel1.Controls.Add(button2);
|
panel1.Controls.Add(ButtonUpd);
|
||||||
panel1.Controls.Add(button1);
|
panel1.Controls.Add(ButtonAdd);
|
||||||
panel1.Dock = DockStyle.Right;
|
panel1.Dock = DockStyle.Right;
|
||||||
panel1.Location = new Point(970, 0);
|
panel1.Location = new Point(970, 0);
|
||||||
panel1.Name = "panel1";
|
panel1.Name = "panel1";
|
||||||
panel1.Size = new Size(122, 450);
|
panel1.Size = new Size(122, 450);
|
||||||
panel1.TabIndex = 0;
|
panel1.TabIndex = 0;
|
||||||
|
panel1.Paint += panel1_Paint;
|
||||||
//
|
//
|
||||||
// button3
|
// ButtonDel
|
||||||
//
|
//
|
||||||
button3.BackgroundImage = Properties.Resources.Gradelink_cross_1;
|
ButtonDel.BackgroundImage = Properties.Resources.Gradelink_cross_1;
|
||||||
button3.BackgroundImageLayout = ImageLayout.Stretch;
|
ButtonDel.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
button3.Location = new Point(16, 193);
|
ButtonDel.Location = new Point(16, 193);
|
||||||
button3.Name = "button3";
|
ButtonDel.Name = "ButtonDel";
|
||||||
button3.Size = new Size(85, 78);
|
ButtonDel.Size = new Size(85, 78);
|
||||||
button3.TabIndex = 2;
|
ButtonDel.TabIndex = 2;
|
||||||
button3.UseVisualStyleBackColor = true;
|
ButtonDel.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// button2
|
// ButtonUpd
|
||||||
//
|
//
|
||||||
button2.BackgroundImage = Properties.Resources.Simpleicons_Business_pencil_striped_symbol_for_interface_edit_buttons_svg;
|
ButtonUpd.BackgroundImage = Properties.Resources.Simpleicons_Business_pencil_striped_symbol_for_interface_edit_buttons_svg;
|
||||||
button2.BackgroundImageLayout = ImageLayout.Stretch;
|
ButtonUpd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
button2.Location = new Point(16, 110);
|
ButtonUpd.Location = new Point(16, 110);
|
||||||
button2.Name = "button2";
|
ButtonUpd.Name = "ButtonUpd";
|
||||||
button2.Size = new Size(85, 77);
|
ButtonUpd.Size = new Size(85, 77);
|
||||||
button2.TabIndex = 1;
|
ButtonUpd.TabIndex = 1;
|
||||||
button2.UseVisualStyleBackColor = true;
|
ButtonUpd.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// button1
|
// ButtonAdd
|
||||||
//
|
//
|
||||||
button1.BackgroundImage = Properties.Resources.Ambox_plus_svg;
|
ButtonAdd.BackgroundImage = Properties.Resources.Ambox_plus_svg;
|
||||||
button1.BackgroundImageLayout = ImageLayout.Stretch;
|
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
button1.Location = new Point(16, 27);
|
ButtonAdd.Location = new Point(16, 27);
|
||||||
button1.Name = "button1";
|
ButtonAdd.Name = "ButtonAdd";
|
||||||
button1.Size = new Size(85, 77);
|
ButtonAdd.Size = new Size(85, 77);
|
||||||
button1.TabIndex = 0;
|
ButtonAdd.TabIndex = 0;
|
||||||
button1.UseVisualStyleBackColor = true;
|
ButtonAdd.UseVisualStyleBackColor = true;
|
||||||
|
ButtonAdd.Click += ButtonAdd_Click;
|
||||||
//
|
//
|
||||||
// dataGridViewData
|
// dataGridViewData
|
||||||
//
|
//
|
||||||
@ -115,9 +117,9 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private Panel panel1;
|
private Panel panel1;
|
||||||
private Button button3;
|
private Button ButtonDel;
|
||||||
private Button button2;
|
private Button ButtonUpd;
|
||||||
private Button button1;
|
private Button ButtonAdd;
|
||||||
private DataGridView dataGridViewData;
|
private DataGridView dataGridViewData;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -113,6 +113,12 @@ namespace ShoeStore.Forms
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void panel1_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ public class FactoryRepository : IFactoryRepository
|
|||||||
|
|
||||||
public Factory ReadFactoryById(int id)
|
public Factory ReadFactoryById(int id)
|
||||||
{
|
{
|
||||||
return Factory.CreateEntity(0, string.Empty, string.Empty,
|
return Factory.CreateEntity(0, string.Empty,
|
||||||
Manufacturer.None);
|
Manufacturer.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user