diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Client.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Client.cs
index 33b7f98..4473053 100644
--- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Client.cs
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Client.cs
@@ -17,7 +17,7 @@ public class Client
public bool Optovik { get; private set; }
- public static Client CreateClient(int id, string name, ClientType clientType, bool optovik)
+ public static Client CreateEntity(int id, string name, ClientType clientType, bool optovik)
{
return new Client
{
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/ClientType.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/ClientType.cs
index 92c857d..d518da4 100644
--- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/ClientType.cs
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/ClientType.cs
@@ -6,7 +6,6 @@ using System.Threading.Tasks;
namespace ProjectCompanyFurniture.Entities.Enums;
-[Flags]
public enum ClientType
{
None = 0,
@@ -21,6 +20,6 @@ public enum ClientType
///
/// организация
///
- Organization = 4
+ Organization = 3
}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/Movement.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/Movement.cs
index a010820..88633d6 100644
--- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/Movement.cs
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/Movement.cs
@@ -6,6 +6,8 @@ using System.Threading.Tasks;
namespace ProjectCompanyFurniture.Entities.Enums;
+
+[Flags]
public enum Movement
{
None = 0,
@@ -20,15 +22,14 @@ public enum Movement
///
/// перемещение на склад
///
- MovingToWarehouse = 3,
-
+ MovingToWarehouse = 4,
///
/// подготовка к отправке
///
- PreparationForShipment = 4,
+ PreparationForShipment = 8,
///
/// перемещение в магазин
///
- MovingToStore = 5,
+ MovingToStore = 16,
}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Invoice.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Invoice.cs
index a598aaf..7034b3c 100644
--- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Invoice.cs
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Invoice.cs
@@ -12,6 +12,7 @@ public class Invoice
public int ClientID { get; set; }
+ // 0 или 1
public int AvailabilityOfPromotionalCode { get; set; }
public int DiscountPercentage { get; set; }
@@ -20,8 +21,14 @@ public class Invoice
DateTime Data { get; set; }
- public static Invoice CreateInvoice(int id, int clientId, int availabilityOfPromotionalCode, int discountPercentage,
- int sellingPrice, DateTime data)
+ public IEnumerable Products
+ {
+ get;
+ private set;
+ } = [];
+
+ public static Invoice CreateOperation(int id, int clientId, int availabilityOfPromotionalCode, int discountPercentage,
+ int sellingPrice, IEnumerable products)
{
return new Invoice
{
@@ -30,7 +37,8 @@ public class Invoice
AvailabilityOfPromotionalCode = availabilityOfPromotionalCode,
DiscountPercentage = discountPercentage,
SellingPrice = sellingPrice,
- Data = data
+ Data = DateTime.Now,
+ Products = products
};
}
}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/InvoiceProduct.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/InvoiceProduct.cs
index 39f2ac4..4714d20 100644
--- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/InvoiceProduct.cs
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/InvoiceProduct.cs
@@ -14,7 +14,9 @@ public class InvoiceProduct
public int Count { get; private set; }
- public static InvoiceProduct CreateInvoiceProduct(int invoiceId, int productID, int count)
+ public int SellingPrice { get; private set; }
+
+ public static InvoiceProduct CreateElement(int invoiceId, int productID, int count)
{
return new InvoiceProduct
{
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Manufacturer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Manufacturer.cs
index 995e3ee..70716d3 100644
--- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Manufacturer.cs
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Manufacturer.cs
@@ -1,4 +1,4 @@
-using System;
+ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -12,7 +12,7 @@ public class Manufacturer
public string Name { get; set; }
- public static Manufacturer CreateManufacturer(int iD, string name)
+ public static Manufacturer CreateEntity(int iD, string name)
{
return new Manufacturer
{
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Product.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Product.cs
new file mode 100644
index 0000000..02fa9de
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Product.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectCompanyFurniture.Entities;
+
+public class Product
+{
+ public int ID { get; private set; }
+
+ public int ManufacturerID { get; private set; }
+
+ public string Name { get; private set; }
+
+ public string Category { get; private set; }
+
+ public int StartingPrice { get; private set; }
+
+ public static Product CreateEntity(int id, int manufacturerID, string name, string category, int startingPrice)
+ {
+ return new Product
+ {
+
+ ID = id,
+ ManufacturerID = manufacturerID,
+ Name = name,
+ Category = category,
+ StartingPrice = startingPrice
+ };
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/ProductMovement.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/ProductMovement.cs
index 5628b14..cba9cff 100644
--- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/ProductMovement.cs
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/ProductMovement.cs
@@ -15,13 +15,16 @@ public class ProductMovement
public Movement MovementProduct { get; private set; }
- public ProductMovement CreateProductMovement (int it, int productId, Movement movement)
+ public DateTime Date { get; private set; }
+
+ public static ProductMovement CreateOperation (int it, int productId, Movement movement)
{
return new ProductMovement
{
ID = it,
ProductID = productId,
- MovementProduct = movement
+ MovementProduct = movement,
+ Date = DateTime.Now
};
}
}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Form1.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Form1.Designer.cs
deleted file mode 100644
index 99f47fb..0000000
--- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Form1.Designer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace ProjectCompanyFurniture
-{
- 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
- }
-}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Form1.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Form1.cs
deleted file mode 100644
index 3307d65..0000000
--- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Form1.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace ProjectCompanyFurniture
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/FormCompanyFurniture.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/FormCompanyFurniture.Designer.cs
new file mode 100644
index 0000000..c1ec43b
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/FormCompanyFurniture.Designer.cs
@@ -0,0 +1,147 @@
+namespace ProjectCompanyFurniture
+{
+ partial class FormCompanyFurniture
+ {
+ ///
+ /// 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()
+ {
+ components = new System.ComponentModel.Container();
+ menuStrip1 = new MenuStrip();
+ справочникиToolStripMenuItem = new ToolStripMenuItem();
+ productToolStripMenuItem = new ToolStripMenuItem();
+ manufacturerToolStripMenuItem = new ToolStripMenuItem();
+ clientToolStripMenuItem1 = new ToolStripMenuItem();
+ операцииToolStripMenuItem = new ToolStripMenuItem();
+ invoiceToolStripMenuItem = new ToolStripMenuItem();
+ productMovementToolStripMenuItem = new ToolStripMenuItem();
+ отчетыToolStripMenuItem = new ToolStripMenuItem();
+ contextMenuStrip1 = new ContextMenuStrip(components);
+ menuStrip1.SuspendLayout();
+ SuspendLayout();
+ //
+ // menuStrip1
+ //
+ menuStrip1.ImageScalingSize = new Size(20, 20);
+ menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem });
+ menuStrip1.Location = new Point(0, 0);
+ menuStrip1.Name = "menuStrip1";
+ menuStrip1.Size = new Size(995, 28);
+ menuStrip1.TabIndex = 0;
+ menuStrip1.Text = "menuStrip1";
+ //
+ // справочникиToolStripMenuItem
+ //
+ справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { productToolStripMenuItem, manufacturerToolStripMenuItem, clientToolStripMenuItem1 });
+ справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
+ справочникиToolStripMenuItem.Size = new Size(117, 24);
+ справочникиToolStripMenuItem.Text = "Справочники";
+ //
+ // productToolStripMenuItem
+ //
+ productToolStripMenuItem.Name = "productToolStripMenuItem";
+ productToolStripMenuItem.Size = new Size(201, 26);
+ productToolStripMenuItem.Text = "Продукт";
+ productToolStripMenuItem.Click += ProductToolStripMenuItem_Click;
+ //
+ // manufacturerToolStripMenuItem
+ //
+ manufacturerToolStripMenuItem.Name = "manufacturerToolStripMenuItem";
+ manufacturerToolStripMenuItem.Size = new Size(201, 26);
+ manufacturerToolStripMenuItem.Text = "Производитель";
+ manufacturerToolStripMenuItem.Click += ManufacturerToolStripMenuItem_Click;
+ //
+ // clientToolStripMenuItem1
+ //
+ clientToolStripMenuItem1.Name = "clientToolStripMenuItem1";
+ clientToolStripMenuItem1.Size = new Size(201, 26);
+ clientToolStripMenuItem1.Text = "Клиент";
+ clientToolStripMenuItem1.Click += ClientToolStripMenuItem_Click;
+ //
+ // операцииToolStripMenuItem
+ //
+ операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { invoiceToolStripMenuItem, productMovementToolStripMenuItem });
+ операцииToolStripMenuItem.Name = "операцииToolStripMenuItem";
+ операцииToolStripMenuItem.Size = new Size(95, 24);
+ операцииToolStripMenuItem.Text = "Операции";
+ //
+ // invoiceToolStripMenuItem
+ //
+ invoiceToolStripMenuItem.Name = "invoiceToolStripMenuItem";
+ invoiceToolStripMenuItem.Size = new Size(216, 26);
+ invoiceToolStripMenuItem.Text = "Накладная";
+ invoiceToolStripMenuItem.Click += InvoiceToolStripMenuItem_Click;
+ //
+ // productMovementToolStripMenuItem
+ //
+ productMovementToolStripMenuItem.Name = "productMovementToolStripMenuItem";
+ productMovementToolStripMenuItem.Size = new Size(216, 26);
+ productMovementToolStripMenuItem.Text = "Движение товара";
+ productMovementToolStripMenuItem.Click += ProductMovementToolStripMenuItem_Click;
+ //
+ // отчетыToolStripMenuItem
+ //
+ отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
+ отчетыToolStripMenuItem.Size = new Size(73, 24);
+ отчетыToolStripMenuItem.Text = "Отчеты";
+ //
+ // contextMenuStrip1
+ //
+ contextMenuStrip1.ImageScalingSize = new Size(20, 20);
+ contextMenuStrip1.Name = "contextMenuStrip1";
+ contextMenuStrip1.Size = new Size(61, 4);
+ //
+ // FormCompanyFurniture
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ BackgroundImage = Properties.Resources.mebel;
+ BackgroundImageLayout = ImageLayout.Stretch;
+ ClientSize = new Size(995, 553);
+ Controls.Add(menuStrip1);
+ MainMenuStrip = menuStrip1;
+ Name = "FormCompanyFurniture";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "Фирма \"Мебель\"";
+ menuStrip1.ResumeLayout(false);
+ menuStrip1.PerformLayout();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private MenuStrip menuStrip1;
+ private ToolStripMenuItem справочникиToolStripMenuItem;
+ private ToolStripMenuItem productToolStripMenuItem;
+ private ToolStripMenuItem операцииToolStripMenuItem;
+ private ToolStripMenuItem отчетыToolStripMenuItem;
+ private ToolStripMenuItem manufacturerToolStripMenuItem;
+ private ToolStripMenuItem clientToolStripMenuItem1;
+ private ContextMenuStrip contextMenuStrip1;
+ private ToolStripMenuItem invoiceToolStripMenuItem;
+ private ToolStripMenuItem productMovementToolStripMenuItem;
+ }
+}
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/FormCompanyFurniture.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/FormCompanyFurniture.cs
new file mode 100644
index 0000000..f764b9d
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/FormCompanyFurniture.cs
@@ -0,0 +1,86 @@
+using ProjectCompanyFurniture.Forms;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Xml.Linq;
+using Unity;
+
+namespace ProjectCompanyFurniture
+{
+ public partial class FormCompanyFurniture : Form
+ {
+ private readonly IUnityContainer _container;
+
+ public FormCompanyFurniture(IUnityContainer container)
+ {
+ InitializeComponent();
+ _container = container ?? throw new ArgumentNullException(nameof(container));
+ }
+
+ private void ProductToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ _container.Resolve().ShowDialog();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ClientToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ _container.Resolve().ShowDialog();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ManufacturerToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ _container.Resolve().ShowDialog();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void InvoiceToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ _container.Resolve().ShowDialog();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ProductMovementToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ _container.Resolve().ShowDialog();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/FormCompanyFurniture.resx b/ProjectCompanyFurniture/ProjectCompanyFurniture/FormCompanyFurniture.resx
new file mode 100644
index 0000000..244ba90
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/FormCompanyFurniture.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+ 153, 17
+
+
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.Designer.cs
new file mode 100644
index 0000000..d2c0722
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.Designer.cs
@@ -0,0 +1,161 @@
+namespace ProjectCompanyFurniture.Forms
+{
+ partial class FormClient
+ {
+ ///
+ /// 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()
+ {
+ labelName = new Label();
+ labelType = new Label();
+ labelOptovik = new Label();
+ textBoxName = new TextBox();
+ buttonSave = new Button();
+ buttonCancel = new Button();
+ radioButtonOptYes = new RadioButton();
+ radioButtonOptNo = new RadioButton();
+ comboBoxClientType = new ComboBox();
+ SuspendLayout();
+ //
+ // labelName
+ //
+ labelName.AutoSize = true;
+ labelName.Location = new Point(38, 39);
+ labelName.Name = "labelName";
+ labelName.Size = new Size(42, 20);
+ labelName.TabIndex = 0;
+ labelName.Text = "ФИО";
+ //
+ // labelType
+ //
+ labelType.AutoSize = true;
+ labelType.Location = new Point(38, 106);
+ labelType.Name = "labelType";
+ labelType.Size = new Size(94, 20);
+ labelType.TabIndex = 1;
+ labelType.Text = "Тип клиента";
+ //
+ // labelOptovik
+ //
+ labelOptovik.AutoSize = true;
+ labelOptovik.Location = new Point(38, 179);
+ labelOptovik.Name = "labelOptovik";
+ labelOptovik.Size = new Size(68, 20);
+ labelOptovik.TabIndex = 2;
+ labelOptovik.Text = "Оптовик";
+ //
+ // textBoxName
+ //
+ textBoxName.Location = new Point(157, 36);
+ textBoxName.Name = "textBoxName";
+ textBoxName.Size = new Size(125, 27);
+ textBoxName.TabIndex = 3;
+ //
+ // buttonSave
+ //
+ buttonSave.BackColor = Color.FromArgb(255, 192, 128);
+ buttonSave.Location = new Point(38, 255);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(94, 29);
+ buttonSave.TabIndex = 6;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = false;
+ buttonSave.Click += ButtonSave_Click;
+ //
+ // buttonCancel
+ //
+ buttonCancel.BackColor = Color.FromArgb(255, 192, 128);
+ buttonCancel.Location = new Point(188, 255);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(94, 29);
+ buttonCancel.TabIndex = 7;
+ buttonCancel.Text = "Отмена";
+ buttonCancel.UseVisualStyleBackColor = false;
+ buttonCancel.Click += ButtonCancel_Click;
+ //
+ // radioButtonOptYes
+ //
+ radioButtonOptYes.AutoSize = true;
+ radioButtonOptYes.Location = new Point(157, 177);
+ radioButtonOptYes.Name = "radioButtonOptYes";
+ radioButtonOptYes.Size = new Size(48, 24);
+ radioButtonOptYes.TabIndex = 8;
+ radioButtonOptYes.TabStop = true;
+ radioButtonOptYes.Text = "Да";
+ radioButtonOptYes.UseVisualStyleBackColor = true;
+ //
+ // radioButtonOptNo
+ //
+ radioButtonOptNo.AutoSize = true;
+ radioButtonOptNo.Location = new Point(227, 177);
+ radioButtonOptNo.Name = "radioButtonOptNo";
+ radioButtonOptNo.Size = new Size(55, 24);
+ radioButtonOptNo.TabIndex = 9;
+ radioButtonOptNo.TabStop = true;
+ radioButtonOptNo.Text = "Нет";
+ radioButtonOptNo.UseVisualStyleBackColor = true;
+ //
+ // comboBoxClientType
+ //
+ comboBoxClientType.FormattingEnabled = true;
+ comboBoxClientType.Location = new Point(157, 106);
+ comboBoxClientType.Name = "comboBoxClientType";
+ comboBoxClientType.Size = new Size(125, 28);
+ comboBoxClientType.TabIndex = 10;
+ //
+ // FormClient
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(329, 324);
+ Controls.Add(comboBoxClientType);
+ Controls.Add(radioButtonOptNo);
+ Controls.Add(radioButtonOptYes);
+ Controls.Add(buttonCancel);
+ Controls.Add(buttonSave);
+ Controls.Add(textBoxName);
+ Controls.Add(labelOptovik);
+ Controls.Add(labelType);
+ Controls.Add(labelName);
+ Name = "FormClient";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "Клиент";
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private Label labelName;
+ private Label labelType;
+ private Label labelOptovik;
+ private TextBox textBoxName;
+ private Button buttonSave;
+ private Button buttonCancel;
+ private RadioButton radioButtonOptYes;
+ private RadioButton radioButtonOptNo;
+ private ComboBox comboBoxClientType;
+ }
+}
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.cs
new file mode 100644
index 0000000..10b1c13
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.cs
@@ -0,0 +1,90 @@
+using ProjectCompanyFurniture.Entities;
+using ProjectCompanyFurniture.Entities.Enums;
+using ProjectCompanyFurniture.Repositories;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ProjectCompanyFurniture.Forms
+{
+ public partial class FormClient : Form
+ {
+ private readonly IClientRepository _clientRepository;
+ private int? _clientId;
+ public int Id
+ {
+ set
+ {
+ try
+ {
+ var client = _clientRepository.ReadClientById(value);
+ if (client == null)
+ {
+ throw new InvalidDataException(nameof(client));
+ }
+ textBoxName.Text = client.Name;
+ comboBoxClientType.SelectedItem = client.ClientType;
+ if (client.Optovik)
+ {
+ radioButtonOptYes.Checked = true;
+ }
+ else
+ {
+ radioButtonOptNo.Checked = true;
+ }
+ _clientId = value;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ }
+ }
+
+ public FormClient(IClientRepository clientRepository)
+ {
+ InitializeComponent();
+ _clientRepository = clientRepository ?? throw new ArgumentNullException(nameof(clientRepository));
+ comboBoxClientType.DataSource = Enum.GetValues(typeof(ClientType));
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (string.IsNullOrWhiteSpace(textBoxName.Text)
+ || (radioButtonOptYes.Checked == false && radioButtonOptNo.Checked == false)
+ || comboBoxClientType.SelectedIndex < 1)
+ {
+ throw new Exception("Имеются незаполненные поля");
+ }
+ if (_clientId.HasValue)
+ {
+ _clientRepository.UpdateClient(CreateClient(_clientId.Value));
+ }
+ else
+ {
+ _clientRepository.CreateClient(CreateClient(0));
+ }
+ Close();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при сохранении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e) => Close();
+
+ private Client CreateClient(int id) => Client.CreateEntity(id, textBoxName.Text,
+ (ClientType)comboBoxClientType.SelectedItem!, radioButtonOptYes.Checked);
+ }
+}
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Form1.resx b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.resx
similarity index 92%
rename from ProjectCompanyFurniture/ProjectCompanyFurniture/Form1.resx
rename to ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.resx
index 1af7de1..8b2ff64 100644
--- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Form1.resx
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.resx
@@ -1,17 +1,17 @@
-
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClients.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClients.Designer.cs
new file mode 100644
index 0000000..e9b1dbb
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClients.Designer.cs
@@ -0,0 +1,128 @@
+namespace ProjectCompanyFurniture.Forms
+{
+ partial class FormClients
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ panel1 = new Panel();
+ buttonDel = new Button();
+ buttonEdt = new Button();
+ buttonAdd = new Button();
+ dataGridViewData = new DataGridView();
+ panel1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
+ SuspendLayout();
+ //
+ // panel1
+ //
+ panel1.Controls.Add(buttonDel);
+ panel1.Controls.Add(buttonEdt);
+ panel1.Controls.Add(buttonAdd);
+ panel1.Dock = DockStyle.Right;
+ panel1.Location = new Point(692, 0);
+ panel1.Name = "panel1";
+ panel1.Size = new Size(108, 450);
+ panel1.TabIndex = 0;
+ //
+ // buttonDel
+ //
+ buttonDel.BackgroundImage = Properties.Resources.minus;
+ buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonDel.Location = new Point(8, 244);
+ buttonDel.Name = "buttonDel";
+ buttonDel.Size = new Size(94, 91);
+ buttonDel.TabIndex = 2;
+ buttonDel.UseVisualStyleBackColor = true;
+ buttonDel.Click += ButtonDel_Click;
+ //
+ // buttonEdt
+ //
+ buttonEdt.BackgroundImage = Properties.Resources.edit;
+ buttonEdt.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonEdt.Location = new Point(8, 135);
+ buttonEdt.Name = "buttonEdt";
+ buttonEdt.Size = new Size(94, 90);
+ buttonEdt.TabIndex = 1;
+ buttonEdt.UseVisualStyleBackColor = true;
+ buttonEdt.Click += ButtonEdt_Click;
+ //
+ // buttonAdd
+ //
+ buttonAdd.BackgroundImage = Properties.Resources.plus;
+ buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonAdd.Location = new Point(8, 26);
+ buttonAdd.Name = "buttonAdd";
+ buttonAdd.Size = new Size(94, 90);
+ buttonAdd.TabIndex = 0;
+ buttonAdd.UseVisualStyleBackColor = true;
+ buttonAdd.Click += ButtonAdd_Click;
+ //
+ // dataGridViewData
+ //
+ dataGridViewData.AllowUserToAddRows = false;
+ dataGridViewData.AllowUserToDeleteRows = false;
+ dataGridViewData.AllowUserToResizeColumns = false;
+ dataGridViewData.AllowUserToResizeRows = false;
+ dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
+ dataGridViewData.BackgroundColor = Color.FromArgb(255, 224, 192);
+ dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridViewData.Dock = DockStyle.Fill;
+ dataGridViewData.Location = new Point(0, 0);
+ dataGridViewData.MultiSelect = false;
+ dataGridViewData.Name = "dataGridViewData";
+ dataGridViewData.ReadOnly = true;
+ dataGridViewData.RowHeadersVisible = false;
+ dataGridViewData.RowHeadersWidth = 51;
+ dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+ dataGridViewData.Size = new Size(692, 450);
+ dataGridViewData.TabIndex = 3;
+ //
+ // FormClients
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(dataGridViewData);
+ Controls.Add(panel1);
+ Name = "FormClients";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "Клиенты";
+ Load += FormClients_Load;
+ panel1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private Panel panel1;
+ private Button buttonDel;
+ private Button buttonEdt;
+ private Button buttonAdd;
+ private DataGridView dataGridViewData;
+ }
+}
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClients.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClients.cs
new file mode 100644
index 0000000..40f9fac
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClients.cs
@@ -0,0 +1,108 @@
+using ProjectCompanyFurniture.Repositories;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using System.Xml.Linq;
+using Unity;
+
+namespace ProjectCompanyFurniture.Forms
+{
+ public partial class FormClients : Form
+ {
+ private readonly IUnityContainer _container;
+ private readonly IClientRepository _clientRepository;
+
+ public FormClients(IUnityContainer container, IClientRepository clientRepository)
+ {
+ InitializeComponent();
+ _container = container ?? throw new ArgumentNullException(nameof(container));
+ _clientRepository = clientRepository ?? throw new ArgumentNullException(nameof(clientRepository));
+ }
+
+ private void FormClients_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ _container.Resolve().ShowDialog();
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonEdt_Click(object sender, EventArgs e)
+ {
+ if (!TryGetIdentifierFromSelectedRow(out var findId))
+ {
+ return;
+ }
+ try
+ {
+ var form = _container.Resolve();
+ form.Id = findId;
+ form.ShowDialog();
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonDel_Click(object sender, EventArgs e)
+ {
+ if (!TryGetIdentifierFromSelectedRow(out var findId))
+ {
+ return;
+ }
+ if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
+ {
+ return;
+ }
+ try
+ {
+ _clientRepository.DeleteClient(findId);
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
+ }
+
+ private void LoadList() => dataGridViewData.DataSource = _clientRepository.ReadClients();
+ private bool TryGetIdentifierFromSelectedRow(out int id)
+ {
+ id = 0;
+ if (dataGridViewData.SelectedRows.Count < 1)
+ {
+ MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return false;
+ }
+ id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
+ return true;
+ }
+
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClients.resx b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClients.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClients.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.Designer.cs
new file mode 100644
index 0000000..4c3fe30
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.Designer.cs
@@ -0,0 +1,261 @@
+namespace ProjectCompanyFurniture.Forms
+{
+ partial class FormInvoice
+ {
+ ///
+ /// 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()
+ {
+ label5 = new Label();
+ dateTimePickerDateInvoice = new DateTimePicker();
+ buttonCancel = new Button();
+ buttonSave = new Button();
+ groupBoxProducts = new GroupBox();
+ dataGridViewProducts = new DataGridView();
+ ColumnProduct = new DataGridViewComboBoxColumn();
+ ColumnCount = new DataGridViewTextBoxColumn();
+ labelClientName = new Label();
+ radioButtonPromYes = new RadioButton();
+ radioButtonPromNot = new RadioButton();
+ label1 = new Label();
+ label2 = new Label();
+ numericUpDownDiscPercentage = new NumericUpDown();
+ comboBoxClient = new ComboBox();
+ label3 = new Label();
+ numericUpDownSellingPrice = new NumericUpDown();
+ groupBoxProducts.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridViewProducts).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownDiscPercentage).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownSellingPrice).BeginInit();
+ SuspendLayout();
+ //
+ // label5
+ //
+ label5.AutoSize = true;
+ label5.Location = new Point(27, 251);
+ label5.Name = "label5";
+ label5.Size = new Size(44, 20);
+ label5.TabIndex = 4;
+ label5.Text = "Дата:";
+ //
+ // dateTimePickerDateInvoice
+ //
+ dateTimePickerDateInvoice.Location = new Point(216, 246);
+ dateTimePickerDateInvoice.Name = "dateTimePickerDateInvoice";
+ dateTimePickerDateInvoice.Size = new Size(151, 27);
+ dateTimePickerDateInvoice.TabIndex = 10;
+ //
+ // buttonCancel
+ //
+ buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonCancel.BackColor = Color.FromArgb(192, 255, 192);
+ buttonCancel.Location = new Point(270, 691);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(102, 29);
+ buttonCancel.TabIndex = 11;
+ buttonCancel.Text = "Отмена";
+ buttonCancel.UseVisualStyleBackColor = false;
+ buttonCancel.Click += ButtonCancel_Click;
+ //
+ // buttonSave
+ //
+ buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
+ buttonSave.BackColor = Color.FromArgb(192, 255, 192);
+ buttonSave.Location = new Point(24, 691);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(102, 29);
+ buttonSave.TabIndex = 12;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = false;
+ buttonSave.Click += ButtonSave_Click;
+ //
+ // groupBoxProducts
+ //
+ groupBoxProducts.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ groupBoxProducts.Controls.Add(dataGridViewProducts);
+ groupBoxProducts.Location = new Point(24, 306);
+ groupBoxProducts.Name = "groupBoxProducts";
+ groupBoxProducts.Size = new Size(348, 366);
+ groupBoxProducts.TabIndex = 13;
+ groupBoxProducts.TabStop = false;
+ groupBoxProducts.Text = "Продукты";
+ //
+ // dataGridViewProducts
+ //
+ dataGridViewProducts.BackgroundColor = Color.FromArgb(192, 255, 192);
+ dataGridViewProducts.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridViewProducts.Columns.AddRange(new DataGridViewColumn[] { ColumnProduct, ColumnCount });
+ dataGridViewProducts.Dock = DockStyle.Fill;
+ dataGridViewProducts.Location = new Point(3, 23);
+ dataGridViewProducts.Name = "dataGridViewProducts";
+ dataGridViewProducts.RowHeadersWidth = 51;
+ dataGridViewProducts.Size = new Size(342, 340);
+ dataGridViewProducts.TabIndex = 0;
+ //
+ // ColumnProduct
+ //
+ ColumnProduct.HeaderText = "Продукт";
+ ColumnProduct.MinimumWidth = 6;
+ ColumnProduct.Name = "ColumnProduct";
+ ColumnProduct.Width = 125;
+ //
+ // ColumnCount
+ //
+ ColumnCount.HeaderText = "Количество";
+ ColumnCount.MinimumWidth = 6;
+ ColumnCount.Name = "ColumnCount";
+ ColumnCount.Width = 125;
+ //
+ // labelClientName
+ //
+ labelClientName.AutoSize = true;
+ labelClientName.Location = new Point(27, 33);
+ labelClientName.Name = "labelClientName";
+ labelClientName.Size = new Size(104, 20);
+ labelClientName.TabIndex = 14;
+ labelClientName.Text = "ФИО клиента:";
+ //
+ // radioButtonPromYes
+ //
+ radioButtonPromYes.AutoSize = true;
+ radioButtonPromYes.Location = new Point(213, 89);
+ radioButtonPromYes.Name = "radioButtonPromYes";
+ radioButtonPromYes.Size = new Size(48, 24);
+ radioButtonPromYes.TabIndex = 16;
+ radioButtonPromYes.TabStop = true;
+ radioButtonPromYes.Text = "Да";
+ radioButtonPromYes.UseVisualStyleBackColor = true;
+ //
+ // radioButtonPromNot
+ //
+ radioButtonPromNot.AutoSize = true;
+ radioButtonPromNot.Location = new Point(309, 89);
+ radioButtonPromNot.Name = "radioButtonPromNot";
+ radioButtonPromNot.Size = new Size(55, 24);
+ radioButtonPromNot.TabIndex = 17;
+ radioButtonPromNot.TabStop = true;
+ radioButtonPromNot.Text = "Нет";
+ radioButtonPromNot.UseVisualStyleBackColor = true;
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Location = new Point(27, 93);
+ label1.Name = "label1";
+ label1.Size = new Size(156, 20);
+ label1.TabIndex = 18;
+ label1.Text = "Наличие промокода:";
+ //
+ // label2
+ //
+ label2.AutoSize = true;
+ label2.Location = new Point(27, 148);
+ label2.Name = "label2";
+ label2.Size = new Size(124, 20);
+ label2.TabIndex = 19;
+ label2.Text = "Процент скидки:";
+ //
+ // numericUpDownDiscPercentage
+ //
+ numericUpDownDiscPercentage.Location = new Point(213, 141);
+ numericUpDownDiscPercentage.Name = "numericUpDownDiscPercentage";
+ numericUpDownDiscPercentage.Size = new Size(150, 27);
+ numericUpDownDiscPercentage.TabIndex = 20;
+ //
+ // comboBoxClient
+ //
+ comboBoxClient.DropDownStyle = ComboBoxStyle.DropDownList;
+ comboBoxClient.FormattingEnabled = true;
+ comboBoxClient.Location = new Point(212, 33);
+ comboBoxClient.Name = "comboBoxClient";
+ comboBoxClient.Size = new Size(151, 28);
+ comboBoxClient.TabIndex = 21;
+ //
+ // label3
+ //
+ label3.AutoSize = true;
+ label3.Location = new Point(27, 201);
+ label3.Name = "label3";
+ label3.Size = new Size(115, 20);
+ label3.TabIndex = 22;
+ label3.Text = "Итоговая цена:";
+ //
+ // numericUpDownSellingPrice
+ //
+ numericUpDownSellingPrice.Location = new Point(212, 194);
+ numericUpDownSellingPrice.Name = "numericUpDownSellingPrice";
+ numericUpDownSellingPrice.Size = new Size(151, 27);
+ numericUpDownSellingPrice.TabIndex = 23;
+ //
+ // FormInvoice
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(403, 747);
+ Controls.Add(numericUpDownSellingPrice);
+ Controls.Add(label3);
+ Controls.Add(comboBoxClient);
+ Controls.Add(numericUpDownDiscPercentage);
+ Controls.Add(label2);
+ Controls.Add(label1);
+ Controls.Add(radioButtonPromNot);
+ Controls.Add(radioButtonPromYes);
+ Controls.Add(labelClientName);
+ Controls.Add(groupBoxProducts);
+ Controls.Add(buttonSave);
+ Controls.Add(buttonCancel);
+ Controls.Add(dateTimePickerDateInvoice);
+ Controls.Add(label5);
+ Name = "FormInvoice";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "Накладная";
+ groupBoxProducts.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)dataGridViewProducts).EndInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownDiscPercentage).EndInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownSellingPrice).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+ private Label label5;
+ private DateTimePicker dateTimePickerDateInvoice;
+ private Button buttonCancel;
+ private Button buttonSave;
+ private GroupBox groupBoxProducts;
+ private DataGridView dataGridViewProducts;
+ private DataGridViewComboBoxColumn ColumnProduct;
+ private DataGridViewTextBoxColumn ColumnCount;
+ private Label label2;
+ private Label labelClientName;
+ private RadioButton radioButtonPromYes;
+ private RadioButton radioButtonPromNot;
+ private Label label1;
+ private NumericUpDown numericUpDownDiscPercentage;
+ private ComboBox comboBoxClient;
+ private Label label3;
+ private NumericUpDown numericUpDownSellingPrice;
+ }
+}
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.cs
new file mode 100644
index 0000000..ab54160
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.cs
@@ -0,0 +1,92 @@
+using ProjectCompanyFurniture.Entities;
+using ProjectCompanyFurniture.Repositories;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ProjectCompanyFurniture.Forms
+{
+ public partial class FormInvoice : Form
+ {
+ private readonly IInvoiceRepository _invoiceRepository;
+
+ public FormInvoice(IInvoiceRepository invoiceRepository, IClientRepository clientRepository,
+ IProductRepository productRepository)
+ {
+ InitializeComponent();
+ _invoiceRepository = invoiceRepository ??
+ throw new ArgumentNullException(nameof(invoiceRepository));
+
+ comboBoxClient.DataSource = clientRepository.ReadClients();
+ comboBoxClient.DisplayMember = "FirstName";
+ comboBoxClient.ValueMember = "Id";
+
+ ColumnProduct.DataSource = productRepository.ReadProducts();
+ ColumnProduct.DisplayMember = "Name";
+ ColumnProduct.ValueMember = "Id";
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (dataGridViewProducts.RowCount < 1 || comboBoxClient.SelectedIndex < 0 ||
+ (radioButtonPromYes.Checked == false && radioButtonPromNot.Checked == false))
+ {
+ throw new Exception("Имеются незаполненные поля");
+ }
+ if (radioButtonPromYes.Checked && numericUpDownDiscPercentage.Value == 0)
+ {
+ throw new Exception("Не указан процент скидки");
+ }
+
+ if (radioButtonPromYes.Checked)
+ {
+ _invoiceRepository.CreateInvoice(Invoice.CreateOperation(0,
+ (int)comboBoxClient.SelectedValue!, 1, Convert.ToInt32(numericUpDownDiscPercentage.Value),
+ Convert.ToInt32(numericUpDownSellingPrice.Value),
+ /*dateTimePickerDateInvoice.Value,*/
+ CreateListInvoiceProductFromDataGrid()));
+ }
+ else
+ {
+ _invoiceRepository.CreateInvoice(Invoice.CreateOperation(0,
+ (int)comboBoxClient.SelectedValue!, 0, 0, Convert.ToInt32(numericUpDownSellingPrice.Value),
+ /*dateTimePickerDateInvoice.Value,*/ CreateListInvoiceProductFromDataGrid()));
+ }
+
+ Close();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при сохранении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e) => Close();
+
+ private List CreateListInvoiceProductFromDataGrid()
+ {
+ var list = new List();
+ foreach (DataGridViewRow row in dataGridViewProducts.Rows)
+ {
+ if (row.Cells["ColumnProduct"].Value == null ||
+ row.Cells["ColumnCount"].Value == null)
+ {
+ continue;
+ }
+ list.Add(InvoiceProduct.CreateElement(0, Convert.ToInt32(row.Cells["ColumnProduct"].Value),
+ Convert.ToInt32(row.Cells["ColumnCount"].Value)));
+ }
+ return list;
+ }
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.resx b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.resx
new file mode 100644
index 0000000..9746ebf
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.resx
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+ True
+
+
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoices.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoices.Designer.cs
new file mode 100644
index 0000000..f5280ef
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoices.Designer.cs
@@ -0,0 +1,114 @@
+namespace ProjectCompanyFurniture.Forms
+{
+ partial class FormInvoices
+ {
+ ///
+ /// 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()
+ {
+ dataGridViewData = new DataGridView();
+ panel1 = new Panel();
+ buttonDel = new Button();
+ buttonAdd = new Button();
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
+ panel1.SuspendLayout();
+ SuspendLayout();
+ //
+ // dataGridViewData
+ //
+ dataGridViewData.AllowUserToAddRows = false;
+ dataGridViewData.AllowUserToDeleteRows = false;
+ dataGridViewData.AllowUserToResizeColumns = false;
+ dataGridViewData.AllowUserToResizeRows = false;
+ dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
+ dataGridViewData.BackgroundColor = Color.FromArgb(192, 255, 192);
+ dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridViewData.Dock = DockStyle.Fill;
+ dataGridViewData.Location = new Point(0, 0);
+ dataGridViewData.MultiSelect = false;
+ dataGridViewData.Name = "dataGridViewData";
+ dataGridViewData.ReadOnly = true;
+ dataGridViewData.RowHeadersVisible = false;
+ dataGridViewData.RowHeadersWidth = 51;
+ dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+ dataGridViewData.Size = new Size(692, 450);
+ dataGridViewData.TabIndex = 5;
+ //
+ // panel1
+ //
+ panel1.Controls.Add(buttonDel);
+ panel1.Controls.Add(buttonAdd);
+ panel1.Dock = DockStyle.Right;
+ panel1.Location = new Point(692, 0);
+ panel1.Name = "panel1";
+ panel1.Size = new Size(108, 450);
+ panel1.TabIndex = 4;
+ //
+ // buttonDel
+ //
+ buttonDel.BackgroundImage = Properties.Resources.minus;
+ buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonDel.Location = new Point(8, 244);
+ buttonDel.Name = "buttonDel";
+ buttonDel.Size = new Size(94, 91);
+ buttonDel.TabIndex = 2;
+ buttonDel.UseVisualStyleBackColor = true;
+ buttonDel.Click += ButtonDel_Click;
+ //
+ // buttonAdd
+ //
+ buttonAdd.BackgroundImage = Properties.Resources.plus;
+ buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonAdd.Location = new Point(8, 26);
+ buttonAdd.Name = "buttonAdd";
+ buttonAdd.Size = new Size(94, 90);
+ buttonAdd.TabIndex = 0;
+ buttonAdd.UseVisualStyleBackColor = true;
+ buttonAdd.Click += ButtonAdd_Click;
+ //
+ // FormInvoices
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(dataGridViewData);
+ Controls.Add(panel1);
+ Name = "FormInvoices";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "Накладные";
+ Load += FormInvoices_Load;
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
+ panel1.ResumeLayout(false);
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private DataGridView dataGridViewData;
+ private Panel panel1;
+ private Button buttonDel;
+ private Button buttonAdd;
+ }
+}
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoices.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoices.cs
new file mode 100644
index 0000000..c296a30
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoices.cs
@@ -0,0 +1,88 @@
+using ProjectCompanyFurniture.Repositories;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using Unity;
+
+namespace ProjectCompanyFurniture.Forms
+{
+ public partial class FormInvoices : Form
+ {
+ private readonly IUnityContainer _container;
+ private readonly IInvoiceRepository _invoiceRepository;
+
+ public FormInvoices(IUnityContainer container, IInvoiceRepository invoiceRepository)
+ {
+ InitializeComponent();
+ _container = container ?? throw new ArgumentNullException(nameof(container));
+ _invoiceRepository = invoiceRepository ?? throw new ArgumentNullException(nameof(invoiceRepository));
+ }
+
+ private void FormInvoices_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ _container.Resolve().ShowDialog();
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonDel_Click(object sender, EventArgs e)
+ {
+ if (!TryGetIdentifierFromSelectedRow(out var findId))
+ {
+ return;
+ }
+ if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
+ {
+ return;
+ }
+ try
+ {
+ _invoiceRepository.DeleteInvoice(findId);
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void LoadList() => dataGridViewData.DataSource = _invoiceRepository.ReadInvoice();
+
+ private bool TryGetIdentifierFromSelectedRow(out int id)
+ {
+ id = 0;
+ if (dataGridViewData.SelectedRows.Count < 1)
+ {
+ MessageBox.Show("Нет выбранной записи", "Ошибка",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return false;
+ }
+ id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
+ return true;
+ }
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoices.resx b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoices.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoices.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturer.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturer.Designer.cs
new file mode 100644
index 0000000..0a06609
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturer.Designer.cs
@@ -0,0 +1,98 @@
+namespace ProjectCompanyFurniture.Forms
+{
+ partial class FormManufacturer
+ {
+ ///
+ /// 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()
+ {
+ labelName = new Label();
+ textBoxName = new TextBox();
+ buttonSave = new Button();
+ buttonCancel = new Button();
+ SuspendLayout();
+ //
+ // labelName
+ //
+ labelName.AutoSize = true;
+ labelName.Location = new Point(25, 28);
+ labelName.Name = "labelName";
+ labelName.Size = new Size(77, 20);
+ labelName.TabIndex = 0;
+ labelName.Text = "Название";
+ //
+ // textBoxName
+ //
+ textBoxName.Location = new Point(166, 25);
+ textBoxName.Name = "textBoxName";
+ textBoxName.Size = new Size(125, 27);
+ textBoxName.TabIndex = 1;
+ //
+ // buttonSave
+ //
+ buttonSave.BackColor = Color.FromArgb(192, 255, 255);
+ buttonSave.Location = new Point(25, 91);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(94, 29);
+ buttonSave.TabIndex = 2;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = false;
+ buttonSave.Click += ButtonSave_Click;
+ //
+ // buttonCancel
+ //
+ buttonCancel.BackColor = Color.FromArgb(192, 255, 255);
+ buttonCancel.Location = new Point(197, 91);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(94, 29);
+ buttonCancel.TabIndex = 3;
+ buttonCancel.Text = "Отмена";
+ buttonCancel.UseVisualStyleBackColor = false;
+ buttonCancel.Click += ButtonCancel_Click;
+ //
+ // FormManufacturer
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(342, 171);
+ Controls.Add(buttonCancel);
+ Controls.Add(buttonSave);
+ Controls.Add(textBoxName);
+ Controls.Add(labelName);
+ Name = "FormManufacturer";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "FormManufacturer";
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private Label labelName;
+ private TextBox textBoxName;
+ private Button buttonSave;
+ private Button buttonCancel;
+ }
+}
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturer.cs
new file mode 100644
index 0000000..5bcdb0b
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturer.cs
@@ -0,0 +1,69 @@
+using ProjectCompanyFurniture.Entities;
+using ProjectCompanyFurniture.Repositories;
+
+namespace ProjectCompanyFurniture.Forms;
+
+public partial class FormManufacturer : Form
+{
+ private readonly IManufacturerRepository _manufacturerRepository;
+ private int? _manufacturerId;
+
+ public int Id
+ {
+ set
+ {
+ try
+ {
+ var manufacturer = _manufacturerRepository.ReadManufacturerById(value);
+ if (manufacturer == null)
+ {
+ throw new
+ InvalidDataException(nameof(manufacturer));
+ }
+ textBoxName.Text = manufacturer.Name;
+ _manufacturerId = value;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ }
+ }
+
+ public FormManufacturer(IManufacturerRepository manufacturerRepository)
+ {
+ InitializeComponent();
+ _manufacturerRepository = manufacturerRepository ?? throw new ArgumentNullException(nameof(manufacturerRepository));
+
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (string.IsNullOrWhiteSpace(textBoxName.Text))
+ {
+ throw new Exception("Имеются незаполненные поля");
+ }
+ if (_manufacturerId.HasValue)
+ {
+ _manufacturerRepository.UpdateManufacturer(CreateManufacturer(_manufacturerId.Value));
+ }
+ else
+ {
+ _manufacturerRepository.CreateManufacturer(CreateManufacturer(0));
+ }
+ Close();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при сохранении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e) => Close();
+
+ private Manufacturer CreateManufacturer(int id) => Manufacturer.CreateEntity(id, textBoxName.Text);
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturer.resx b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturer.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturer.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturers.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturers.Designer.cs
new file mode 100644
index 0000000..e537022
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturers.Designer.cs
@@ -0,0 +1,126 @@
+namespace ProjectCompanyFurniture.Forms
+{
+ partial class FormManufacturers
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ panel1 = new Panel();
+ buttonDel = new Button();
+ buttonEdt = new Button();
+ buttonAdd = new Button();
+ dataGridViewData = new DataGridView();
+ panel1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
+ SuspendLayout();
+ //
+ // panel1
+ //
+ panel1.Controls.Add(buttonDel);
+ panel1.Controls.Add(buttonEdt);
+ panel1.Controls.Add(buttonAdd);
+ panel1.Dock = DockStyle.Right;
+ panel1.Location = new Point(680, 0);
+ panel1.Name = "panel1";
+ panel1.Size = new Size(120, 450);
+ panel1.TabIndex = 0;
+ //
+ // buttonDel
+ //
+ buttonDel.BackgroundImage = Properties.Resources.minus;
+ buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonDel.Location = new Point(14, 258);
+ buttonDel.Name = "buttonDel";
+ buttonDel.Size = new Size(94, 91);
+ buttonDel.TabIndex = 3;
+ buttonDel.UseVisualStyleBackColor = true;
+ buttonDel.Click += ButtonDel_Click;
+ //
+ // buttonEdt
+ //
+ buttonEdt.BackgroundImage = Properties.Resources.edit;
+ buttonEdt.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonEdt.Location = new Point(14, 143);
+ buttonEdt.Name = "buttonEdt";
+ buttonEdt.Size = new Size(94, 90);
+ buttonEdt.TabIndex = 2;
+ buttonEdt.UseVisualStyleBackColor = true;
+ buttonEdt.Click += ButtonEdt_Click;
+ //
+ // buttonAdd
+ //
+ buttonAdd.BackgroundImage = Properties.Resources.plus;
+ buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonAdd.Location = new Point(14, 28);
+ buttonAdd.Name = "buttonAdd";
+ buttonAdd.Size = new Size(94, 90);
+ buttonAdd.TabIndex = 1;
+ buttonAdd.UseVisualStyleBackColor = true;
+ buttonAdd.Click += ButtonAdd_Click;
+ //
+ // dataGridViewData
+ //
+ dataGridViewData.AllowUserToAddRows = false;
+ dataGridViewData.AllowUserToDeleteRows = false;
+ dataGridViewData.AllowUserToResizeColumns = false;
+ dataGridViewData.AllowUserToResizeRows = false;
+ dataGridViewData.BackgroundColor = Color.FromArgb(192, 255, 255);
+ dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridViewData.Dock = DockStyle.Fill;
+ dataGridViewData.Location = new Point(0, 0);
+ dataGridViewData.Name = "dataGridViewData";
+ dataGridViewData.ReadOnly = true;
+ dataGridViewData.RowHeadersVisible = false;
+ dataGridViewData.RowHeadersWidth = 51;
+ dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+ dataGridViewData.Size = new Size(680, 450);
+ dataGridViewData.TabIndex = 1;
+ //
+ // FormManufacturers
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(dataGridViewData);
+ Controls.Add(panel1);
+ Name = "FormManufacturers";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "Производители";
+ Load += FormManufacturers_Load;
+ panel1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private Panel panel1;
+ private Button buttonAdd;
+ private Button buttonEdt;
+ private Button buttonDel;
+ private DataGridView dataGridViewData;
+ }
+}
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturers.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturers.cs
new file mode 100644
index 0000000..03834eb
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturers.cs
@@ -0,0 +1,96 @@
+using ProjectCompanyFurniture.Repositories;
+using Unity;
+
+namespace ProjectCompanyFurniture.Forms
+{
+ public partial class FormManufacturers : Form
+ {
+ private readonly IUnityContainer _container;
+ private readonly IManufacturerRepository _manufacturerRepository;
+
+ public FormManufacturers(IUnityContainer container, IManufacturerRepository manufacturerRepository)
+ {
+ InitializeComponent();
+ _container = container ?? throw new ArgumentNullException(nameof(container));
+ _manufacturerRepository = manufacturerRepository ?? throw new ArgumentNullException(nameof(manufacturerRepository));
+ }
+
+ private void FormManufacturers_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ _container.Resolve().ShowDialog();
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonEdt_Click(object sender, EventArgs e)
+ {
+ if (!TryGetIdentifierFromSelectedRow(out var findId))
+ {
+ return;
+ }
+ try
+ {
+ var form = _container.Resolve();
+ form.Id = findId;
+ form.ShowDialog();
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonDel_Click(object sender, EventArgs e)
+ {
+ if (!TryGetIdentifierFromSelectedRow(out var findId))
+ {
+ return;
+ }
+ if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
+ {
+ return;
+ }
+ try
+ {
+ _manufacturerRepository.DeleteManufacturer(findId);
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void LoadList() => dataGridViewData.DataSource = _manufacturerRepository.ReadManufacturer();
+ private bool TryGetIdentifierFromSelectedRow(out int id)
+ {
+ id = 0;
+ if (dataGridViewData.SelectedRows.Count < 1)
+ {
+ MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return false;
+ }
+ id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
+ return true;
+ }
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturers.resx b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturers.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormManufacturers.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.Designer.cs
new file mode 100644
index 0000000..fb83fdc
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.Designer.cs
@@ -0,0 +1,168 @@
+namespace ProjectCompanyFurniture.Forms
+{
+ partial class FormProduct
+ {
+ ///
+ /// 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()
+ {
+ labelName = new Label();
+ labelCategory = new Label();
+ labelStartPrice = new Label();
+ textBoxName = new TextBox();
+ textBoxCategory = new TextBox();
+ numericUpDownStartPrice = new NumericUpDown();
+ buttonSave = new Button();
+ buttonCancel = new Button();
+ labelIDManuf = new Label();
+ numericUpDownIDManuf = new NumericUpDown();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownStartPrice).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownIDManuf).BeginInit();
+ SuspendLayout();
+ //
+ // labelName
+ //
+ labelName.AutoSize = true;
+ labelName.Location = new Point(35, 88);
+ labelName.Name = "labelName";
+ labelName.Size = new Size(77, 20);
+ labelName.TabIndex = 0;
+ labelName.Text = "Название";
+ //
+ // labelCategory
+ //
+ labelCategory.AutoSize = true;
+ labelCategory.Location = new Point(35, 153);
+ labelCategory.Name = "labelCategory";
+ labelCategory.Size = new Size(81, 20);
+ labelCategory.TabIndex = 1;
+ labelCategory.Text = "Категория";
+ //
+ // labelStartPrice
+ //
+ labelStartPrice.AutoSize = true;
+ labelStartPrice.Location = new Point(35, 222);
+ labelStartPrice.Name = "labelStartPrice";
+ labelStartPrice.Size = new Size(123, 20);
+ labelStartPrice.TabIndex = 2;
+ labelStartPrice.Text = "Начальная цена";
+ //
+ // textBoxName
+ //
+ textBoxName.Location = new Point(211, 85);
+ textBoxName.Name = "textBoxName";
+ textBoxName.Size = new Size(125, 27);
+ textBoxName.TabIndex = 3;
+ //
+ // textBoxCategory
+ //
+ textBoxCategory.Location = new Point(211, 150);
+ textBoxCategory.Name = "textBoxCategory";
+ textBoxCategory.Size = new Size(125, 27);
+ textBoxCategory.TabIndex = 4;
+ //
+ // numericUpDownStartPrice
+ //
+ numericUpDownStartPrice.Location = new Point(211, 220);
+ numericUpDownStartPrice.Name = "numericUpDownStartPrice";
+ numericUpDownStartPrice.Size = new Size(125, 27);
+ numericUpDownStartPrice.TabIndex = 5;
+ //
+ // buttonSave
+ //
+ buttonSave.BackColor = Color.FromArgb(192, 255, 192);
+ buttonSave.Location = new Point(33, 307);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(125, 29);
+ buttonSave.TabIndex = 6;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = false;
+ buttonSave.Click += ButtonSave_Click;
+ //
+ // buttonCancel
+ //
+ buttonCancel.BackColor = Color.FromArgb(192, 255, 192);
+ buttonCancel.Location = new Point(211, 307);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(125, 29);
+ buttonCancel.TabIndex = 7;
+ buttonCancel.Text = "Отмена";
+ buttonCancel.UseVisualStyleBackColor = false;
+ buttonCancel.Click += ButtonCancel_Click;
+ //
+ // labelIDManuf
+ //
+ labelIDManuf.AutoSize = true;
+ labelIDManuf.Location = new Point(35, 31);
+ labelIDManuf.Name = "labelIDManuf";
+ labelIDManuf.Size = new Size(135, 20);
+ labelIDManuf.TabIndex = 8;
+ labelIDManuf.Text = "ID производителя";
+ //
+ // numericUpDownIDManuf
+ //
+ numericUpDownIDManuf.Location = new Point(211, 29);
+ numericUpDownIDManuf.Name = "numericUpDownIDManuf";
+ numericUpDownIDManuf.Size = new Size(125, 27);
+ numericUpDownIDManuf.TabIndex = 9;
+ //
+ // FormProduct
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(363, 394);
+ Controls.Add(numericUpDownIDManuf);
+ Controls.Add(labelIDManuf);
+ Controls.Add(buttonCancel);
+ Controls.Add(buttonSave);
+ Controls.Add(numericUpDownStartPrice);
+ Controls.Add(textBoxCategory);
+ Controls.Add(textBoxName);
+ Controls.Add(labelStartPrice);
+ Controls.Add(labelCategory);
+ Controls.Add(labelName);
+ Name = "FormProduct";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "Продукт";
+ ((System.ComponentModel.ISupportInitialize)numericUpDownStartPrice).EndInit();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownIDManuf).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private Label labelName;
+ private Label labelCategory;
+ private Label labelStartPrice;
+ private TextBox textBoxName;
+ private TextBox textBoxCategory;
+ private NumericUpDown numericUpDownStartPrice;
+ private Button buttonSave;
+ private Button buttonCancel;
+ private Label labelIDManuf;
+ private NumericUpDown numericUpDownIDManuf;
+ }
+}
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.cs
new file mode 100644
index 0000000..ba49e73
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.cs
@@ -0,0 +1,76 @@
+using ProjectCompanyFurniture.Entities.Enums;
+using ProjectCompanyFurniture.Entities;
+using ProjectCompanyFurniture.Repositories;
+using ProjectCompanyFurniture.Repositories.Implementations;
+
+namespace ProjectCompanyFurniture.Forms
+{
+ public partial class FormProduct : Form
+ {
+
+ private readonly IProductRepository _productRepository;
+ private int? _productId;
+
+ public int Id
+ {
+ set
+ {
+ try
+ {
+ var product = _productRepository.ReadProductById(value);
+ if (product == null)
+ {
+ throw new InvalidDataException(nameof(product));
+ }
+ numericUpDownIDManuf.Value = product.ManufacturerID;
+ textBoxName.Text = product.Name;
+ textBoxCategory.Text = product.Category;
+ numericUpDownIDManuf.Value = product.StartingPrice;
+ _productId = value;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ }
+ }
+
+ public FormProduct(IProductRepository productRepository)
+ {
+ InitializeComponent();
+ _productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (string.IsNullOrWhiteSpace(textBoxName.Text)
+ || string.IsNullOrEmpty(textBoxCategory.Text))
+ {
+ throw new Exception("Имеются незаполненные поля");
+ }
+ if (_productId.HasValue)
+ {
+ _productRepository.UpdateProduct(CreateProduct(_productId.Value));
+ }
+ else
+ {
+ _productRepository.CreateProduct(CreateProduct(0));
+ }
+ Close();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при сохранении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e) => Close();
+
+ private Product CreateProduct(int id) => Product.CreateEntity(id, Convert.ToInt32(numericUpDownIDManuf.Value),
+ textBoxName.Text, textBoxCategory.Text, Convert.ToInt32(numericUpDownStartPrice.Value));
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.resx b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovement.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovement.Designer.cs
new file mode 100644
index 0000000..f07428b
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovement.Designer.cs
@@ -0,0 +1,146 @@
+namespace ProjectCompanyFurniture.Forms
+{
+ partial class FormProductMovement
+ {
+ ///
+ /// 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()
+ {
+ labelProductID = new Label();
+ labelMovement = new Label();
+ labelDate = new Label();
+ dateTimePickerProductMovementDate = new DateTimePicker();
+ buttonCancel = new Button();
+ buttonSave = new Button();
+ checkedListBoxMovement = new CheckedListBox();
+ comboBoxProduct = new ComboBox();
+ SuspendLayout();
+ //
+ // labelProductID
+ //
+ labelProductID.AutoSize = true;
+ labelProductID.Location = new Point(31, 28);
+ labelProductID.Name = "labelProductID";
+ labelProductID.Size = new Size(66, 20);
+ labelProductID.TabIndex = 0;
+ labelProductID.Text = "Продукт";
+ //
+ // labelMovement
+ //
+ labelMovement.AutoSize = true;
+ labelMovement.Location = new Point(31, 90);
+ labelMovement.Name = "labelMovement";
+ labelMovement.Size = new Size(109, 20);
+ labelMovement.TabIndex = 1;
+ labelMovement.Text = "Тип движения";
+ //
+ // labelDate
+ //
+ labelDate.AutoSize = true;
+ labelDate.Location = new Point(31, 232);
+ labelDate.Name = "labelDate";
+ labelDate.Size = new Size(41, 20);
+ labelDate.TabIndex = 2;
+ labelDate.Text = "Дата";
+ //
+ // dateTimePickerProductMovementDate
+ //
+ dateTimePickerProductMovementDate.Enabled = false;
+ dateTimePickerProductMovementDate.Location = new Point(267, 232);
+ dateTimePickerProductMovementDate.Name = "dateTimePickerProductMovementDate";
+ dateTimePickerProductMovementDate.Size = new Size(181, 27);
+ dateTimePickerProductMovementDate.TabIndex = 3;
+ //
+ // buttonCancel
+ //
+ buttonCancel.BackColor = Color.FromArgb(255, 192, 192);
+ buttonCancel.Location = new Point(286, 296);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(162, 29);
+ buttonCancel.TabIndex = 6;
+ buttonCancel.Text = "Отмена";
+ buttonCancel.UseVisualStyleBackColor = false;
+ buttonCancel.Click += ButtonCancel_Click;
+ //
+ // buttonSave
+ //
+ buttonSave.BackColor = Color.FromArgb(255, 192, 192);
+ buttonSave.Location = new Point(31, 296);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(162, 29);
+ buttonSave.TabIndex = 7;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = false;
+ buttonSave.Click += ButtonSave_Click;
+ //
+ // checkedListBoxMovement
+ //
+ checkedListBoxMovement.FormattingEnabled = true;
+ checkedListBoxMovement.Location = new Point(267, 71);
+ checkedListBoxMovement.Name = "checkedListBoxMovement";
+ checkedListBoxMovement.Size = new Size(181, 114);
+ checkedListBoxMovement.TabIndex = 8;
+ //
+ // comboBoxProduct
+ //
+ comboBoxProduct.DropDownStyle = ComboBoxStyle.DropDownList;
+ comboBoxProduct.FormattingEnabled = true;
+ comboBoxProduct.Location = new Point(267, 28);
+ comboBoxProduct.Name = "comboBoxProduct";
+ comboBoxProduct.Size = new Size(181, 28);
+ comboBoxProduct.TabIndex = 9;
+ //
+ // FormProductMovement
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(485, 399);
+ Controls.Add(comboBoxProduct);
+ Controls.Add(checkedListBoxMovement);
+ Controls.Add(buttonSave);
+ Controls.Add(buttonCancel);
+ Controls.Add(dateTimePickerProductMovementDate);
+ Controls.Add(labelDate);
+ Controls.Add(labelMovement);
+ Controls.Add(labelProductID);
+ Name = "FormProductMovement";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "Движение товара";
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private Label labelProductID;
+ private Label labelMovement;
+ private Label labelDate;
+ private DateTimePicker dateTimePickerProductMovementDate;
+ private Button buttonCancel;
+ private Button buttonSave;
+ private CheckedListBox checkedListBoxMovement;
+ private ComboBox comboBoxProduct;
+ }
+}
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovement.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovement.cs
new file mode 100644
index 0000000..89b19e6
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovement.cs
@@ -0,0 +1,65 @@
+using Microsoft.VisualBasic.FileIO;
+using ProjectCompanyFurniture.Entities;
+using ProjectCompanyFurniture.Entities.Enums;
+using ProjectCompanyFurniture.Repositories;
+using ProjectCompanyFurniture.Repositories.Implementations;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ProjectCompanyFurniture.Forms
+{
+ public partial class FormProductMovement : Form
+ {
+ private readonly IProductMovementRepository _productMovementRepository;
+ private int? _productMovementId;
+
+ public FormProductMovement(IProductMovementRepository productMovementRepository,
+ IProductRepository productRepository)
+ {
+ InitializeComponent();
+ _productMovementRepository = productMovementRepository ?? throw new ArgumentNullException(nameof(productMovementRepository));
+
+ comboBoxProduct.DataSource = productRepository.ReadProducts();
+ comboBoxProduct.DisplayMember = "Name";
+ comboBoxProduct.ValueMember = "ID";
+
+ foreach (var elem in Enum.GetValues(typeof(ProductMovement)))
+ {
+ checkedListBoxMovement.Items.Add(elem);
+ }
+ }
+
+ private void ButtonSave_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (comboBoxProduct.SelectedIndex < 0 || checkedListBoxMovement.CheckedItems.Count == 0)
+ {
+ throw new Exception("Имеются незаполненные поля");
+ }
+ Movement movement = Movement.None;
+ foreach (var elem in checkedListBoxMovement.CheckedItems)
+ {
+ movement |= (Movement)elem;
+ }
+ _productMovementRepository.CreateProductMovement(ProductMovement.CreateOperation(0,
+ (int)comboBoxProduct.SelectedValue!, movement)); //dateTimePickerProductMovementDate.Value));
+
+ Close();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e) => Close();
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovement.resx b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovement.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovement.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovements.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovements.Designer.cs
new file mode 100644
index 0000000..aa5df40
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovements.Designer.cs
@@ -0,0 +1,97 @@
+namespace ProjectCompanyFurniture.Forms
+{
+ partial class FormProductMovements
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ panel1 = new Panel();
+ buttonAdd = new Button();
+ dataGridViewData = new DataGridView();
+ panel1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
+ SuspendLayout();
+ //
+ // panel1
+ //
+ panel1.Controls.Add(buttonAdd);
+ panel1.Dock = DockStyle.Right;
+ panel1.Location = new Point(674, 0);
+ panel1.Name = "panel1";
+ panel1.Size = new Size(126, 450);
+ panel1.TabIndex = 1;
+ //
+ // buttonAdd
+ //
+ buttonAdd.BackgroundImage = Properties.Resources.plus;
+ buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonAdd.Location = new Point(15, 27);
+ buttonAdd.Name = "buttonAdd";
+ buttonAdd.Size = new Size(94, 90);
+ buttonAdd.TabIndex = 3;
+ buttonAdd.UseVisualStyleBackColor = true;
+ buttonAdd.Click += ButtonAdd_Click;
+ //
+ // dataGridViewData
+ //
+ dataGridViewData.AllowUserToResizeColumns = false;
+ dataGridViewData.AllowUserToResizeRows = false;
+ dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
+ dataGridViewData.BackgroundColor = Color.FromArgb(255, 192, 192);
+ dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridViewData.Dock = DockStyle.Fill;
+ dataGridViewData.Location = new Point(0, 0);
+ dataGridViewData.MultiSelect = false;
+ dataGridViewData.Name = "dataGridViewData";
+ dataGridViewData.RowHeadersVisible = false;
+ dataGridViewData.RowHeadersWidth = 51;
+ dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+ dataGridViewData.Size = new Size(674, 450);
+ dataGridViewData.TabIndex = 2;
+ //
+ // FormProductMovements
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(dataGridViewData);
+ Controls.Add(panel1);
+ Name = "FormProductMovements";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "Движения продуктов";
+ Load += FormProductMovements_Load;
+ panel1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private Panel panel1;
+ private Button buttonAdd;
+ private DataGridView dataGridViewData;
+ }
+}
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovements.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovements.cs
new file mode 100644
index 0000000..9a47ebe
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovements.cs
@@ -0,0 +1,56 @@
+using ProjectCompanyFurniture.Repositories;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using Unity;
+
+namespace ProjectCompanyFurniture.Forms
+{
+ public partial class FormProductMovements : Form
+ {
+ private readonly IUnityContainer _container;
+ private readonly IProductMovementRepository _productMovementRepository;
+ public FormProductMovements(IUnityContainer container, IProductMovementRepository productMovementRepository)
+ {
+ InitializeComponent();
+ _container = container ?? throw new ArgumentNullException(nameof(container)); ;
+ _productMovementRepository = productMovementRepository ??
+ throw new ArgumentNullException(nameof(productMovementRepository));
+ }
+
+ private void FormProductMovements_Load(object sender, EventArgs e)
+ {
+ try
+ {
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при загрузке",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ _container.Resolve().ShowDialog();
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void LoadList() => dataGridViewData.DataSource = _productMovementRepository.ReadProductMovements();
+
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovements.resx b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovements.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovements.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.Designer.cs
new file mode 100644
index 0000000..8860492
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.Designer.cs
@@ -0,0 +1,127 @@
+namespace ProjectCompanyFurniture.Forms
+{
+ partial class FormProducts
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ panel1 = new Panel();
+ buttonDel = new Button();
+ buttonEdt = new Button();
+ buttonAdd = new Button();
+ dataGridViewData = new DataGridView();
+ panel1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
+ SuspendLayout();
+ //
+ // panel1
+ //
+ panel1.Controls.Add(buttonDel);
+ panel1.Controls.Add(buttonEdt);
+ panel1.Controls.Add(buttonAdd);
+ panel1.Dock = DockStyle.Right;
+ panel1.Location = new Point(674, 0);
+ panel1.Name = "panel1";
+ panel1.Size = new Size(126, 450);
+ panel1.TabIndex = 0;
+ //
+ // buttonDel
+ //
+ buttonDel.BackgroundImage = Properties.Resources.minus;
+ buttonDel.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonDel.Location = new Point(15, 245);
+ buttonDel.Name = "buttonDel";
+ buttonDel.Size = new Size(94, 91);
+ buttonDel.TabIndex = 5;
+ buttonDel.UseVisualStyleBackColor = true;
+ buttonDel.Click += ButtonDel_Click;
+ //
+ // buttonEdt
+ //
+ buttonEdt.BackgroundImage = Properties.Resources.edit;
+ buttonEdt.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonEdt.Location = new Point(15, 136);
+ buttonEdt.Name = "buttonEdt";
+ buttonEdt.Size = new Size(94, 90);
+ buttonEdt.TabIndex = 4;
+ buttonEdt.UseVisualStyleBackColor = true;
+ buttonEdt.Click += ButtonEdt_Click;
+ //
+ // buttonAdd
+ //
+ buttonAdd.BackgroundImage = Properties.Resources.plus;
+ buttonAdd.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonAdd.Location = new Point(15, 27);
+ buttonAdd.Name = "buttonAdd";
+ buttonAdd.Size = new Size(94, 90);
+ buttonAdd.TabIndex = 3;
+ buttonAdd.UseVisualStyleBackColor = true;
+ buttonAdd.Click += ButtonAdd_Click;
+ //
+ // dataGridViewData
+ //
+ dataGridViewData.AllowUserToAddRows = false;
+ dataGridViewData.AllowUserToDeleteRows = false;
+ dataGridViewData.AllowUserToResizeColumns = false;
+ dataGridViewData.AllowUserToResizeRows = false;
+ dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
+ dataGridViewData.BackgroundColor = Color.FromArgb(255, 192, 255);
+ dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ dataGridViewData.Dock = DockStyle.Fill;
+ dataGridViewData.Location = new Point(0, 0);
+ dataGridViewData.MultiSelect = false;
+ dataGridViewData.Name = "dataGridViewData";
+ dataGridViewData.ReadOnly = true;
+ dataGridViewData.RowHeadersVisible = false;
+ dataGridViewData.RowHeadersWidth = 51;
+ dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
+ dataGridViewData.Size = new Size(674, 450);
+ dataGridViewData.TabIndex = 1;
+ //
+ // FormProducts
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(dataGridViewData);
+ Controls.Add(panel1);
+ Name = "FormProducts";
+ StartPosition = FormStartPosition.CenterScreen;
+ Text = "Продукты";
+ panel1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private Panel panel1;
+ private Button buttonDel;
+ private Button buttonEdt;
+ private Button buttonAdd;
+ private DataGridView dataGridViewData;
+ }
+}
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.cs
new file mode 100644
index 0000000..c31c413
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.cs
@@ -0,0 +1,94 @@
+using ProjectCompanyFurniture.Repositories;
+using ProjectCompanyFurniture.Repositories.Implementations;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using Unity;
+
+namespace ProjectCompanyFurniture.Forms
+{
+ public partial class FormProducts : Form
+ {
+ private readonly IUnityContainer _container;
+ private readonly IProductRepository _productRepository;
+
+ public FormProducts(IUnityContainer container, IProductRepository productRepository)
+ {
+ InitializeComponent();
+ _container = container ?? throw new ArgumentNullException(nameof(container));
+ _productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
+ }
+
+ private void ButtonAdd_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ _container.Resolve().ShowDialog();
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonEdt_Click(object sender, EventArgs e)
+ {
+ if (!TryGetIdentifierFromSelectedRow(out var findId))
+ {
+ return;
+ }
+ try
+ {
+ var form = _container.Resolve();
+ form.Id = findId;
+ form.ShowDialog();
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonDel_Click(object sender, EventArgs e)
+ {
+ if (!TryGetIdentifierFromSelectedRow(out var findId))
+ {
+ return;
+ }
+ if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes)
+ {
+ return;
+ }
+ try
+ {
+ _productRepository.DeleteProduct(findId);
+ LoadList();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void LoadList() => dataGridViewData.DataSource = _productRepository.ReadProducts();
+ private bool TryGetIdentifierFromSelectedRow(out int id)
+ {
+ id = 0;
+ if (dataGridViewData.SelectedRows.Count < 1)
+ {
+ MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return false;
+ }
+ id = Convert.ToInt32(dataGridViewData.SelectedRows[0].Cells["Id"].Value);
+ return true;
+ }
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.resx b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.resx
new file mode 100644
index 0000000..8b2ff64
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Program.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Program.cs
index 1861512..95b14d8 100644
--- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Program.cs
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Program.cs
@@ -1,3 +1,7 @@
+using ProjectCompanyFurniture.Repositories;
+using ProjectCompanyFurniture.Repositories.Implementations;
+using Unity;
+
namespace ProjectCompanyFurniture
{
internal static class Program
@@ -11,7 +15,18 @@ namespace ProjectCompanyFurniture
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
+ Application.Run(CreateContainer().Resolve());
+ }
+
+ private static IUnityContainer CreateContainer()
+ {
+ var container = new UnityContainer();
+ container.RegisterType();
+ container.RegisterType();
+ container.RegisterType();
+ container.RegisterType();
+ container.RegisterType();
+ return container;
}
}
}
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/ProjectCompanyFurniture.csproj b/ProjectCompanyFurniture/ProjectCompanyFurniture/ProjectCompanyFurniture.csproj
index 663fdb8..872c2a9 100644
--- a/ProjectCompanyFurniture/ProjectCompanyFurniture/ProjectCompanyFurniture.csproj
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/ProjectCompanyFurniture.csproj
@@ -8,4 +8,36 @@
enable
+
+
+
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ True
+ Settings.settings
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Properties/Resources.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..e11953a
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Properties/Resources.Designer.cs
@@ -0,0 +1,103 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace ProjectCompanyFurniture.Properties {
+ using System;
+
+
+ ///
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
+ ///
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectCompanyFurniture.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap edit {
+ get {
+ object obj = ResourceManager.GetObject("edit", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap mebel {
+ get {
+ object obj = ResourceManager.GetObject("mebel", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap minus {
+ get {
+ object obj = ResourceManager.GetObject("minus", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap plus {
+ get {
+ object obj = ResourceManager.GetObject("plus", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Properties/Resources.resx b/ProjectCompanyFurniture/ProjectCompanyFurniture/Properties/Resources.resx
new file mode 100644
index 0000000..a8009c0
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Properties/Resources.resx
@@ -0,0 +1,133 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+
+ ..\Resources\mebel.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\plus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\edit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\minus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Properties/Settings.Designer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..8a3e29e
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace ProjectCompanyFurniture.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.11.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Properties/Settings.settings b/ProjectCompanyFurniture/ProjectCompanyFurniture/Properties/Settings.settings
new file mode 100644
index 0000000..049245f
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Properties/Settings.settings
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IClientRepository.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IClientRepository.cs
new file mode 100644
index 0000000..2cab5f7
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IClientRepository.cs
@@ -0,0 +1,17 @@
+using ProjectCompanyFurniture.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectCompanyFurniture.Repositories;
+
+public interface IClientRepository
+{
+ IEnumerable ReadClients();
+ Client ReadClientById(int id);
+ void CreateClient(Client client);
+ void UpdateClient(Client client);
+ void DeleteClient(int id);
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IInvoiceRepository.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IInvoiceRepository.cs
new file mode 100644
index 0000000..51f9871
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IInvoiceRepository.cs
@@ -0,0 +1,16 @@
+using ProjectCompanyFurniture.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectCompanyFurniture.Repositories;
+
+public interface IInvoiceRepository
+{
+ IEnumerable ReadInvoice(DateTime? dateForm = null, DateTime? dateTo = null, int? clientId = null);
+ void CreateInvoice(Invoice invoice);
+ void DeleteInvoice(int id);
+
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IManufacturerRepository.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IManufacturerRepository.cs
new file mode 100644
index 0000000..d3f6944
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IManufacturerRepository.cs
@@ -0,0 +1,17 @@
+using ProjectCompanyFurniture.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectCompanyFurniture.Repositories;
+
+public interface IManufacturerRepository
+{
+ IEnumerable ReadManufacturer();
+ Manufacturer ReadManufacturerById(int id);
+ void CreateManufacturer(Manufacturer manufacturer);
+ void UpdateManufacturer(Manufacturer manufacturer);
+ void DeleteManufacturer(int id);
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IProductMovementRepository.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IProductMovementRepository.cs
new file mode 100644
index 0000000..dc586a4
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IProductMovementRepository.cs
@@ -0,0 +1,14 @@
+using ProjectCompanyFurniture.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectCompanyFurniture.Repositories;
+
+public interface IProductMovementRepository
+{
+ IEnumerable ReadProductMovements(DateTime? dateForm = null, DateTime? dateTo = null, int? clientId = null);
+ void CreateProductMovement(ProductMovement productMovement);
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IProductRepository.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IProductRepository.cs
new file mode 100644
index 0000000..93364ec
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/IProductRepository.cs
@@ -0,0 +1,17 @@
+using ProjectCompanyFurniture.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectCompanyFurniture.Repositories;
+
+public interface IProductRepository
+{
+ IEnumerable ReadProducts();
+ Product ReadProductById(int id);
+ void CreateProduct(Product product);
+ void UpdateProduct(Product product);
+ void DeleteProduct(int id);
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/ClientRepository.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/ClientRepository.cs
new file mode 100644
index 0000000..9b6f13a
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/ClientRepository.cs
@@ -0,0 +1,39 @@
+using ProjectCompanyFurniture.Entities;
+using ProjectCompanyFurniture.Entities.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectCompanyFurniture.Repositories.Implementations;
+
+public class ClientRepository : IClientRepository
+{
+ public void CreateClient(Client client)
+ {
+ }
+
+ public void DeleteClient(int id)
+ {
+ }
+
+ public IEnumerable ReadClient()
+ {
+ return [];
+ }
+
+ public Client ReadClientById(int id)
+ {
+ return Client.CreateEntity(0, string.Empty, ClientType.None, false);
+ }
+
+ public IEnumerable ReadClients()
+ {
+ return [];
+ }
+
+ public void UpdateClient(Client client)
+ {
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/InvoiceRepository.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/InvoiceRepository.cs
new file mode 100644
index 0000000..4571f04
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/InvoiceRepository.cs
@@ -0,0 +1,24 @@
+using ProjectCompanyFurniture.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectCompanyFurniture.Repositories.Implementations;
+
+public class InvoiceRepository : IInvoiceRepository
+{
+ public void CreateInvoice(Invoice invoice)
+ {
+ }
+
+ public void DeleteInvoice(int id)
+ {
+ }
+
+ public IEnumerable ReadInvoice(DateTime? dateForm = null, DateTime? dateTo = null, int? clientId = null)
+ {
+ return [];
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/ManufacturerRepository.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/ManufacturerRepository.cs
new file mode 100644
index 0000000..e598099
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/ManufacturerRepository.cs
@@ -0,0 +1,33 @@
+using ProjectCompanyFurniture.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectCompanyFurniture.Repositories.Implementations;
+
+public class ManufacturerRepository : IManufacturerRepository
+{
+ public void CreateManufacturer(Manufacturer manufacturer)
+ {
+ }
+
+ public void DeleteManufacturer(int id)
+ {
+ }
+
+ public IEnumerable ReadManufacturer()
+ {
+ return [];
+ }
+
+ public Manufacturer ReadManufacturerById(int id)
+ {
+ return Manufacturer.CreateEntity(0, string.Empty);
+ }
+
+ public void UpdateManufacturer(Manufacturer manufacturer)
+ {
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/ProductMovementRepository.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/ProductMovementRepository.cs
new file mode 100644
index 0000000..676087c
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/ProductMovementRepository.cs
@@ -0,0 +1,21 @@
+using ProjectCompanyFurniture.Entities;
+using ProjectCompanyFurniture.Entities.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectCompanyFurniture.Repositories.Implementations;
+
+public class ProductMovementRepository : IProductMovementRepository
+{
+ public void CreateProductMovement(ProductMovement productMovement)
+ {
+ }
+
+ public IEnumerable ReadProductMovements(DateTime? dateForm = null, DateTime? dateTo = null, int? clientId = null)
+ {
+ return [];
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/ProductRepository.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/ProductRepository.cs
new file mode 100644
index 0000000..6ff8a8f
--- /dev/null
+++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Repositories/Implementations/ProductRepository.cs
@@ -0,0 +1,33 @@
+using ProjectCompanyFurniture.Entities;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectCompanyFurniture.Repositories.Implementations;
+
+public class ProductRepository : IProductRepository
+{
+ public void CreateProduct(Product product)
+ {
+ }
+
+ public void DeleteProduct(int id)
+ {
+ }
+
+ public Product ReadProductById(int id)
+ {
+ return Product.CreateEntity(0, 0, string.Empty, string.Empty, 0);
+ }
+
+ public IEnumerable ReadProducts()
+ {
+ return [];
+ }
+
+ public void UpdateProduct(Product product)
+ {
+ }
+}
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Resources/edit.png b/ProjectCompanyFurniture/ProjectCompanyFurniture/Resources/edit.png
new file mode 100644
index 0000000..338e5e3
Binary files /dev/null and b/ProjectCompanyFurniture/ProjectCompanyFurniture/Resources/edit.png differ
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Resources/mebel.jpg b/ProjectCompanyFurniture/ProjectCompanyFurniture/Resources/mebel.jpg
new file mode 100644
index 0000000..b05a822
Binary files /dev/null and b/ProjectCompanyFurniture/ProjectCompanyFurniture/Resources/mebel.jpg differ
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Resources/minus.png b/ProjectCompanyFurniture/ProjectCompanyFurniture/Resources/minus.png
new file mode 100644
index 0000000..e22011d
Binary files /dev/null and b/ProjectCompanyFurniture/ProjectCompanyFurniture/Resources/minus.png differ
diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Resources/plus.png b/ProjectCompanyFurniture/ProjectCompanyFurniture/Resources/plus.png
new file mode 100644
index 0000000..36547f1
Binary files /dev/null and b/ProjectCompanyFurniture/ProjectCompanyFurniture/Resources/plus.png differ