diff --git a/FurnitureAssembly/FurnitureAssembly.sln b/FurnitureAssembly/FurnitureAssembly.sln
index 0220e7c..da3aa5d 100644
--- a/FurnitureAssembly/FurnitureAssembly.sln
+++ b/FurnitureAssembly/FurnitureAssembly.sln
@@ -3,7 +3,15 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32901.215
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FurnitureAssembly", "FurnitureAssembly\FurnitureAssembly.csproj", "{356DBB82-0345-4F3C-BD31-2B05E6DA369A}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureAssembly", "FurnitureAssembly\FurnitureAssembly.csproj", "{356DBB82-0345-4F3C-BD31-2B05E6DA369A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureAssemblyDataModels", "FurnitureAssemblyDataModels\FurnitureAssemblyDataModels.csproj", "{179446B0-AC44-43BD-88EE-C3DF7CC4061E}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureAssemblyContracts", "FurnitureAssemblyContracts\FurnitureAssemblyContracts.csproj", "{6ACF0A8B-8F7C-4511-ABB1-7E688F1F3E8A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureAssemblyBusinessLogic", "FurnitureAssemblyBusinessLogic\FurnitureAssemblyBusinessLogic.csproj", "{B51952FD-5EB4-4A80-8598-7B1EC39CD34C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FurnitureAssemblyListImplement", "FurnitureAssemblyListImplement\FurnitureAssemblyListImplement.csproj", "{6662252C-A676-4376-AA01-0ACC6AE5B217}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +23,22 @@ Global
{356DBB82-0345-4F3C-BD31-2B05E6DA369A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{356DBB82-0345-4F3C-BD31-2B05E6DA369A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{356DBB82-0345-4F3C-BD31-2B05E6DA369A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {179446B0-AC44-43BD-88EE-C3DF7CC4061E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {179446B0-AC44-43BD-88EE-C3DF7CC4061E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {179446B0-AC44-43BD-88EE-C3DF7CC4061E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {179446B0-AC44-43BD-88EE-C3DF7CC4061E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6ACF0A8B-8F7C-4511-ABB1-7E688F1F3E8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6ACF0A8B-8F7C-4511-ABB1-7E688F1F3E8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6ACF0A8B-8F7C-4511-ABB1-7E688F1F3E8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6ACF0A8B-8F7C-4511-ABB1-7E688F1F3E8A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B51952FD-5EB4-4A80-8598-7B1EC39CD34C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B51952FD-5EB4-4A80-8598-7B1EC39CD34C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B51952FD-5EB4-4A80-8598-7B1EC39CD34C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B51952FD-5EB4-4A80-8598-7B1EC39CD34C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6662252C-A676-4376-AA01-0ACC6AE5B217}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6662252C-A676-4376-AA01-0ACC6AE5B217}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6662252C-A676-4376-AA01-0ACC6AE5B217}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6662252C-A676-4376-AA01-0ACC6AE5B217}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/FurnitureAssembly/FurnitureAssembly/Form1.Designer.cs b/FurnitureAssembly/FurnitureAssembly/Form1.Designer.cs
deleted file mode 100644
index 83ebd63..0000000
--- a/FurnitureAssembly/FurnitureAssembly/Form1.Designer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace FurnitureAssembly
-{
- 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/FurnitureAssembly/FurnitureAssembly/Form1.cs b/FurnitureAssembly/FurnitureAssembly/Form1.cs
deleted file mode 100644
index c186dd4..0000000
--- a/FurnitureAssembly/FurnitureAssembly/Form1.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace FurnitureAssembly
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- }
-}
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/Form1.resx b/FurnitureAssembly/FurnitureAssembly/Form1.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/FurnitureAssembly/FurnitureAssembly/Form1.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 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/FurnitureAssembly/FurnitureAssembly/FormComponent.Designer.cs b/FurnitureAssembly/FurnitureAssembly/FormComponent.Designer.cs
new file mode 100644
index 0000000..802d0af
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormComponent.Designer.cs
@@ -0,0 +1,119 @@
+namespace FurnitureAssembly
+{
+ partial class FormComponent
+ {
+ ///
+ /// 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.textBoxName = new System.Windows.Forms.TextBox();
+ this.textBoxCost = new System.Windows.Forms.TextBox();
+ this.labelName = new System.Windows.Forms.Label();
+ this.labelCost = new System.Windows.Forms.Label();
+ this.ButtonSave = new System.Windows.Forms.Button();
+ this.ButtonCancel = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // textBoxName
+ //
+ this.textBoxName.Location = new System.Drawing.Point(138, 22);
+ this.textBoxName.Name = "textBoxName";
+ this.textBoxName.Size = new System.Drawing.Size(281, 23);
+ this.textBoxName.TabIndex = 0;
+ //
+ // textBoxCost
+ //
+ this.textBoxCost.Location = new System.Drawing.Point(138, 62);
+ this.textBoxCost.Name = "textBoxCost";
+ this.textBoxCost.Size = new System.Drawing.Size(145, 23);
+ this.textBoxCost.TabIndex = 1;
+ //
+ // labelName
+ //
+ this.labelName.AutoSize = true;
+ this.labelName.Location = new System.Drawing.Point(35, 27);
+ this.labelName.Name = "labelName";
+ this.labelName.Size = new System.Drawing.Size(59, 15);
+ this.labelName.TabIndex = 2;
+ this.labelName.Text = "Название";
+ //
+ // labelCost
+ //
+ this.labelCost.AutoSize = true;
+ this.labelCost.Location = new System.Drawing.Point(35, 65);
+ this.labelCost.Name = "labelCost";
+ this.labelCost.Size = new System.Drawing.Size(35, 15);
+ this.labelCost.TabIndex = 3;
+ this.labelCost.Text = "Цена";
+ //
+ // ButtonSave
+ //
+ this.ButtonSave.Location = new System.Drawing.Point(240, 93);
+ this.ButtonSave.Name = "ButtonSave";
+ this.ButtonSave.Size = new System.Drawing.Size(75, 23);
+ this.ButtonSave.TabIndex = 4;
+ this.ButtonSave.Text = "Сохранить";
+ this.ButtonSave.UseVisualStyleBackColor = true;
+ this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
+ //
+ // ButtonCancel
+ //
+ this.ButtonCancel.Location = new System.Drawing.Point(344, 93);
+ this.ButtonCancel.Name = "ButtonCancel";
+ this.ButtonCancel.Size = new System.Drawing.Size(75, 23);
+ this.ButtonCancel.TabIndex = 5;
+ this.ButtonCancel.Text = "Отмена";
+ this.ButtonCancel.UseVisualStyleBackColor = true;
+ this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
+ //
+ // FormComponent
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(459, 130);
+ this.Controls.Add(this.ButtonCancel);
+ this.Controls.Add(this.ButtonSave);
+ this.Controls.Add(this.labelCost);
+ this.Controls.Add(this.labelName);
+ this.Controls.Add(this.textBoxCost);
+ this.Controls.Add(this.textBoxName);
+ this.Name = "FormComponent";
+ this.Text = "Компонент";
+ this.Load += new System.EventHandler(this.FormComponent_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private TextBox textBoxName;
+ private TextBox textBoxCost;
+ private Label labelName;
+ private Label labelCost;
+ private Button ButtonSave;
+ private Button ButtonCancel;
+ }
+}
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/FormComponent.cs b/FurnitureAssembly/FurnitureAssembly/FormComponent.cs
new file mode 100644
index 0000000..4a9cadd
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormComponent.cs
@@ -0,0 +1,99 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.BusinessLogicsContarcts;
+using FurnitureAssemblyContracts.SearchModels;
+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 FurnitureAssembly
+{
+ public partial class FormComponent : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IComponentLogic _logic;
+ private int? _id;
+ public int Id { set { _id = value; } }
+ public FormComponent(ILogger logger, IComponentLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormComponent_Load(object sender, EventArgs e)
+ {
+ if (_id.HasValue)
+ {
+ try
+ {
+ _logger.LogInformation("Получение компонента");
+ var view = _logic.ReadElement(new ComponentSearchModel
+ {
+ Id =
+ _id.Value
+ });
+ if (view != null)
+ {
+ textBoxName.Text = view.ComponentName;
+ textBoxCost.Text = view.Cost.ToString();
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка получения компонента");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(textBoxName.Text))
+ {
+ MessageBox.Show("Заполните название", "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ _logger.LogInformation("Сохранение компонента");
+ try
+ {
+ var model = new ComponentBindingModel
+ {
+ Id = _id ?? 0,
+ ComponentName = textBoxName.Text,
+ Cost = Convert.ToDouble(textBoxCost.Text)
+ };
+ var operationResult = _id.HasValue ? _logic.Update(model) :
+ _logic.Create(model);
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+ MessageBox.Show("Сохранение прошло успешно", "Сообщение",
+ MessageBoxButtons.OK, MessageBoxIcon.Information);
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка сохранения компонента");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssembly/FormComponent.resx b/FurnitureAssembly/FurnitureAssembly/FormComponent.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormComponent.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
diff --git a/FurnitureAssembly/FurnitureAssembly/FormComponents.Designer.cs b/FurnitureAssembly/FurnitureAssembly/FormComponents.Designer.cs
new file mode 100644
index 0000000..b93da90
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormComponents.Designer.cs
@@ -0,0 +1,114 @@
+namespace FurnitureAssembly
+{
+ partial class FormComponents
+ {
+ ///
+ /// 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.ButtonAdd = new System.Windows.Forms.Button();
+ this.ButtonUpd = new System.Windows.Forms.Button();
+ this.ButtonDel = new System.Windows.Forms.Button();
+ this.ButtonRef = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(-2, 0);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(559, 453);
+ this.dataGridView.TabIndex = 0;
+ //
+ // ButtonAdd
+ //
+ this.ButtonAdd.Location = new System.Drawing.Point(586, 59);
+ this.ButtonAdd.Name = "ButtonAdd";
+ this.ButtonAdd.Size = new System.Drawing.Size(105, 29);
+ this.ButtonAdd.TabIndex = 1;
+ this.ButtonAdd.Text = "Добавить";
+ this.ButtonAdd.UseVisualStyleBackColor = true;
+ this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
+ //
+ // ButtonUpd
+ //
+ this.ButtonUpd.Location = new System.Drawing.Point(586, 115);
+ this.ButtonUpd.Name = "ButtonUpd";
+ this.ButtonUpd.Size = new System.Drawing.Size(105, 29);
+ this.ButtonUpd.TabIndex = 2;
+ this.ButtonUpd.Text = "Изменить";
+ this.ButtonUpd.UseVisualStyleBackColor = true;
+ this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
+ //
+ // ButtonDel
+ //
+ this.ButtonDel.Location = new System.Drawing.Point(586, 172);
+ this.ButtonDel.Name = "ButtonDel";
+ this.ButtonDel.Size = new System.Drawing.Size(105, 29);
+ this.ButtonDel.TabIndex = 3;
+ this.ButtonDel.Text = "Удалить";
+ this.ButtonDel.UseVisualStyleBackColor = true;
+ this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
+ //
+ // ButtonRef
+ //
+ this.ButtonRef.Location = new System.Drawing.Point(586, 230);
+ this.ButtonRef.Name = "ButtonRef";
+ this.ButtonRef.Size = new System.Drawing.Size(105, 29);
+ this.ButtonRef.TabIndex = 4;
+ this.ButtonRef.Text = "Обновить";
+ this.ButtonRef.UseVisualStyleBackColor = true;
+ this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
+ //
+ // FormComponents
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(718, 450);
+ this.Controls.Add(this.ButtonRef);
+ this.Controls.Add(this.ButtonDel);
+ this.Controls.Add(this.ButtonUpd);
+ this.Controls.Add(this.ButtonAdd);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormComponents";
+ this.Text = "Компоненты";
+ this.Load += new System.EventHandler(this.FormComponents_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button ButtonAdd;
+ private Button ButtonUpd;
+ private Button ButtonDel;
+ private Button ButtonRef;
+ }
+}
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/FormComponents.cs b/FurnitureAssembly/FurnitureAssembly/FormComponents.cs
new file mode 100644
index 0000000..ea435f5
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormComponents.cs
@@ -0,0 +1,121 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.BusinessLogicsContarcts;
+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 FurnitureAssembly
+{
+ public partial class FormComponents : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IComponentLogic _logic;
+
+ public FormComponents(ILogger logger, IComponentLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormComponents_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["ComponentName"].AutoSizeMode =
+ DataGridViewAutoSizeColumnMode.Fill;
+ }
+ _logger.LogInformation("Загрузка компонентов");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки компонентов");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
+ if (service is FormComponent form)
+ {
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+
+ private void ButtonUpd_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ var service =
+ Program.ServiceProvider?.GetService(typeof(FormComponent));
+ if (service is FormComponent form)
+ {
+ form.Id =
+ Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+ }
+
+ private void ButtonDel_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);
+ _logger.LogInformation("Удаление компонента");
+ try
+ {
+ if (!_logic.Delete(new ComponentBindingModel
+ {
+ Id = id
+ }))
+ {
+ throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
+ }
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка удаления компонента");
+ MessageBox.Show(ex.Message, "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+
+ private void ButtonRef_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssembly/FormComponents.resx b/FurnitureAssembly/FurnitureAssembly/FormComponents.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormComponents.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
diff --git a/FurnitureAssembly/FurnitureAssembly/FormCreateOrder.Designer.cs b/FurnitureAssembly/FurnitureAssembly/FormCreateOrder.Designer.cs
new file mode 100644
index 0000000..dde2a1d
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormCreateOrder.Designer.cs
@@ -0,0 +1,144 @@
+namespace FurnitureAssembly
+{
+ partial class FormCreateOrder
+ {
+ ///
+ /// 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.labelFurniture = new System.Windows.Forms.Label();
+ this.labelCount = new System.Windows.Forms.Label();
+ this.labelSum = new System.Windows.Forms.Label();
+ this.textBoxCount = new System.Windows.Forms.TextBox();
+ this.comboBoxProduct = new System.Windows.Forms.ComboBox();
+ this.textBoxSum = new System.Windows.Forms.TextBox();
+ this.ButtonSave = new System.Windows.Forms.Button();
+ this.ButtonCancel = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // labelFurniture
+ //
+ this.labelFurniture.AutoSize = true;
+ this.labelFurniture.Location = new System.Drawing.Point(29, 23);
+ this.labelFurniture.Name = "labelFurniture";
+ this.labelFurniture.Size = new System.Drawing.Size(56, 15);
+ this.labelFurniture.TabIndex = 0;
+ this.labelFurniture.Text = "Изделие:";
+ //
+ // labelCount
+ //
+ this.labelCount.AutoSize = true;
+ this.labelCount.Location = new System.Drawing.Point(29, 50);
+ this.labelCount.Name = "labelCount";
+ this.labelCount.Size = new System.Drawing.Size(75, 15);
+ this.labelCount.TabIndex = 1;
+ this.labelCount.Text = "Количество:";
+ //
+ // labelSum
+ //
+ this.labelSum.AutoSize = true;
+ this.labelSum.Location = new System.Drawing.Point(29, 77);
+ this.labelSum.Name = "labelSum";
+ this.labelSum.Size = new System.Drawing.Size(45, 15);
+ this.labelSum.TabIndex = 2;
+ this.labelSum.Text = "Сумма";
+ //
+ // textBoxCount
+ //
+ this.textBoxCount.Location = new System.Drawing.Point(125, 44);
+ this.textBoxCount.Name = "textBoxCount";
+ this.textBoxCount.Size = new System.Drawing.Size(297, 23);
+ this.textBoxCount.TabIndex = 3;
+ this.textBoxCount.TextChanged += new System.EventHandler(this.TextBoxCount_TextChanged);
+ //
+ // comboBoxProduct
+ //
+ this.comboBoxProduct.FormattingEnabled = true;
+ this.comboBoxProduct.Location = new System.Drawing.Point(125, 15);
+ this.comboBoxProduct.Name = "comboBoxProduct";
+ this.comboBoxProduct.Size = new System.Drawing.Size(297, 23);
+ this.comboBoxProduct.TabIndex = 4;
+ this.comboBoxProduct.SelectedIndexChanged += new System.EventHandler(this.ComboBoxProduct_SelectedIndexChanged);
+ //
+ // textBoxSum
+ //
+ this.textBoxSum.Location = new System.Drawing.Point(125, 77);
+ this.textBoxSum.Name = "textBoxSum";
+ this.textBoxSum.Size = new System.Drawing.Size(297, 23);
+ this.textBoxSum.TabIndex = 5;
+ //
+ // ButtonSave
+ //
+ this.ButtonSave.Location = new System.Drawing.Point(188, 104);
+ this.ButtonSave.Name = "ButtonSave";
+ this.ButtonSave.Size = new System.Drawing.Size(105, 29);
+ this.ButtonSave.TabIndex = 6;
+ this.ButtonSave.Text = "Сохранить";
+ this.ButtonSave.UseVisualStyleBackColor = true;
+ this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
+ //
+ // ButtonCancel
+ //
+ this.ButtonCancel.Location = new System.Drawing.Point(317, 104);
+ this.ButtonCancel.Name = "ButtonCancel";
+ this.ButtonCancel.Size = new System.Drawing.Size(105, 29);
+ this.ButtonCancel.TabIndex = 7;
+ this.ButtonCancel.Text = "Отмена";
+ this.ButtonCancel.UseVisualStyleBackColor = true;
+ this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
+ //
+ // FormCreateOrder
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(453, 137);
+ this.Controls.Add(this.ButtonCancel);
+ this.Controls.Add(this.ButtonSave);
+ this.Controls.Add(this.textBoxSum);
+ this.Controls.Add(this.comboBoxProduct);
+ this.Controls.Add(this.textBoxCount);
+ this.Controls.Add(this.labelSum);
+ this.Controls.Add(this.labelCount);
+ this.Controls.Add(this.labelFurniture);
+ this.Name = "FormCreateOrder";
+ this.Text = "FormCreateOrder";
+ this.Load += new System.EventHandler(this.FormCreateOrder_Load);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private Label labelFurniture;
+ private Label labelCount;
+ private Label labelSum;
+ private TextBox textBoxCount;
+ private ComboBox comboBoxProduct;
+ private TextBox textBoxSum;
+ private Button ButtonSave;
+ private Button ButtonCancel;
+ }
+}
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/FormCreateOrder.cs b/FurnitureAssembly/FurnitureAssembly/FormCreateOrder.cs
new file mode 100644
index 0000000..f506bb3
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormCreateOrder.cs
@@ -0,0 +1,135 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.BusinessLogicsContarcts;
+using FurnitureAssemblyContracts.SearchModels;
+using Microsoft.Extensions.Logging;
+using Microsoft.VisualBasic.Logging;
+using System;
+using System.Collections;
+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 FurnitureAssembly
+{
+ public partial class FormCreateOrder : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IFurnitureLogic _logicF;
+ private readonly IOrderLogic _logicO;
+ public FormCreateOrder(ILogger logger, IFurnitureLogic logicF, IOrderLogic logicO)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logicF = logicF;
+ _logicO = logicO;
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(textBoxCount.Text))
+ {
+ MessageBox.Show("Заполните поле Количество", "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ if (comboBoxProduct.SelectedValue == null)
+ {
+ MessageBox.Show("Выберите изделие", "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ _logger.LogInformation("Создание заказа");
+ try
+ {
+ var operationResult = _logicO.CreateOrder(new OrderBindingModel
+ {
+ FurnitureId = Convert.ToInt32(comboBoxProduct.SelectedValue),
+ FurnitureName = comboBoxProduct.Text,
+ Count = Convert.ToInt32(textBoxCount.Text),
+ Sum = Convert.ToDouble(textBoxSum.Text)
+ });
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при создании заказа. Дополнительная информация в логах.");
+ }
+ MessageBox.Show("Сохранение прошло успешно", "Сообщение",
+ MessageBoxButtons.OK, MessageBoxIcon.Information);
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка создания заказа");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+
+ private void FormCreateOrder_Load(object sender, EventArgs e)
+ {
+ _logger.LogInformation("Загрузка изделий для заказа");
+ // прописать логику
+ LoadData();
+ }
+ private void LoadData()
+ {
+ var _list = _logicF.ReadList(null);
+ if (_list != null)
+ {
+ comboBoxProduct.DisplayMember = "FurnitureName";
+ comboBoxProduct.ValueMember = "Id";
+ comboBoxProduct.DataSource = _list;
+ comboBoxProduct.SelectedItem = null;
+ }
+ }
+
+
+ private void CalcSum()
+ {
+ if (comboBoxProduct.SelectedValue != null &&
+ !string.IsNullOrEmpty(textBoxCount.Text))
+ {
+ try
+ {
+ int id = Convert.ToInt32(comboBoxProduct.SelectedValue);
+ var product = _logicF.ReadElement(new FurnitureSearchModel
+ {
+ Id
+ = id
+ });
+ int count = Convert.ToInt32(textBoxCount.Text);
+ textBoxSum.Text = Math.Round(count * (product?.Price ?? 0),
+ 2).ToString();
+ _logger.LogInformation("Расчет суммы заказа");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка расчета суммы заказа");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ private void TextBoxCount_TextChanged(object sender, EventArgs e)
+ {
+ CalcSum();
+ }
+ private void ComboBoxProduct_SelectedIndexChanged(object sender,
+ EventArgs e)
+ {
+ CalcSum();
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssembly/FormCreateOrder.resx b/FurnitureAssembly/FurnitureAssembly/FormCreateOrder.resx
new file mode 100644
index 0000000..c3d80ca
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormCreateOrder.resx
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+ True
+
+
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/FormFurniture.Designer.cs b/FurnitureAssembly/FurnitureAssembly/FormFurniture.Designer.cs
new file mode 100644
index 0000000..b39db36
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormFurniture.Designer.cs
@@ -0,0 +1,225 @@
+namespace FurnitureAssembly
+{
+ partial class FormFurniture
+ {
+ ///
+ /// 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.labelName = new System.Windows.Forms.Label();
+ this.labelPrice = new System.Windows.Forms.Label();
+ this.textBoxName = new System.Windows.Forms.TextBox();
+ this.textBoxPrice = new System.Windows.Forms.TextBox();
+ this.groupBoxComponents = new System.Windows.Forms.GroupBox();
+ this.dataGridViewFurn = new System.Windows.Forms.DataGridView();
+ this.FurnitureId = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.FurnitureName = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.ButtonRef = new System.Windows.Forms.Button();
+ this.ButtonDel = new System.Windows.Forms.Button();
+ this.ButtonUpd = new System.Windows.Forms.Button();
+ this.ButtonAdd = new System.Windows.Forms.Button();
+ this.ButtonCancel = new System.Windows.Forms.Button();
+ this.ButtonSave = new System.Windows.Forms.Button();
+ this.groupBoxComponents.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridViewFurn)).BeginInit();
+ this.SuspendLayout();
+ //
+ // labelName
+ //
+ this.labelName.AutoSize = true;
+ this.labelName.Location = new System.Drawing.Point(45, 39);
+ this.labelName.Name = "labelName";
+ this.labelName.Size = new System.Drawing.Size(62, 15);
+ this.labelName.TabIndex = 0;
+ this.labelName.Text = "Название:";
+ //
+ // labelPrice
+ //
+ this.labelPrice.AutoSize = true;
+ this.labelPrice.Location = new System.Drawing.Point(45, 76);
+ this.labelPrice.Name = "labelPrice";
+ this.labelPrice.Size = new System.Drawing.Size(70, 15);
+ this.labelPrice.TabIndex = 1;
+ this.labelPrice.Text = "Стоимость:";
+ //
+ // textBoxName
+ //
+ this.textBoxName.Location = new System.Drawing.Point(160, 36);
+ this.textBoxName.Name = "textBoxName";
+ this.textBoxName.Size = new System.Drawing.Size(233, 23);
+ this.textBoxName.TabIndex = 2;
+ //
+ // textBoxPrice
+ //
+ this.textBoxPrice.Location = new System.Drawing.Point(160, 73);
+ this.textBoxPrice.Name = "textBoxPrice";
+ this.textBoxPrice.Size = new System.Drawing.Size(151, 23);
+ this.textBoxPrice.TabIndex = 3;
+ //
+ // groupBoxComponents
+ //
+ this.groupBoxComponents.Controls.Add(this.dataGridViewFurn);
+ this.groupBoxComponents.Controls.Add(this.ButtonRef);
+ this.groupBoxComponents.Controls.Add(this.ButtonDel);
+ this.groupBoxComponents.Controls.Add(this.ButtonUpd);
+ this.groupBoxComponents.Controls.Add(this.ButtonAdd);
+ this.groupBoxComponents.Location = new System.Drawing.Point(12, 122);
+ this.groupBoxComponents.Name = "groupBoxComponents";
+ this.groupBoxComponents.Size = new System.Drawing.Size(764, 300);
+ this.groupBoxComponents.TabIndex = 4;
+ this.groupBoxComponents.TabStop = false;
+ this.groupBoxComponents.Text = "Компоненты";
+ //
+ // dataGridViewFurn
+ //
+ this.dataGridViewFurn.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridViewFurn.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.FurnitureId,
+ this.FurnitureName,
+ this.Count});
+ this.dataGridViewFurn.Location = new System.Drawing.Point(0, 22);
+ this.dataGridViewFurn.Name = "dataGridViewFurn";
+ this.dataGridViewFurn.RowTemplate.Height = 25;
+ this.dataGridViewFurn.Size = new System.Drawing.Size(628, 278);
+ this.dataGridViewFurn.TabIndex = 9;
+ //
+ // FurnitureId
+ //
+ this.FurnitureId.HeaderText = "Id";
+ this.FurnitureId.Name = "FurnitureId";
+ this.FurnitureId.Visible = false;
+ //
+ // FurnitureName
+ //
+ this.FurnitureName.HeaderText = "Название";
+ this.FurnitureName.Name = "FurnitureName";
+ //
+ // Count
+ //
+ this.Count.HeaderText = "Количество";
+ this.Count.Name = "Count";
+ //
+ // ButtonRef
+ //
+ this.ButtonRef.Location = new System.Drawing.Point(643, 219);
+ this.ButtonRef.Name = "ButtonRef";
+ this.ButtonRef.Size = new System.Drawing.Size(105, 29);
+ this.ButtonRef.TabIndex = 8;
+ this.ButtonRef.Text = "Обновить";
+ this.ButtonRef.UseVisualStyleBackColor = true;
+ this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
+ //
+ // ButtonDel
+ //
+ this.ButtonDel.Location = new System.Drawing.Point(643, 161);
+ this.ButtonDel.Name = "ButtonDel";
+ this.ButtonDel.Size = new System.Drawing.Size(105, 29);
+ this.ButtonDel.TabIndex = 7;
+ this.ButtonDel.Text = "Удалить";
+ this.ButtonDel.UseVisualStyleBackColor = true;
+ this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
+ //
+ // ButtonUpd
+ //
+ this.ButtonUpd.Location = new System.Drawing.Point(643, 104);
+ this.ButtonUpd.Name = "ButtonUpd";
+ this.ButtonUpd.Size = new System.Drawing.Size(105, 29);
+ this.ButtonUpd.TabIndex = 6;
+ this.ButtonUpd.Text = "Изменить";
+ this.ButtonUpd.UseVisualStyleBackColor = true;
+ this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
+ //
+ // ButtonAdd
+ //
+ this.ButtonAdd.Location = new System.Drawing.Point(643, 48);
+ this.ButtonAdd.Name = "ButtonAdd";
+ this.ButtonAdd.Size = new System.Drawing.Size(105, 29);
+ this.ButtonAdd.TabIndex = 5;
+ this.ButtonAdd.Text = "Добавить";
+ this.ButtonAdd.UseVisualStyleBackColor = true;
+ this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
+ //
+ // ButtonCancel
+ //
+ this.ButtonCancel.Location = new System.Drawing.Point(669, 440);
+ this.ButtonCancel.Name = "ButtonCancel";
+ this.ButtonCancel.Size = new System.Drawing.Size(105, 29);
+ this.ButtonCancel.TabIndex = 9;
+ this.ButtonCancel.Text = "Отмена";
+ this.ButtonCancel.UseVisualStyleBackColor = true;
+ this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
+ //
+ // ButtonSave
+ //
+ this.ButtonSave.Location = new System.Drawing.Point(535, 440);
+ this.ButtonSave.Name = "ButtonSave";
+ this.ButtonSave.Size = new System.Drawing.Size(105, 29);
+ this.ButtonSave.TabIndex = 8;
+ this.ButtonSave.Text = "Сохранить";
+ this.ButtonSave.UseVisualStyleBackColor = true;
+ this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
+ //
+ // FormFurniture
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(799, 475);
+ this.Controls.Add(this.ButtonCancel);
+ this.Controls.Add(this.ButtonSave);
+ this.Controls.Add(this.groupBoxComponents);
+ this.Controls.Add(this.textBoxPrice);
+ this.Controls.Add(this.textBoxName);
+ this.Controls.Add(this.labelPrice);
+ this.Controls.Add(this.labelName);
+ this.Name = "FormFurniture";
+ this.Text = "Изделие";
+ this.Load += new System.EventHandler(this.FormFurniture_Load);
+ this.groupBoxComponents.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridViewFurn)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private Label labelName;
+ private Label labelPrice;
+ private TextBox textBoxName;
+ private TextBox textBoxPrice;
+ private GroupBox groupBoxComponents;
+ private Button ButtonCancel;
+ private Button ButtonSave;
+ private Button ButtonRef;
+ private Button ButtonDel;
+ private Button ButtonUpd;
+ private Button ButtonAdd;
+ private DataGridView dataGridViewFurn;
+ private DataGridViewTextBoxColumn FurnitureId;
+ private DataGridViewTextBoxColumn FurnitureName;
+ private DataGridViewTextBoxColumn Count;
+ }
+}
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/FormFurniture.cs b/FurnitureAssembly/FurnitureAssembly/FormFurniture.cs
new file mode 100644
index 0000000..a089a15
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormFurniture.cs
@@ -0,0 +1,230 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.BusinessLogicsContarcts;
+using FurnitureAssemblyContracts.SearchModels;
+using FurnitureAssemblyDataModels.Models;
+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 FurnitureAssembly
+{
+ public partial class FormFurniture : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IFurnitureLogic _logic;
+ private int? _id;
+ private Dictionary _productComponents;
+ public int Id { set { _id = value; } }
+
+ public FormFurniture(ILogger logger, IFurnitureLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ _productComponents = new Dictionary();
+ }
+
+ private void FormFurniture_Load(object sender, EventArgs e)
+ {
+ if (_id.HasValue)
+ {
+ _logger.LogInformation("Загрузка изделия");
+ try
+ {
+ var view = _logic.ReadElement(new FurnitureSearchModel
+ {
+ Id =
+ _id.Value
+ });
+ if (view != null)
+ {
+ textBoxName.Text = view.FurnitureName;
+ textBoxPrice.Text = view.Price.ToString();
+ _productComponents = view.FurnitureComponents ?? new
+ Dictionary();
+ LoadData();
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки изделия");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ private void LoadData()
+ {
+ _logger.LogInformation("Загрузка компонент изделия");
+ try
+ {
+ if (_productComponents != null)
+ {
+ dataGridViewFurn.Rows.Clear();
+ foreach (var pc in _productComponents)
+ {
+ dataGridViewFurn.Rows.Add(new object[] { pc.Key, pc.Value.Item1.ComponentName, pc.Value.Item2 });
+ }
+ textBoxPrice.Text = CalcPrice().ToString();
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки компонент изделия");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ var service =
+ Program.ServiceProvider?.GetService(typeof(FormFurnitureComponent));
+ if (service is FormFurnitureComponent form)
+ {
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ if (form.ComponentModel == null)
+ {
+ return;
+ }
+ _logger.LogInformation("Добавление нового компонента: { ComponentName}- { Count}", form.ComponentModel.ComponentName, form.Count);
+ if (_productComponents.ContainsKey(form.Id))
+ {
+ _productComponents[form.Id] = (form.ComponentModel,
+ form.Count);
+ }
+ else
+ {
+ _productComponents.Add(form.Id, (form.ComponentModel,
+ form.Count));
+ }
+ LoadData();
+ }
+ }
+ }
+
+ private void ButtonUpd_Click(object sender, EventArgs e)
+ {
+ if (dataGridViewFurn.SelectedRows.Count == 1)
+ {
+ var service =
+ Program.ServiceProvider?.GetService(typeof(FormFurnitureComponent));
+ if (service is FormFurnitureComponent form)
+ {
+ int id =
+ Convert.ToInt32(dataGridViewFurn.SelectedRows[0].Cells[0].Value);
+ form.Id = id;
+ form.Count = _productComponents[id].Item2;
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ if (form.ComponentModel == null)
+ {
+ return;
+ }
+ _logger.LogInformation("Изменение компонента: { ComponentName}- { Count}", form.ComponentModel.ComponentName, form.Count);
+ _productComponents[form.Id] = (form.ComponentModel, form.Count);
+ LoadData();
+ }
+ }
+ }
+ }
+
+ private void ButtonDel_Click(object sender, EventArgs e)
+ {
+ if (dataGridViewFurn.SelectedRows.Count == 1)
+ {
+ if (MessageBox.Show("Удалить запись?", "Вопрос",
+ MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
+ {
+ try
+ {
+ _logger.LogInformation("Удаление компонента: { ComponentName} - { Count}", dataGridViewFurn.SelectedRows[0].Cells[1].Value);
+ _productComponents?.Remove(Convert.ToInt32(dataGridViewFurn.SelectedRows[0].Cells[0].Value));
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ LoadData();
+ }
+ }
+ }
+
+ private void ButtonRef_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(textBoxName.Text))
+ {
+ MessageBox.Show("Заполните название", "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ if (string.IsNullOrEmpty(textBoxPrice.Text))
+ {
+ MessageBox.Show("Заполните цену", "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ return;
+ }
+ if (_productComponents == null || _productComponents.Count == 0)
+ {
+ MessageBox.Show("Заполните компоненты", "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ _logger.LogInformation("Сохранение изделия");
+ try
+ {
+ var model = new FurnitureBindingModel
+ {
+ Id = _id ?? 0,
+ FurnitureName = textBoxName.Text,
+ Price = Convert.ToDouble(textBoxPrice.Text),
+ FurnitureComponents = _productComponents
+ };
+ var operationResult = _id.HasValue ? _logic.Update(model) :
+ _logic.Create(model);
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+ MessageBox.Show("Сохранение прошло успешно", "Сообщение",
+ MessageBoxButtons.OK, MessageBoxIcon.Information);
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка сохранения изделия");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ private double CalcPrice()
+ {
+ double price = 0;
+ foreach (var elem in _productComponents)
+ {
+ price += ((elem.Value.Item1?.Cost ?? 0) * elem.Value.Item2);
+ }
+ return Math.Round(price * 1.1, 2);
+ }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssembly/FormFurniture.resx b/FurnitureAssembly/FurnitureAssembly/FormFurniture.resx
new file mode 100644
index 0000000..565a3a5
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormFurniture.resx
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+ True
+
+
+ True
+
+
+ True
+
+
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/FormFurnitureComponent.Designer.cs b/FurnitureAssembly/FurnitureAssembly/FormFurnitureComponent.Designer.cs
new file mode 100644
index 0000000..9a36165
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormFurnitureComponent.Designer.cs
@@ -0,0 +1,119 @@
+namespace FurnitureAssembly
+{
+ partial class FormFurnitureComponent
+ {
+ ///
+ /// 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.ButtonCancel = new System.Windows.Forms.Button();
+ this.ButtonSave = new System.Windows.Forms.Button();
+ this.comboBoxComponent = new System.Windows.Forms.ComboBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.textBoxCount = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // ButtonCancel
+ //
+ this.ButtonCancel.Location = new System.Drawing.Point(293, 109);
+ this.ButtonCancel.Name = "ButtonCancel";
+ this.ButtonCancel.Size = new System.Drawing.Size(75, 23);
+ this.ButtonCancel.TabIndex = 7;
+ this.ButtonCancel.Text = "Отмена";
+ this.ButtonCancel.UseVisualStyleBackColor = true;
+ this.ButtonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
+ //
+ // ButtonSave
+ //
+ this.ButtonSave.Location = new System.Drawing.Point(189, 109);
+ this.ButtonSave.Name = "ButtonSave";
+ this.ButtonSave.Size = new System.Drawing.Size(75, 23);
+ this.ButtonSave.TabIndex = 6;
+ this.ButtonSave.Text = "Сохранить";
+ this.ButtonSave.UseVisualStyleBackColor = true;
+ this.ButtonSave.Click += new System.EventHandler(this.ButtonSave_Click);
+ //
+ // comboBoxComponent
+ //
+ this.comboBoxComponent.FormattingEnabled = true;
+ this.comboBoxComponent.Location = new System.Drawing.Point(116, 18);
+ this.comboBoxComponent.Name = "comboBoxComponent";
+ this.comboBoxComponent.Size = new System.Drawing.Size(252, 23);
+ this.comboBoxComponent.TabIndex = 8;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(30, 21);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(72, 15);
+ this.label1.TabIndex = 9;
+ this.label1.Text = "Компонент:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(30, 62);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(75, 15);
+ this.label2.TabIndex = 10;
+ this.label2.Text = "Количество:";
+ //
+ // textBoxCount
+ //
+ this.textBoxCount.Location = new System.Drawing.Point(116, 59);
+ this.textBoxCount.Name = "textBoxCount";
+ this.textBoxCount.Size = new System.Drawing.Size(252, 23);
+ this.textBoxCount.TabIndex = 11;
+ //
+ // FormFurnitureComponent
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(407, 146);
+ this.Controls.Add(this.textBoxCount);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.comboBoxComponent);
+ this.Controls.Add(this.ButtonCancel);
+ this.Controls.Add(this.ButtonSave);
+ this.Name = "FormFurnitureComponent";
+ this.Text = "Компонент изделия";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private Button ButtonCancel;
+ private Button ButtonSave;
+ private ComboBox comboBoxComponent;
+ private Label label1;
+ private Label label2;
+ private TextBox textBoxCount;
+ }
+}
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/FormFurnitureComponent.cs b/FurnitureAssembly/FurnitureAssembly/FormFurnitureComponent.cs
new file mode 100644
index 0000000..5ef9cbf
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormFurnitureComponent.cs
@@ -0,0 +1,94 @@
+using FurnitureAssemblyContracts.BusinessLogicsContarcts;
+using FurnitureAssemblyContracts.ViewModels;
+using FurnitureAssemblyDataModels.Models;
+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 FurnitureAssembly
+{
+ public partial class FormFurnitureComponent : Form
+ {
+ private readonly List? _list;
+ public int Id
+ {
+ get
+ {
+ return Convert.ToInt32(comboBoxComponent.SelectedValue);
+ }
+ set
+ {
+ comboBoxComponent.SelectedValue = value;
+ }
+ }
+ public IComponentModel? ComponentModel
+ {
+ get
+ {
+ if (_list == null)
+ {
+ return null;
+ }
+ foreach (var elem in _list)
+ {
+ if (elem.Id == Id)
+ {
+ return elem;
+ }
+ }
+ return null;
+ }
+ }
+
+ public int Count
+ {
+ get { return Convert.ToInt32(textBoxCount.Text); }
+ set
+ { textBoxCount.Text = value.ToString(); }
+ }
+
+
+ public FormFurnitureComponent(IComponentLogic logic)
+ {
+ InitializeComponent();
+ _list = logic.ReadList(null);
+ if (_list != null)
+ {
+ comboBoxComponent.DisplayMember = "ComponentName";
+ comboBoxComponent.ValueMember = "Id";
+ comboBoxComponent.DataSource = _list;
+ comboBoxComponent.SelectedItem = null;
+ }
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ if (string.IsNullOrEmpty(textBoxCount.Text))
+ {
+ MessageBox.Show("Заполните поле Количество", "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ if (comboBoxComponent.SelectedValue == null)
+ {
+ MessageBox.Show("Выберите компонент", "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssembly/FormFurnitureComponent.resx b/FurnitureAssembly/FurnitureAssembly/FormFurnitureComponent.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormFurnitureComponent.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
diff --git a/FurnitureAssembly/FurnitureAssembly/FormFurnitures.Designer.cs b/FurnitureAssembly/FurnitureAssembly/FormFurnitures.Designer.cs
new file mode 100644
index 0000000..abe74ea
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormFurnitures.Designer.cs
@@ -0,0 +1,116 @@
+namespace FurnitureAssembly
+{
+ partial class FormFurnitures
+ {
+ ///
+ /// 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.ButtonAdd = new System.Windows.Forms.Button();
+ this.ButtonDel = new System.Windows.Forms.Button();
+ this.ButtonUpd = new System.Windows.Forms.Button();
+ this.ButtonRef = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(-1, 1);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(559, 453);
+ this.dataGridView.TabIndex = 5;
+ //
+ // ButtonAdd
+ //
+ this.ButtonAdd.Location = new System.Drawing.Point(583, 52);
+ this.ButtonAdd.Name = "ButtonAdd";
+ this.ButtonAdd.Size = new System.Drawing.Size(105, 29);
+ this.ButtonAdd.TabIndex = 6;
+ this.ButtonAdd.Text = "Добавить";
+ this.ButtonAdd.UseVisualStyleBackColor = true;
+ this.ButtonAdd.Click += new System.EventHandler(this.ButtonAdd_Click);
+ //
+ // ButtonDel
+ //
+ this.ButtonDel.Location = new System.Drawing.Point(583, 106);
+ this.ButtonDel.Name = "ButtonDel";
+ this.ButtonDel.Size = new System.Drawing.Size(105, 29);
+ this.ButtonDel.TabIndex = 7;
+ this.ButtonDel.Text = "Удалить";
+ this.ButtonDel.UseVisualStyleBackColor = true;
+ this.ButtonDel.Click += new System.EventHandler(this.ButtonDel_Click);
+ //
+ // ButtonUpd
+ //
+ this.ButtonUpd.Location = new System.Drawing.Point(583, 161);
+ this.ButtonUpd.Name = "ButtonUpd";
+ this.ButtonUpd.Size = new System.Drawing.Size(105, 29);
+ this.ButtonUpd.TabIndex = 8;
+ this.ButtonUpd.Text = "Изменить";
+ this.ButtonUpd.UseVisualStyleBackColor = true;
+ this.ButtonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
+ //
+ // ButtonRef
+ //
+ this.ButtonRef.Location = new System.Drawing.Point(583, 216);
+ this.ButtonRef.Name = "ButtonRef";
+ this.ButtonRef.Size = new System.Drawing.Size(105, 29);
+ this.ButtonRef.TabIndex = 9;
+ this.ButtonRef.Text = "Обновить";
+ this.ButtonRef.UseVisualStyleBackColor = true;
+ this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
+ //
+ // FormFurnitures
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(712, 453);
+ this.Controls.Add(this.ButtonRef);
+ this.Controls.Add(this.ButtonUpd);
+ this.Controls.Add(this.ButtonDel);
+ this.Controls.Add(this.ButtonAdd);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormFurnitures";
+ this.Text = "Изделия";
+ this.Load += new System.EventHandler(this.FormFurnitures_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+
+ private DataGridView dataGridView1;
+ private Button ButtonAdd;
+ private Button ButtonDel;
+ private Button ButtonUpd;
+ private Button ButtonRef;
+ private DataGridView dataGridView;
+ }
+}
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/FormFurnitures.cs b/FurnitureAssembly/FurnitureAssembly/FormFurnitures.cs
new file mode 100644
index 0000000..ad82020
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormFurnitures.cs
@@ -0,0 +1,121 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.BusinessLogicsContarcts;
+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 FurnitureAssembly
+{
+ public partial class FormFurnitures : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IFurnitureLogic _logic;
+ public FormFurnitures(ILogger logger, IFurnitureLogic logic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _logic = logic;
+ }
+
+ private void FormFurnitures_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["FurnitureName"].AutoSizeMode =
+ DataGridViewAutoSizeColumnMode.Fill;
+ dataGridView.Columns["FurnitureComponents"].Visible = false;
+ }
+ _logger.LogInformation("Загрузка изделий");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки изделий");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormFurniture));
+ if (service is FormFurniture form)
+ {
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+
+ private void ButtonUpd_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ var service =
+ Program.ServiceProvider?.GetService(typeof(FormFurniture));
+ if (service is FormFurniture form)
+ {
+ form.Id =
+ Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ LoadData();
+ }
+ }
+ }
+ }
+
+ private void ButtonDel_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);
+ _logger.LogInformation("Удаление изделия");
+ try
+ {
+ if (!_logic.Delete(new FurnitureBindingModel
+ {
+ Id = id
+ }))
+ {
+ throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
+ }
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка удаления изделия");
+ MessageBox.Show(ex.Message, "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+ }
+
+ private void ButtonRef_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssembly/FormFurnitures.resx b/FurnitureAssembly/FurnitureAssembly/FormFurnitures.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormFurnitures.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
diff --git a/FurnitureAssembly/FurnitureAssembly/FormMain.Designer.cs b/FurnitureAssembly/FurnitureAssembly/FormMain.Designer.cs
new file mode 100644
index 0000000..0199789
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormMain.Designer.cs
@@ -0,0 +1,174 @@
+namespace FurnitureAssembly
+{
+ partial class FormMain
+ {
+ ///
+ /// 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.ButtonCreateOrder = new System.Windows.Forms.Button();
+ this.ButtonTakeOrderInWork = new System.Windows.Forms.Button();
+ this.ButtonOrderReady = new System.Windows.Forms.Button();
+ this.ButtonIssuedOrder = new System.Windows.Forms.Button();
+ this.ButtonRef = new System.Windows.Forms.Button();
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.изделияToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.menuStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(2, 25);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(859, 425);
+ this.dataGridView.TabIndex = 0;
+ //
+ // ButtonCreateOrder
+ //
+ this.ButtonCreateOrder.Location = new System.Drawing.Point(902, 72);
+ this.ButtonCreateOrder.Name = "ButtonCreateOrder";
+ this.ButtonCreateOrder.Size = new System.Drawing.Size(150, 25);
+ this.ButtonCreateOrder.TabIndex = 1;
+ this.ButtonCreateOrder.Text = "Создать заказ";
+ this.ButtonCreateOrder.UseVisualStyleBackColor = true;
+ this.ButtonCreateOrder.Click += new System.EventHandler(this.ButtonCreateOrder_Click);
+ //
+ // ButtonTakeOrderInWork
+ //
+ this.ButtonTakeOrderInWork.Location = new System.Drawing.Point(902, 122);
+ this.ButtonTakeOrderInWork.Name = "ButtonTakeOrderInWork";
+ this.ButtonTakeOrderInWork.Size = new System.Drawing.Size(150, 25);
+ this.ButtonTakeOrderInWork.TabIndex = 2;
+ this.ButtonTakeOrderInWork.Text = "Отдать на выполнение";
+ this.ButtonTakeOrderInWork.UseVisualStyleBackColor = true;
+ this.ButtonTakeOrderInWork.Click += new System.EventHandler(this.ButtonTakeOrderInWork_Click);
+ //
+ // ButtonOrderReady
+ //
+ this.ButtonOrderReady.Location = new System.Drawing.Point(902, 173);
+ this.ButtonOrderReady.Name = "ButtonOrderReady";
+ this.ButtonOrderReady.Size = new System.Drawing.Size(150, 25);
+ this.ButtonOrderReady.TabIndex = 3;
+ this.ButtonOrderReady.Text = "Заказ готов";
+ this.ButtonOrderReady.UseVisualStyleBackColor = true;
+ this.ButtonOrderReady.Click += new System.EventHandler(this.ButtonOrderReady_Click);
+ //
+ // ButtonIssuedOrder
+ //
+ this.ButtonIssuedOrder.Location = new System.Drawing.Point(902, 223);
+ this.ButtonIssuedOrder.Name = "ButtonIssuedOrder";
+ this.ButtonIssuedOrder.Size = new System.Drawing.Size(150, 25);
+ this.ButtonIssuedOrder.TabIndex = 4;
+ this.ButtonIssuedOrder.Text = "Заказ выдан";
+ this.ButtonIssuedOrder.UseVisualStyleBackColor = true;
+ this.ButtonIssuedOrder.Click += new System.EventHandler(this.ButtonIssuedOrder_Click);
+ //
+ // ButtonRef
+ //
+ this.ButtonRef.Location = new System.Drawing.Point(902, 273);
+ this.ButtonRef.Name = "ButtonRef";
+ this.ButtonRef.Size = new System.Drawing.Size(150, 25);
+ this.ButtonRef.TabIndex = 5;
+ this.ButtonRef.Text = "Обновить список";
+ this.ButtonRef.UseVisualStyleBackColor = true;
+ this.ButtonRef.Click += new System.EventHandler(this.ButtonRef_Click);
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.справочникиToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(1065, 24);
+ this.menuStrip1.TabIndex = 6;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // справочникиToolStripMenuItem
+ //
+ this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.компонентыToolStripMenuItem,
+ this.изделияToolStripMenuItem});
+ this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
+ this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
+ this.справочникиToolStripMenuItem.Text = "Справочники";
+ //
+ // компонентыToolStripMenuItem
+ //
+ this.компонентыToolStripMenuItem.Name = "компонентыToolStripMenuItem";
+ this.компонентыToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
+ this.компонентыToolStripMenuItem.Text = "Компоненты";
+ this.компонентыToolStripMenuItem.Click += new System.EventHandler(this.КомпонентыToolStripMenuItem_Click);
+ //
+ // изделияToolStripMenuItem
+ //
+ this.изделияToolStripMenuItem.Name = "изделияToolStripMenuItem";
+ this.изделияToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
+ this.изделияToolStripMenuItem.Text = "Изделия";
+ this.изделияToolStripMenuItem.Click += new System.EventHandler(this.ИзделияToolStripMenuItem_Click);
+ //
+ // FormMain
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(1065, 450);
+ this.Controls.Add(this.ButtonRef);
+ this.Controls.Add(this.ButtonIssuedOrder);
+ this.Controls.Add(this.ButtonOrderReady);
+ this.Controls.Add(this.ButtonTakeOrderInWork);
+ this.Controls.Add(this.ButtonCreateOrder);
+ this.Controls.Add(this.dataGridView);
+ this.Controls.Add(this.menuStrip1);
+ this.MainMenuStrip = this.menuStrip1;
+ this.Name = "FormMain";
+ this.Text = "Магазин мебели";
+ this.Load += new System.EventHandler(this.FormMain_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private Button ButtonCreateOrder;
+ private Button ButtonTakeOrderInWork;
+ private Button ButtonOrderReady;
+ private Button ButtonIssuedOrder;
+ private Button ButtonRef;
+ private MenuStrip menuStrip1;
+ private ToolStripMenuItem справочникиToolStripMenuItem;
+ private ToolStripMenuItem компонентыToolStripMenuItem;
+ private ToolStripMenuItem изделияToolStripMenuItem;
+ }
+}
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/FormMain.cs b/FurnitureAssembly/FurnitureAssembly/FormMain.cs
new file mode 100644
index 0000000..62e043a
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormMain.cs
@@ -0,0 +1,158 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.BusinessLogicsContarcts;
+using FurnitureAssemblyDataModels.Enums;
+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 FurnitureAssembly
+{
+ public partial class FormMain : Form
+ {
+ private readonly ILogger _logger;
+ private readonly IOrderLogic _orderLogic;
+ public FormMain(ILogger logger, IOrderLogic orderLogic)
+ {
+ InitializeComponent();
+ _logger = logger;
+ _orderLogic = orderLogic;
+ }
+ private void FormMain_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ private void LoadData()
+ {
+ try
+ {
+ var list = _orderLogic.ReadList(null);
+ if (list != null)
+ {
+ dataGridView.DataSource = list;
+ dataGridView.Columns["FurnitureId"].Visible = false;
+ }
+ _logger.LogInformation("Загрузка заказов");
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка загрузки заказов");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ private void КомпонентыToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service =
+ Program.ServiceProvider?.GetService(typeof(FormComponents));
+ if (service is FormComponents form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void ИзделияToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service =
+ Program.ServiceProvider?.GetService(typeof(FormFurnitures));
+ if (service is FormFurnitures form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void ButtonCreateOrder_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
+ if (service is FormCreateOrder form)
+ {
+ form.ShowDialog();
+ LoadData();
+ }
+ }
+ private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
+ try
+ {
+ var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка передачи заказа в работу");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ private void ButtonOrderReady_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'",
+ id);
+ try
+ {
+ var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id });
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка отметки о готовности заказа");
+
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+
+ private void ButtonIssuedOrder_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count == 1)
+ {
+ int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
+ _logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'",
+ id);
+ try
+ {
+ var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id });
+ if (!operationResult)
+ {
+ throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
+ }
+ _logger.LogInformation("Заказ №{id} выдан", id);
+ LoadData();
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, "Ошибка отметки о выдачи заказа");
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
+ MessageBoxIcon.Error);
+ }
+ }
+ }
+ private void ButtonRef_Click(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssembly/FormMain.resx b/FurnitureAssembly/FurnitureAssembly/FormMain.resx
new file mode 100644
index 0000000..938108a
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/FormMain.resx
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/FurnitureAssembly.csproj b/FurnitureAssembly/FurnitureAssembly/FurnitureAssembly.csproj
index b57c89e..243cc38 100644
--- a/FurnitureAssembly/FurnitureAssembly/FurnitureAssembly.csproj
+++ b/FurnitureAssembly/FurnitureAssembly/FurnitureAssembly.csproj
@@ -8,4 +8,26 @@
enable
+
+
+
+
+
+
+ Always
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/Program.cs b/FurnitureAssembly/FurnitureAssembly/Program.cs
index 22f2995..2cc7ecb 100644
--- a/FurnitureAssembly/FurnitureAssembly/Program.cs
+++ b/FurnitureAssembly/FurnitureAssembly/Program.cs
@@ -1,7 +1,18 @@
+using FurnitureAssemblyBusinessLogic;
+using FurnitureAssemblyContracts.BusinessLogicsContarcts;
+using FurnitureAssemblyContracts.StoragesContracts;
+using FurnitureAssemblyListImplement.Implements;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Logging;
+using NLog.Extensions.Logging;
+using System.Drawing;
+
namespace FurnitureAssembly
{
internal static class Program
{
+ private static ServiceProvider? _serviceProvider;
+ public static ServiceProvider? ServiceProvider => _serviceProvider;
///
/// The main entry point for the application.
///
@@ -11,7 +22,32 @@ namespace FurnitureAssembly
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
+ var services = new ServiceCollection();
+ ConfigureServices(services);
+ _serviceProvider = services.BuildServiceProvider();
+ Application.Run(_serviceProvider.GetRequiredService());
+ }
+
+ private static void ConfigureServices(ServiceCollection services)
+ {
+ services.AddLogging(option =>
+ {
+ option.SetMinimumLevel(LogLevel.Information);
+ option.AddNLog("nlog.config");
+ });
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
}
}
}
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssembly/nlog.config b/FurnitureAssembly/FurnitureAssembly/nlog.config
new file mode 100644
index 0000000..e515916
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssembly/nlog.config
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/ComponentLogic.cs b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/ComponentLogic.cs
new file mode 100644
index 0000000..b6a8da5
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/ComponentLogic.cs
@@ -0,0 +1,113 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.BusinessLogicsContarcts;
+using FurnitureAssemblyContracts.SearchModels;
+using FurnitureAssemblyContracts.StoragesContracts;
+using FurnitureAssemblyContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Extensions.Logging;
+
+namespace FurnitureAssemblyBusinessLogic
+{
+ public class ComponentLogic : IComponentLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IComponentStorage _componentStorage;
+ public ComponentLogic(ILogger logger, IComponentStorage
+ componentStorage)
+ {
+ _logger = logger;
+ _componentStorage = componentStorage;
+ }
+ public List? ReadList(ComponentSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. ComponentName:{ComponentName}. Id:{ Id}", model?.ComponentName, model?.Id);
+ var list = model == null ? _componentStorage.GetFullList() : _componentStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count:{Count}", list.Count);
+ return list;
+ }
+ public ComponentViewModel? ReadElement(ComponentSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. ComponentName:{ComponentName}. Id:{ Id}", model.ComponentName, model.Id);
+ var element = _componentStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
+ return element;
+ }
+ public bool Create(ComponentBindingModel model)
+ {
+ CheckModel(model);
+ if (_componentStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+
+ }
+ public bool Update(ComponentBindingModel model)
+ {
+ CheckModel(model);
+ if (_componentStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+ public bool Delete(ComponentBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id:{Id}", model.Id);
+ if (_componentStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+ private void CheckModel(ComponentBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.ComponentName))
+ {
+ throw new ArgumentNullException("Нет названия компонента",
+ nameof(model.ComponentName));
+ }
+ if (model.Cost <= 0)
+ {
+ throw new ArgumentNullException("Цена компонента должна быть больше 0", nameof(model.Cost));
+ }
+ _logger.LogInformation("Component. ComponentName:{ComponentName}. Cost:{ Cost}. Id: { Id}", model.ComponentName, model.Cost, model.Id);
+ var element = _componentStorage.GetElement(new ComponentSearchModel{ ComponentName = model.ComponentName });
+ if (element != null && element.Id != model.Id)
+ {
+ throw new InvalidOperationException("Компонент с таким названием уже есть");
+ }
+ }
+
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/FurnitureAssemblyBusinessLogic.csproj b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/FurnitureAssemblyBusinessLogic.csproj
new file mode 100644
index 0000000..544ed82
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/FurnitureAssemblyBusinessLogic.csproj
@@ -0,0 +1,20 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/FurnitureLogic.cs b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/FurnitureLogic.cs
new file mode 100644
index 0000000..0326d00
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/FurnitureLogic.cs
@@ -0,0 +1,115 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.BusinessLogicsContarcts;
+using FurnitureAssemblyContracts.SearchModels;
+using FurnitureAssemblyContracts.StoragesContracts;
+using FurnitureAssemblyContracts.ViewModels;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyBusinessLogic
+{
+ public class FurnitureLogic : IFurnitureLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IFurnitureStorage _furnitureStorage;
+ public FurnitureLogic(ILogger logger, IFurnitureStorage furnitureStorage)
+ {
+ _logger = logger;
+ _furnitureStorage = furnitureStorage;
+ }
+ public bool Create(FurnitureBindingModel model)
+ {
+ CheckModel(model);
+ if (_furnitureStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public bool Delete(FurnitureBindingModel model)
+ {
+ CheckModel(model, false);
+ _logger.LogInformation("Delete. Id:{Id}", model.Id);
+ if (_furnitureStorage.Delete(model) == null)
+ {
+ _logger.LogWarning("Delete operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ public FurnitureViewModel? ReadElement(FurnitureSearchModel model)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ _logger.LogInformation("ReadElement. FurnitureName:{FurnitureName}. Id:{ Id}", model.FurnitureName, model.Id);
+ var element = _furnitureStorage.GetElement(model);
+ if (element == null)
+ {
+ _logger.LogWarning("ReadElement element not found");
+ return null;
+ }
+ _logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
+ return element;
+ }
+
+ public List? ReadList(FurnitureSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. FurnitureName:{FurnitureName}. Id:{ Id}", model?.FurnitureName, model?.Id);
+ var list = model == null ? _furnitureStorage.GetFullList() : _furnitureStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count:{Count}", list.Count);
+ return list;
+ }
+
+ public bool Update(FurnitureBindingModel model)
+ {
+ CheckModel(model);
+ if (_furnitureStorage.Update(model) == null)
+ {
+ _logger.LogWarning("Update operation failed");
+ return false;
+ }
+ return true;
+ }
+
+ private void CheckModel(FurnitureBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(model.FurnitureName))
+ {
+ throw new ArgumentNullException("Нет названия изделия",
+ nameof(model.FurnitureName));
+ }
+ if (model.Price <= 0)
+ {
+ throw new ArgumentNullException("Цена изделия должна быть больше 0", nameof(model.Price));
+ }
+ _logger.LogInformation("Furniture. FurnitureName:{FurnitureName}. Price:{ Price}. Id: { Id}", model.FurnitureName, model.Price, model.Id);
+ var element = _furnitureStorage.GetElement(new FurnitureSearchModel { FurnitureName = model.FurnitureName });
+ if (element != null && element.Id != model.Id)
+ {
+ throw new InvalidOperationException("Изделие с таким названием уже есть");
+ }
+ }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OrderLogic.cs b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OrderLogic.cs
new file mode 100644
index 0000000..bbe6d31
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyBusinessLogic/OrderLogic.cs
@@ -0,0 +1,163 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.BusinessLogicsContarcts;
+using FurnitureAssemblyContracts.SearchModels;
+using FurnitureAssemblyContracts.StoragesContracts;
+using FurnitureAssemblyContracts.ViewModels;
+using FurnitureAssemblyDataModels.Enums;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyBusinessLogic
+{
+ public class OrderLogic : IOrderLogic
+ {
+ private readonly ILogger _logger;
+ private readonly IOrderStorage _orderStorage;
+
+ public OrderLogic(ILogger logger, IOrderStorage orderStorage)
+ {
+ _logger = logger;
+ _orderStorage = orderStorage;
+ }
+
+ private bool ChangeStatus(OrderBindingModel model, OrderStatus orderStatus)
+ {
+ if (model.Status + 1 != orderStatus)
+ {
+ return false;
+ }
+ model.Status = orderStatus;
+ return true;
+ }
+
+ public bool CreateOrder(OrderBindingModel model)
+ {
+ CheckModel(model);
+
+ if (!ChangeStatus(model, OrderStatus.Принят))
+ {
+ _logger.LogWarning("Order's status is wrong");
+ return false;
+ }
+
+ if (_orderStorage.Insert(model) == null)
+ {
+ _logger.LogWarning("Insert operation failed");
+ return false;
+ }
+
+ return true;
+ }
+
+ public bool TakeOrderInWork(OrderBindingModel model)
+ {
+ model = Find(model);
+ if (model == null)
+ {
+ return false;
+ }
+ if (!ChangeStatus(model, OrderStatus.Выполняется))
+ {
+ _logger.LogWarning("Order's status is wrong");
+ return false;
+ }
+ _orderStorage.Update(model);
+ return true;
+ }
+
+ public bool FinishOrder(OrderBindingModel model)
+ {
+ model = Find(model);
+ if (model == null) {
+ return false;
+ }
+ if (!ChangeStatus(model, OrderStatus.Готов))
+ {
+ _logger.LogWarning("Order's status is wrong");
+ return false;
+ }
+ _orderStorage.Update(model);
+ return true;
+ }
+
+ public bool DeliveryOrder(OrderBindingModel model)
+ {
+ model = Find(model);
+ if (model == null)
+ {
+ return false;
+ }
+ if (!ChangeStatus(model, OrderStatus.Выдан))
+ {
+ _logger.LogWarning("Order's status is wrong");
+ return false;
+ }
+ model.DateImplement = DateTime.Now;
+ _orderStorage.Update(model);
+ return true;
+ }
+
+
+ public List? ReadList(OrderSearchModel? model)
+ {
+ _logger.LogInformation("ReadList. Id:{ Id}", model?.Id);
+ var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
+ if (list == null)
+ {
+ _logger.LogWarning("ReadList return null list");
+ return null;
+ }
+ _logger.LogInformation("ReadList. Count:{Count}", list.Count);
+ return list;
+ }
+
+
+ private void CheckModel(OrderBindingModel model, bool withParams = true)
+ {
+ if (model == null)
+ {
+ throw new ArgumentNullException(nameof(model));
+ }
+ if (!withParams)
+ {
+ return;
+ }
+ if (model.FurnitureId <= 0)
+ {
+ throw new ArgumentNullException("Неверный идентификатор изделия", nameof(model.FurnitureId));
+ }
+ if (model.Count <= 0)
+ {
+ throw new ArgumentNullException("Количество изделий должно быть больше 0", nameof(model.Count));
+ }
+ if (model.Sum <= 0)
+ {
+ throw new ArgumentNullException("Стоимость заказа должна быть больше 0", nameof(model.Sum));
+ }
+ _logger.LogInformation("Order. OrderId: { Id}. OrderStatus: {OrderStatus} DateCreate: {DateCreate} " +
+ "FurnitureId:{FurnitureId}. FurnitureName:{FurnitureName}. Count:{ Count}. Sum:{ Sum}. ",
+ model.Id, model.Status, model.DateCreate, model.FurnitureId, model.FurnitureName, model.Count, model.Sum);
+ }
+
+ private OrderBindingModel Find(OrderBindingModel model)
+ {
+ var modelView = _orderStorage.GetElement(new OrderSearchModel { Id = model.Id });
+ if (modelView == null)
+ {
+ return null;
+ }
+ model.FurnitureId = modelView.FurnitureId;
+ model.DateCreate = modelView.DateCreate;
+ model.Count = modelView.Count;
+ model.Sum = modelView.Sum;
+ model.FurnitureId = model.FurnitureId;
+ model.FurnitureName = modelView.FurnitureName;
+ model.Status = modelView.Status;
+ return model;
+ }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/BindingModels/ComponentBindingModel.cs b/FurnitureAssembly/FurnitureAssemblyContracts/BindingModels/ComponentBindingModel.cs
new file mode 100644
index 0000000..d0041df
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/BindingModels/ComponentBindingModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using FurnitureAssemblyDataModels.Models;
+namespace FurnitureAssemblyContracts.BindingModels
+{
+ public class ComponentBindingModel : IComponentModel
+ {
+ public int Id { get; set; }
+ public string ComponentName { get; set; } = string.Empty;
+ public double Cost { get; set; }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/BindingModels/FurnitureBindingModel.cs b/FurnitureAssembly/FurnitureAssemblyContracts/BindingModels/FurnitureBindingModel.cs
new file mode 100644
index 0000000..b29f35d
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/BindingModels/FurnitureBindingModel.cs
@@ -0,0 +1,17 @@
+using FurnitureAssemblyDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.BindingModels
+{
+ public class FurnitureBindingModel : IFurnitureModel
+ {
+ public int Id { get; set; }
+ public string FurnitureName { get; set; } = string.Empty;
+ public double Price { get; set; }
+ public Dictionary FurnitureComponents{ get; set; } = new();
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/BindingModels/OrderBindingModel.cs b/FurnitureAssembly/FurnitureAssemblyContracts/BindingModels/OrderBindingModel.cs
new file mode 100644
index 0000000..ea145e7
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/BindingModels/OrderBindingModel.cs
@@ -0,0 +1,22 @@
+using FurnitureAssemblyDataModels.Enums;
+using FurnitureAssemblyDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.BindingModels
+{
+ public class OrderBindingModel : IOrderModel
+ {
+ public int Id { get; set; }
+ public int FurnitureId { get; set; }
+ public string FurnitureName { get; set; } = string.Empty;
+ public int Count { get; set; }
+ public double Sum { get; set; }
+ public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
+ public DateTime DateCreate { get; set; } = DateTime.Now;
+ public DateTime? DateImplement { get; set; }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/BusinessLogicsContarcts/IComponentLogic.cs b/FurnitureAssembly/FurnitureAssemblyContracts/BusinessLogicsContarcts/IComponentLogic.cs
new file mode 100644
index 0000000..d2465d6
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/BusinessLogicsContarcts/IComponentLogic.cs
@@ -0,0 +1,20 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.SearchModels;
+using FurnitureAssemblyContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.BusinessLogicsContarcts
+{
+ public interface IComponentLogic
+ {
+ List? ReadList(ComponentSearchModel? model);
+ ComponentViewModel? ReadElement(ComponentSearchModel model);
+ bool Create(ComponentBindingModel model);
+ bool Update(ComponentBindingModel model);
+ bool Delete(ComponentBindingModel model);
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/BusinessLogicsContarcts/IFurnitureLogic.cs b/FurnitureAssembly/FurnitureAssemblyContracts/BusinessLogicsContarcts/IFurnitureLogic.cs
new file mode 100644
index 0000000..b4ec4f9
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/BusinessLogicsContarcts/IFurnitureLogic.cs
@@ -0,0 +1,20 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.SearchModels;
+using FurnitureAssemblyContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.BusinessLogicsContarcts
+{
+ public interface IFurnitureLogic
+ {
+ List? ReadList(FurnitureSearchModel? model);
+ FurnitureViewModel? ReadElement(FurnitureSearchModel model);
+ bool Create(FurnitureBindingModel model);
+ bool Update(FurnitureBindingModel model);
+ bool Delete(FurnitureBindingModel model);
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/BusinessLogicsContarcts/IOrderLogic.cs b/FurnitureAssembly/FurnitureAssemblyContracts/BusinessLogicsContarcts/IOrderLogic.cs
new file mode 100644
index 0000000..0619a27
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/BusinessLogicsContarcts/IOrderLogic.cs
@@ -0,0 +1,21 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.SearchModels;
+using FurnitureAssemblyContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.BusinessLogicsContarcts
+{
+ public interface IOrderLogic
+ {
+ List? ReadList(OrderSearchModel? model);
+ bool CreateOrder(OrderBindingModel model);
+ bool TakeOrderInWork(OrderBindingModel model);
+ bool FinishOrder(OrderBindingModel model);
+ bool DeliveryOrder(OrderBindingModel model);
+
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/FurnitureAssemblyContracts.csproj b/FurnitureAssembly/FurnitureAssemblyContracts/FurnitureAssemblyContracts.csproj
new file mode 100644
index 0000000..f9f8ab4
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/FurnitureAssemblyContracts.csproj
@@ -0,0 +1,20 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/SearchModels/ComponentSearchModel.cs b/FurnitureAssembly/FurnitureAssemblyContracts/SearchModels/ComponentSearchModel.cs
new file mode 100644
index 0000000..d6cad61
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/SearchModels/ComponentSearchModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.SearchModels
+{
+ public class ComponentSearchModel
+ {
+ public int? Id { get; set; }
+ public string? ComponentName { get; set; }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/SearchModels/FurnitureSearchModel.cs b/FurnitureAssembly/FurnitureAssemblyContracts/SearchModels/FurnitureSearchModel.cs
new file mode 100644
index 0000000..827fe8f
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/SearchModels/FurnitureSearchModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.SearchModels
+{
+ public class FurnitureSearchModel
+ {
+ public int? Id { get; set; }
+ public string? FurnitureName { get; set; }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/SearchModels/OrderSearchModel.cs b/FurnitureAssembly/FurnitureAssemblyContracts/SearchModels/OrderSearchModel.cs
new file mode 100644
index 0000000..25dba07
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/SearchModels/OrderSearchModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.SearchModels
+{
+ public class OrderSearchModel
+ {
+ public int? Id { get; set; }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/StoragesContracts/IComponentStorage.cs b/FurnitureAssembly/FurnitureAssemblyContracts/StoragesContracts/IComponentStorage.cs
new file mode 100644
index 0000000..22a17d8
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/StoragesContracts/IComponentStorage.cs
@@ -0,0 +1,21 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.SearchModels;
+using FurnitureAssemblyContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.StoragesContracts
+{
+ public interface IComponentStorage
+ {
+ List GetFullList();
+ List GetFilteredList(ComponentSearchModel model);
+ ComponentViewModel? GetElement(ComponentSearchModel model);
+ ComponentViewModel? Insert(ComponentBindingModel model);
+ ComponentViewModel? Update(ComponentBindingModel model);
+ ComponentViewModel? Delete(ComponentBindingModel model);
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/StoragesContracts/IFurnitureStorage.cs b/FurnitureAssembly/FurnitureAssemblyContracts/StoragesContracts/IFurnitureStorage.cs
new file mode 100644
index 0000000..b6bd179
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/StoragesContracts/IFurnitureStorage.cs
@@ -0,0 +1,21 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.SearchModels;
+using FurnitureAssemblyContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.StoragesContracts
+{
+ public interface IFurnitureStorage
+ {
+ List GetFullList();
+ List GetFilteredList(FurnitureSearchModel model);
+ FurnitureViewModel? GetElement(FurnitureSearchModel model);
+ FurnitureViewModel? Insert(FurnitureBindingModel model);
+ FurnitureViewModel? Update(FurnitureBindingModel model);
+ FurnitureViewModel? Delete(FurnitureBindingModel model);
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/StoragesContracts/IOrderStorage.cs b/FurnitureAssembly/FurnitureAssemblyContracts/StoragesContracts/IOrderStorage.cs
new file mode 100644
index 0000000..fd843e7
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/StoragesContracts/IOrderStorage.cs
@@ -0,0 +1,21 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.SearchModels;
+using FurnitureAssemblyContracts.ViewModels;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.StoragesContracts
+{
+ public interface IOrderStorage
+ {
+ List GetFullList();
+ List GetFilteredList(OrderSearchModel model);
+ OrderViewModel? GetElement(OrderSearchModel model);
+ OrderViewModel? Insert(OrderBindingModel model);
+ OrderViewModel? Update(OrderBindingModel model);
+ OrderViewModel? Delete(OrderBindingModel model);
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/ComponentViewModel.cs b/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/ComponentViewModel.cs
new file mode 100644
index 0000000..516ff28
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/ComponentViewModel.cs
@@ -0,0 +1,19 @@
+using FurnitureAssemblyDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.ViewModels
+{
+ public class ComponentViewModel : IComponentModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Название компонента")]
+ public string ComponentName { get; set; } = string.Empty;
+ [DisplayName("Цена")]
+ public double Cost { get; set; }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/FurnitureViewModel.cs b/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/FurnitureViewModel.cs
new file mode 100644
index 0000000..ea144c1
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/FurnitureViewModel.cs
@@ -0,0 +1,20 @@
+using FurnitureAssemblyDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.ViewModels
+{
+ public class FurnitureViewModel : IFurnitureModel
+ {
+ public int Id { get; set; }
+ [DisplayName("Название изделия")]
+ public string FurnitureName { get; set; } = string.Empty;
+ [DisplayName("Цена")]
+ public double Price { get; set; }
+ public Dictionary FurnitureComponents{ get; set; } = new();
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/OrderViewModel.cs b/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/OrderViewModel.cs
new file mode 100644
index 0000000..da11b84
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyContracts/ViewModels/OrderViewModel.cs
@@ -0,0 +1,30 @@
+using FurnitureAssemblyDataModels.Enums;
+using FurnitureAssemblyDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyContracts.ViewModels
+{
+ public class OrderViewModel : IOrderModel
+ {
+ [DisplayName("Номер")]
+ public int Id { get; set; }
+ public int FurnitureId { get; set; }
+ [DisplayName("Изделие")]
+ public string FurnitureName { get; set; } = string.Empty;
+ [DisplayName("Количество")]
+ public int Count { get; set; }
+ [DisplayName("Сумма")]
+ public double Sum { get; set; }
+ [DisplayName("Статус")]
+ public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
+ [DisplayName("Дата создания")]
+ public DateTime DateCreate { get; set; } = DateTime.Now;
+ [DisplayName("Дата выполнения")]
+ public DateTime? DateImplement { get; set; }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyDataModels/Enums/OrderStatus.cs b/FurnitureAssembly/FurnitureAssemblyDataModels/Enums/OrderStatus.cs
new file mode 100644
index 0000000..0f80752
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyDataModels/Enums/OrderStatus.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyDataModels.Enums
+{
+ public enum OrderStatus
+ {
+ Неизвестен = -1,
+ Принят = 0,
+ Выполняется = 1,
+ Готов = 2,
+ Выдан = 3
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyDataModels/FurnitureAssemblyDataModels.csproj b/FurnitureAssembly/FurnitureAssemblyDataModels/FurnitureAssemblyDataModels.csproj
new file mode 100644
index 0000000..d730273
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyDataModels/FurnitureAssemblyDataModels.csproj
@@ -0,0 +1,16 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
diff --git a/FurnitureAssembly/FurnitureAssemblyDataModels/IId.cs b/FurnitureAssembly/FurnitureAssemblyDataModels/IId.cs
new file mode 100644
index 0000000..07be087
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyDataModels/IId.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyDataModels
+{
+ public interface IId
+ {
+ int Id { get; }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyDataModels/Models/IComponentModel.cs b/FurnitureAssembly/FurnitureAssemblyDataModels/Models/IComponentModel.cs
new file mode 100644
index 0000000..6ade160
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyDataModels/Models/IComponentModel.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyDataModels.Models
+{
+ public interface IComponentModel : IId
+ {
+ string ComponentName { get; }
+ double Cost { get; }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyDataModels/Models/IFurnitureModel.cs b/FurnitureAssembly/FurnitureAssemblyDataModels/Models/IFurnitureModel.cs
new file mode 100644
index 0000000..217f579
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyDataModels/Models/IFurnitureModel.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyDataModels.Models
+{
+ public interface IFurnitureModel : IId
+ {
+ string FurnitureName { get; }
+ double Price { get; }
+ Dictionary FurnitureComponents { get; }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyDataModels/Models/IOrderModel.cs b/FurnitureAssembly/FurnitureAssemblyDataModels/Models/IOrderModel.cs
new file mode 100644
index 0000000..6334ef8
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyDataModels/Models/IOrderModel.cs
@@ -0,0 +1,19 @@
+using FurnitureAssemblyDataModels.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyDataModels.Models
+{
+ public interface IOrderModel : IId
+ {
+ int FurnitureId { get; }
+ int Count { get; }
+ double Sum { get; }
+ OrderStatus Status { get; }
+ DateTime DateCreate { get; }
+ DateTime? DateImplement { get; }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyListImplement/DataListSingleton.cs b/FurnitureAssembly/FurnitureAssemblyListImplement/DataListSingleton.cs
new file mode 100644
index 0000000..d3d6d9d
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyListImplement/DataListSingleton.cs
@@ -0,0 +1,32 @@
+using FurnitureAssemblyListImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyListImplement
+{
+ public class DataListSingleton
+ {
+ private static DataListSingleton? _instance;
+ public List Components { get; set; }
+ public List Orders { get; set; }
+ public List Furnitures { get; set; }
+ private DataListSingleton()
+ {
+ Components = new List();
+ Orders = new List();
+ Furnitures = new List();
+ }
+ public static DataListSingleton GetInstance()
+ {
+ if (_instance == null)
+ {
+ _instance = new DataListSingleton();
+ }
+ return _instance;
+ }
+
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyListImplement/FurnitureAssemblyListImplement.csproj b/FurnitureAssembly/FurnitureAssemblyListImplement/FurnitureAssemblyListImplement.csproj
new file mode 100644
index 0000000..5081f9c
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyListImplement/FurnitureAssemblyListImplement.csproj
@@ -0,0 +1,18 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FurnitureAssembly/FurnitureAssemblyListImplement/Implements/ComponentStorage.cs b/FurnitureAssembly/FurnitureAssemblyListImplement/Implements/ComponentStorage.cs
new file mode 100644
index 0000000..6becfba
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyListImplement/Implements/ComponentStorage.cs
@@ -0,0 +1,110 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.SearchModels;
+using FurnitureAssemblyContracts.StoragesContracts;
+using FurnitureAssemblyContracts.ViewModels;
+using FurnitureAssemblyListImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyListImplement.Implements
+{
+ public class ComponentStorage : IComponentStorage
+ {
+ private readonly DataListSingleton _source;
+ public ComponentStorage()
+ {
+ _source = DataListSingleton.GetInstance();
+ }
+ public List GetFullList()
+ {
+ var result = new List();
+ foreach (var component in _source.Components)
+ {
+ result.Add(component.GetViewModel);
+ }
+ return result;
+ }
+ public List GetFilteredList(ComponentSearchModel
+ model)
+ {
+ var result = new List();
+ if (string.IsNullOrEmpty(model.ComponentName))
+ {
+ return result;
+ }
+ foreach (var component in _source.Components)
+ {
+ if (component.ComponentName.Contains(model.ComponentName))
+ {
+ result.Add(component.GetViewModel);
+ }
+ }
+ return result;
+ }
+ public ComponentViewModel? GetElement(ComponentSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.ComponentName) && !model.Id.HasValue)
+ {
+ return null;
+ }
+
+ foreach (var component in _source.Components)
+ {
+ if ((!string.IsNullOrEmpty(model.ComponentName) &&
+ component.ComponentName == model.ComponentName) ||
+ (model.Id.HasValue && component.Id == model.Id))
+ {
+ return component.GetViewModel;
+ }
+ }
+ return null;
+ }
+ public ComponentViewModel? Insert(ComponentBindingModel model)
+ {
+ model.Id = 1;
+ foreach (var component in _source.Components)
+ {
+ if (model.Id <= component.Id)
+ {
+ model.Id = component.Id + 1;
+ }
+ }
+ var newComponent = Component.Create(model);
+ if (newComponent == null)
+ {
+ return null;
+ }
+ _source.Components.Add(newComponent);
+ return newComponent.GetViewModel;
+ }
+ public ComponentViewModel? Update(ComponentBindingModel model)
+ {
+ foreach (var component in _source.Components)
+ {
+ if (component.Id == model.Id)
+ {
+ component.Update(model);
+ return component.GetViewModel;
+ }
+ }
+ return null;
+ }
+ public ComponentViewModel? Delete(ComponentBindingModel model)
+ {
+ for (int i = 0; i < _source.Components.Count; ++i)
+ {
+ if (_source.Components[i].Id == model.Id)
+ {
+ var element = _source.Components[i];
+ _source.Components.RemoveAt(i);
+ return element.GetViewModel;
+ }
+ }
+ return null;
+ }
+
+ }
+ }
diff --git a/FurnitureAssembly/FurnitureAssemblyListImplement/Implements/FurnitureStorage.cs b/FurnitureAssembly/FurnitureAssemblyListImplement/Implements/FurnitureStorage.cs
new file mode 100644
index 0000000..d2cd6fc
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyListImplement/Implements/FurnitureStorage.cs
@@ -0,0 +1,114 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.SearchModels;
+using FurnitureAssemblyContracts.StoragesContracts;
+using FurnitureAssemblyContracts.ViewModels;
+using FurnitureAssemblyListImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyListImplement.Implements
+{
+ public class FurnitureStorage : IFurnitureStorage
+ {
+ private readonly DataListSingleton _source;
+ public FurnitureStorage()
+ {
+ _source = DataListSingleton.GetInstance();
+ }
+
+ public FurnitureViewModel? Delete(FurnitureBindingModel model)
+ {
+ for (int i = 0; i < _source.Furnitures.Count; ++i)
+ {
+ if (_source.Furnitures[i].Id == model.Id)
+ {
+ var element = _source.Furnitures[i];
+ _source.Furnitures.RemoveAt(i);
+ return element.GetViewModel;
+ }
+ }
+ return null;
+ }
+
+ public FurnitureViewModel? GetElement(FurnitureSearchModel model)
+ {
+ if (string.IsNullOrEmpty(model.FurnitureName) && !model.Id.HasValue)
+ {
+ return null;
+ }
+
+ foreach (var furniture in _source.Furnitures)
+ {
+ if ((!string.IsNullOrEmpty(model.FurnitureName) &&
+ furniture.FurnitureName == model.FurnitureName) ||
+ (model.Id.HasValue && furniture.Id == model.Id))
+ {
+ return furniture.GetViewModel;
+ }
+ }
+ return null;
+ }
+
+ public List GetFilteredList(FurnitureSearchModel model)
+ {
+ var result = new List();
+ if (string.IsNullOrEmpty(model.FurnitureName))
+ {
+ return result;
+ }
+ foreach (var furniture in _source.Furnitures)
+ {
+ if (furniture.FurnitureName.Contains(model.FurnitureName))
+ {
+ result.Add(furniture.GetViewModel);
+ }
+ }
+ return result;
+ }
+
+ public List GetFullList()
+ {
+ var result = new List();
+ foreach (var furniture in _source.Furnitures)
+ {
+ result.Add(furniture.GetViewModel);
+ }
+ return result;
+ }
+
+ public FurnitureViewModel? Insert(FurnitureBindingModel model)
+ {
+ model.Id = 1;
+ foreach (var furniture in _source.Furnitures)
+ {
+ if (model.Id <= furniture.Id)
+ {
+ model.Id = furniture.Id + 1;
+ }
+ }
+ var newFurniture = Furniture.Create(model);
+ if (newFurniture == null)
+ {
+ return null;
+ }
+ _source.Furnitures.Add(newFurniture);
+ return newFurniture.GetViewModel;
+ }
+
+ public FurnitureViewModel? Update(FurnitureBindingModel model)
+ {
+ foreach (var furniture in _source.Furnitures)
+ {
+ if (furniture.Id == model.Id)
+ {
+ furniture.Update(model);
+ return furniture.GetViewModel;
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyListImplement/Implements/OrderStorage.cs b/FurnitureAssembly/FurnitureAssemblyListImplement/Implements/OrderStorage.cs
new file mode 100644
index 0000000..eeb359d
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyListImplement/Implements/OrderStorage.cs
@@ -0,0 +1,108 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.SearchModels;
+using FurnitureAssemblyContracts.StoragesContracts;
+using FurnitureAssemblyContracts.ViewModels;
+using FurnitureAssemblyListImplement.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyListImplement.Implements
+{
+ public class OrderStorage : IOrderStorage
+ {
+ private readonly DataListSingleton _source;
+ public OrderStorage()
+ {
+ _source = DataListSingleton.GetInstance();
+ }
+ public OrderViewModel? Delete(OrderBindingModel model)
+ {
+ for (int i = 0; i < _source.Orders.Count; ++i)
+ {
+ if (_source.Orders[i].Id == model.Id)
+ {
+ var element = _source.Orders[i];
+ _source.Orders.RemoveAt(i);
+ return element.GetViewModel;
+ }
+ }
+ return null;
+ }
+
+ public OrderViewModel? GetElement(OrderSearchModel model)
+ {
+ if (!model.Id.HasValue)
+ {
+ return null;
+ }
+
+ foreach (var order in _source.Orders)
+ {
+ if (model.Id.HasValue && order.Id == model.Id)
+ {
+ return order.GetViewModel;
+ }
+ }
+ return null;
+ }
+
+ public List GetFilteredList(OrderSearchModel model)
+ {
+ var result = new List();
+
+ foreach (var order in _source.Orders)
+ {
+ if (order.Id.Equals(model.Id))
+ {
+ result.Add(order.GetViewModel);
+ }
+ }
+ return result;
+ }
+
+ public List GetFullList()
+ {
+ var result = new List();
+ foreach (var order in _source.Orders)
+ {
+ result.Add(order.GetViewModel);
+ }
+ return result;
+ }
+
+ public OrderViewModel? Insert(OrderBindingModel model)
+ {
+ model.Id = 1;
+ foreach (var order in _source.Orders)
+ {
+ if (model.Id <= order.Id)
+ {
+ model.Id = order.Id + 1;
+ }
+ }
+ var newOrder = Order.Create(model);
+ if (newOrder == null)
+ {
+ return null;
+ }
+ _source.Orders.Add(newOrder);
+ return newOrder.GetViewModel;
+ }
+
+ public OrderViewModel? Update(OrderBindingModel model)
+ {
+ foreach (var order in _source.Orders)
+ {
+ if (order.Id == model.Id)
+ {
+ order.Update(model);
+ return order.GetViewModel;
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyListImplement/Models/Component.cs b/FurnitureAssembly/FurnitureAssemblyListImplement/Models/Component.cs
new file mode 100644
index 0000000..3c70f80
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyListImplement/Models/Component.cs
@@ -0,0 +1,49 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.ViewModels;
+using FurnitureAssemblyDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyListImplement.Models
+{
+ public class Component : IComponentModel
+ {
+ public string ComponentName { get; private set; } = string.Empty;
+
+ public double Cost { get; set; }
+
+ public int Id { get; private set; }
+
+ public static Component? Create(ComponentBindingModel? model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Component()
+ {
+ Id = model.Id,
+ ComponentName = model.ComponentName,
+ Cost = model.Cost
+ };
+ }
+ public void Update(ComponentBindingModel? model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ ComponentName = model.ComponentName;
+ Cost = model.Cost;
+ }
+ public ComponentViewModel GetViewModel => new()
+ {
+ Id = Id,
+ ComponentName = ComponentName,
+ Cost = Cost
+ };
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyListImplement/Models/Furniture.cs b/FurnitureAssembly/FurnitureAssemblyListImplement/Models/Furniture.cs
new file mode 100644
index 0000000..9202cb4
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyListImplement/Models/Furniture.cs
@@ -0,0 +1,56 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.ViewModels;
+using FurnitureAssemblyDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyListImplement.Models
+{
+ public class Furniture : IFurnitureModel
+ {
+ public string FurnitureName { get; private set; } = string.Empty;
+
+ public double Price { get; private set; }
+
+ public Dictionary FurnitureComponents { get; private set; } = new Dictionary();
+
+ public int Id { get; private set; }
+
+ public static Furniture? Create(FurnitureBindingModel? model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Furniture() {
+ Id = model.Id,
+ FurnitureName = model.FurnitureName,
+ Price = model.Price,
+ FurnitureComponents = model.FurnitureComponents
+ };
+ }
+
+ public void Update(FurnitureBindingModel? model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ FurnitureName = model.FurnitureName;
+ Price = model.Price;
+ FurnitureComponents = model.FurnitureComponents;
+ }
+ public FurnitureViewModel GetViewModel => new()
+ {
+ Id = Id,
+ FurnitureName = FurnitureName,
+ Price = Price,
+ FurnitureComponents = FurnitureComponents
+ };
+
+ }
+}
diff --git a/FurnitureAssembly/FurnitureAssemblyListImplement/Models/Order.cs b/FurnitureAssembly/FurnitureAssemblyListImplement/Models/Order.cs
new file mode 100644
index 0000000..04b3752
--- /dev/null
+++ b/FurnitureAssembly/FurnitureAssemblyListImplement/Models/Order.cs
@@ -0,0 +1,79 @@
+using FurnitureAssemblyContracts.BindingModels;
+using FurnitureAssemblyContracts.ViewModels;
+using FurnitureAssemblyDataModels.Enums;
+using FurnitureAssemblyDataModels.Models;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace FurnitureAssemblyListImplement.Models
+{
+ public class Order : IOrderModel
+ {
+ public int FurnitureId { get; private set; }
+
+ public string FurnitureName { get; private set; } = string.Empty;
+
+ public int Count { get; private set; }
+
+ public double Sum { get; private set; }
+
+ public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
+
+ public DateTime DateCreate { get; private set; } = DateTime.Now;
+
+ public DateTime? DateImplement { get; private set; }
+
+ public int Id { get; private set; }
+
+ public static Order? Create(OrderBindingModel? model)
+ {
+ if (model == null)
+ {
+ return null;
+ }
+ return new Order()
+ {
+ Id = model.Id,
+ FurnitureId = model.FurnitureId,
+ FurnitureName = model.FurnitureName,
+ Count = model.Count,
+ Sum = model.Sum,
+ Status = model.Status,
+ DateCreate = model.DateCreate,
+ DateImplement = model.DateImplement
+ };
+ }
+
+ public void Update(OrderBindingModel? model)
+ {
+ if (model == null)
+ {
+ return;
+ }
+ FurnitureId = model.FurnitureId;
+ FurnitureName = model.FurnitureName;
+ Count = model.Count;
+ Sum = model.Sum;
+ Status = model.Status;
+ DateCreate = model.DateCreate;
+ DateImplement = model.DateImplement;
+ }
+
+ public OrderViewModel GetViewModel => new()
+ {
+ Id = Id,
+ FurnitureId = FurnitureId,
+ FurnitureName = FurnitureName,
+ Count = Count,
+ Sum = Sum,
+ Status = Status,
+ DateCreate = DateCreate,
+ DateImplement = DateImplement
+ };
+ }
+}