diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/Detail.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/Detail.cs new file mode 100644 index 0000000..7fd5b9d --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/Detail.cs @@ -0,0 +1,29 @@ +using ProjectRepairCompany.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities; + +public class Detail +{ + public int Id { get; private set; } + public string NameDetail { get; private set; } = string.Empty; + public int NumberDetail { get; private set; } + public double PriceDetail { get; private set; } + public DetailProperties DetailProperties { get; private set; } + + public static Detail CreateEntity(int id, string nameDetail, int numberDetail, double priceDetail, DetailProperties detailProperties) + { + return new Detail + { + Id = id, + NameDetail = nameDetail, + NumberDetail = numberDetail, + PriceDetail = priceDetail, + DetailProperties = detailProperties + }; + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/Enums/DetailProperties.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/Enums/DetailProperties.cs new file mode 100644 index 0000000..2bb1512 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/Enums/DetailProperties.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities.Enums; + +[Flags] +public enum DetailProperties +{ + None = 0, // Нет свойств + Fragile = 1, // Хрупкая деталь + Heavy = 2, // Тяжелая + Expensive = 4, // Дорогая + CustomMade = 8, // Изготовлена на заказ + InStock = 16, // В наличии + Discounted = 32 // Со скидкой +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/Enums/MasterPost.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/Enums/MasterPost.cs new file mode 100644 index 0000000..d014c30 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/Enums/MasterPost.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities.Enums; + +public enum MasterPost +{ + None = 0, + Intern = 1, + Worker = 2, + Head = 3 + +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/Master.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/Master.cs new file mode 100644 index 0000000..3399e0c --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/Master.cs @@ -0,0 +1,31 @@ +using ProjectRepairCompany.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities; + +public class Master +{ + public int Id { get; private set; } + public string MasterName { get; private set; } = string.Empty; + public DateTime StartDate { get; private set; } + public MasterPost MasterPost { get; private set; } + + public static Master CreateEntity(int id, string masterName, DateTime startDate, MasterPost masterPost) + { + if (startDate > DateTime.Now) + { + throw new ArgumentException("Дата начала работы не может быть в будущем."); + } + return new Master + { + Id = id, + MasterName = masterName, + StartDate = startDate, + MasterPost = masterPost + }; + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/Order.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/Order.cs new file mode 100644 index 0000000..221a475 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/Order.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities; + +public class Order +{ + public int Id { get; private set; } + public DateTime OrderDate { get; private set; } + public DateTime DateCompletion { get; private set; } + public DateTime DateIssue { get; private set; } + public int FullPrice { get; private set; } + public int MasterId { get; private set; } + public IEnumerable OrderDetails { get; private set; } = []; + + public static Order CreateOperation(int id, int fullPrice, int masterId, DateTime dateCompletion, + DateTime dateIssue, IEnumerable orderDetails) + { + + + return new Order + { + Id = id, + OrderDate = DateTime.Now, + DateCompletion = dateCompletion, + DateIssue = dateIssue, + FullPrice = fullPrice, + MasterId = masterId, + OrderDetails = orderDetails + }; + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/OrderDetail.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/OrderDetail.cs new file mode 100644 index 0000000..00073f2 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/OrderDetail.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities; + +public class OrderDetail +{ + public int OrderId { get; private set; } + public int DetailId { get; private set; } + public int DetailCount { get; private set; } + + public static OrderDetail CreateOperation(int orderId, int detailId, int detailCount) + { + return new OrderDetail + { + OrderId = orderId, + DetailId = detailId, + DetailCount = detailCount + }; + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/Storage.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/Storage.cs new file mode 100644 index 0000000..0bf4dc7 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/Storage.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities; + +public class Storage +{ + public int Id { get; private set; } + public string StorageAddress { get; private set; } = string.Empty; + public int Capacity { get; private set; } + + public static Storage CreateEntity(int id, string storageAddress, int capacity) + { + return new Storage + { + Id = id, + StorageAddress = storageAddress, + Capacity = capacity + }; + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/StorageDetail.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/StorageDetail.cs new file mode 100644 index 0000000..bbed691 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/StorageDetail.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities; + +public class StorageDetail +{ + public int StorageId { get; private set; } + public int DetailId { get; private set; } + public int DetailCount { get; private set; } + public DateTime SupplyDate { get; private set; } // Дата поступления деталей + + public static StorageDetail CreateOperation(int storageId, int detailId, int detailCount, DateTime supplyDate) + { + return new StorageDetail + { + StorageId = storageId, + DetailId = detailId, + DetailCount = detailCount, + SupplyDate = supplyDate + }; + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Form1.Designer.cs b/ProjectRepairCompany/ProjectRepairCompany/Form1.Designer.cs deleted file mode 100644 index 1d1688b..0000000 --- a/ProjectRepairCompany/ProjectRepairCompany/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace ProjectRepairCompany -{ - 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/ProjectRepairCompany/ProjectRepairCompany/Form1.cs b/ProjectRepairCompany/ProjectRepairCompany/Form1.cs deleted file mode 100644 index 4059ecb..0000000 --- a/ProjectRepairCompany/ProjectRepairCompany/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ProjectRepairCompany -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/ProjectRepairCompany/ProjectRepairCompany/FormRepairCompany.Designer.cs b/ProjectRepairCompany/ProjectRepairCompany/FormRepairCompany.Designer.cs new file mode 100644 index 0000000..5a2c8e5 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/FormRepairCompany.Designer.cs @@ -0,0 +1,138 @@ +namespace ProjectRepairCompany +{ + partial class FormRepairCompany + { + /// + /// 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(); + MasterToolStripMenuItem = new ToolStripMenuItem(); + DetailToolStripMenuItem = new ToolStripMenuItem(); + StorageToolStripMenuItem = new ToolStripMenuItem(); + операцииToolStripMenuItem = new ToolStripMenuItem(); + OrderToolStripMenuItem = new ToolStripMenuItem(); + StorageDetailToolStripMenuItem = new ToolStripMenuItem(); + отчетыToolStripMenuItem = new ToolStripMenuItem(); + menuStrip1.SuspendLayout(); + SuspendLayout(); + // + // menuStrip1 + // + menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem }); + menuStrip1.Location = new Point(0, 0); + menuStrip1.Name = "menuStrip1"; + menuStrip1.Size = new Size(834, 25); + menuStrip1.TabIndex = 0; + menuStrip1.Text = "menuStrip"; + // + // справочникиToolStripMenuItem + // + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { MasterToolStripMenuItem, DetailToolStripMenuItem, StorageToolStripMenuItem }); + справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; + справочникиToolStripMenuItem.Size = new Size(99, 21); + справочникиToolStripMenuItem.Text = "Справочники"; + // + // MasterToolStripMenuItem + // + MasterToolStripMenuItem.Name = "MasterToolStripMenuItem"; + MasterToolStripMenuItem.Size = new Size(138, 22); + MasterToolStripMenuItem.Text = "Работники"; + MasterToolStripMenuItem.Click += MasterToolStripMenuItem_Click; + // + // DetailToolStripMenuItem + // + DetailToolStripMenuItem.Name = "DetailToolStripMenuItem"; + DetailToolStripMenuItem.Size = new Size(138, 22); + DetailToolStripMenuItem.Text = "Детали"; + DetailToolStripMenuItem.Click += DetailToolStripMenuItem_Click; + // + // StorageToolStripMenuItem + // + StorageToolStripMenuItem.Name = "StorageToolStripMenuItem"; + StorageToolStripMenuItem.Size = new Size(138, 22); + StorageToolStripMenuItem.Text = "Склады"; + StorageToolStripMenuItem.Click += StorageToolStripMenuItem_Click; + // + // операцииToolStripMenuItem + // + операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { OrderToolStripMenuItem, StorageDetailToolStripMenuItem }); + операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; + операцииToolStripMenuItem.Size = new Size(80, 21); + операцииToolStripMenuItem.Text = "Операции"; + // + // OrderToolStripMenuItem + // + OrderToolStripMenuItem.Name = "OrderToolStripMenuItem"; + OrderToolStripMenuItem.Size = new Size(194, 22); + OrderToolStripMenuItem.Text = "Заказы"; + OrderToolStripMenuItem.Click += OrderToolStripMenuItem_Click; + // + // StorageDetailToolStripMenuItem + // + StorageDetailToolStripMenuItem.Name = "StorageDetailToolStripMenuItem"; + StorageDetailToolStripMenuItem.Size = new Size(194, 22); + StorageDetailToolStripMenuItem.Text = "Пополнение склада"; + StorageDetailToolStripMenuItem.Click += StorageDetailToolStripMenuItem_Click; + // + // отчетыToolStripMenuItem + // + отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; + отчетыToolStripMenuItem.Size = new Size(63, 21); + отчетыToolStripMenuItem.Text = "Отчеты"; + // + // FormRepairCompany + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + BackgroundImage = Properties.Resources.Снимок_экрана_2024_09_02_200407; + BackgroundImageLayout = ImageLayout.Stretch; + ClientSize = new Size(834, 461); + Controls.Add(menuStrip1); + DoubleBuffered = true; + MainMenuStrip = menuStrip1; + Name = "FormRepairCompany"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Фирма по ремонту техники"; + menuStrip1.ResumeLayout(false); + menuStrip1.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private MenuStrip menuStrip1; + private ToolStripMenuItem справочникиToolStripMenuItem; + private ToolStripMenuItem MasterToolStripMenuItem; + private ToolStripMenuItem DetailToolStripMenuItem; + private ToolStripMenuItem StorageToolStripMenuItem; + private ToolStripMenuItem операцииToolStripMenuItem; + private ToolStripMenuItem отчетыToolStripMenuItem; + private ToolStripMenuItem StorageDetailToolStripMenuItem; + private ToolStripMenuItem OrderToolStripMenuItem; + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/FormRepairCompany.cs b/ProjectRepairCompany/ProjectRepairCompany/FormRepairCompany.cs new file mode 100644 index 0000000..10177e6 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/FormRepairCompany.cs @@ -0,0 +1,76 @@ +using ProjectRepairCompany.Forms; +using Unity; + +namespace ProjectRepairCompany +{ + public partial class FormRepairCompany : Form + { + private readonly IUnityContainer _container; + public FormRepairCompany(IUnityContainer container) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + } + + private void MasterToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void DetailToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void StorageToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void OrderToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void StorageDetailToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/FormRepairCompany.resx b/ProjectRepairCompany/ProjectRepairCompany/FormRepairCompany.resx new file mode 100644 index 0000000..a0623c8 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/FormRepairCompany.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/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetail.Designer.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetail.Designer.cs new file mode 100644 index 0000000..736fb7b --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetail.Designer.cs @@ -0,0 +1,170 @@ +namespace ProjectRepairCompany.Forms +{ + partial class FormDetail + { + /// + /// 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() + { + checkedListBoxDetailProperties = new CheckedListBox(); + label1 = new Label(); + label2 = new Label(); + textBoxNameDetail = new TextBox(); + label3 = new Label(); + label4 = new Label(); + ButtonSave = new Button(); + ButtonCancel = new Button(); + numericUpDownPrice = new NumericUpDown(); + numericUpDownNumber = new NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)numericUpDownPrice).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownNumber).BeginInit(); + SuspendLayout(); + // + // checkedListBoxDetailProperties + // + checkedListBoxDetailProperties.FormattingEnabled = true; + checkedListBoxDetailProperties.Location = new Point(146, 12); + checkedListBoxDetailProperties.Name = "checkedListBoxDetailProperties"; + checkedListBoxDetailProperties.Size = new Size(229, 144); + checkedListBoxDetailProperties.TabIndex = 0; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(30, 31); + label1.Name = "label1"; + label1.Size = new Size(110, 17); + label1.TabIndex = 1; + label1.Text = "Свойства детали:"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(30, 179); + label2.Name = "label2"; + label2.Size = new Size(68, 17); + label2.TabIndex = 2; + label2.Text = "Название:"; + // + // textBoxNameDetail + // + textBoxNameDetail.Location = new Point(123, 171); + textBoxNameDetail.Name = "textBoxNameDetail"; + textBoxNameDetail.Size = new Size(252, 25); + textBoxNameDetail.TabIndex = 3; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(12, 213); + label3.Name = "label3"; + label3.Size = new Size(143, 17); + label3.TabIndex = 4; + label3.Text = "Количество на складе:"; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(12, 258); + label4.Name = "label4"; + label4.Size = new Size(86, 17); + label4.TabIndex = 6; + label4.Text = "Цена детали:"; + // + // ButtonSave + // + ButtonSave.Location = new Point(30, 307); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(103, 44); + ButtonSave.TabIndex = 8; + ButtonSave.Text = "Сохранить"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; + // + // ButtonCancel + // + ButtonCancel.Location = new Point(172, 307); + ButtonCancel.Name = "ButtonCancel"; + ButtonCancel.Size = new Size(100, 44); + ButtonCancel.TabIndex = 9; + ButtonCancel.Text = "Отмена"; + ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; + // + // numericUpDownPrice + // + numericUpDownPrice.DecimalPlaces = 2; + numericUpDownPrice.Location = new Point(162, 256); + numericUpDownPrice.Maximum = new decimal(new int[] { 1000000, 0, 0, 0 }); + numericUpDownPrice.Name = "numericUpDownPrice"; + numericUpDownPrice.Size = new Size(169, 25); + numericUpDownPrice.TabIndex = 10; + // + // numericUpDownNumber + // + numericUpDownNumber.Location = new Point(172, 213); + numericUpDownNumber.Maximum = new decimal(new int[] { 1000, 0, 0, 0 }); + numericUpDownNumber.Name = "numericUpDownNumber"; + numericUpDownNumber.Size = new Size(169, 25); + numericUpDownNumber.TabIndex = 11; + // + // FormDetail + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(405, 450); + Controls.Add(numericUpDownNumber); + Controls.Add(numericUpDownPrice); + Controls.Add(ButtonCancel); + Controls.Add(ButtonSave); + Controls.Add(label4); + Controls.Add(label3); + Controls.Add(textBoxNameDetail); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(checkedListBoxDetailProperties); + Name = "FormDetail"; + StartPosition = FormStartPosition.CenterParent; + Text = "Деталь"; + ((System.ComponentModel.ISupportInitialize)numericUpDownPrice).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownNumber).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private CheckedListBox checkedListBoxDetailProperties; + private Label label1; + private Label label2; + private TextBox textBoxNameDetail; + private Label label3; + private Label label4; + private Button ButtonSave; + private Button ButtonCancel; + private NumericUpDown numericUpDownPrice; + private NumericUpDown numericUpDownNumber; + } +} \ No newline at end of file diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetail.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetail.cs new file mode 100644 index 0000000..f99700e --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetail.cs @@ -0,0 +1,106 @@ +using Microsoft.VisualBasic.FileIO; +using ProjectRepairCompany.Entities; +using ProjectRepairCompany.Entities.Enums; +using ProjectRepairCompany.Repositories; +using ProjectRepairCompany.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 ProjectRepairCompany.Forms +{ + public partial class FormDetail : Form + { + private readonly IDetailRepository _detailRepository; + private int? _detailId; + + public int Id + { + set + { + try + { + var detail = _detailRepository.ReadDetailById(value); + if (detail == null) + { + throw new InvalidOperationException(nameof(detail)); + } + foreach (DetailProperties elem in Enum.GetValues(typeof(DetailProperties))) + { + if ((elem & detail.DetailProperties) != 0) + { + checkedListBoxDetailProperties.SetItemChecked(checkedListBoxDetailProperties.Items.IndexOf(elem), true); + } + } + textBoxNameDetail.Text = detail.NameDetail; + numericUpDownNumber.Value = (decimal)detail.NumberDetail; + numericUpDownPrice.Value = (decimal)detail.PriceDetail; + _detailId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + + public FormDetail(IDetailRepository detailRepository) + { + InitializeComponent(); + _detailRepository = detailRepository ?? + throw new ArgumentNullException(nameof(detailRepository)); + foreach (var elem in Enum.GetValues(typeof(DetailProperties))) + { + checkedListBoxDetailProperties.Items.Add(elem); + } + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxNameDetail.Text) || + checkedListBoxDetailProperties.CheckedItems.Count == 0) + { + throw new Exception("Имеются незаполненные поля"); + } + if (_detailId.HasValue) + { + _detailRepository.UpdateDetail(CreateDetail(_detailId.Value)); + } + else + { + _detailRepository.CreateDetail(CreateDetail(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private Detail CreateDetail(int id) + { + DetailProperties detailProperties = DetailProperties.None; + foreach (var elem in checkedListBoxDetailProperties.CheckedItems) + { + detailProperties |= (DetailProperties)elem; + } + return Detail.CreateEntity(id, textBoxNameDetail.Text, + Convert.ToInt32(numericUpDownNumber.Value), Convert.ToDouble(numericUpDownPrice.Value), detailProperties); + } + + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Form1.resx b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetail.resx similarity index 93% rename from ProjectRepairCompany/ProjectRepairCompany/Form1.resx rename to ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetail.resx index 1af7de1..af32865 100644 --- a/ProjectRepairCompany/ProjectRepairCompany/Form1.resx +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetail.resx @@ -1,17 +1,17 @@  - diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetails.Designer.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetails.Designer.cs new file mode 100644 index 0000000..85f8acd --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetails.Designer.cs @@ -0,0 +1,125 @@ +namespace ProjectRepairCompany.Forms +{ + partial class FormDetails + { + /// + /// 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(); + ButtonUp = new Button(); + ButtonDel = new Button(); + ButtonAdd = new Button(); + dataGridView = new DataGridView(); + panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // panel1 + // + panel1.Controls.Add(ButtonUp); + panel1.Controls.Add(ButtonDel); + panel1.Controls.Add(ButtonAdd); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(607, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(193, 450); + panel1.TabIndex = 2; + // + // ButtonUp + // + ButtonUp.BackgroundImage = Properties.Resources.Feedbin_Icon_home_edit_svg; + ButtonUp.BackgroundImageLayout = ImageLayout.Stretch; + ButtonUp.Location = new Point(42, 113); + ButtonUp.Name = "ButtonUp"; + ButtonUp.Size = new Size(117, 77); + ButtonUp.TabIndex = 2; + ButtonUp.UseVisualStyleBackColor = true; + ButtonUp.Click += ButtonUp_Click; + // + // ButtonDel + // + ButtonDel.BackgroundImage = Properties.Resources.Ic_remove_circle_48px_svg; + ButtonDel.BackgroundImageLayout = ImageLayout.Stretch; + ButtonDel.Location = new Point(42, 213); + ButtonDel.Name = "ButtonDel"; + ButtonDel.Size = new Size(117, 83); + ButtonDel.TabIndex = 1; + ButtonDel.UseVisualStyleBackColor = true; + ButtonDel.Click += ButtonDel_Click; + // + // ButtonAdd + // + ButtonAdd.BackgroundImage = Properties.Resources._43_436254_plus_green_plus_icon_png; + ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch; + ButtonAdd.Location = new Point(42, 20); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(117, 74); + ButtonAdd.TabIndex = 0; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(607, 450); + dataGridView.TabIndex = 3; + // + // FormDetails + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panel1); + Name = "FormDetails"; + Text = "Детали"; + Load += FormDetails_Load; + panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panel1; + private Button ButtonUp; + private Button ButtonDel; + private Button ButtonAdd; + private DataGridView dataGridView; + } +} \ No newline at end of file diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetails.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetails.cs new file mode 100644 index 0000000..d2e71a7 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetails.cs @@ -0,0 +1,119 @@ +using ProjectRepairCompany.Repositories; +using ProjectRepairCompany.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 ProjectRepairCompany.Forms +{ + public partial class FormDetails : Form + { + private readonly IUnityContainer _container; + private readonly IDetailRepository _detailRepository; + + public FormDetails(IUnityContainer container, IDetailRepository detailRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _detailRepository = detailRepository ?? + throw new ArgumentNullException(nameof(detailRepository)); + } + + private void FormDetails_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 ButtonUp_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectRow(out int 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 (!TryGetIdentifierFromSelectRow(out int findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _detailRepository.DeleteDetail(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка удаления", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() + { + try + { + dataGridView.DataSource = _detailRepository.ReadDetails(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка загрузки данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private bool TryGetIdentifierFromSelectRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetails.resx b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetails.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormDetails.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/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMaster.Designer.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMaster.Designer.cs new file mode 100644 index 0000000..72cb311 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMaster.Designer.cs @@ -0,0 +1,141 @@ +namespace ProjectRepairCompany.Forms +{ + partial class FormMaster + { + /// + /// 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() + { + comboBoxPost = new ComboBox(); + ButtonSave = new Button(); + ButtonCancel = new Button(); + label1 = new Label(); + label2 = new Label(); + label3 = new Label(); + textBoxName = new TextBox(); + dateTimePicker = new DateTimePicker(); + SuspendLayout(); + // + // comboBoxPost + // + comboBoxPost.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxPost.FormattingEnabled = true; + comboBoxPost.Location = new Point(205, 84); + comboBoxPost.Name = "comboBoxPost"; + comboBoxPost.Size = new Size(121, 25); + comboBoxPost.TabIndex = 0; + // + // ButtonSave + // + ButtonSave.Location = new Point(32, 183); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(96, 45); + ButtonSave.TabIndex = 1; + ButtonSave.Text = "Сохранить"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; + // + // ButtonCancel + // + ButtonCancel.Location = new Point(178, 183); + ButtonCancel.Name = "ButtonCancel"; + ButtonCancel.Size = new Size(88, 45); + ButtonCancel.TabIndex = 2; + ButtonCancel.Text = "Отмена"; + ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(30, 43); + label1.Name = "label1"; + label1.Size = new Size(37, 17); + label1.TabIndex = 3; + label1.Text = "Имя:"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(30, 87); + label2.Name = "label2"; + label2.Size = new Size(77, 17); + label2.TabIndex = 4; + label2.Text = "Должность:"; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(30, 129); + label3.Name = "label3"; + label3.Size = new Size(134, 17); + label3.TabIndex = 5; + label3.Text = "Дата начала работы:"; + // + // textBoxName + // + textBoxName.Location = new Point(205, 35); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(121, 25); + textBoxName.TabIndex = 6; + // + // dateTimePicker + // + dateTimePicker.Location = new Point(192, 123); + dateTimePicker.Name = "dateTimePicker"; + dateTimePicker.Size = new Size(152, 25); + dateTimePicker.TabIndex = 7; + dateTimePicker.Value = new DateTime(2024, 11, 30, 5, 36, 53, 0); + // + // FormMaster + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(400, 276); + Controls.Add(dateTimePicker); + Controls.Add(textBoxName); + Controls.Add(label3); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(ButtonCancel); + Controls.Add(ButtonSave); + Controls.Add(comboBoxPost); + Name = "FormMaster"; + Text = "Работник"; + ResumeLayout(false); + PerformLayout(); + } + #endregion + + private ComboBox comboBoxPost; + private Button ButtonSave; + private Button ButtonCancel; + private Label label1; + private Label label2; + private Label label3; + private TextBox textBoxName; + private DateTimePicker dateTimePicker; + } +} \ No newline at end of file diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMaster.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMaster.cs new file mode 100644 index 0000000..8703196 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMaster.cs @@ -0,0 +1,81 @@ +using ProjectRepairCompany.Entities; +using ProjectRepairCompany.Entities.Enums; +using ProjectRepairCompany.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 ProjectRepairCompany.Forms; + +public partial class FormMaster : Form +{ + + private readonly IMasterRepository _masterRepository; + private int? _masterId; + public int Id + { + set + { + try + { + var master = _masterRepository.ReadMasterById(value); + if (master == null) + { + throw new InvalidOperationException(nameof(master)); + } + textBoxName.Text = master.MasterName; + comboBoxPost.SelectedItem = master.MasterPost; + dateTimePicker.Value = master.StartDate; + _masterId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + + public FormMaster(IMasterRepository masterRepository) + { + InitializeComponent(); + _masterRepository = masterRepository ?? + throw new ArgumentNullException(nameof(masterRepository)); + comboBoxPost.DataSource = Enum.GetValues(typeof(MasterPost)); + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxName.Text) || comboBoxPost.SelectedIndex < 1) + { + throw new Exception("Заполните все данные"); + } + if (_masterId.HasValue) + { + _masterRepository.UpdateMaster(CreateMaster(_masterId.Value)); + } + else + { + _masterRepository.CreateMaster(CreateMaster(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + private Master CreateMaster(int id) => Master.CreateEntity(id, textBoxName.Text, dateTimePicker.Value, (MasterPost)comboBoxPost.SelectedItem!); + +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMaster.resx b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMaster.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMaster.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/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMasters.Designer.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMasters.Designer.cs new file mode 100644 index 0000000..891c1c8 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMasters.Designer.cs @@ -0,0 +1,125 @@ +namespace ProjectRepairCompany.Forms +{ + partial class FormMasters + { + /// + /// 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(); + ButtonUp = new Button(); + ButtonDel = new Button(); + ButtonAdd = new Button(); + dataGridView = new DataGridView(); + panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // panel1 + // + panel1.Controls.Add(ButtonUp); + panel1.Controls.Add(ButtonDel); + panel1.Controls.Add(ButtonAdd); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(607, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(193, 450); + panel1.TabIndex = 1; + // + // ButtonUp + // + ButtonUp.BackgroundImage = Properties.Resources.Feedbin_Icon_home_edit_svg; + ButtonUp.BackgroundImageLayout = ImageLayout.Stretch; + ButtonUp.Location = new Point(42, 113); + ButtonUp.Name = "ButtonUp"; + ButtonUp.Size = new Size(117, 77); + ButtonUp.TabIndex = 2; + ButtonUp.UseVisualStyleBackColor = true; + ButtonUp.Click += ButtonUp_Click; + // + // ButtonDel + // + ButtonDel.BackgroundImage = Properties.Resources.Ic_remove_circle_48px_svg; + ButtonDel.BackgroundImageLayout = ImageLayout.Stretch; + ButtonDel.Location = new Point(42, 213); + ButtonDel.Name = "ButtonDel"; + ButtonDel.Size = new Size(117, 83); + ButtonDel.TabIndex = 1; + ButtonDel.UseVisualStyleBackColor = true; + ButtonDel.Click += ButtonDel_Click; + // + // ButtonAdd + // + ButtonAdd.BackgroundImage = Properties.Resources._43_436254_plus_green_plus_icon_png; + ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch; + ButtonAdd.Location = new Point(42, 20); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(117, 74); + ButtonAdd.TabIndex = 0; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(607, 450); + dataGridView.TabIndex = 2; + // + // FormMasters + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panel1); + Name = "FormMasters"; + Text = "Работники"; + Load += FormMasters_Load; + panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panel1; + private Button ButtonUp; + private Button ButtonDel; + private Button ButtonAdd; + private DataGridView dataGridView; + } +} \ No newline at end of file diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMasters.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMasters.cs new file mode 100644 index 0000000..8e17f49 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMasters.cs @@ -0,0 +1,118 @@ +using ProjectRepairCompany.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 ProjectRepairCompany.Forms +{ + public partial class FormMasters : Form + { + private readonly IUnityContainer _container; + private readonly IMasterRepository _masterRepository; + + public FormMasters(IUnityContainer container, IMasterRepository masterRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _masterRepository = masterRepository ?? + throw new ArgumentNullException(nameof(masterRepository)); + } + + private void FormMasters_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 ButtonUp_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectRow(out int 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 (!TryGetIdentifierFromSelectRow(out int findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _masterRepository.DeleteMaster(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка удаления", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() + { + try + { + dataGridView.DataSource = _masterRepository.ReadMasters(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка загрузки данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private bool TryGetIdentifierFromSelectRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMasters.resx b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMasters.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormMasters.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/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrder.Designer.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrder.Designer.cs new file mode 100644 index 0000000..3d1fa63 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrder.Designer.cs @@ -0,0 +1,244 @@ +namespace ProjectRepairCompany.Forms +{ + partial class FormOrder + { + /// + /// 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() + { + ButtonSave = new Button(); + ButtonCancel = new Button(); + label1 = new Label(); + label2 = new Label(); + dateTimePickerOrderDate = new DateTimePicker(); + dateTimeCompletion = new DateTimePicker(); + dateTimeIssue = new DateTimePicker(); + label3 = new Label(); + label4 = new Label(); + numericUpDownFullPrice = new NumericUpDown(); + label5 = new Label(); + comboBoxMaster = new ComboBox(); + groupBoxDetail = new GroupBox(); + dataGridView = new DataGridView(); + Detail = new DataGridViewComboBoxColumn(); + DetailCount = new DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)numericUpDownFullPrice).BeginInit(); + groupBoxDetail.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // ButtonSave + // + ButtonSave.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + ButtonSave.Location = new Point(25, 478); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(96, 42); + ButtonSave.TabIndex = 0; + ButtonSave.Text = "Сохранить"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; + // + // ButtonCancel + // + ButtonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + ButtonCancel.Location = new Point(322, 478); + ButtonCancel.Name = "ButtonCancel"; + ButtonCancel.Size = new Size(118, 42); + ButtonCancel.TabIndex = 1; + ButtonCancel.Text = "Отмена"; + ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(12, 9); + label1.Name = "label1"; + label1.Size = new Size(149, 17); + label1.TabIndex = 2; + label1.Text = "Дата получения заказа:"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(12, 63); + label2.Name = "label2"; + label2.Size = new Size(134, 17); + label2.TabIndex = 3; + label2.Text = "Дата начала работы:"; + // + // dateTimePickerOrderDate + // + dateTimePickerOrderDate.Enabled = false; + dateTimePickerOrderDate.Location = new Point(190, 12); + dateTimePickerOrderDate.Name = "dateTimePickerOrderDate"; + dateTimePickerOrderDate.Size = new Size(188, 25); + dateTimePickerOrderDate.TabIndex = 4; + // + // dateTimeCompletion + // + dateTimeCompletion.Location = new Point(190, 55); + dateTimeCompletion.Name = "dateTimeCompletion"; + dateTimeCompletion.Size = new Size(210, 25); + dateTimeCompletion.TabIndex = 5; + // + // dateTimeIssue + // + dateTimeIssue.Location = new Point(190, 101); + dateTimeIssue.Name = "dateTimeIssue"; + dateTimeIssue.Size = new Size(200, 25); + dateTimeIssue.TabIndex = 6; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(12, 107); + label3.Name = "label3"; + label3.Size = new Size(135, 17); + label3.TabIndex = 7; + label3.Text = "Дата вручения заказ:"; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(25, 147); + label4.Name = "label4"; + label4.Size = new Size(121, 17); + label4.TabIndex = 8; + label4.Text = "Полная стоимость:"; + // + // numericUpDownFullPrice + // + numericUpDownFullPrice.DecimalPlaces = 2; + numericUpDownFullPrice.Location = new Point(189, 146); + numericUpDownFullPrice.Maximum = new decimal(new int[] { 100000, 0, 0, 0 }); + numericUpDownFullPrice.Name = "numericUpDownFullPrice"; + numericUpDownFullPrice.Size = new Size(186, 25); + numericUpDownFullPrice.TabIndex = 9; + // + // label5 + // + label5.AutoSize = true; + label5.Location = new Point(81, 194); + label5.Name = "label5"; + label5.Size = new Size(66, 17); + label5.TabIndex = 10; + label5.Text = "Работник:"; + // + // comboBoxMaster + // + comboBoxMaster.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxMaster.FormattingEnabled = true; + comboBoxMaster.Location = new Point(189, 186); + comboBoxMaster.Name = "comboBoxMaster"; + comboBoxMaster.Size = new Size(182, 25); + comboBoxMaster.TabIndex = 11; + // + // groupBoxDetail + // + groupBoxDetail.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + groupBoxDetail.Controls.Add(dataGridView); + groupBoxDetail.Location = new Point(30, 234); + groupBoxDetail.Name = "groupBoxDetail"; + groupBoxDetail.RightToLeft = RightToLeft.No; + groupBoxDetail.Size = new Size(401, 224); + groupBoxDetail.TabIndex = 12; + groupBoxDetail.TabStop = false; + groupBoxDetail.Text = "Детали"; + // + // dataGridView + // + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { Detail, DetailCount }); + dataGridView.Location = new Point(3, 21); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing; + dataGridView.Size = new Size(395, 200); + dataGridView.TabIndex = 0; + // + // Detail + // + Detail.HeaderText = "Деталь"; + Detail.Name = "Detail"; + // + // DetailCount + // + DetailCount.HeaderText = "Число деталей"; + DetailCount.Name = "DetailCount"; + // + // FormOrder + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(461, 532); + Controls.Add(groupBoxDetail); + Controls.Add(comboBoxMaster); + Controls.Add(label5); + Controls.Add(numericUpDownFullPrice); + Controls.Add(label4); + Controls.Add(label3); + Controls.Add(dateTimeIssue); + Controls.Add(dateTimeCompletion); + Controls.Add(dateTimePickerOrderDate); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(ButtonCancel); + Controls.Add(ButtonSave); + Name = "FormOrder"; + StartPosition = FormStartPosition.CenterParent; + Text = "Заказ"; + ((System.ComponentModel.ISupportInitialize)numericUpDownFullPrice).EndInit(); + groupBoxDetail.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button ButtonSave; + private Button ButtonCancel; + private Label label1; + private Label label2; + private DateTimePicker dateTimePickerOrderDate; + private DateTimePicker dateTimeCompletion; + private DateTimePicker dateTimeIssue; + private Label label3; + private Label label4; + private NumericUpDown numericUpDownFullPrice; + private Label label5; + private ComboBox comboBoxMaster; + private GroupBox groupBoxDetail; + private DataGridView dataGridView; + private DataGridViewComboBoxColumn Detail; + private DataGridViewTextBoxColumn DetailCount; + } +} \ No newline at end of file diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrder.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrder.cs new file mode 100644 index 0000000..86064bb --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrder.cs @@ -0,0 +1,124 @@ +using ProjectRepairCompany.Entities; +using ProjectRepairCompany.Repositories; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ProjectRepairCompany.Forms +{ + public partial class FormOrder : Form + { + private readonly IOrderRepository _orderRepository; + private int? _orderId; + public int Id + { + set + { + try + { + var order = _orderRepository.ReadOrderById(value); + if (order == null) + { + throw new InvalidOperationException(nameof(order)); + } + + comboBoxMaster.SelectedValue = order.MasterId; + numericUpDownFullPrice.Value = (decimal)order.FullPrice; + dateTimeCompletion.Value = order.DateCompletion; + dateTimeIssue.Value = order.DateIssue; + + foreach (var detail in order.OrderDetails) + { + dataGridView.Rows.Add(detail.DetailId, detail.DetailCount); + } + + _orderId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormOrder(IOrderRepository orderRepository, IMasterRepository masterRepository, IDetailRepository detailRepository) + { + InitializeComponent(); + + _orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository)); + + + comboBoxMaster.DataSource = masterRepository.ReadMasters(); + comboBoxMaster.DisplayMember = "MasterName"; + comboBoxMaster.ValueMember = "Id"; + + Detail.DataSource = detailRepository.ReadDetails(); + Detail.DisplayMember = "NameDetail"; + Detail.ValueMember = "Id"; + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (dataGridView.RowCount < 1 || comboBoxMaster.SelectedIndex < 0) + { + throw new Exception("Имеются незаполненные поля."); + } + + var order = CreateOrder(); + if (_orderId.HasValue) + { + _orderRepository.UpdateOrder(order); + } + else + { + _orderRepository.CreateOrder(order); + } + DialogResult = DialogResult.OK; + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private List CreateListOrderDetailsFromDataGrid() + { + var list = new List(); + foreach (DataGridViewRow row in dataGridView.Rows) + { + if (row.Cells["Detail"].Value == null || + row.Cells["DetailCount"].Value == null) + { + continue; + } + list.Add(OrderDetail.CreateOperation(0, + Convert.ToInt32(row.Cells["Detail"].Value), + Convert.ToInt32(row.Cells["DetailCount"].Value))); + } + return list; + } + private Order CreateOrder() + { + var orderDetails = CreateListOrderDetailsFromDataGrid(); + + return Order.CreateOperation( + _orderId ?? 0, + Convert.ToInt32(numericUpDownFullPrice.Value), + (int)comboBoxMaster.SelectedValue, + dateTimeCompletion.Value, + dateTimeIssue.Value, + orderDetails + ); + } + + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrder.resx b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrder.resx new file mode 100644 index 0000000..3513ce1 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrder.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/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrders.Designer.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrders.Designer.cs new file mode 100644 index 0000000..ece12bb --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrders.Designer.cs @@ -0,0 +1,125 @@ +namespace ProjectRepairCompany.Forms +{ + partial class FormOrders + { + /// + /// 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(); + ButtonUp = new Button(); + ButtonDel = new Button(); + ButtonAdd = new Button(); + dataGridView = new DataGridView(); + panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // panel1 + // + panel1.Controls.Add(ButtonUp); + panel1.Controls.Add(ButtonDel); + panel1.Controls.Add(ButtonAdd); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(607, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(193, 450); + panel1.TabIndex = 2; + // + // ButtonUp + // + ButtonUp.BackgroundImage = Properties.Resources.Feedbin_Icon_home_edit_svg; + ButtonUp.BackgroundImageLayout = ImageLayout.Stretch; + ButtonUp.Location = new Point(42, 113); + ButtonUp.Name = "ButtonUp"; + ButtonUp.Size = new Size(117, 77); + ButtonUp.TabIndex = 2; + ButtonUp.UseVisualStyleBackColor = true; + ButtonUp.Click += ButtonUp_Click; + // + // ButtonDel + // + ButtonDel.BackgroundImage = Properties.Resources.Ic_remove_circle_48px_svg; + ButtonDel.BackgroundImageLayout = ImageLayout.Stretch; + ButtonDel.Location = new Point(42, 213); + ButtonDel.Name = "ButtonDel"; + ButtonDel.Size = new Size(117, 83); + ButtonDel.TabIndex = 1; + ButtonDel.UseVisualStyleBackColor = true; + ButtonDel.Click += ButtonDel_Click; + // + // ButtonAdd + // + ButtonAdd.BackgroundImage = Properties.Resources._43_436254_plus_green_plus_icon_png; + ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch; + ButtonAdd.Location = new Point(42, 20); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(117, 74); + ButtonAdd.TabIndex = 0; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(607, 450); + dataGridView.TabIndex = 3; + // + // FormOrders + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panel1); + Name = "FormOrders"; + Text = "FormOrders"; + Load += FormOrders_Load; + panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panel1; + private Button ButtonUp; + private Button ButtonDel; + private Button ButtonAdd; + private DataGridView dataGridView; + } +} \ No newline at end of file diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrders.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrders.cs new file mode 100644 index 0000000..5121f64 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrders.cs @@ -0,0 +1,112 @@ +using ProjectRepairCompany.Repositories; +using ProjectRepairCompany.Entities; +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 ProjectRepairCompany.Forms +{ + public partial class FormOrders : Form + { + private readonly IUnityContainer _container; + private readonly IOrderRepository _orderRepository; + + public FormOrders(IUnityContainer container, IOrderRepository orderRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _orderRepository = orderRepository ?? + throw new ArgumentNullException(nameof(orderRepository)); + } + + private void FormOrders_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 ButtonUp_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + form.Id = findId; + if (form.ShowDialog() == DialogResult.OK) + { + LoadList(); + dataGridView.Refresh(); + } + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка изменения", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonDel_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _orderRepository.DeleteOrder(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка удаления", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() => dataGridView.DataSource = _orderRepository.ReadOrders(); + + private bool TryGetIdentifierFromSelectRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrders.resx b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrders.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormOrders.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/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorage.Designer.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorage.Designer.cs new file mode 100644 index 0000000..a91bafe --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorage.Designer.cs @@ -0,0 +1,121 @@ +namespace ProjectRepairCompany.Forms +{ + partial class FormStorage + { + /// + /// 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() + { + label1 = new Label(); + label2 = new Label(); + textBoxAdress = new TextBox(); + ButtonSave = new Button(); + ButtonCancel = new Button(); + numericUpDownCapacity = new NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).BeginInit(); + SuspendLayout(); + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(32, 33); + label1.Name = "label1"; + label1.Size = new Size(47, 17); + label1.TabIndex = 0; + label1.Text = "Адрес:"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(32, 77); + label2.Name = "label2"; + label2.Size = new Size(111, 17); + label2.TabIndex = 1; + label2.Text = "Вместительность:"; + // + // textBoxAdress + // + textBoxAdress.Location = new Point(149, 25); + textBoxAdress.Name = "textBoxAdress"; + textBoxAdress.Size = new Size(162, 25); + textBoxAdress.TabIndex = 2; + // + // ButtonSave + // + ButtonSave.Location = new Point(32, 139); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(89, 51); + ButtonSave.TabIndex = 4; + ButtonSave.Text = "Сохранить"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; + // + // ButtonCancel + // + ButtonCancel.Location = new Point(163, 139); + ButtonCancel.Name = "ButtonCancel"; + ButtonCancel.Size = new Size(89, 51); + ButtonCancel.TabIndex = 5; + ButtonCancel.Text = "Отмена"; + ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; + // + // numericUpDownCapacity + // + numericUpDownCapacity.Location = new Point(149, 69); + numericUpDownCapacity.Maximum = new decimal(new int[] { 1000, 0, 0, 0 }); + numericUpDownCapacity.Name = "numericUpDownCapacity"; + numericUpDownCapacity.Size = new Size(162, 25); + numericUpDownCapacity.TabIndex = 6; + // + // FormStorage + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(370, 253); + Controls.Add(numericUpDownCapacity); + Controls.Add(ButtonCancel); + Controls.Add(ButtonSave); + Controls.Add(textBoxAdress); + Controls.Add(label2); + Controls.Add(label1); + Name = "FormStorage"; + StartPosition = FormStartPosition.CenterParent; + Text = "Склад"; + ((System.ComponentModel.ISupportInitialize)numericUpDownCapacity).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label label1; + private Label label2; + private TextBox textBoxAdress; + private Button ButtonSave; + private Button ButtonCancel; + private NumericUpDown numericUpDownCapacity; + } +} \ No newline at end of file diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorage.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorage.cs new file mode 100644 index 0000000..8a5cdb7 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorage.cs @@ -0,0 +1,81 @@ +using ProjectRepairCompany.Entities; +using ProjectRepairCompany.Repositories; +using ProjectRepairCompany.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 ProjectRepairCompany.Forms +{ + public partial class FormStorage : Form + { + + private readonly IStorageRepository _storageRepository; + private int? _storageId; + public int Id + { + set + { + try + { + var storage = _storageRepository.ReadStorageById(value); + if (storage == null) + { + throw new InvalidOperationException(nameof(storage)); + } + textBoxAdress.Text = storage.StorageAddress; + numericUpDownCapacity.Value = storage.Capacity; + _storageId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormStorage(IStorageRepository storageRepository) + { + InitializeComponent(); + _storageRepository = storageRepository ?? + throw new ArgumentNullException(nameof(storageRepository)); + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxAdress.Text)) + { + throw new Exception("Заполните все данные"); + } + if (_storageId.HasValue) + { + _storageRepository.UpdateStorage(CreateStorage(_storageId.Value)); + } + else + { + _storageRepository.CreateStorage(CreateStorage(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private Storage CreateStorage(int id) => Storage.CreateEntity(id, + textBoxAdress.Text, Convert.ToInt32(numericUpDownCapacity.Value)); + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorage.resx b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorage.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorage.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/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetail.Designer.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetail.Designer.cs new file mode 100644 index 0000000..3b04e42 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetail.Designer.cs @@ -0,0 +1,167 @@ +namespace ProjectRepairCompany.Forms +{ + partial class FormStorageDetail + { + /// + /// 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() + { + ButtonSave = new Button(); + ButtonCancel = new Button(); + label1 = new Label(); + label2 = new Label(); + label3 = new Label(); + numericUpDownCount = new NumericUpDown(); + dateTimePickerDate = new DateTimePicker(); + comboBoxAddress = new ComboBox(); + label4 = new Label(); + comboBoxDetail = new ComboBox(); + ((System.ComponentModel.ISupportInitialize)numericUpDownCount).BeginInit(); + SuspendLayout(); + // + // ButtonSave + // + ButtonSave.Location = new Point(44, 179); + ButtonSave.Name = "ButtonSave"; + ButtonSave.Size = new Size(86, 31); + ButtonSave.TabIndex = 0; + ButtonSave.Text = "Сохранить"; + ButtonSave.UseVisualStyleBackColor = true; + ButtonSave.Click += ButtonSave_Click; + // + // ButtonCancel + // + ButtonCancel.Location = new Point(163, 180); + ButtonCancel.Name = "ButtonCancel"; + ButtonCancel.Size = new Size(99, 28); + ButtonCancel.TabIndex = 1; + ButtonCancel.Text = "Отмена"; + ButtonCancel.UseVisualStyleBackColor = true; + ButtonCancel.Click += ButtonCancel_Click; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(30, 26); + label1.Name = "label1"; + label1.Size = new Size(50, 17); + label1.TabIndex = 2; + label1.Text = "Деталь"; + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(28, 61); + label2.Name = "label2"; + label2.Size = new Size(78, 17); + label2.TabIndex = 3; + label2.Text = "Количество"; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(44, 101); + label3.Name = "label3"; + label3.Size = new Size(36, 17); + label3.TabIndex = 4; + label3.Text = "Дата"; + // + // numericUpDownCount + // + numericUpDownCount.Location = new Point(128, 62); + numericUpDownCount.Name = "numericUpDownCount"; + numericUpDownCount.Size = new Size(154, 25); + numericUpDownCount.TabIndex = 5; + // + // dateTimePickerDate + // + dateTimePickerDate.Location = new Point(119, 104); + dateTimePickerDate.Name = "dateTimePickerDate"; + dateTimePickerDate.Size = new Size(187, 25); + dateTimePickerDate.TabIndex = 6; + // + // comboBoxAddress + // + comboBoxAddress.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxAddress.FormattingEnabled = true; + comboBoxAddress.Location = new Point(119, 148); + comboBoxAddress.Name = "comboBoxAddress"; + comboBoxAddress.Size = new Size(183, 25); + comboBoxAddress.TabIndex = 8; + // + // label4 + // + label4.AutoSize = true; + label4.Location = new Point(15, 151); + label4.Name = "label4"; + label4.Size = new Size(91, 17); + label4.TabIndex = 9; + label4.Text = "Адрес склада:"; + // + // comboBoxDetail + // + comboBoxDetail.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxDetail.FormattingEnabled = true; + comboBoxDetail.Location = new Point(119, 23); + comboBoxDetail.Name = "comboBoxDetail"; + comboBoxDetail.Size = new Size(183, 25); + comboBoxDetail.TabIndex = 10; + // + // FormStorageDetail + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(393, 283); + Controls.Add(comboBoxDetail); + Controls.Add(label4); + Controls.Add(comboBoxAddress); + Controls.Add(dateTimePickerDate); + Controls.Add(numericUpDownCount); + Controls.Add(label3); + Controls.Add(label2); + Controls.Add(label1); + Controls.Add(ButtonCancel); + Controls.Add(ButtonSave); + Name = "FormStorageDetail"; + Text = "FormStorageDetail"; + ((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button ButtonSave; + private Button ButtonCancel; + private Label label1; + private Label label2; + private Label label3; + private NumericUpDown numericUpDownCount; + private DateTimePicker dateTimePickerDate; + private ComboBox comboBoxAddress; + private Label label4; + private ComboBox comboBoxDetail; + } +} \ No newline at end of file diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetail.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetail.cs new file mode 100644 index 0000000..3cf2ab7 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetail.cs @@ -0,0 +1,47 @@ +using ProjectRepairCompany.Entities; +using ProjectRepairCompany.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 ProjectRepairCompany.Forms +{ + public partial class FormStorageDetail : Form + { + private readonly IStorageDetailRepository _storageDetailRepository; + private readonly IDetailRepository _detailRepository; + + public FormStorageDetail(IStorageDetailRepository storageDetailRepository, IDetailRepository detailRepository) + { + InitializeComponent(); + _storageDetailRepository = storageDetailRepository ?? throw new ArgumentNullException(nameof(storageDetailRepository)); + _detailRepository = detailRepository ?? throw new ArgumentNullException(nameof(detailRepository)); + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (comboBoxDetail.SelectedIndex < 0 || comboBoxAddress.SelectedIndex < 0 || Convert.ToInt32(numericUpDownCount.Value) == 0) + { + throw new Exception("Заполни все поля"); + } + _storageDetailRepository.CreateStorageDetail(StorageDetail.CreateOperation((int)comboBoxAddress.SelectedValue!, (int)comboBoxDetail.SelectedValue!, Convert.ToInt32(numericUpDownCount.Value), dateTimePickerDate.Value)); + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка сохранения данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetail.resx b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetail.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetail.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/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetails.Designer.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetails.Designer.cs new file mode 100644 index 0000000..ca5bc67 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetails.Designer.cs @@ -0,0 +1,97 @@ +namespace ProjectRepairCompany.Forms +{ + partial class FormStorageDetails + { + /// + /// 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(); + dataGridView = new DataGridView(); + panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // panel1 + // + panel1.Controls.Add(ButtonAdd); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(607, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(193, 450); + panel1.TabIndex = 3; + // + // ButtonAdd + // + ButtonAdd.BackgroundImage = Properties.Resources._43_436254_plus_green_plus_icon_png; + ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch; + ButtonAdd.Location = new Point(42, 20); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(117, 74); + ButtonAdd.TabIndex = 0; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(607, 450); + dataGridView.TabIndex = 4; + // + // FormStorageDetails + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panel1); + Name = "FormStorageDetails"; + Text = "Пополнение складов"; + Load += FormStorageDetail_Load; + panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panel1; + private Button ButtonAdd; + private DataGridView dataGridView; + } +} \ No newline at end of file diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetails.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetails.cs new file mode 100644 index 0000000..6455361 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetails.cs @@ -0,0 +1,70 @@ +using ProjectRepairCompany.Entities; +using ProjectRepairCompany.Repositories; +using System; +using System.Windows.Forms; +using Unity; + +namespace ProjectRepairCompany.Forms +{ + public partial class FormStorageDetails : Form + { + private readonly IUnityContainer _container; + private readonly IStorageDetailRepository _storageDetailRepository; + + public FormStorageDetails(IUnityContainer container, IStorageDetailRepository storageDetailRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentNullException(nameof(container)); + _storageDetailRepository = storageDetailRepository ?? throw new ArgumentNullException(nameof(storageDetailRepository)); + } + + private void FormStorageDetail_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() + { + try + { + dataGridView.DataSource = _storageDetailRepository.ReadStorageDetails(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка загрузки данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private bool TryGetIdentifierFromSelectRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["StorageId"].Value); + return true; + } + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetails.resx b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetails.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorageDetails.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/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorages.Designer.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorages.Designer.cs new file mode 100644 index 0000000..12497a2 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorages.Designer.cs @@ -0,0 +1,126 @@ +namespace ProjectRepairCompany.Forms +{ + partial class FormStorages + { + /// + /// 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(); + ButtonUp = new Button(); + ButtonDel = new Button(); + ButtonAdd = new Button(); + dataGridView = new DataGridView(); + panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // panel1 + // + panel1.Controls.Add(ButtonUp); + panel1.Controls.Add(ButtonDel); + panel1.Controls.Add(ButtonAdd); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(615, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(193, 470); + panel1.TabIndex = 0; + // + // ButtonUp + // + ButtonUp.BackgroundImage = Properties.Resources.Feedbin_Icon_home_edit_svg; + ButtonUp.BackgroundImageLayout = ImageLayout.Stretch; + ButtonUp.Location = new Point(42, 113); + ButtonUp.Name = "ButtonUp"; + ButtonUp.Size = new Size(117, 77); + ButtonUp.TabIndex = 2; + ButtonUp.UseVisualStyleBackColor = true; + ButtonUp.Click += ButtonUp_Click; + // + // ButtonDel + // + ButtonDel.BackgroundImage = Properties.Resources.Ic_remove_circle_48px_svg; + ButtonDel.BackgroundImageLayout = ImageLayout.Stretch; + ButtonDel.Location = new Point(42, 213); + ButtonDel.Name = "ButtonDel"; + ButtonDel.Size = new Size(117, 83); + ButtonDel.TabIndex = 1; + ButtonDel.UseVisualStyleBackColor = true; + ButtonDel.Click += ButtonDel_Click; + // + // ButtonAdd + // + ButtonAdd.BackgroundImage = Properties.Resources._43_436254_plus_green_plus_icon_png; + ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch; + ButtonAdd.Location = new Point(42, 20); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(117, 74); + ButtonAdd.TabIndex = 0; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(615, 470); + dataGridView.TabIndex = 1; + // + // FormStorages + // + AutoScaleDimensions = new SizeF(7F, 17F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(808, 470); + Controls.Add(dataGridView); + Controls.Add(panel1); + Name = "FormStorages"; + StartPosition = FormStartPosition.CenterParent; + Text = "Склады"; + Load += FormStorages_Load; + panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panel1; + private Button ButtonUp; + private Button ButtonDel; + private Button ButtonAdd; + private DataGridView dataGridView; + } +} \ No newline at end of file diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorages.cs b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorages.cs new file mode 100644 index 0000000..718c127 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorages.cs @@ -0,0 +1,108 @@ +using ProjectRepairCompany.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 ProjectRepairCompany.Forms +{ + public partial class FormStorages : Form + { + + private readonly IUnityContainer _container; + private readonly IStorageRepository _storageRepository; + + public FormStorages(IUnityContainer container, IStorageRepository storageRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _storageRepository = storageRepository ?? + throw new ArgumentNullException(nameof(storageRepository)); + } + + private void FormStorages_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 ButtonUp_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectRow(out int 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 (!TryGetIdentifierFromSelectRow(out int findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _storageRepository.DeleteStorage(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка удаления", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + + } + private void LoadList() => dataGridView.DataSource = _storageRepository.ReadStorages(); + private bool TryGetIdentifierFromSelectRow(out int id) + { + id = 0; + if (dataGridView.SelectedRows.Count < 1) + { + MessageBox.Show("Нет выбранной записи", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); + return true; + } + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorages.resx b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorages.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Forms/FormStorages.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/ProjectRepairCompany/ProjectRepairCompany/Program.cs b/ProjectRepairCompany/ProjectRepairCompany/Program.cs index 560beb3..3c91fc9 100644 --- a/ProjectRepairCompany/ProjectRepairCompany/Program.cs +++ b/ProjectRepairCompany/ProjectRepairCompany/Program.cs @@ -1,3 +1,7 @@ +using ProjectRepairCompany.Repositories; +using ProjectRepairCompany.Repositories.Implementations; +using Unity; + namespace ProjectRepairCompany { internal static class Program @@ -11,7 +15,18 @@ namespace ProjectRepairCompany // 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/ProjectRepairCompany/ProjectRepairCompany/ProjectRepairCompany.csproj b/ProjectRepairCompany/ProjectRepairCompany/ProjectRepairCompany.csproj index 663fdb8..accbdf0 100644 --- a/ProjectRepairCompany/ProjectRepairCompany/ProjectRepairCompany.csproj +++ b/ProjectRepairCompany/ProjectRepairCompany/ProjectRepairCompany.csproj @@ -8,4 +8,23 @@ enable + + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/ProjectRepairCompany/ProjectRepairCompany/Properties/Resources.Designer.cs b/ProjectRepairCompany/ProjectRepairCompany/Properties/Resources.Designer.cs new file mode 100644 index 0000000..ee52a66 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ProjectRepairCompany.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("ProjectRepairCompany.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 _43_436254_plus_green_plus_icon_png { + get { + object obj = ResourceManager.GetObject("43-436254_plus-green-plus-icon-png", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Feedbin_Icon_home_edit_svg { + get { + object obj = ResourceManager.GetObject("Feedbin-Icon-home-edit.svg", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Ic_remove_circle_48px_svg { + get { + object obj = ResourceManager.GetObject("Ic_remove_circle_48px.svg", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Снимок_экрана_2024_09_02_200407 { + get { + object obj = ResourceManager.GetObject("Снимок экрана 2024-09-02 200407", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Properties/Resources.resx b/ProjectRepairCompany/ProjectRepairCompany/Properties/Resources.resx new file mode 100644 index 0000000..5ca932c --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/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\Снимок экрана 2024-09-02 200407.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Ic_remove_circle_48px.svg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\43-436254_plus-green-plus-icon-png.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Feedbin-Icon-home-edit.svg.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ProjectRepairCompany/ProjectRepairCompany/Repositories/IDetailRepository.cs b/ProjectRepairCompany/ProjectRepairCompany/Repositories/IDetailRepository.cs new file mode 100644 index 0000000..35903ff --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Repositories/IDetailRepository.cs @@ -0,0 +1,18 @@ +using ProjectRepairCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Repositories; + +public interface IDetailRepository +{ + IEnumerable ReadDetails(); + Detail ReadDetailById(int id); + void CreateDetail(Detail detail); + void UpdateDetail(Detail detail); + void DeleteDetail(int id); + +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Repositories/IMasterRepository.cs b/ProjectRepairCompany/ProjectRepairCompany/Repositories/IMasterRepository.cs new file mode 100644 index 0000000..85993c4 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Repositories/IMasterRepository.cs @@ -0,0 +1,18 @@ +using ProjectRepairCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Repositories; + +public interface IMasterRepository +{ + IEnumerable ReadMasters(); + Master ReadMasterById(int id); + void CreateMaster(Master master); + void UpdateMaster(Master master); + void DeleteMaster(int id); + +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Repositories/IOrderRepository.cs b/ProjectRepairCompany/ProjectRepairCompany/Repositories/IOrderRepository.cs new file mode 100644 index 0000000..1dac1bd --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Repositories/IOrderRepository.cs @@ -0,0 +1,17 @@ +using ProjectRepairCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Repositories; + +public interface IOrderRepository +{ + IEnumerable ReadOrders(); + Order ReadOrderById(int id); + void CreateOrder(Order order); + void UpdateOrder(Order order); + void DeleteOrder(int id); +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Repositories/IStorageDetailRepository.cs b/ProjectRepairCompany/ProjectRepairCompany/Repositories/IStorageDetailRepository.cs new file mode 100644 index 0000000..e9ffd3a --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Repositories/IStorageDetailRepository.cs @@ -0,0 +1,15 @@ +using ProjectRepairCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Repositories; + +public interface IStorageDetailRepository +{ + IEnumerable ReadStorageDetails(DateTime? dateFrom = null, DateTime? dateTo = null, int? storageId = null, + int? detailId = null); + void CreateStorageDetail(StorageDetail storageDetail); +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Repositories/IStorageRepository.cs b/ProjectRepairCompany/ProjectRepairCompany/Repositories/IStorageRepository.cs new file mode 100644 index 0000000..5aadf95 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Repositories/IStorageRepository.cs @@ -0,0 +1,17 @@ +using ProjectRepairCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Repositories; + +public interface IStorageRepository +{ + IEnumerable ReadStorages(); + Storage ReadStorageById(int id); + void CreateStorage(Storage storage); + void UpdateStorage(Storage storage); + void DeleteStorage(int id); +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/DetailRepository.cs b/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/DetailRepository.cs new file mode 100644 index 0000000..847751f --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/DetailRepository.cs @@ -0,0 +1,34 @@ +using ProjectRepairCompany.Entities; +using ProjectRepairCompany.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Repositories.Implementations; + +public class DetailRepository : IDetailRepository +{ + public void CreateDetail(Detail detail) + { + } + + public void DeleteDetail(int id) + { + } + + public Detail ReadDetailById(int id) + { + return Detail.CreateEntity(0, string.Empty, 0, 0, DetailProperties.None); + } + + public IEnumerable ReadDetails() + { + return []; + } + + public void UpdateDetail(Detail detail) + { + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/MasterRepository.cs b/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/MasterRepository.cs new file mode 100644 index 0000000..acecefe --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/MasterRepository.cs @@ -0,0 +1,34 @@ +using ProjectRepairCompany.Entities; +using ProjectRepairCompany.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Repositories.Implementations; + +public class MasterRepository : IMasterRepository +{ + public void CreateMaster(Master master) + { + } + + public void DeleteMaster(int id) + { + } + + public Master ReadMasterById(int id) + { + return Master.CreateEntity(0, string.Empty, DateTime.MinValue, MasterPost.None); + } + + public IEnumerable ReadMasters() + { + return []; + } + + public void UpdateMaster(Master master) + { + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/OrderRepository.cs b/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/OrderRepository.cs new file mode 100644 index 0000000..ddb770a --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/OrderRepository.cs @@ -0,0 +1,35 @@ +using ProjectRepairCompany.Entities; +using ProjectRepairCompany.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Repositories.Implementations; + +public class OrderRepository : IOrderRepository +{ + public void CreateOrder(Order order) + { + } + + public void DeleteOrder(int id) + { + } + + public Order ReadOrderById(int id) + { + return Order.CreateOperation(0, 0, 0, DateTime.MinValue, DateTime.MinValue, Enumerable.Empty()); + } + + public IEnumerable ReadOrders() + { + return []; + } + + public void UpdateOrder(Order order) + { + } + +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/StorageDetailRepository.cs b/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/StorageDetailRepository.cs new file mode 100644 index 0000000..d1e3613 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/StorageDetailRepository.cs @@ -0,0 +1,20 @@ +using ProjectRepairCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Repositories.Implementations; + +public class StorageDetailRepository : IStorageDetailRepository +{ + public void CreateStorageDetail(StorageDetail storageDetail) + { + } + + public IEnumerable ReadStorageDetails(DateTime? dateFrom = null, DateTime? dateTo = null, int? storageId = null, int? detailId = null) + { + return []; + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/StorageRepository.cs b/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/StorageRepository.cs new file mode 100644 index 0000000..aaa4d86 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Repositories/Implementations/StorageRepository.cs @@ -0,0 +1,33 @@ +using ProjectRepairCompany.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Repositories.Implementations; + +public class StorageRepository : IStorageRepository +{ + public void CreateStorage(Storage storage) + { + } + + public void DeleteStorage(int id) + { + } + + public Storage ReadStorageById(int id) + { + return Storage.CreateEntity(0, string.Empty, 0); + } + + public IEnumerable ReadStorages() + { + return []; + } + + public void UpdateStorage(Storage storage) + { + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Resources/43-436254_plus-green-plus-icon-png.png b/ProjectRepairCompany/ProjectRepairCompany/Resources/43-436254_plus-green-plus-icon-png.png new file mode 100644 index 0000000..95bb2f3 Binary files /dev/null and b/ProjectRepairCompany/ProjectRepairCompany/Resources/43-436254_plus-green-plus-icon-png.png differ diff --git a/ProjectRepairCompany/ProjectRepairCompany/Resources/Feedbin-Icon-home-edit.svg.png b/ProjectRepairCompany/ProjectRepairCompany/Resources/Feedbin-Icon-home-edit.svg.png new file mode 100644 index 0000000..b5b138b Binary files /dev/null and b/ProjectRepairCompany/ProjectRepairCompany/Resources/Feedbin-Icon-home-edit.svg.png differ diff --git a/ProjectRepairCompany/ProjectRepairCompany/Resources/Ic_remove_circle_48px.svg.png b/ProjectRepairCompany/ProjectRepairCompany/Resources/Ic_remove_circle_48px.svg.png new file mode 100644 index 0000000..9e6b150 Binary files /dev/null and b/ProjectRepairCompany/ProjectRepairCompany/Resources/Ic_remove_circle_48px.svg.png differ diff --git a/ProjectRepairCompany/ProjectRepairCompany/Resources/Снимок экрана 2024-09-02 200407.png b/ProjectRepairCompany/ProjectRepairCompany/Resources/Снимок экрана 2024-09-02 200407.png new file mode 100644 index 0000000..b4488b8 Binary files /dev/null and b/ProjectRepairCompany/ProjectRepairCompany/Resources/Снимок экрана 2024-09-02 200407.png differ diff --git a/ИконкаМинус.png b/ИконкаМинус.png new file mode 100644 index 0000000..9e6b150 Binary files /dev/null and b/ИконкаМинус.png differ diff --git a/ИконкаПлюс.png b/ИконкаПлюс.png new file mode 100644 index 0000000..95bb2f3 Binary files /dev/null and b/ИконкаПлюс.png differ diff --git a/ИконкаРедактировать.png b/ИконкаРедактировать.png new file mode 100644 index 0000000..b5b138b Binary files /dev/null and b/ИконкаРедактировать.png differ