diff --git a/ShoeStore/ShoeStore/Entities/Factory.cs b/ShoeStore/ShoeStore/Entities/Factory.cs
index fe664b5..e0bc30a 100644
--- a/ShoeStore/ShoeStore/Entities/Factory.cs
+++ b/ShoeStore/ShoeStore/Entities/Factory.cs
@@ -11,16 +11,14 @@ public class Factory
{
public int Id { get; private set; }
public string FactoryName { get; private set; } = string.Empty;
- public string LastName { get; private set; } = string.Empty;
public Manufacturer Manufacturer { get; private set; }
- public static Factory CreateEntity(int id, string factoryName, string last,
+ public static Factory CreateEntity(int id, string factoryName,
Manufacturer manufacturer)
{
return new Factory
{
Id = id,
FactoryName = factoryName ?? string.Empty,
- LastName = last ?? string.Empty,
Manufacturer = manufacturer
};
}
diff --git a/ShoeStore/ShoeStore/Forms/Form1.Designer.cs b/ShoeStore/ShoeStore/Forms/Form1.Designer.cs
deleted file mode 100644
index 79d2801..0000000
--- a/ShoeStore/ShoeStore/Forms/Form1.Designer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace ShoeStore.Forms
-{
- partial class Form1
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
- this.Text = "Form1";
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/ShoeStore/ShoeStore/Forms/FormFactory.Designer.cs b/ShoeStore/ShoeStore/Forms/FormFactory.Designer.cs
new file mode 100644
index 0000000..ffbb94b
--- /dev/null
+++ b/ShoeStore/ShoeStore/Forms/FormFactory.Designer.cs
@@ -0,0 +1,118 @@
+namespace ShoeStore.Forms
+{
+ partial class FormFactory
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ comboBox1 = new ComboBox();
+ label1 = new Label();
+ label2 = new Label();
+ textBox1 = new TextBox();
+ button1 = new Button();
+ button2 = new Button();
+ SuspendLayout();
+ //
+ // comboBox1
+ //
+ comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
+ comboBox1.FormattingEnabled = true;
+ comboBox1.Location = new Point(74, 79);
+ comboBox1.Name = "comboBox1";
+ comboBox1.Size = new Size(182, 23);
+ comboBox1.TabIndex = 0;
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Location = new Point(22, 29);
+ label1.Name = "label1";
+ label1.Size = new Size(59, 15);
+ label1.TabIndex = 1;
+ label1.Text = "Название";
+ label1.Click += label1_Click;
+ //
+ // label2
+ //
+ label2.AutoSize = true;
+ label2.Location = new Point(22, 82);
+ label2.Name = "label2";
+ label2.Size = new Size(46, 15);
+ label2.TabIndex = 2;
+ label2.Text = "Страна";
+ //
+ // textBox1
+ //
+ textBox1.Location = new Point(87, 26);
+ textBox1.Name = "textBox1";
+ textBox1.Size = new Size(169, 23);
+ textBox1.TabIndex = 3;
+ //
+ // button1
+ //
+ button1.Location = new Point(22, 140);
+ button1.Name = "button1";
+ button1.Size = new Size(102, 23);
+ button1.TabIndex = 4;
+ button1.Text = "Сохранить";
+ button1.UseVisualStyleBackColor = true;
+ //
+ // button2
+ //
+ button2.Location = new Point(158, 140);
+ button2.Name = "button2";
+ button2.Size = new Size(98, 23);
+ button2.TabIndex = 5;
+ button2.Text = "Отмена";
+ button2.UseVisualStyleBackColor = true;
+ //
+ // FormFactory
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(280, 199);
+ Controls.Add(button2);
+ Controls.Add(button1);
+ Controls.Add(textBox1);
+ Controls.Add(label2);
+ Controls.Add(label1);
+ Controls.Add(comboBox1);
+ Name = "FormFactory";
+ Text = "FormFactory";
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private ComboBox comboBox1;
+ private Label label1;
+ private Label label2;
+ private TextBox textBox1;
+ private Button button1;
+ private Button button2;
+ }
+}
\ No newline at end of file
diff --git a/ShoeStore/ShoeStore/Forms/Form1.cs b/ShoeStore/ShoeStore/Forms/FormFactory.cs
similarity index 66%
rename from ShoeStore/ShoeStore/Forms/Form1.cs
rename to ShoeStore/ShoeStore/Forms/FormFactory.cs
index bff4da3..d1f3d2c 100644
--- a/ShoeStore/ShoeStore/Forms/Form1.cs
+++ b/ShoeStore/ShoeStore/Forms/FormFactory.cs
@@ -10,11 +10,16 @@ using System.Windows.Forms;
namespace ShoeStore.Forms
{
- public partial class Form1 : Form
+ public partial class FormFactory : Form
{
- public Form1()
+ public FormFactory()
{
InitializeComponent();
}
+
+ private void label1_Click(object sender, EventArgs e)
+ {
+
+ }
}
}
diff --git a/ShoeStore/ShoeStore/Forms/Form1.resx b/ShoeStore/ShoeStore/Forms/FormFactory.resx
similarity index 93%
rename from ShoeStore/ShoeStore/Forms/Form1.resx
rename to ShoeStore/ShoeStore/Forms/FormFactory.resx
index 1af7de1..af32865 100644
--- a/ShoeStore/ShoeStore/Forms/Form1.resx
+++ b/ShoeStore/ShoeStore/Forms/FormFactory.resx
@@ -1,17 +1,17 @@
-
diff --git a/ShoeStore/ShoeStore/Forms/FormStore.Designer.cs b/ShoeStore/ShoeStore/Forms/FormStore.Designer.cs
index 8c20130..1bbe695 100644
--- a/ShoeStore/ShoeStore/Forms/FormStore.Designer.cs
+++ b/ShoeStore/ShoeStore/Forms/FormStore.Designer.cs
@@ -28,19 +28,153 @@
///
private void InitializeComponent()
{
+ textBoxStoreType = new TextBox();
+ label1 = new Label();
+ label2 = new Label();
+ textBoxStoreName = new TextBox();
+ label3 = new Label();
+ label4 = new Label();
+ numericUpDownEmployees = new NumericUpDown();
+ label5 = new Label();
+ numericUpDownVisitors = new NumericUpDown();
+ button1 = new Button();
+ button2 = new Button();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownEmployees).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownVisitors).BeginInit();
SuspendLayout();
//
+ // textBoxStoreType
+ //
+ textBoxStoreType.Location = new Point(161, 47);
+ textBoxStoreType.Name = "textBoxStoreType";
+ textBoxStoreType.Size = new Size(178, 23);
+ textBoxStoreType.TabIndex = 0;
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Location = new Point(39, 50);
+ label1.Name = "label1";
+ label1.Size = new Size(84, 15);
+ label1.TabIndex = 1;
+ label1.Text = "Тип магазина:";
+ //
+ // label2
+ //
+ label2.AutoSize = true;
+ label2.Location = new Point(39, 94);
+ label2.Name = "label2";
+ label2.Size = new Size(116, 15);
+ label2.TabIndex = 2;
+ label2.Text = "Название магазина:";
+ //
+ // textBoxStoreName
+ //
+ textBoxStoreName.Location = new Point(161, 91);
+ textBoxStoreName.Name = "textBoxStoreName";
+ textBoxStoreName.Size = new Size(178, 23);
+ textBoxStoreName.TabIndex = 3;
+ //
+ // label3
+ //
+ label3.AutoSize = true;
+ label3.Location = new Point(39, 137);
+ label3.Name = "label3";
+ label3.Size = new Size(0, 15);
+ label3.TabIndex = 4;
+ //
+ // label4
+ //
+ label4.AutoSize = true;
+ label4.Location = new Point(39, 152);
+ label4.Name = "label4";
+ label4.Size = new Size(148, 15);
+ label4.TabIndex = 6;
+ label4.Text = "Количество сотрудников:";
+ //
+ // numericUpDownEmployees
+ //
+ numericUpDownEmployees.Location = new Point(193, 150);
+ numericUpDownEmployees.Maximum = new decimal(new int[] { 20, 0, 0, 0 });
+ numericUpDownEmployees.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
+ numericUpDownEmployees.Name = "numericUpDownEmployees";
+ numericUpDownEmployees.Size = new Size(60, 23);
+ numericUpDownEmployees.TabIndex = 7;
+ numericUpDownEmployees.Value = new decimal(new int[] { 1, 0, 0, 0 });
+ //
+ // label5
+ //
+ label5.AutoSize = true;
+ label5.Location = new Point(39, 191);
+ label5.Name = "label5";
+ label5.Size = new Size(147, 15);
+ label5.TabIndex = 8;
+ label5.Text = "Количество посетителей:";
+ //
+ // numericUpDownVisitors
+ //
+ numericUpDownVisitors.Location = new Point(193, 189);
+ numericUpDownVisitors.Maximum = new decimal(new int[] { 30, 0, 0, 0 });
+ numericUpDownVisitors.Name = "numericUpDownVisitors";
+ numericUpDownVisitors.Size = new Size(60, 23);
+ numericUpDownVisitors.TabIndex = 9;
+ //
+ // button1
+ //
+ button1.Location = new Point(39, 234);
+ button1.Name = "button1";
+ button1.Size = new Size(125, 23);
+ button1.TabIndex = 10;
+ button1.Text = "Сохраить";
+ button1.UseVisualStyleBackColor = true;
+ //
+ // button2
+ //
+ button2.Location = new Point(214, 234);
+ button2.Name = "button2";
+ button2.Size = new Size(125, 23);
+ button2.TabIndex = 11;
+ button2.Text = "Отмена";
+ button2.UseVisualStyleBackColor = true;
+ //
// FormStore
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(800, 450);
+ ClientSize = new Size(392, 304);
+ Controls.Add(button2);
+ Controls.Add(button1);
+ Controls.Add(numericUpDownVisitors);
+ Controls.Add(label5);
+ Controls.Add(numericUpDownEmployees);
+ Controls.Add(label4);
+ Controls.Add(label3);
+ Controls.Add(textBoxStoreName);
+ Controls.Add(label2);
+ Controls.Add(label1);
+ Controls.Add(textBoxStoreType);
Name = "FormStore";
- Text = "FormStore";
+ StartPosition = FormStartPosition.CenterParent;
+ Text = "Магазин";
Load += FormStore_Load;
+ ((System.ComponentModel.ISupportInitialize)numericUpDownEmployees).EndInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownVisitors).EndInit();
ResumeLayout(false);
+ PerformLayout();
}
#endregion
+
+ private TextBox textBoxStoreType;
+ private Label label1;
+ private Label label2;
+ private TextBox textBoxStoreName;
+ private Label label3;
+ private Label label4;
+ private NumericUpDown numericUpDownEmployees;
+ private Label label5;
+ private NumericUpDown numericUpDownVisitors;
+ private Button button1;
+ private Button button2;
}
}
\ No newline at end of file
diff --git a/ShoeStore/ShoeStore/Forms/FormStore.cs b/ShoeStore/ShoeStore/Forms/FormStore.cs
index 0ef8f3a..64d6397 100644
--- a/ShoeStore/ShoeStore/Forms/FormStore.cs
+++ b/ShoeStore/ShoeStore/Forms/FormStore.cs
@@ -1,4 +1,5 @@
-using ShoeStore.Forms;
+using ShoeStore.Entities;
+using ShoeStore.Repositories;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -9,79 +10,78 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
-namespace ShoeStore.Forms
+namespace ShoeStore.Forms;
+
+public partial class FormStore : Form
{
- public partial class FormStore : Form
+ private readonly IStoreRepository _storeRepository;
+ private int? _storeId;
+ public int Id
{
- private readonly IStoreRepository _storeRepository;
- private int? _storeId;
- public int Id
- {
- set
- {
- try
- {
- var store =
- _storeRepository.ReadStoreById(value);
- if (store == null)
- {
-
-
-
- throw new InvalidDataException(nameof(store));
- }
- textBoxAnimalSpecies.Text = store.AnimalSpecies;
- textBoxAnimalNickName.Text =
- store.AnimalNickName;
- numericUpDownAge.Value = store.Age;
- numericUpDownWeight.Value =
- (decimal)store.Weight;
- _storeId = value;
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- }
- }
- public FormAnimal(IAnimalRepository storeRepository)
- {
- InitializeComponent();
- _storeRepository = storeRepository ??
- throw new
- ArgumentNullException(nameof(storeRepository));
- }
- private void ButtonSave_Click(object sender, EventArgs e)
+ set
{
try
{
- if (string.IsNullOrWhiteSpace(textBoxAnimalSpecies.Text) || string.IsNullOrWhiteSpace(textBoxAnimalNickName.Text))
+ var store = _storeRepository.ReadStoreById(value);
+ if (store == null)
{
- throw new Exception("Имеются незаполненные поля");
+ throw new InvalidDataException(nameof(store));
}
- if (_storeId.HasValue)
- {
- _storeRepository.UpdateAnimal(CreateAnimal(_storeId.Value));
- }
- else
- {
- _storeRepository.CreateAnimal(CreateAnimal(0));
- }
- Close();
+
+ textBoxStoreType.Text = store.StoreType;
+ textBoxStoreName.Text = store.StoreName;
+ numericUpDownEmployees.Value = store.Employees;
+ numericUpDownVisitors.Value = (decimal)store.Visitors;
+ _storeId = value;
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Ошибка при сохранении",
- MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
}
}
- private void ButtonCancel_Click(object sender, EventArgs e) =>
- Close();
- private Animal CreateAnimal(int id) => Animal.CreateEntity(id,
- textBoxAnimalSpecies.Text,
- textBoxAnimalNickName.Text,
- Convert.ToInt32(numericUpDownAge.Value),
- Convert.ToDouble(numericUpDownWeight.Value));
+ }
+ public FormStore(IStoreRepository storeRepository)
+ {
+ InitializeComponent();
+ _storeRepository = storeRepository ??
+ throw new ArgumentNullException(nameof(storeRepository));
+ }
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (string.IsNullOrWhiteSpace(textBoxStoreType.Text)
+ ||
+ string.IsNullOrWhiteSpace(textBoxStoreName.Text))
+ {
+ throw new Exception("Имеются незаполненные поля");
+ }
+ if (_storeId.HasValue)
+ {
+ _storeRepository.UpdateStore(CreateStore(_storeId.Value));
+ }
+ else
+ {
+ _storeRepository.CreateStore(CreateStore(0));
+ }
+ Close();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при сохранении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ private void ButtonCancel_Click(object sender, EventArgs e) => Close();
+ private Store CreateStore(int id) => Store.CreateEntity(id,
+ textBoxStoreType.Text,
+ textBoxStoreName.Text,
+ Convert.ToInt32(numericUpDownEmployees.Value),
+ Convert.ToDouble(numericUpDownVisitors.Value));
+
+ private void FormStore_Load(object sender, EventArgs e)
+ {
+
}
}
diff --git a/ShoeStore/ShoeStore/Forms/FormStores.Designer.cs b/ShoeStore/ShoeStore/Forms/FormStores.Designer.cs
new file mode 100644
index 0000000..30f2227
--- /dev/null
+++ b/ShoeStore/ShoeStore/Forms/FormStores.Designer.cs
@@ -0,0 +1,123 @@
+namespace ShoeStore.Forms
+{
+ partial class FormStores
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ panel1 = new Panel();
+ button3 = new Button();
+ button2 = new Button();
+ button1 = new Button();
+ dataGridViewData = new DataGridView();
+ panel1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
+ SuspendLayout();
+ //
+ // panel1
+ //
+ panel1.Controls.Add(button3);
+ panel1.Controls.Add(button2);
+ panel1.Controls.Add(button1);
+ panel1.Dock = DockStyle.Right;
+ panel1.Location = new Point(970, 0);
+ panel1.Name = "panel1";
+ panel1.Size = new Size(122, 450);
+ panel1.TabIndex = 0;
+ //
+ // button3
+ //
+ button3.BackgroundImage = Properties.Resources.Gradelink_cross_1;
+ button3.BackgroundImageLayout = ImageLayout.Stretch;
+ button3.Location = new Point(16, 193);
+ button3.Name = "button3";
+ button3.Size = new Size(85, 78);
+ button3.TabIndex = 2;
+ button3.UseVisualStyleBackColor = true;
+ //
+ // button2
+ //
+ button2.BackgroundImage = Properties.Resources.Simpleicons_Business_pencil_striped_symbol_for_interface_edit_buttons_svg;
+ button2.BackgroundImageLayout = ImageLayout.Stretch;
+ button2.Location = new Point(16, 110);
+ button2.Name = "button2";
+ button2.Size = new Size(85, 77);
+ button2.TabIndex = 1;
+ button2.UseVisualStyleBackColor = true;
+ //
+ // button1
+ //
+ button1.BackgroundImage = Properties.Resources.Ambox_plus_svg;
+ button1.BackgroundImageLayout = ImageLayout.Stretch;
+ button1.Location = new Point(16, 27);
+ button1.Name = "button1";
+ button1.Size = new Size(85, 77);
+ button1.TabIndex = 0;
+ button1.UseVisualStyleBackColor = true;
+ //
+ // 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;
+ //
+ // FormStores
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(1092, 450);
+ Controls.Add(dataGridViewData);
+ Controls.Add(panel1);
+ Name = "FormStores";
+ StartPosition = FormStartPosition.CenterParent;
+ Text = "Магазины";
+ Load += FormStores_Load;
+ panel1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private Panel panel1;
+ private Button button3;
+ private Button button2;
+ private Button button1;
+ private DataGridView dataGridViewData;
+ }
+}
\ No newline at end of file
diff --git a/ShoeStore/ShoeStore/Forms/FormStores.cs b/ShoeStore/ShoeStore/Forms/FormStores.cs
new file mode 100644
index 0000000..0ca463c
--- /dev/null
+++ b/ShoeStore/ShoeStore/Forms/FormStores.cs
@@ -0,0 +1,118 @@
+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 FormStores : Form
+ {
+ private readonly IUnityContainer _container;
+ private readonly IStoreRepository _storeRepository;
+ public FormStores(IUnityContainer container, IStoreRepository
+ storeRepository)
+ {
+ InitializeComponent();
+ _container = container ??
+ throw new ArgumentNullException(nameof(container));
+ _storeRepository = storeRepository ??
+ throw new
+ ArgumentNullException(nameof(storeRepository));
+ }
+ private void FormStores_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().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();
+ 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
+ {
+ _storeRepository.DeleteStore(findId);
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при удалении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ private void LoadList() => dataGridViewData.DataSource =
+ _storeRepository.ReadStores();
+ 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)
+ {
+
+ }
+ }
+
+}
diff --git a/ShoeStore/ShoeStore/Forms/FormStores.resx b/ShoeStore/ShoeStore/Forms/FormStores.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/ShoeStore/ShoeStore/Forms/FormStores.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ShoeStore/ShoeStore/Properties/Resources.Designer.cs b/ShoeStore/ShoeStore/Properties/Resources.Designer.cs
index a47acfc..9301801 100644
--- a/ShoeStore/ShoeStore/Properties/Resources.Designer.cs
+++ b/ShoeStore/ShoeStore/Properties/Resources.Designer.cs
@@ -60,6 +60,36 @@ namespace ShoeStore.Properties {
}
}
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap _862518 {
+ get {
+ object obj = ResourceManager.GetObject("862518", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap _8625181 {
+ get {
+ object obj = ResourceManager.GetObject("8625181", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Ambox_plus_svg {
+ get {
+ object obj = ResourceManager.GetObject("Ambox_plus.svg", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
///
@@ -69,5 +99,25 @@ namespace ShoeStore.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Gradelink_cross_1 {
+ get {
+ object obj = ResourceManager.GetObject("Gradelink-cross-1", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Simpleicons_Business_pencil_striped_symbol_for_interface_edit_buttons_svg {
+ get {
+ object obj = ResourceManager.GetObject("Simpleicons_Business_pencil-striped-symbol-for-interface-edit-buttons.svg", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
}
}
diff --git a/ShoeStore/ShoeStore/Properties/Resources.resx b/ShoeStore/ShoeStore/Properties/Resources.resx
index 5794ac6..e75fd58 100644
--- a/ShoeStore/ShoeStore/Properties/Resources.resx
+++ b/ShoeStore/ShoeStore/Properties/Resources.resx
@@ -121,4 +121,19 @@
..\Resources\fb3882d00f3138e7a504134cff73630f.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\862518.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Gradelink-cross-1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Ambox_plus.svg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\8625181.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\Simpleicons_Business_pencil-striped-symbol-for-interface-edit-buttons.svg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/ShoeStore/ShoeStore/Resources/862518.png b/ShoeStore/ShoeStore/Resources/862518.png
new file mode 100644
index 0000000..b848547
Binary files /dev/null and b/ShoeStore/ShoeStore/Resources/862518.png differ
diff --git a/ShoeStore/ShoeStore/Resources/8625181.png b/ShoeStore/ShoeStore/Resources/8625181.png
new file mode 100644
index 0000000..b848547
Binary files /dev/null and b/ShoeStore/ShoeStore/Resources/8625181.png differ
diff --git a/ShoeStore/ShoeStore/Resources/Ambox_plus.svg.png b/ShoeStore/ShoeStore/Resources/Ambox_plus.svg.png
new file mode 100644
index 0000000..41673a1
Binary files /dev/null and b/ShoeStore/ShoeStore/Resources/Ambox_plus.svg.png differ
diff --git a/ShoeStore/ShoeStore/Resources/Gradelink-cross-1.png b/ShoeStore/ShoeStore/Resources/Gradelink-cross-1.png
new file mode 100644
index 0000000..a6312cc
Binary files /dev/null and b/ShoeStore/ShoeStore/Resources/Gradelink-cross-1.png differ
diff --git a/ShoeStore/ShoeStore/Resources/Simpleicons_Business_pencil-striped-symbol-for-interface-edit-buttons.svg.png b/ShoeStore/ShoeStore/Resources/Simpleicons_Business_pencil-striped-symbol-for-interface-edit-buttons.svg.png
new file mode 100644
index 0000000..374ad79
Binary files /dev/null and b/ShoeStore/ShoeStore/Resources/Simpleicons_Business_pencil-striped-symbol-for-interface-edit-buttons.svg.png differ