diff --git a/PIbd-23_Panina.A.D_JewelryStore/JewelryShopDataModels/Models/IClientModel.cs b/PIbd-23_Panina.A.D_JewelryStore/JewelryShopDataModels/Models/IClientModel.cs
new file mode 100644
index 0000000..31b3fa6
--- /dev/null
+++ b/PIbd-23_Panina.A.D_JewelryStore/JewelryShopDataModels/Models/IClientModel.cs
@@ -0,0 +1,16 @@
+using JewelryShopDataModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace JewelryStoreDataModels.Models
+{
+ public interface IClientModel : IId
+ {
+ string ClientFIO { get; }
+ string Email { get; }
+ string Password { get; }
+ }
+}
diff --git a/PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormClients.Designer.cs b/PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormClients.Designer.cs
new file mode 100644
index 0000000..845072c
--- /dev/null
+++ b/PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormClients.Designer.cs
@@ -0,0 +1,89 @@
+namespace JewelryStore
+{
+ partial class FormClients
+ {
+ ///
+ /// 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.dataGridView = new System.Windows.Forms.DataGridView();
+ this.buttonUpdate = new System.Windows.Forms.Button();
+ this.buttonDelete = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Window;
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(12, 12);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowHeadersWidth = 62;
+ this.dataGridView.RowTemplate.Height = 33;
+ this.dataGridView.Size = new System.Drawing.Size(621, 433);
+ this.dataGridView.TabIndex = 0;
+ //
+ // buttonUpdate
+ //
+ this.buttonUpdate.Location = new System.Drawing.Point(662, 71);
+ this.buttonUpdate.Name = "buttonUpdate";
+ this.buttonUpdate.Size = new System.Drawing.Size(112, 34);
+ this.buttonUpdate.TabIndex = 1;
+ this.buttonUpdate.Text = "Обновить";
+ this.buttonUpdate.UseVisualStyleBackColor = true;
+ this.buttonUpdate.Click += new System.EventHandler(this.ButtonUpdate_Click);
+ //
+ // buttonDelete
+ //
+ this.buttonDelete.Location = new System.Drawing.Point(662, 130);
+ this.buttonDelete.Name = "buttonDelete";
+ this.buttonDelete.Size = new System.Drawing.Size(112, 34);
+ this.buttonDelete.TabIndex = 2;
+ this.buttonDelete.Text = "Удалить";
+ this.buttonDelete.UseVisualStyleBackColor = true;
+ this.buttonDelete.Click += new System.EventHandler(this.ButtonDelete_Click);
+ //
+ // FormClients
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 25F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.buttonDelete);
+ this.Controls.Add(this.buttonUpdate);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormClients";
+ this.Text = "Клиенты";
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button buttonUpdate;
+ private Button buttonDelete;
+ }
+}
\ No newline at end of file
diff --git a/PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormClients.cs b/PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormClients.cs
new file mode 100644
index 0000000..7a45d2d
--- /dev/null
+++ b/PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormClients.cs
@@ -0,0 +1,83 @@
+using JewelryStoreContracts.BindingModels;
+using JewelryStoreContracts.BusinessLogicsContracts;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace JewelryStore
+{
+ public partial class FormClients : Form
+ {
+ private readonly ILogger _logger;
+
+ private readonly IClientLogic _logic;
+ public FormClients(ILogger logger, IClientLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void ButtonDelete_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ try
+ {
+ if (!_logic.Delete(new ClientBindingModel { Id = id }))
+ {
+ throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
+ }
+ _logger.LogInformation("Удаление клиента");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка удаления клиента");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ LoadData();
+ }
+ }
+ }
+
+ private void ButtonUpdate_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+
+ private void FormClients_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+
+ private void LoadData()
+ {
+ try
+ {
+ var list = _logic.ReadList(null);
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ dataGridView.Columns["Id"].Visible = false;
+ dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
+ }
+ _logger.LogInformation("Загрузка клиентов");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки клиентов");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+}
diff --git a/PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormClients.resx b/PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormClients.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/PIbd-23_Panina.A.D_JewelryStore/JewelryStore/FormClients.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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