diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Client.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Client.cs new file mode 100644 index 0000000..4473053 --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Client.cs @@ -0,0 +1,30 @@ +using ProjectCompanyFurniture.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectCompanyFurniture.Entities; + +public class Client +{ + public int ID { get; private set; } + + public string Name { get; private set; } + + public ClientType ClientType { get; private set; } + + public bool Optovik { get; private set; } + + public static Client CreateEntity(int id, string name, ClientType clientType, bool optovik) + { + return new Client + { + ID = id, + Name = name, + ClientType = clientType, + Optovik = optovik + }; + } +} diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/ClientType.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/ClientType.cs new file mode 100644 index 0000000..d518da4 --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/ClientType.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectCompanyFurniture.Entities.Enums; + +public enum ClientType +{ + None = 0, + /// + /// частное лицо + /// + PrivatePerson = 1, + /// + /// предприниматель + /// + Entrepreneur = 2, + /// + /// организация + /// + Organization = 3 + +} diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/Movement.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/Movement.cs new file mode 100644 index 0000000..88633d6 --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Enums/Movement.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectCompanyFurniture.Entities.Enums; + + +[Flags] +public enum Movement +{ + None = 0, + /// + /// проступление + /// + Reseipt = 1, + /// + /// продажа + /// + Sale = 2, + /// + /// перемещение на склад + /// + MovingToWarehouse = 4, + /// + /// подготовка к отправке + /// + PreparationForShipment = 8, + /// + /// перемещение в магазин + /// + MovingToStore = 16, + +} diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Invoice.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Invoice.cs new file mode 100644 index 0000000..063a75f --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Invoice.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectCompanyFurniture.Entities; + +public class Invoice +{ + public int ID { get; private set; } + + public int ClientID { get; set; } + + // 0 или 1 + public int AvailabilityOfPromotionalCode { get; set; } + + public int DiscountPercentage { get; set; } + + public int SellingPrice { get; set; } + + public DateTime Date { get; set; } + + 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 + { + ID = id, + ClientID = clientId, + AvailabilityOfPromotionalCode = availabilityOfPromotionalCode, + DiscountPercentage = discountPercentage, + SellingPrice = sellingPrice, + Date = DateTime.Now, + Products = products + }; + } +} diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/InvoiceProduct.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/InvoiceProduct.cs new file mode 100644 index 0000000..4714d20 --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/InvoiceProduct.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectCompanyFurniture; + +public class InvoiceProduct +{ + public int InvoiceID { get; private set; } + + public int ProductID { get; private set; } + + public int Count { get; private set; } + + public int SellingPrice { get; private set; } + + public static InvoiceProduct CreateElement(int invoiceId, int productID, int count) + { + return new InvoiceProduct + { + InvoiceID = invoiceId, + ProductID = productID, + Count = count + }; + } +} diff --git a/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Manufacturer.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Manufacturer.cs new file mode 100644 index 0000000..70716d3 --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/Manufacturer.cs @@ -0,0 +1,23 @@ + using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectCompanyFurniture.Entities; + +public class Manufacturer +{ + public int ID { get; set; } + + public string Name { get; set; } + + public static Manufacturer CreateEntity(int iD, string name) + { + return new Manufacturer + { + ID = iD, + Name = name + }; + } +} 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 new file mode 100644 index 0000000..add15c2 --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Entities/ProductMovement.cs @@ -0,0 +1,30 @@ +using ProjectCompanyFurniture.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectCompanyFurniture.Entities; + +public class ProductMovement +{ + public int ID { get; private set; } + + public int ProductID { get; private set; } + + public Movement MovementType { get; private set; } + + public DateTime Date { get; private set; } + + public static ProductMovement CreateOperation (int it, int productId, Movement movementType) + { + return new ProductMovement + { + ID = it, + ProductID = productId, + MovementType = movementType, + 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..523b0ae --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.Designer.cs @@ -0,0 +1,135 @@ +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(); + textBoxName = new TextBox(); + buttonSave = new Button(); + buttonCancel = new Button(); + comboBoxClientType = new ComboBox(); + checkBoxOptYes = new CheckBox(); + SuspendLayout(); + // + // labelName + // + labelName.AutoSize = true; + labelName.Location = new Point(38, 39); + labelName.Name = "labelName"; + labelName.Size = new Size(45, 20); + labelName.TabIndex = 0; + labelName.Text = "ФИО:"; + // + // labelType + // + labelType.AutoSize = true; + labelType.Location = new Point(38, 106); + labelType.Name = "labelType"; + labelType.Size = new Size(97, 20); + labelType.TabIndex = 1; + labelType.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, 224, 192); + 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, 224, 192); + 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; + // + // comboBoxClientType + // + comboBoxClientType.FormattingEnabled = true; + comboBoxClientType.Location = new Point(157, 106); + comboBoxClientType.Name = "comboBoxClientType"; + comboBoxClientType.Size = new Size(125, 28); + comboBoxClientType.TabIndex = 10; + // + // checkBoxOptYes + // + checkBoxOptYes.AutoSize = true; + checkBoxOptYes.CheckAlign = ContentAlignment.MiddleRight; + checkBoxOptYes.Location = new Point(45, 185); + checkBoxOptYes.Name = "checkBoxOptYes"; + checkBoxOptYes.Size = new Size(90, 24); + checkBoxOptYes.TabIndex = 12; + checkBoxOptYes.Text = "Оптивик"; + checkBoxOptYes.UseVisualStyleBackColor = true; + // + // FormClient + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(329, 324); + Controls.Add(checkBoxOptYes); + Controls.Add(comboBoxClientType); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(textBoxName); + Controls.Add(labelType); + Controls.Add(labelName); + Name = "FormClient"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Клиент"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelName; + private Label labelType; + private TextBox textBoxName; + private Button buttonSave; + private Button buttonCancel; + private ComboBox comboBoxClientType; + private CheckBox checkBoxOptYes; + } +} \ 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..d131e60 --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormClient.cs @@ -0,0 +1,84 @@ +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) + { + checkBoxOptYes.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) || 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!, checkBoxOptYes.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..9979d0d --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.Designer.cs @@ -0,0 +1,213 @@ +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() + { + buttonCancel = new Button(); + buttonSave = new Button(); + groupBoxProducts = new GroupBox(); + dataGridViewProducts = new DataGridView(); + ColumnProduct = new DataGridViewComboBoxColumn(); + ColumnCount = new DataGridViewTextBoxColumn(); + labelClientName = new Label(); + label2 = new Label(); + numericUpDownDiscPercentage = new NumericUpDown(); + comboBoxClient = new ComboBox(); + label3 = new Label(); + numericUpDownSellingPrice = new NumericUpDown(); + checkBoxPromYes = new CheckBox(); + groupBoxProducts.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridViewProducts).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownDiscPercentage).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownSellingPrice).BeginInit(); + SuspendLayout(); + // + // buttonCancel + // + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonCancel.BackColor = Color.FromArgb(192, 255, 192); + buttonCancel.Location = new Point(270, 548); + 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, 548); + 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, 236); + groupBoxProducts.Name = "groupBoxProducts"; + groupBoxProducts.Size = new Size(348, 291); + 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, 265); + 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 = "ФИО клиента:"; + // + // 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; + // + // checkBoxPromYes + // + checkBoxPromYes.AutoSize = true; + checkBoxPromYes.CheckAlign = ContentAlignment.MiddleRight; + checkBoxPromYes.Location = new Point(27, 94); + checkBoxPromYes.Name = "checkBoxPromYes"; + checkBoxPromYes.Size = new Size(175, 24); + checkBoxPromYes.TabIndex = 24; + checkBoxPromYes.Text = "Наличие промокода"; + checkBoxPromYes.UseVisualStyleBackColor = true; + // + // FormInvoice + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(403, 589); + Controls.Add(checkBoxPromYes); + Controls.Add(numericUpDownSellingPrice); + Controls.Add(label3); + Controls.Add(comboBoxClient); + Controls.Add(numericUpDownDiscPercentage); + Controls.Add(label2); + Controls.Add(labelClientName); + Controls.Add(groupBoxProducts); + Controls.Add(buttonSave); + Controls.Add(buttonCancel); + 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 Button buttonCancel; + private Button buttonSave; + private GroupBox groupBoxProducts; + private DataGridView dataGridViewProducts; + private DataGridViewComboBoxColumn ColumnProduct; + private DataGridViewTextBoxColumn ColumnCount; + private Label label2; + private Label labelClientName; + private NumericUpDown numericUpDownDiscPercentage; + private ComboBox comboBoxClient; + private Label label3; + private NumericUpDown numericUpDownSellingPrice; + private CheckBox checkBoxPromYes; + } +} \ 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..a001695 --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.cs @@ -0,0 +1,89 @@ +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 = "Name"; + 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) + { + throw new Exception("Имеются незаполненные поля"); + } + if (checkBoxPromYes.Checked && numericUpDownDiscPercentage.Value == 0) + { + throw new Exception("Не указан процент скидки"); + } + + if (checkBoxPromYes.Checked) + { + _invoiceRepository.CreateInvoice(Invoice.CreateOperation(0, + (int)comboBoxClient.SelectedValue!, 1, Convert.ToInt32(numericUpDownDiscPercentage.Value), + Convert.ToInt32(numericUpDownSellingPrice.Value), CreateListInvoiceProductFromDataGrid())); + } + else + { + _invoiceRepository.CreateInvoice(Invoice.CreateOperation(0, + (int)comboBoxClient.SelectedValue!, 0, 0, Convert.ToInt32(numericUpDownSellingPrice.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..f7cc2cb --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormInvoice.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 + + + 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..b5541c6 --- /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.ReadInvoices(); + + 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..be46c02 --- /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(80, 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(318, 158); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(textBoxName); + Controls.Add(labelName); + Name = "FormManufacturer"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Производитель"; + 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..8ac6c35 --- /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.ReadManufacturers(); + 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..0f033f1 --- /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(); + comboBoxManufacturer = new ComboBox(); + ((System.ComponentModel.ISupportInitialize)numericUpDownStartPrice).BeginInit(); + SuspendLayout(); + // + // labelName + // + labelName.AutoSize = true; + labelName.Location = new Point(35, 94); + labelName.Name = "labelName"; + labelName.Size = new Size(80, 20); + labelName.TabIndex = 0; + labelName.Text = "Название:"; + // + // labelCategory + // + labelCategory.AutoSize = true; + labelCategory.Location = new Point(35, 161); + labelCategory.Name = "labelCategory"; + labelCategory.Size = new Size(84, 20); + labelCategory.TabIndex = 1; + labelCategory.Text = "Категория:"; + // + // labelStartPrice + // + labelStartPrice.AutoSize = true; + labelStartPrice.Location = new Point(35, 222); + labelStartPrice.Name = "labelStartPrice"; + labelStartPrice.Size = new Size(126, 20); + labelStartPrice.TabIndex = 2; + labelStartPrice.Text = "Начальная цена:"; + // + // textBoxName + // + textBoxName.Location = new Point(211, 91); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(125, 27); + textBoxName.TabIndex = 3; + // + // textBoxCategory + // + textBoxCategory.Location = new Point(211, 158); + 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(255, 192, 255); + 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(255, 192, 255); + 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(121, 20); + labelIDManuf.TabIndex = 8; + labelIDManuf.Text = "Производитель:"; + // + // comboBoxManufacturer + // + comboBoxManufacturer.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxManufacturer.FormattingEnabled = true; + comboBoxManufacturer.Location = new Point(211, 31); + comboBoxManufacturer.Name = "comboBoxManufacturer"; + comboBoxManufacturer.Size = new Size(125, 28); + comboBoxManufacturer.TabIndex = 9; + // + // FormProduct + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(363, 394); + Controls.Add(comboBoxManufacturer); + 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(); + 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 ComboBox comboBoxManufacturer; + } +} \ 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..2823d4d --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProduct.cs @@ -0,0 +1,80 @@ +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)); + } + comboBoxManufacturer.SelectedValue = product.ManufacturerID; + textBoxName.Text = product.Name; + textBoxCategory.Text = product.Category; + numericUpDownStartPrice.Value = product.StartingPrice; + _productId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormProduct(IProductRepository productRepository, IManufacturerRepository manufacturerRepository) + { + InitializeComponent(); + _productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository)); + + comboBoxManufacturer.DataSource = manufacturerRepository.ReadManufacturers(); + comboBoxManufacturer.DisplayMember = "FirstName"; + comboBoxManufacturer.ValueMember = "Id"; + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxName.Text) || string.IsNullOrEmpty(textBoxCategory.Text) + || comboBoxManufacturer.SelectedIndex < 0) + { + 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((int)comboBoxManufacturer.SelectedValue!), + 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..ba704f8 --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProductMovement.Designer.cs @@ -0,0 +1,125 @@ +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(); + 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(69, 20); + labelProductID.TabIndex = 0; + labelProductID.Text = "Продукт:"; + // + // labelMovement + // + labelMovement.AutoSize = true; + labelMovement.Location = new Point(31, 71); + labelMovement.Name = "labelMovement"; + labelMovement.Size = new Size(112, 20); + labelMovement.TabIndex = 1; + labelMovement.Text = "Тип движения:"; + // + // buttonCancel + // + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonCancel.BackColor = Color.FromArgb(255, 192, 192); + buttonCancel.Location = new Point(286, 232); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(162, 29); + buttonCancel.TabIndex = 6; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = false; + buttonCancel.Click += ButtonCancel_Click; + // + // buttonSave + // + buttonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonSave.BackColor = Color.FromArgb(255, 192, 192); + buttonSave.Location = new Point(31, 232); + 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, 136); + 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, 290); + Controls.Add(comboBoxProduct); + Controls.Add(checkedListBoxMovement); + Controls.Add(buttonSave); + Controls.Add(buttonCancel); + Controls.Add(labelMovement); + Controls.Add(labelProductID); + Name = "FormProductMovement"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Движение товара"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelProductID; + private Label labelMovement; + 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..1ab5ff5 --- /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(Movement))) + { + 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)); + + 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..e342b04 --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.Designer.cs @@ -0,0 +1,128 @@ +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 = "Продукты"; + Load += FormProducts_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/FormProducts.cs b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.cs new file mode 100644 index 0000000..b20d13e --- /dev/null +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Forms/FormProducts.cs @@ -0,0 +1,107 @@ +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 FormProducts_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 + { + _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..e593abf 100644 --- a/ProjectCompanyFurniture/ProjectCompanyFurniture/Program.cs +++ b/ProjectCompanyFurniture/ProjectCompanyFurniture/Program.cs @@ -1,3 +1,8 @@ +using ProjectCompanyFurniture.Repositories; +using ProjectCompanyFurniture.Repositories.Implementations; +using Unity; +using Unity.Lifetime; + namespace ProjectCompanyFurniture { internal static class Program @@ -11,7 +16,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(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + container.RegisterType(new TransientLifetimeManager()); + 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..c19e15b --- /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 ReadInvoices (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..9ba4fcf --- /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 ReadManufacturers(); + 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..1bdfddc --- /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 ReadInvoices(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..934d720 --- /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 ReadManufacturers() + { + 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