diff --git a/FurnitureCompany/FurnitureCompany/Entities/Client.cs b/FurnitureCompany/FurnitureCompany/Entities/Client.cs new file mode 100644 index 0000000..cd724c5 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Entities/Client.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Entities; + +public class Client +{ + public int Id { get; private set; } + + public string Name { get; private set; } = string.Empty; + + public string Address { get; private set; } = string.Empty; + + public int Age { get; private set; } + + public double Earnings { get; private set; } + + public static Client CreateEntity(int id, string name, string address, int age, double earnings) + { + return new Client + { + Id = id, + Name = name ?? string.Empty, + Address = address ?? string.Empty, + Age = age, + Earnings = earnings + }; + } +} diff --git a/FurnitureCompany/FurnitureCompany/Entities/Delivery.cs b/FurnitureCompany/FurnitureCompany/Entities/Delivery.cs new file mode 100644 index 0000000..00e3d6c --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Entities/Delivery.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Entities; + +public class Delivery +{ + public int Id { get; private set; } + + public int WorkerId { get; private set; } + + public string Status { get; private set; } = string.Empty; + + public DateTime DateDelivery { get; private set; } + + public IEnumerable DeliveryProducts { get; private set; } = []; + + public static Delivery CreateOperation(int id, int workerId, string status, IEnumerable deliveryProducts) + { + return new Delivery + { + Id = id, + WorkerId = workerId, + Status = status, + DateDelivery = DateTime.Now, + DeliveryProducts = deliveryProducts + }; + } +} diff --git a/FurnitureCompany/FurnitureCompany/Entities/DeliveryProduct.cs b/FurnitureCompany/FurnitureCompany/Entities/DeliveryProduct.cs new file mode 100644 index 0000000..eb07acf --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Entities/DeliveryProduct.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Entities; + +public class DeliveryProduct +{ + public int Id { get; private set; } + + public int ProductId { get; private set; } + + public int DeliveryId { get; private set; } + + public int Count { get; private set; } + + public static DeliveryProduct CreateElement(int id, int productId, int deliveryId, int count) + { + return new DeliveryProduct + { + Id = id, + ProductId = productId, + DeliveryId = deliveryId, + Count = count + }; + } +} diff --git a/FurnitureCompany/FurnitureCompany/Entities/Enums/Material.cs b/FurnitureCompany/FurnitureCompany/Entities/Enums/Material.cs new file mode 100644 index 0000000..87703c6 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Entities/Enums/Material.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Entities.Enums; + +[Flags] +public enum Material +{ + None = 0, + + Wood = 1, + + Stone = 2, + + Glass = 4, + + Metal = 8 +} diff --git a/FurnitureCompany/FurnitureCompany/Entities/Enums/WorkerPost.cs b/FurnitureCompany/FurnitureCompany/Entities/Enums/WorkerPost.cs new file mode 100644 index 0000000..e183877 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Entities/Enums/WorkerPost.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Entities.Enums; + +public enum WorkerPost +{ + None = 0, + + Beginner = 1, + + Advanced = 2, + + Professional = 3 +} diff --git a/FurnitureCompany/FurnitureCompany/Entities/Invoice.cs b/FurnitureCompany/FurnitureCompany/Entities/Invoice.cs new file mode 100644 index 0000000..a5cf261 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Entities/Invoice.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Entities; + +public class Invoice +{ + public int Id { get; private set; } + + public int WorkerId { get; private set; } + + public int ClientId { get; private set; } + + public int ProductId { get; private set; } + + public DateTime Date { get; private set; } + + public int CountProduct { get; private set; } + + public static Invoice CreateOperation(int id, int workerId, int clientId, int productId, int countProduct) + { + return new Invoice + { + Id = id, + WorkerId = workerId, + ClientId = clientId, + ProductId = productId, + Date = DateTime.Now, + CountProduct = countProduct + }; + } +} diff --git a/FurnitureCompany/FurnitureCompany/Entities/Product.cs b/FurnitureCompany/FurnitureCompany/Entities/Product.cs new file mode 100644 index 0000000..32e8e6c --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Entities/Product.cs @@ -0,0 +1,30 @@ +using FurnitureCompany.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Entities; + +public class Product +{ + public int Id { get; private set; } + + public string Name { get; private set; } = string.Empty; + + public Material Material { get; private set; } + + public double Price { get; private set; } + + public static Product CreateEntity(int id, Material material, string name, double price) + { + return new Product + { + Id = id, + Material = material, + Name = name ?? string.Empty, + Price = price + }; + } +} diff --git a/FurnitureCompany/FurnitureCompany/Entities/Worker.cs b/FurnitureCompany/FurnitureCompany/Entities/Worker.cs new file mode 100644 index 0000000..31eb241 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Entities/Worker.cs @@ -0,0 +1,30 @@ +using FurnitureCompany.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Entities; + +public class Worker +{ + public int Id { get; private set; } + + public string Surname { get; private set; } = string.Empty; + + public int Expirience { get; private set; } + + public WorkerPost WorkerPost { get; private set; } + + public static Worker CreateEntity(int id, string surname, int expirience, WorkerPost workerPost) + { + return new Worker + { + Id = id, + Surname = surname ?? string.Empty, + Expirience = expirience, + WorkerPost = workerPost + }; + } +} diff --git a/FurnitureCompany/FurnitureCompany/Form1.Designer.cs b/FurnitureCompany/FurnitureCompany/Form1.Designer.cs deleted file mode 100644 index 58f533a..0000000 --- a/FurnitureCompany/FurnitureCompany/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace FurnitureCompany -{ - 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/FurnitureCompany/FurnitureCompany/FormFurnitureCompany.Designer.cs b/FurnitureCompany/FurnitureCompany/FormFurnitureCompany.Designer.cs new file mode 100644 index 0000000..6e1e6b6 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/FormFurnitureCompany.Designer.cs @@ -0,0 +1,133 @@ +namespace FurnitureCompany +{ + partial class FormFurnitureCompany + { + /// + /// 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() + { + menuStrip1 = new MenuStrip(); + справочникиToolStripMenuItem = new ToolStripMenuItem(); + работникиToolStripMenuItem = new ToolStripMenuItem(); + клиентыToolStripMenuItem = new ToolStripMenuItem(); + изделияToolStripMenuItem = new ToolStripMenuItem(); + операцииToolStripMenuItem = new ToolStripMenuItem(); + оформлениеЗаказаToolStripMenuItem = new ToolStripMenuItem(); + доставкаToolStripMenuItem = new ToolStripMenuItem(); + отчётыToolStripMenuItem = new ToolStripMenuItem(); + 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(782, 28); + menuStrip1.TabIndex = 0; + menuStrip1.Text = "menuStrip1"; + // + // справочникиToolStripMenuItem + // + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { работникиToolStripMenuItem, клиентыToolStripMenuItem, изделияToolStripMenuItem }); + справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; + справочникиToolStripMenuItem.Size = new Size(117, 24); + справочникиToolStripMenuItem.Text = "Справочники"; + // + // работникиToolStripMenuItem + // + работникиToolStripMenuItem.Name = "работникиToolStripMenuItem"; + работникиToolStripMenuItem.Size = new Size(166, 26); + работникиToolStripMenuItem.Text = "Работники"; + // + // клиентыToolStripMenuItem + // + клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem"; + клиентыToolStripMenuItem.Size = new Size(166, 26); + клиентыToolStripMenuItem.Text = "Клиенты"; + // + // изделияToolStripMenuItem + // + изделияToolStripMenuItem.Name = "изделияToolStripMenuItem"; + изделияToolStripMenuItem.Size = new Size(166, 26); + изделияToolStripMenuItem.Text = "Изделия"; + // + // операцииToolStripMenuItem + // + операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { оформлениеЗаказаToolStripMenuItem, доставкаToolStripMenuItem }); + операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; + операцииToolStripMenuItem.Size = new Size(95, 24); + операцииToolStripMenuItem.Text = "Операции"; + // + // оформлениеЗаказаToolStripMenuItem + // + оформлениеЗаказаToolStripMenuItem.Name = "оформлениеЗаказаToolStripMenuItem"; + оформлениеЗаказаToolStripMenuItem.Size = new Size(233, 26); + оформлениеЗаказаToolStripMenuItem.Text = "Оформление заказа"; + // + // доставкаToolStripMenuItem + // + доставкаToolStripMenuItem.Name = "доставкаToolStripMenuItem"; + доставкаToolStripMenuItem.Size = new Size(233, 26); + доставкаToolStripMenuItem.Text = "Доставка"; + // + // отчётыToolStripMenuItem + // + отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem"; + отчётыToolStripMenuItem.Size = new Size(73, 24); + отчётыToolStripMenuItem.Text = "Отчёты"; + // + // FormFurnitureCompany + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + BackgroundImage = Properties.Resources._57435d62a4b6bbc87520597c0e8c4c3a; + BackgroundImageLayout = ImageLayout.Stretch; + ClientSize = new Size(782, 403); + Controls.Add(menuStrip1); + MainMenuStrip = menuStrip1; + Name = "FormFurnitureCompany"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Мебельная компания"; + menuStrip1.ResumeLayout(false); + menuStrip1.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private MenuStrip menuStrip1; + private ToolStripMenuItem справочникиToolStripMenuItem; + private ToolStripMenuItem работникиToolStripMenuItem; + private ToolStripMenuItem клиентыToolStripMenuItem; + private ToolStripMenuItem изделияToolStripMenuItem; + private ToolStripMenuItem операцииToolStripMenuItem; + private ToolStripMenuItem отчётыToolStripMenuItem; + private ToolStripMenuItem оформлениеЗаказаToolStripMenuItem; + private ToolStripMenuItem доставкаToolStripMenuItem; + } +} diff --git a/FurnitureCompany/FurnitureCompany/Form1.cs b/FurnitureCompany/FurnitureCompany/FormFurnitureCompany.cs similarity index 51% rename from FurnitureCompany/FurnitureCompany/Form1.cs rename to FurnitureCompany/FurnitureCompany/FormFurnitureCompany.cs index 223c63b..8abe90b 100644 --- a/FurnitureCompany/FurnitureCompany/Form1.cs +++ b/FurnitureCompany/FurnitureCompany/FormFurnitureCompany.cs @@ -1,10 +1,11 @@ namespace FurnitureCompany { - public partial class Form1 : Form + public partial class FormFurnitureCompany : Form { - public Form1() + public FormFurnitureCompany() { InitializeComponent(); } + } } diff --git a/FurnitureCompany/FurnitureCompany/FormFurnitureCompany.resx b/FurnitureCompany/FurnitureCompany/FormFurnitureCompany.resx new file mode 100644 index 0000000..b48baf1 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/FormFurnitureCompany.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/FurnitureCompany/FurnitureCompany/Forms/FormClient.Designer.cs b/FurnitureCompany/FurnitureCompany/Forms/FormClient.Designer.cs new file mode 100644 index 0000000..9696902 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Forms/FormClient.Designer.cs @@ -0,0 +1,172 @@ +namespace FurnitureCompany.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() + { + labelClientName = new Label(); + labelClientAddress = new Label(); + labelClientAge = new Label(); + textBoxClientName = new TextBox(); + textBoxClientAddress = new TextBox(); + labelClientEarnings = new Label(); + numericUpDownClientEarnings = new NumericUpDown(); + buttonSave = new Button(); + buttonCancel = new Button(); + numericUpDownClientAge = new NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)numericUpDownClientEarnings).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownClientAge).BeginInit(); + SuspendLayout(); + // + // labelClientName + // + labelClientName.AutoSize = true; + labelClientName.Location = new Point(46, 34); + labelClientName.Name = "labelClientName"; + labelClientName.Size = new Size(101, 20); + labelClientName.TabIndex = 0; + labelClientName.Text = "Имя клиента:"; + // + // labelClientAddress + // + labelClientAddress.AutoSize = true; + labelClientAddress.Location = new Point(46, 95); + labelClientAddress.Name = "labelClientAddress"; + labelClientAddress.Size = new Size(147, 20); + labelClientAddress.TabIndex = 1; + labelClientAddress.Text = "Адрес проживания:"; + // + // labelClientAge + // + labelClientAge.AutoSize = true; + labelClientAge.Location = new Point(46, 160); + labelClientAge.Name = "labelClientAge"; + labelClientAge.Size = new Size(67, 20); + labelClientAge.TabIndex = 2; + labelClientAge.Text = "Возраст:"; + // + // textBoxClientName + // + textBoxClientName.Location = new Point(212, 31); + textBoxClientName.Name = "textBoxClientName"; + textBoxClientName.Size = new Size(192, 27); + textBoxClientName.TabIndex = 3; + // + // textBoxClientAddress + // + textBoxClientAddress.Location = new Point(212, 92); + textBoxClientAddress.Name = "textBoxClientAddress"; + textBoxClientAddress.Size = new Size(192, 27); + textBoxClientAddress.TabIndex = 4; + // + // labelClientEarnings + // + labelClientEarnings.AutoSize = true; + labelClientEarnings.Location = new Point(46, 223); + labelClientEarnings.Name = "labelClientEarnings"; + labelClientEarnings.Size = new Size(71, 20); + labelClientEarnings.TabIndex = 6; + labelClientEarnings.Text = "Выручка:"; + // + // numericUpDownClientEarnings + // + numericUpDownClientEarnings.DecimalPlaces = 2; + numericUpDownClientEarnings.Location = new Point(212, 221); + numericUpDownClientEarnings.Maximum = new decimal(new int[] { 10000, 0, 0, 0 }); + numericUpDownClientEarnings.Minimum = new decimal(new int[] { 1, 0, 0, 131072 }); + numericUpDownClientEarnings.Name = "numericUpDownClientEarnings"; + numericUpDownClientEarnings.Size = new Size(150, 27); + numericUpDownClientEarnings.TabIndex = 7; + numericUpDownClientEarnings.Value = new decimal(new int[] { 1, 0, 0, 131072 }); + // + // buttonSave + // + buttonSave.Location = new Point(99, 300); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(94, 29); + buttonSave.TabIndex = 8; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += buttonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(268, 300); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(94, 29); + buttonCancel.TabIndex = 9; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += buttonCancel_Click; + // + // numericUpDownClientAge + // + numericUpDownClientAge.Location = new Point(212, 158); + numericUpDownClientAge.Minimum = new decimal(new int[] { 1, 0, 0, 0 }); + numericUpDownClientAge.Name = "numericUpDownClientAge"; + numericUpDownClientAge.Size = new Size(150, 27); + numericUpDownClientAge.TabIndex = 10; + numericUpDownClientAge.Value = new decimal(new int[] { 1, 0, 0, 0 }); + // + // FormClient + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(450, 365); + Controls.Add(numericUpDownClientAge); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(numericUpDownClientEarnings); + Controls.Add(labelClientEarnings); + Controls.Add(textBoxClientAddress); + Controls.Add(textBoxClientName); + Controls.Add(labelClientAge); + Controls.Add(labelClientAddress); + Controls.Add(labelClientName); + Name = "FormClient"; + StartPosition = FormStartPosition.CenterParent; + Text = "Клиент"; + ((System.ComponentModel.ISupportInitialize)numericUpDownClientEarnings).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownClientAge).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelClientName; + private Label labelClientAddress; + private Label labelClientAge; + private TextBox textBoxClientName; + private TextBox textBoxClientAddress; + private Label labelClientEarnings; + private NumericUpDown numericUpDownClientEarnings; + private Button buttonSave; + private Button buttonCancel; + private NumericUpDown numericUpDownClientAge; + } +} \ No newline at end of file diff --git a/FurnitureCompany/FurnitureCompany/Forms/FormClient.cs b/FurnitureCompany/FurnitureCompany/Forms/FormClient.cs new file mode 100644 index 0000000..b425517 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Forms/FormClient.cs @@ -0,0 +1,88 @@ +using FurnitureCompany.Entities; +using FurnitureCompany.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 FurnitureCompany.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)); + } + + textBoxClientName.Text = client.Name; + textBoxClientAddress.Text = client.Address; + numericUpDownClientAge.Value = client.Age; + numericUpDownClientEarnings.Value = (decimal)client.Earnings; + _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)); + } + + private void buttonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxClientName.Text) || + string.IsNullOrWhiteSpace(textBoxClientAddress.Text)) + { + 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, + textBoxClientName.Text, textBoxClientAddress.Text, + Convert.ToInt32(numericUpDownClientAge.Value), + Convert.ToDouble(numericUpDownClientEarnings.Value)); + } +} diff --git a/FurnitureCompany/FurnitureCompany/Form1.resx b/FurnitureCompany/FurnitureCompany/Forms/FormClient.resx similarity index 92% rename from FurnitureCompany/FurnitureCompany/Form1.resx rename to FurnitureCompany/FurnitureCompany/Forms/FormClient.resx index 1af7de1..8b2ff64 100644 --- a/FurnitureCompany/FurnitureCompany/Form1.resx +++ b/FurnitureCompany/FurnitureCompany/Forms/FormClient.resx @@ -1,17 +1,17 @@  - diff --git a/FurnitureCompany/FurnitureCompany/FurnitureCompany.csproj b/FurnitureCompany/FurnitureCompany/FurnitureCompany.csproj index 663fdb8..accbdf0 100644 --- a/FurnitureCompany/FurnitureCompany/FurnitureCompany.csproj +++ b/FurnitureCompany/FurnitureCompany/FurnitureCompany.csproj @@ -8,4 +8,23 @@ enable + + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/FurnitureCompany/FurnitureCompany/Program.cs b/FurnitureCompany/FurnitureCompany/Program.cs index c460ded..8783116 100644 --- a/FurnitureCompany/FurnitureCompany/Program.cs +++ b/FurnitureCompany/FurnitureCompany/Program.cs @@ -1,3 +1,7 @@ +using FurnitureCompany.Repositories; +using FurnitureCompany.Repositories.Implementations; +using Unity; + namespace FurnitureCompany { internal static class Program @@ -11,7 +15,20 @@ namespace FurnitureCompany // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); + Application.Run(CreateContainer().Resolve()); + } + + private static IUnityContainer CreateContainer() + { + var container = new UnityContainer(); + + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + + return container; } } } \ No newline at end of file diff --git a/FurnitureCompany/FurnitureCompany/Properties/Resources.Designer.cs b/FurnitureCompany/FurnitureCompany/Properties/Resources.Designer.cs new file mode 100644 index 0000000..b4aa89b --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Properties/Resources.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace FurnitureCompany.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("FurnitureCompany.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 _57435d62a4b6bbc87520597c0e8c4c3a { + get { + object obj = ResourceManager.GetObject("57435d62a4b6bbc87520597c0e8c4c3a", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/FurnitureCompany/FurnitureCompany/Properties/Resources.resx b/FurnitureCompany/FurnitureCompany/Properties/Resources.resx new file mode 100644 index 0000000..6515da1 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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\57435d62a4b6bbc87520597c0e8c4c3a.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/FurnitureCompany/FurnitureCompany/Repositories/IClientRepository.cs b/FurnitureCompany/FurnitureCompany/Repositories/IClientRepository.cs new file mode 100644 index 0000000..4feefa0 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Repositories/IClientRepository.cs @@ -0,0 +1,21 @@ +using FurnitureCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Repositories; + +public interface IClientRepository +{ + IEnumerable GetClients(); + + Client ReadClientById(int id); + + void CreateClient(Client client); + + void UpdateClient(Client client); + + void DeleteClient(int id); +} diff --git a/FurnitureCompany/FurnitureCompany/Repositories/IDeliveryRepository.cs b/FurnitureCompany/FurnitureCompany/Repositories/IDeliveryRepository.cs new file mode 100644 index 0000000..4d4aa4c --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Repositories/IDeliveryRepository.cs @@ -0,0 +1,18 @@ +using FurnitureCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Repositories; + +public interface IDeliveryRepository +{ + IEnumerable ReadDeliverys(DateTime? dateFrom = null, DateTime? dateTo = null, int? productId = null, + int? workerId = null); + + void CreateDelivery(Delivery delivery); + + void DeleteDelivery(Delivery delivery); +} diff --git a/FurnitureCompany/FurnitureCompany/Repositories/IInvoiceRepository.cs b/FurnitureCompany/FurnitureCompany/Repositories/IInvoiceRepository.cs new file mode 100644 index 0000000..892c882 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Repositories/IInvoiceRepository.cs @@ -0,0 +1,16 @@ +using FurnitureCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Repositories; + +public interface IInvoiceRepository +{ + IEnumerable ReadInvoices(DateTime? dateFrom = null, DateTime? dateTo = null, int? productId = null, + int? workerId = null, int? clientId = null); + + void CreateInvoice(Invoice invoice); +} diff --git a/FurnitureCompany/FurnitureCompany/Repositories/IProductRepository.cs b/FurnitureCompany/FurnitureCompany/Repositories/IProductRepository.cs new file mode 100644 index 0000000..492a68c --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Repositories/IProductRepository.cs @@ -0,0 +1,21 @@ +using FurnitureCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.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/FurnitureCompany/FurnitureCompany/Repositories/IWorkerRepository.cs b/FurnitureCompany/FurnitureCompany/Repositories/IWorkerRepository.cs new file mode 100644 index 0000000..aa8f8ec --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Repositories/IWorkerRepository.cs @@ -0,0 +1,21 @@ +using FurnitureCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Repositories; + +public interface IWorkerRepository +{ + IEnumerable ReadWorkers(); + + Worker ReadWorkerById(int id); + + void CreateWorker(Worker worker); + + void UpdateWorker(Worker worker); + + void DeleteWorker(int id); +} diff --git a/FurnitureCompany/FurnitureCompany/Repositories/Implementations/ClientRepository.cs b/FurnitureCompany/FurnitureCompany/Repositories/Implementations/ClientRepository.cs new file mode 100644 index 0000000..129c665 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Repositories/Implementations/ClientRepository.cs @@ -0,0 +1,33 @@ +using FurnitureCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Repositories.Implementations; + +public class ClientRepository : IClientRepository +{ + public void CreateClient(Client client) + { + } + + public void DeleteClient(int id) + { + } + + public IEnumerable GetClients() + { + return[]; + } + + public Client ReadClientById(int id) + { + return Client.CreateEntity(0, string.Empty, string.Empty, 0, 0); + } + + public void UpdateClient(Client client) + { + } +} diff --git a/FurnitureCompany/FurnitureCompany/Repositories/Implementations/DeliveryRepository.cs b/FurnitureCompany/FurnitureCompany/Repositories/Implementations/DeliveryRepository.cs new file mode 100644 index 0000000..3a7581b --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Repositories/Implementations/DeliveryRepository.cs @@ -0,0 +1,24 @@ +using FurnitureCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Repositories.Implementations; + +public class DeliveryRepository : IDeliveryRepository +{ + public void CreateDelivery(Delivery delivery) + { + } + + public void DeleteDelivery(Delivery delivery) + { + } + + public IEnumerable ReadDeliverys(DateTime? dateFrom = null, DateTime? dateTo = null, int? productId = null, int? workerId = null) + { + return []; + } +} diff --git a/FurnitureCompany/FurnitureCompany/Repositories/Implementations/InvoiceRepository.cs b/FurnitureCompany/FurnitureCompany/Repositories/Implementations/InvoiceRepository.cs new file mode 100644 index 0000000..f1e0372 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Repositories/Implementations/InvoiceRepository.cs @@ -0,0 +1,20 @@ +using FurnitureCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Repositories.Implementations; + +public class InvoiceRepository : IInvoiceRepository +{ + public void CreateInvoice(Invoice invoice) + { + } + + public IEnumerable ReadInvoices(DateTime? dateFrom = null, DateTime? dateTo = null, int? productId = null, int? workerId = null, int? clientId = null) + { + return []; + } +} diff --git a/FurnitureCompany/FurnitureCompany/Repositories/Implementations/ProductRepository.cs b/FurnitureCompany/FurnitureCompany/Repositories/Implementations/ProductRepository.cs new file mode 100644 index 0000000..4322cc4 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Repositories/Implementations/ProductRepository.cs @@ -0,0 +1,34 @@ +using FurnitureCompany.Entities; +using FurnitureCompany.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.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, Material.None, string.Empty, 0); + } + + public IEnumerable ReadProducts() + { + return []; + } + + public void UpdateProduct(Product product) + { + } +} diff --git a/FurnitureCompany/FurnitureCompany/Repositories/Implementations/WorkerRepository.cs b/FurnitureCompany/FurnitureCompany/Repositories/Implementations/WorkerRepository.cs new file mode 100644 index 0000000..93c4094 --- /dev/null +++ b/FurnitureCompany/FurnitureCompany/Repositories/Implementations/WorkerRepository.cs @@ -0,0 +1,34 @@ +using FurnitureCompany.Entities; +using FurnitureCompany.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace FurnitureCompany.Repositories.Implementations; + +public class WorkerRepository : IWorkerRepository +{ + public void CreateWorker(Worker worker) + { + } + + public void DeleteWorker(int id) + { + } + + public Worker ReadWorkerById(int id) + { + return Worker.CreateEntity(0, string.Empty, 0, WorkerPost.None); + } + + public IEnumerable ReadWorkers() + { + return []; + } + + public void UpdateWorker(Worker worker) + { + } +} diff --git a/FurnitureCompany/FurnitureCompany/Resources/57435d62a4b6bbc87520597c0e8c4c3a.jpg b/FurnitureCompany/FurnitureCompany/Resources/57435d62a4b6bbc87520597c0e8c4c3a.jpg new file mode 100644 index 0000000..1cbc179 Binary files /dev/null and b/FurnitureCompany/FurnitureCompany/Resources/57435d62a4b6bbc87520597c0e8c4c3a.jpg differ