diff --git a/ProjectAtelier/Entities/Client.cs b/ProjectAtelier/Entities/Client.cs new file mode 100644 index 0000000..6f2da15 --- /dev/null +++ b/ProjectAtelier/Entities/Client.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Entities; + +public class Client +{ + public int Id { get; set; } + public string Name { get; private set; } = string.Empty; + public string Phone { get; private set; } = string.Empty; + public Gender Gender { get; private set; } = Gender.None; // Используем flag Gender + + public static Client CreateEntity(int id, string name, string phone, Gender gender) + { + return new Client + { + Id = id, + Name = name, + Phone = phone, + Gender = gender, + }; + } +} + diff --git a/ProjectAtelier/Entities/Material.cs b/ProjectAtelier/Entities/Material.cs new file mode 100644 index 0000000..bd12b00 --- /dev/null +++ b/ProjectAtelier/Entities/Material.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Entities; + +public class Material +{ + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + public int UseCount { get; private set; } + public int CountInWareHouse { get; private set; } + public static Material CreateEntity(int id, string name,int usecount, int countInWarehouse) + { + return new Material + { + Id = id, + Name = name, + UseCount = usecount, + CountInWareHouse = countInWarehouse + }; + } +} diff --git a/ProjectAtelier/Entities/MaterialReplenishment.cs b/ProjectAtelier/Entities/MaterialReplenishment.cs new file mode 100644 index 0000000..65fa020 --- /dev/null +++ b/ProjectAtelier/Entities/MaterialReplenishment.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Entities; +public class MaterialReplenishment +{ + public int Id { get; private set; } + + public int Count { get; private set; } + public DateTime DataTime { get; private set; } + + public int IDMaterial { get; private set; } + + public static MaterialReplenishment CreateOperation(int id, int count, DateTime dataTime, int idmaterial) + { + return new MaterialReplenishment + { + Id = id, + + Count = count, + DataTime = dataTime, + IDMaterial = idmaterial + }; + } + +} + diff --git a/ProjectAtelier/Entities/Order.cs b/ProjectAtelier/Entities/Order.cs new file mode 100644 index 0000000..3df3220 --- /dev/null +++ b/ProjectAtelier/Entities/Order.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; + +namespace ProjectAtelier.Entities; + +public class Order +{ + public int Id { get; private set; } + public DateTime DataTime { get; private set; } + public OrderStatus Status { get; private set; } + public string Characteristic { get; private set; } = string.Empty; + public IEnumerable OrderProduct { get; private set; } = []; + public int IdClient { get; private set; } + + public static Order CreateOperation(int id, OrderStatus status, string characteristic, IEnumerable orderProduct, int idClient, DateTime dateTime) + { + return new Order + { + Id = id, + DataTime = dateTime, + Status = status, + Characteristic = characteristic, + OrderProduct = orderProduct, + IdClient = idClient + }; + } +} \ No newline at end of file diff --git a/ProjectAtelier/Entities/OrderProduct.cs b/ProjectAtelier/Entities/OrderProduct.cs new file mode 100644 index 0000000..340fd82 --- /dev/null +++ b/ProjectAtelier/Entities/OrderProduct.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Entities; + + public class OrderProduct + { + public int Id { get; private set; } + public int ProductId { get; private set; } + + public int Count { get; private set; } + public static OrderProduct CreateOperation(int id, int productId, int count) + { + return new OrderProduct + { + Id = id, + ProductId = productId, + + Count = count + }; + } +} + diff --git a/ProjectAtelier/Entities/Product.cs b/ProjectAtelier/Entities/Product.cs new file mode 100644 index 0000000..2a42baa --- /dev/null +++ b/ProjectAtelier/Entities/Product.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Entities; + + public class Product + { + public int Id { get; private set; } + public string Name { get; private set; } = string.Empty; + + public ProductView View{ get; private set; } + public int CountMaterial { get; private set; } + public IEnumerable ProductMaterial { get; private set; } = []; + public static Product CreateEntity(int id, string name, ProductView view, int countmaterial, IEnumerable productMaterial) + { + return new Product + { + Id = id, + Name = name, + + View = view, + CountMaterial = countmaterial, + ProductMaterial = productMaterial + }; + } + +} + diff --git a/ProjectAtelier/Entities/ProductMaterial.cs b/ProjectAtelier/Entities/ProductMaterial.cs new file mode 100644 index 0000000..ff9ebf8 --- /dev/null +++ b/ProjectAtelier/Entities/ProductMaterial.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Entities; + + public class ProductMaterial + { + public int Id { get; private set; } + public int ProductId { get; private set; } + public int MaterialId { get; private set; } + public int Count { get; private set; } + + public static ProductMaterial CreateOperation(int id, int productId, int materialid, int count) + { + return new ProductMaterial + { + Id = id, + ProductId = productId, + MaterialId = materialid, + Count = count + }; + } +} + diff --git a/ProjectAtelier/Entities/enum/Gender.cs b/ProjectAtelier/Entities/enum/Gender.cs new file mode 100644 index 0000000..80d13ae --- /dev/null +++ b/ProjectAtelier/Entities/enum/Gender.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Entities; + [Flags] +public enum Gender + +{ + None = 0, + Male = 1, + Female = 2, + Other = 4 +} + diff --git a/ProjectAtelier/Entities/enum/OrderStatus.cs b/ProjectAtelier/Entities/enum/OrderStatus.cs new file mode 100644 index 0000000..325989d --- /dev/null +++ b/ProjectAtelier/Entities/enum/OrderStatus.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Entities; +public enum OrderStatus +{ + None = 0, + NotCompleted = 1, + Reserv = 2, + Completed = 3 +} + diff --git a/ProjectAtelier/Entities/enum/ProductView.cs b/ProjectAtelier/Entities/enum/ProductView.cs new file mode 100644 index 0000000..33c14e8 --- /dev/null +++ b/ProjectAtelier/Entities/enum/ProductView.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Entities; + +public enum ProductView +{ + None = 0, + Shirt = 1, + Trousers = 2, + Jacket = 3 +} + diff --git a/ProjectAtelier/Form1.Designer.cs b/ProjectAtelier/Form1.Designer.cs deleted file mode 100644 index 558c1ca..0000000 --- a/ProjectAtelier/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace ProjectAtelier -{ - 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/ProjectAtelier/Form1.cs b/ProjectAtelier/Form1.cs deleted file mode 100644 index e279473..0000000 --- a/ProjectAtelier/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ProjectAtelier -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/ProjectAtelier/FormAtelier.Designer.cs b/ProjectAtelier/FormAtelier.Designer.cs new file mode 100644 index 0000000..2dfbf08 --- /dev/null +++ b/ProjectAtelier/FormAtelier.Designer.cs @@ -0,0 +1,138 @@ +namespace ProjectAtelier +{ + partial class FormAtelier + { + /// + /// 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() + { + menuStrip = new MenuStrip(); + справочникиToolStripMenuItem = new ToolStripMenuItem(); + ProductsToolStripMenuItem = new ToolStripMenuItem(); + MaterialsToolStripMenuItem = new ToolStripMenuItem(); + ClientToolStripMenuItem = new ToolStripMenuItem(); + операцииToolStripMenuItem = new ToolStripMenuItem(); + MaterialConsumptionToolStripMenuItem = new ToolStripMenuItem(); + OrderToolStripMenuItem = new ToolStripMenuItem(); + отчетыToolStripMenuItem = new ToolStripMenuItem(); + menuStrip.SuspendLayout(); + SuspendLayout(); + // + // menuStrip + // + menuStrip.ImageScalingSize = new Size(20, 20); + menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Size = new Size(782, 28); + menuStrip.TabIndex = 0; + menuStrip.Text = "menuStrip"; + // + // справочникиToolStripMenuItem + // + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ProductsToolStripMenuItem, MaterialsToolStripMenuItem, ClientToolStripMenuItem }); + справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; + справочникиToolStripMenuItem.Size = new Size(117, 24); + справочникиToolStripMenuItem.Text = "Справочники"; + // + // ProductsToolStripMenuItem + // + ProductsToolStripMenuItem.Name = "ProductsToolStripMenuItem"; + ProductsToolStripMenuItem.Size = new Size(149, 26); + ProductsToolStripMenuItem.Text = "Продукт"; + ProductsToolStripMenuItem.Click += ProductsToolStripMenuItem_Click; + // + // MaterialsToolStripMenuItem + // + MaterialsToolStripMenuItem.Name = "MaterialsToolStripMenuItem"; + MaterialsToolStripMenuItem.Size = new Size(149, 26); + MaterialsToolStripMenuItem.Text = "Ткань"; + MaterialsToolStripMenuItem.Click += MaterialsToolStripMenuItem_Click; + // + // ClientToolStripMenuItem + // + ClientToolStripMenuItem.Name = "ClientToolStripMenuItem"; + ClientToolStripMenuItem.Size = new Size(149, 26); + ClientToolStripMenuItem.Text = "Клиент"; + ClientToolStripMenuItem.Click += ClientToolStripMenuItem_Click; + // + // операцииToolStripMenuItem + // + операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { MaterialConsumptionToolStripMenuItem, OrderToolStripMenuItem }); + операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; + операцииToolStripMenuItem.Size = new Size(95, 24); + операцииToolStripMenuItem.Text = "Операции"; + // + // MaterialConsumptionToolStripMenuItem + // + MaterialConsumptionToolStripMenuItem.Name = "MaterialConsumptionToolStripMenuItem"; + MaterialConsumptionToolStripMenuItem.Size = new Size(215, 26); + MaterialConsumptionToolStripMenuItem.Text = "Пополение ткани"; + MaterialConsumptionToolStripMenuItem.Click += MaterialConsumptionToolStripMenuItem_Click; + // + // OrderToolStripMenuItem + // + OrderToolStripMenuItem.Name = "OrderToolStripMenuItem"; + OrderToolStripMenuItem.Size = new Size(215, 26); + OrderToolStripMenuItem.Text = "Заказ продукта"; + OrderToolStripMenuItem.Click += OrderToolStripMenuItem_Click; + // + // отчетыToolStripMenuItem + // + отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; + отчетыToolStripMenuItem.Size = new Size(73, 24); + отчетыToolStripMenuItem.Text = "Отчеты"; + // + // FormAtelier + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + BackgroundImage = Properties.Resources.i; + BackgroundImageLayout = ImageLayout.Stretch; + ClientSize = new Size(782, 403); + Controls.Add(menuStrip); + MainMenuStrip = menuStrip; + Name = "FormAtelier"; + StartPosition = FormStartPosition.CenterParent; + Text = "Ателье"; + menuStrip.ResumeLayout(false); + menuStrip.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private MenuStrip menuStrip; + private ToolStripMenuItem справочникиToolStripMenuItem; + private ToolStripMenuItem ProductsToolStripMenuItem; + private ToolStripMenuItem MaterialsToolStripMenuItem; + private ToolStripMenuItem ClientToolStripMenuItem; + private ToolStripMenuItem операцииToolStripMenuItem; + private ToolStripMenuItem MaterialConsumptionToolStripMenuItem; + private ToolStripMenuItem OrderToolStripMenuItem; + private ToolStripMenuItem отчетыToolStripMenuItem; + } +} diff --git a/ProjectAtelier/FormAtelier.cs b/ProjectAtelier/FormAtelier.cs new file mode 100644 index 0000000..15ac99c --- /dev/null +++ b/ProjectAtelier/FormAtelier.cs @@ -0,0 +1,76 @@ + +using ProjectAtelier.Forms; +using Unity; + +namespace ProjectAtelier +{ + public partial class FormAtelier : Form + { + private readonly IUnityContainer _container; + public FormAtelier(IUnityContainer container) + { + InitializeComponent(); + _container = container ?? throw new ArgumentNullException(nameof(container)); + } + private void ProductsToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void MaterialsToolStripMenuItem_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 MaterialConsumptionToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ClientToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, " ", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + + } + +} + diff --git a/ProjectAtelier/FormAtelier.resx b/ProjectAtelier/FormAtelier.resx new file mode 100644 index 0000000..31084d5 --- /dev/null +++ b/ProjectAtelier/FormAtelier.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/ProjectAtelier/Forms/FormClient.Designer.cs b/ProjectAtelier/Forms/FormClient.Designer.cs new file mode 100644 index 0000000..85177f2 --- /dev/null +++ b/ProjectAtelier/Forms/FormClient.Designer.cs @@ -0,0 +1,140 @@ +namespace ProjectAtelier.Forms +{ + partial class FormClient + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + buttonCancel = new Button(); + buttonAdd = new Button(); + textBoxName = new TextBox(); + labelName = new Label(); + labelGender = new Label(); + textBoxPhone = new TextBox(); + labelPhone = new Label(); + checkedListBoxGender = new CheckedListBox(); + SuspendLayout(); + // + // buttonCancel + // + buttonCancel.Location = new Point(267, 388); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(103, 59); + buttonCancel.TabIndex = 14; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // buttonAdd + // + buttonAdd.Location = new Point(75, 388); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(96, 59); + buttonAdd.TabIndex = 13; + buttonAdd.Text = "Сохранить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // textBoxName + // + textBoxName.Location = new Point(213, 78); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(174, 27); + textBoxName.TabIndex = 11; + // + // labelName + // + labelName.AutoSize = true; + labelName.Location = new Point(55, 85); + labelName.Name = "labelName"; + labelName.Size = new Size(43, 20); + labelName.TabIndex = 9; + labelName.Text = "Имя "; + // + // labelGender + // + labelGender.AutoSize = true; + labelGender.Location = new Point(55, 180); + labelGender.Name = "labelGender"; + labelGender.Size = new Size(58, 20); + labelGender.TabIndex = 15; + labelGender.Text = "Гендер"; + // + // textBoxPhone + // + textBoxPhone.Location = new Point(213, 118); + textBoxPhone.Name = "textBoxPhone"; + textBoxPhone.Size = new Size(174, 27); + textBoxPhone.TabIndex = 18; + // + // labelPhone + // + labelPhone.AutoSize = true; + labelPhone.Location = new Point(55, 125); + labelPhone.Name = "labelPhone"; + labelPhone.Size = new Size(69, 20); + labelPhone.TabIndex = 17; + labelPhone.Text = "Телефон"; + // + // checkedListBoxGender + // + checkedListBoxGender.FormattingEnabled = true; + checkedListBoxGender.Location = new Point(213, 168); + checkedListBoxGender.Name = "checkedListBoxGender"; + checkedListBoxGender.Size = new Size(174, 114); + checkedListBoxGender.TabIndex = 19; + // + // FormClient + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(502, 528); + Controls.Add(checkedListBoxGender); + Controls.Add(textBoxPhone); + Controls.Add(labelPhone); + Controls.Add(labelGender); + Controls.Add(buttonCancel); + Controls.Add(buttonAdd); + Controls.Add(textBoxName); + Controls.Add(labelName); + Name = "FormClient"; + Text = "Клиент"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button buttonCancel; + private Button buttonAdd; + private TextBox textBoxName; + private Label labelName; + private Label labelGender; + private TextBox textBoxPhone; + private Label labelPhone; + private CheckedListBox checkedListBoxGender; + } +} \ No newline at end of file diff --git a/ProjectAtelier/Forms/FormClient.cs b/ProjectAtelier/Forms/FormClient.cs new file mode 100644 index 0000000..8be7ddb --- /dev/null +++ b/ProjectAtelier/Forms/FormClient.cs @@ -0,0 +1,104 @@ +using ProjectAtelier.Entities; +using ProjectAtelier.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 ProjectAtelier.Forms +{ + public partial class FormClient : Form + { + private readonly IClientRepository _clientRepository; + private int? _clientId; + + public int Id + { + set + { + try + { + var client = _clientRepository.ReadClientById(value); + if (client == null) + { + throw new InvalidDataException(nameof(client)); + } + textBoxName.Text = client.Name; + textBoxPhone.Text = client.Phone; + SetCheckedListBoxGender(client.Gender); // Устанавливаем выбранные элементы + _clientId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormClient(IClientRepository clientRepository) + { + InitializeComponent(); + _clientRepository = clientRepository ?? throw new ArgumentNullException(nameof(clientRepository)); + + // Инициализация CheckedListBox с элементами перечисления Gender + checkedListBoxGender.Items.AddRange(Enum.GetValues(typeof(Gender)).Cast().ToArray()); + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxName.Text) || string.IsNullOrWhiteSpace(textBoxPhone.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + + if (_clientId.HasValue) + { + _clientRepository.UpdateClient(CreateClient(_clientId.Value)); + } + else + { + _clientRepository.CreateClient(CreateClient(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private Client CreateClient(int id) + { + // Получаем выбранные значения из CheckedListBox + Gender gender = Gender.None; + foreach (var item in checkedListBoxGender.CheckedItems) + { + gender |= (Gender)item; + } + + return Client.CreateEntity(id, textBoxName.Text, textBoxPhone.Text, gender); + } + + private void SetCheckedListBoxGender(Gender gender) + { + checkedListBoxGender.ClearSelected(); + foreach (var item in checkedListBoxGender.Items) + { + if (gender.HasFlag((Gender)item)) + { + checkedListBoxGender.SetItemChecked(checkedListBoxGender.Items.IndexOf(item), true); + } + } + } + } +} \ No newline at end of file diff --git a/ProjectAtelier/Form1.resx b/ProjectAtelier/Forms/FormClient.resx similarity index 92% rename from ProjectAtelier/Form1.resx rename to ProjectAtelier/Forms/FormClient.resx index 1af7de1..8b2ff64 100644 --- a/ProjectAtelier/Form1.resx +++ b/ProjectAtelier/Forms/FormClient.resx @@ -1,17 +1,17 @@  - diff --git a/ProjectAtelier/Forms/FormClientS.Designer.cs b/ProjectAtelier/Forms/FormClientS.Designer.cs new file mode 100644 index 0000000..8d3ae18 --- /dev/null +++ b/ProjectAtelier/Forms/FormClientS.Designer.cs @@ -0,0 +1,127 @@ +namespace ProjectAtelier.Forms +{ + partial class FormClientS + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + dataGridView = new DataGridView(); + panel = new Panel(); + buttonUpdate = new Button(); + buttonRemove = new Button(); + buttonAdd = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panel.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Left; + dataGridView.Location = new Point(0, 0); + dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(558, 450); + dataGridView.TabIndex = 3; + // + // panel + // + panel.Anchor = AnchorStyles.Right; + panel.Controls.Add(buttonUpdate); + panel.Controls.Add(buttonRemove); + panel.Controls.Add(buttonAdd); + panel.Location = new Point(556, 1); + panel.Name = "panel"; + panel.Size = new Size(205, 448); + panel.TabIndex = 2; + // + // buttonUpdate + // + buttonUpdate.BackgroundImage = Properties.Resources.pencil1; + buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch; + buttonUpdate.Location = new Point(37, 326); + buttonUpdate.Name = "buttonUpdate"; + buttonUpdate.Size = new Size(94, 92); + buttonUpdate.TabIndex = 2; + buttonUpdate.UseVisualStyleBackColor = true; + buttonUpdate.Click += ButtonUpdate_Click; + // + // buttonRemove + // + buttonRemove.BackgroundImage = Properties.Resources._; + buttonRemove.BackgroundImageLayout = ImageLayout.Stretch; + buttonRemove.Location = new Point(37, 163); + buttonRemove.Name = "buttonRemove"; + buttonRemove.Size = new Size(94, 92); + buttonRemove.TabIndex = 1; + buttonRemove.UseVisualStyleBackColor = true; + buttonRemove.Click += ButtonRemove_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources._77_; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(37, 28); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(94, 92); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // FormClientS + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(761, 450); + Controls.Add(dataGridView); + Controls.Add(panel); + Name = "FormClientS"; + Text = "Клиенты"; + Load += FormClientS_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panel.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panel; + private Button buttonUpdate; + private Button buttonRemove; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/ProjectAtelier/Forms/FormClientS.cs b/ProjectAtelier/Forms/FormClientS.cs new file mode 100644 index 0000000..59a58f0 --- /dev/null +++ b/ProjectAtelier/Forms/FormClientS.cs @@ -0,0 +1,94 @@ +using ProjectAtelier.Repositories; +using Unity; + +namespace ProjectAtelier.Forms +{ + public partial class FormClientS : Form + { + private readonly IUnityContainer _container; + private readonly IClientRepository _clientRepository; + + public FormClientS(IUnityContainer container, IClientRepository clientRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentNullException(nameof(container)); + _clientRepository = clientRepository ?? throw new ArgumentNullException(nameof(clientRepository)); + } + private void FormClientS_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonRemove_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _clientRepository.DeleteClient(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonUpdate_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void LoadList() => dataGridView.DataSource = _clientRepository.ReadClient(); + private bool TryGetIdentifierFromSelectedRow(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/ProjectAtelier/Forms/FormClientS.resx b/ProjectAtelier/Forms/FormClientS.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectAtelier/Forms/FormClientS.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectAtelier/Forms/FormMaterial.Designer.cs b/ProjectAtelier/Forms/FormMaterial.Designer.cs new file mode 100644 index 0000000..1a98375 --- /dev/null +++ b/ProjectAtelier/Forms/FormMaterial.Designer.cs @@ -0,0 +1,156 @@ +namespace ProjectAtelier.Forms +{ + partial class FormMaterial + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + labelName = new Label(); + labelCountUse = new Label(); + label3 = new Label(); + textBoxName = new TextBox(); + numericUpDownUseCount = new NumericUpDown(); + buttonAdd = new Button(); + buttonCancel = new Button(); + labelCountInWareHouse = new Label(); + numericUpDownCountInWareHouse = new NumericUpDown(); + ((System.ComponentModel.ISupportInitialize)numericUpDownUseCount).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownCountInWareHouse).BeginInit(); + SuspendLayout(); + // + // labelName + // + labelName.AutoSize = true; + labelName.Location = new Point(12, 52); + labelName.Name = "labelName"; + labelName.Size = new Size(156, 20); + labelName.TabIndex = 0; + labelName.Text = "Название материала"; + // + // labelCountUse + // + labelCountUse.AutoSize = true; + labelCountUse.Location = new Point(12, 95); + labelCountUse.Name = "labelCountUse"; + labelCountUse.Size = new Size(230, 20); + labelCountUse.TabIndex = 1; + labelCountUse.Text = "Количество для использования"; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(33, 173); + label3.Name = "label3"; + label3.Size = new Size(0, 20); + label3.TabIndex = 2; + // + // textBoxName + // + textBoxName.Location = new Point(269, 45); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(174, 27); + textBoxName.TabIndex = 3; + // + // numericUpDownUseCount + // + numericUpDownUseCount.Location = new Point(269, 93); + numericUpDownUseCount.Name = "numericUpDownUseCount"; + numericUpDownUseCount.Size = new Size(175, 27); + numericUpDownUseCount.TabIndex = 4; + numericUpDownUseCount.Value = new decimal(new int[] { 1, 0, 0, 0 }); + // + // buttonAdd + // + buttonAdd.Location = new Point(72, 230); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(96, 59); + buttonAdd.TabIndex = 5; + buttonAdd.Text = "Сохранить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(269, 230); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(103, 59); + buttonCancel.TabIndex = 6; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // labelCountInWareHouse + // + labelCountInWareHouse.AutoSize = true; + labelCountInWareHouse.Location = new Point(12, 143); + labelCountInWareHouse.Name = "labelCountInWareHouse"; + labelCountInWareHouse.Size = new Size(161, 20); + labelCountInWareHouse.TabIndex = 7; + labelCountInWareHouse.Text = "Количество на складе"; + // + // numericUpDownCountInWareHouse + // + numericUpDownCountInWareHouse.Location = new Point(268, 143); + numericUpDownCountInWareHouse.Name = "numericUpDownCountInWareHouse"; + numericUpDownCountInWareHouse.Size = new Size(175, 27); + numericUpDownCountInWareHouse.TabIndex = 8; + // + // FormMaterial + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(489, 331); + Controls.Add(numericUpDownCountInWareHouse); + Controls.Add(labelCountInWareHouse); + Controls.Add(buttonCancel); + Controls.Add(buttonAdd); + Controls.Add(numericUpDownUseCount); + Controls.Add(textBoxName); + Controls.Add(label3); + Controls.Add(labelCountUse); + Controls.Add(labelName); + Name = "FormMaterial"; + StartPosition = FormStartPosition.CenterParent; + Text = "Ткань"; + ((System.ComponentModel.ISupportInitialize)numericUpDownUseCount).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownCountInWareHouse).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelName; + private Label labelCountUse; + private Label label3; + private TextBox textBoxName; + private NumericUpDown numericUpDownUseCount; + private Button buttonAdd; + private Button buttonCancel; + private Label labelCountInWareHouse; + private NumericUpDown numericUpDownCountInWareHouse; + } +} \ No newline at end of file diff --git a/ProjectAtelier/Forms/FormMaterial.cs b/ProjectAtelier/Forms/FormMaterial.cs new file mode 100644 index 0000000..e3a8764 --- /dev/null +++ b/ProjectAtelier/Forms/FormMaterial.cs @@ -0,0 +1,80 @@ +using ProjectAtelier.Entities; +using ProjectAtelier.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 ProjectAtelier.Forms +{ + public partial class FormMaterial : Form + { + private readonly IMaterialRepository _materialRepository; + private int? _materialId; + public int Id + { + set + { + try + { + var material = _materialRepository.ReadMaterialById(value); + if (material == null) + { + throw new InvalidDataException(nameof(material)); + } + textBoxName.Text = material.Name; + numericUpDownUseCount.Value = material.UseCount; + numericUpDownCountInWareHouse.Value = material.CountInWareHouse; + _materialId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + public FormMaterial(IMaterialRepository materialRepository) + { + InitializeComponent(); + _materialRepository = materialRepository ?? throw new ArgumentNullException(nameof(materialRepository)); + } + private void ButtonAdd_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrWhiteSpace(textBoxName.Text)) + { + throw new Exception("Имеются незаполненные поля"); + } + if (numericUpDownCountInWareHouse.Value < numericUpDownUseCount.Value) + { + throw new Exception("Нельзя использовать больше чем храниться на складе"); + } + if (_materialId.HasValue) + { + _materialRepository.UpdateMaterial(CreateMaterial(_materialId.Value)); + } + else + { + _materialRepository.CreateMaterial(CreateMaterial(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + private Material CreateMaterial(int id) => Material.CreateEntity(id, textBoxName.Text, Convert.ToInt32(numericUpDownUseCount.Value), Convert.ToInt32(numericUpDownCountInWareHouse.Value)); + + + } +} + diff --git a/ProjectAtelier/Forms/FormMaterial.resx b/ProjectAtelier/Forms/FormMaterial.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectAtelier/Forms/FormMaterial.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/ProjectAtelier/Forms/FormMaterialReplenishment.Designer.cs b/ProjectAtelier/Forms/FormMaterialReplenishment.Designer.cs new file mode 100644 index 0000000..d37af7c --- /dev/null +++ b/ProjectAtelier/Forms/FormMaterialReplenishment.Designer.cs @@ -0,0 +1,148 @@ +namespace ProjectAtelier.Forms +{ + partial class FormMaterialReplenishment + { + /// + /// 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() + { + label2 = new Label(); + numericUpDownCount = new NumericUpDown(); + buttonAdd = new Button(); + buttonCancel = new Button(); + comboBoxMaterial = new ComboBox(); + label1 = new Label(); + dateTimePicker = new DateTimePicker(); + label3 = new Label(); + ((System.ComponentModel.ISupportInitialize)numericUpDownCount).BeginInit(); + SuspendLayout(); + // + // label2 + // + label2.AutoSize = true; + label2.Location = new Point(77, 130); + label2.Name = "label2"; + label2.Size = new Size(90, 20); + label2.TabIndex = 1; + label2.Text = "Количество"; + // + // numericUpDownCount + // + numericUpDownCount.Location = new Point(212, 123); + numericUpDownCount.Name = "numericUpDownCount"; + numericUpDownCount.Size = new Size(150, 27); + numericUpDownCount.TabIndex = 3; + // + // buttonAdd + // + buttonAdd.Location = new Point(77, 197); + buttonAdd.Margin = new Padding(3, 4, 3, 4); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(107, 53); + buttonAdd.TabIndex = 4; + buttonAdd.Text = "Сохранить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click_1; + // + // buttonCancel + // + buttonCancel.Location = new Point(231, 197); + buttonCancel.Margin = new Padding(3, 4, 3, 4); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(117, 53); + buttonCancel.TabIndex = 5; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click_1; + // + // comboBoxMaterial + // + comboBoxMaterial.FormattingEnabled = true; + comboBoxMaterial.Location = new Point(210, 76); + comboBoxMaterial.Name = "comboBoxMaterial"; + comboBoxMaterial.Size = new Size(151, 28); + comboBoxMaterial.TabIndex = 6; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(77, 76); + label1.Name = "label1"; + label1.Size = new Size(103, 20); + label1.TabIndex = 7; + label1.Text = "ID материала"; + // + // dateTimePicker + // + dateTimePicker.Location = new Point(210, 26); + dateTimePicker.Name = "dateTimePicker"; + dateTimePicker.Size = new Size(152, 27); + dateTimePicker.TabIndex = 8; + // + // label3 + // + label3.AutoSize = true; + label3.Location = new Point(77, 33); + label3.Name = "label3"; + label3.Size = new Size(41, 20); + label3.TabIndex = 9; + label3.Text = "Дата"; + // + // FormMaterialReplenishment + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(411, 273); + Controls.Add(label3); + Controls.Add(dateTimePicker); + Controls.Add(label1); + Controls.Add(comboBoxMaterial); + Controls.Add(buttonCancel); + Controls.Add(buttonAdd); + Controls.Add(numericUpDownCount); + Controls.Add(label2); + Name = "FormMaterialReplenishment"; + Text = "Пополнение ткани"; + ((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + throw new NotImplementedException(); + } + +#endregion + private Label label2; + private NumericUpDown numericUpDownCount; + private Button buttonAdd; + private Button buttonCancel; + private ComboBox comboBoxMaterial; + private Label label1; + private DateTimePicker dateTimePicker; + private Label label3; + } +} \ No newline at end of file diff --git a/ProjectAtelier/Forms/FormMaterialReplenishment.cs b/ProjectAtelier/Forms/FormMaterialReplenishment.cs new file mode 100644 index 0000000..c242774 --- /dev/null +++ b/ProjectAtelier/Forms/FormMaterialReplenishment.cs @@ -0,0 +1,93 @@ +using ProjectAtelier.Entities; +using ProjectAtelier.Repositories; +using ProjectAtelier.REPOSITORY; +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 ProjectAtelier.Forms +{ + public partial class FormMaterialReplenishment : Form + { + private readonly IMaterialReplenishmentRepository _materialReplenishmentRepository; + private readonly IMaterialRepository _materialRepository; // Добавляем репозиторий для материалов + private int? _materialReplenishmentId; + + public int Id + { + set + { + try + { + var materialReplenishment = _materialReplenishmentRepository.ReadMaterialSpentById(value); + if (materialReplenishment == null) + { + throw new InvalidDataException(nameof(materialReplenishment)); + } + + numericUpDownCount.Value = materialReplenishment.Count; + comboBoxMaterial.SelectedValue = materialReplenishment.IDMaterial; // Устанавливаем выбранный материал + dateTimePicker.Value = materialReplenishment.DataTime; // Устанавливаем выбранную дату и время + _materialReplenishmentId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormMaterialReplenishment(IMaterialReplenishmentRepository materialReplenishmentRepository, IMaterialRepository materialRepository) + { + InitializeComponent(); + _materialReplenishmentRepository = materialReplenishmentRepository ?? throw new ArgumentNullException(nameof(materialReplenishmentRepository)); + _materialRepository = materialRepository ?? throw new ArgumentNullException(nameof(materialRepository)); + + // Заполняем ComboBox для выбора материала + comboBoxMaterial.DataSource = _materialRepository.ReadMaterials(); + comboBoxMaterial.DisplayMember = "Name"; + comboBoxMaterial.ValueMember = "Id"; + } + + private MaterialReplenishment CreateMaterialReplenishment(int id) + { + int selectedMaterialId = (int)comboBoxMaterial.SelectedValue; + DateTime selectedDateTime = dateTimePicker.Value; + return MaterialReplenishment.CreateOperation(id, Convert.ToInt32(numericUpDownCount.Value), selectedDateTime, selectedMaterialId); + } + + private void ButtonAdd_Click_1(object sender, EventArgs e) + { + try + { + if (comboBoxMaterial.SelectedIndex < 0) + { + throw new Exception("Имеются незаполненные поля"); + } + + if (_materialReplenishmentId.HasValue) + { + _materialReplenishmentRepository.UpdateMaterialSpent(CreateMaterialReplenishment(_materialReplenishmentId.Value)); + } + else + { + _materialReplenishmentRepository.CreateMaterialSpent(CreateMaterialReplenishment(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click_1(object sender, EventArgs e) => Close(); + } +} \ No newline at end of file diff --git a/ProjectAtelier/Forms/FormMaterialReplenishment.resx b/ProjectAtelier/Forms/FormMaterialReplenishment.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectAtelier/Forms/FormMaterialReplenishment.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/ProjectAtelier/Forms/FormMaterialS.Designer.cs b/ProjectAtelier/Forms/FormMaterialS.Designer.cs new file mode 100644 index 0000000..b5726a0 --- /dev/null +++ b/ProjectAtelier/Forms/FormMaterialS.Designer.cs @@ -0,0 +1,127 @@ +namespace ProjectAtelier.Forms +{ + partial class FormMaterialS + { + /// + /// 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() + { + panel = new Panel(); + buttonUpdate = new Button(); + buttonRemove = new Button(); + buttonAdd = new Button(); + dataGridView = new DataGridView(); + panel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // panel + // + panel.Anchor = AnchorStyles.Right; + panel.Controls.Add(buttonUpdate); + panel.Controls.Add(buttonRemove); + panel.Controls.Add(buttonAdd); + panel.Location = new Point(555, 1); + panel.Name = "panel"; + panel.Size = new Size(154, 448); + panel.TabIndex = 0; + // + // buttonUpdate + // + buttonUpdate.BackgroundImage = Properties.Resources.pencil1; + buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch; + buttonUpdate.Location = new Point(37, 326); + buttonUpdate.Name = "buttonUpdate"; + buttonUpdate.Size = new Size(94, 92); + buttonUpdate.TabIndex = 2; + buttonUpdate.UseVisualStyleBackColor = true; + buttonUpdate.Click += ButtonUpdate_Click; + // + // buttonRemove + // + buttonRemove.BackgroundImage = Properties.Resources._; + buttonRemove.BackgroundImageLayout = ImageLayout.Stretch; + buttonRemove.Location = new Point(37, 163); + buttonRemove.Name = "buttonRemove"; + buttonRemove.Size = new Size(94, 92); + buttonRemove.TabIndex = 1; + buttonRemove.UseVisualStyleBackColor = true; + buttonRemove.Click += ButtonRemove_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources._77_; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(37, 28); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(94, 92); + 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.Left; + dataGridView.Location = new Point(0, 0); + dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(558, 450); + dataGridView.TabIndex = 1; + // + // FormMaterialS + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(707, 450); + Controls.Add(dataGridView); + Controls.Add(panel); + Name = "FormMaterialS"; + Text = "Ткани"; + Load += FormMaterialS_Load; + panel.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panel; + private DataGridView dataGridView; + private Button buttonAdd; + private Button buttonUpdate; + private Button buttonRemove; + } +} \ No newline at end of file diff --git a/ProjectAtelier/Forms/FormMaterialS.cs b/ProjectAtelier/Forms/FormMaterialS.cs new file mode 100644 index 0000000..f7a8ecb --- /dev/null +++ b/ProjectAtelier/Forms/FormMaterialS.cs @@ -0,0 +1,104 @@ +using ProjectAtelier.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 ProjectAtelier.Forms +{ + public partial class FormMaterialS : Form + { + private readonly IUnityContainer _container; + private readonly IMaterialRepository _materialRepository; + + public FormMaterialS(IUnityContainer container, IMaterialRepository materiallRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentNullException(nameof(container)); + _materialRepository = materiallRepository ?? throw new ArgumentNullException(nameof(materiallRepository)); + } + private void FormMaterialS_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 ButtonRemove_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _materialRepository.DeleteMaterial(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void ButtonUpdate_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void LoadList() => dataGridView.DataSource = _materialRepository.ReadMaterials(); + private bool TryGetIdentifierFromSelectedRow(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/ProjectAtelier/Forms/FormMaterialS.resx b/ProjectAtelier/Forms/FormMaterialS.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectAtelier/Forms/FormMaterialS.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/ProjectAtelier/Forms/FormMaterialSReplenishmentS.Designer.cs b/ProjectAtelier/Forms/FormMaterialSReplenishmentS.Designer.cs new file mode 100644 index 0000000..8f0b828 --- /dev/null +++ b/ProjectAtelier/Forms/FormMaterialSReplenishmentS.Designer.cs @@ -0,0 +1,113 @@ +namespace ProjectAtelier.Forms +{ + partial class FormMaterialSReplenishmentS + { + /// + /// 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() + { + dataGridView = new DataGridView(); + panel = new Panel(); + buttonUpdate = new Button(); + buttonAdd = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panel.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Left; + dataGridView.Location = new Point(0, 0); + dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(605, 450); + dataGridView.TabIndex = 2; + // + // panel + // + panel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right; + panel.Controls.Add(buttonUpdate); + panel.Controls.Add(buttonAdd); + panel.Location = new Point(603, 0); + panel.Name = "panel"; + panel.Size = new Size(195, 450); + panel.TabIndex = 3; + // + // buttonUpdate + // + buttonUpdate.BackgroundImage = Properties.Resources.pencil1; + buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch; + buttonUpdate.Location = new Point(52, 244); + buttonUpdate.Name = "buttonUpdate"; + buttonUpdate.Size = new Size(94, 104); + buttonUpdate.TabIndex = 1; + buttonUpdate.UseVisualStyleBackColor = true; + buttonUpdate.Click += buttonUpdate_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources._77_; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(52, 67); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(94, 101); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; + // + // FormMaterialSReplenishmentS + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(panel); + Controls.Add(dataGridView); + Name = "FormMaterialSReplenishmentS"; + Text = "Пополнение ткани"; + Load += FormMaterialSReplenishmentS_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panel.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panel; + private Button buttonUpdate; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/ProjectAtelier/Forms/FormMaterialSReplenishmentS.cs b/ProjectAtelier/Forms/FormMaterialSReplenishmentS.cs new file mode 100644 index 0000000..a0e8034 --- /dev/null +++ b/ProjectAtelier/Forms/FormMaterialSReplenishmentS.cs @@ -0,0 +1,83 @@ +using ProjectAtelier.REPOSITORY; +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 ProjectAtelier.Forms +{ + public partial class FormMaterialSReplenishmentS : Form + { + private readonly IUnityContainer _container; + private readonly IMaterialReplenishmentRepository _materialSpentRepository; + public FormMaterialSReplenishmentS(IUnityContainer container, IMaterialReplenishmentRepository materialSpentRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentNullException(nameof(container)); + _materialSpentRepository = materialSpentRepository ?? throw new ArgumentNullException(nameof(materialSpentRepository)); + } + private void FormMaterialSReplenishmentS_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 buttonUpdate_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void LoadList() => dataGridView.DataSource = _materialSpentRepository.ReadMaterialsSpent(); + private bool TryGetIdentifierFromSelectedRow(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/ProjectAtelier/Forms/FormMaterialSReplenishmentS.resx b/ProjectAtelier/Forms/FormMaterialSReplenishmentS.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectAtelier/Forms/FormMaterialSReplenishmentS.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/ProjectAtelier/Forms/FormOrderS.Designer.cs b/ProjectAtelier/Forms/FormOrderS.Designer.cs new file mode 100644 index 0000000..6a8e8d7 --- /dev/null +++ b/ProjectAtelier/Forms/FormOrderS.Designer.cs @@ -0,0 +1,113 @@ +namespace ProjectAtelier.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() + { + dataGridView = new DataGridView(); + panel = new Panel(); + ButtonRemove = new Button(); + ButtonAdd = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panel.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Left; + dataGridView.Location = new Point(0, 0); + dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(706, 511); + dataGridView.TabIndex = 2; + // + // panel + // + panel.Anchor = AnchorStyles.Right; + panel.Controls.Add(ButtonRemove); + panel.Controls.Add(ButtonAdd); + panel.Location = new Point(712, 0); + panel.Name = "panel"; + panel.Size = new Size(186, 511); + panel.TabIndex = 4; + // + // ButtonRemove + // + ButtonRemove.BackgroundImage = Properties.Resources._; + ButtonRemove.BackgroundImageLayout = ImageLayout.Stretch; + ButtonRemove.Location = new Point(37, 245); + ButtonRemove.Name = "ButtonRemove"; + ButtonRemove.Size = new Size(94, 92); + ButtonRemove.TabIndex = 1; + ButtonRemove.UseVisualStyleBackColor = true; + ButtonRemove.Click += ButtonRemove_Click; + // + // ButtonAdd + // + ButtonAdd.BackgroundImage = Properties.Resources._77_; + ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch; + ButtonAdd.Location = new Point(37, 84); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(94, 92); + ButtonAdd.TabIndex = 0; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; + // + // FormOrderS + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(901, 511); + Controls.Add(panel); + Controls.Add(dataGridView); + Name = "FormOrderS"; + Text = "Заказы"; + Load += FormOrderS_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panel.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panel; + private Button ButtonRemove; + private Button ButtonAdd; + } +} \ No newline at end of file diff --git a/ProjectAtelier/Forms/FormOrderS.cs b/ProjectAtelier/Forms/FormOrderS.cs new file mode 100644 index 0000000..28e88d6 --- /dev/null +++ b/ProjectAtelier/Forms/FormOrderS.cs @@ -0,0 +1,75 @@ +using ProjectAtelier.Repositories; + +using Unity; + +namespace ProjectAtelier.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 ButtonRemove_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(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 TryGetIdentifierFromSelectedRow(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/ProjectAtelier/Forms/FormOrderS.resx b/ProjectAtelier/Forms/FormOrderS.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectAtelier/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/ProjectAtelier/Forms/FormProductMaterial.Designer.cs b/ProjectAtelier/Forms/FormProductMaterial.Designer.cs new file mode 100644 index 0000000..3a05021 --- /dev/null +++ b/ProjectAtelier/Forms/FormProductMaterial.Designer.cs @@ -0,0 +1,204 @@ +namespace ProjectAtelier.Forms +{ + partial class FormProductMaterial + { + /// + /// 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() + { + groupBox = new GroupBox(); + dataGridView = new DataGridView(); + ColumnMaterials = new DataGridViewComboBoxColumn(); + ColumnCount = new DataGridViewTextBoxColumn(); + buttonAdd = new Button(); + buttonCancel = new Button(); + labelName = new Label(); + labelType = new Label(); + labelCountInWarehouse = new Label(); + textBoxName = new TextBox(); + comboBoxProduct = new ComboBox(); + numericUpDownCount = new NumericUpDown(); + groupBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownCount).BeginInit(); + SuspendLayout(); + // + // groupBox + // + groupBox.Controls.Add(dataGridView); + groupBox.Location = new Point(14, 228); + groupBox.Margin = new Padding(3, 4, 3, 4); + groupBox.Name = "groupBox"; + groupBox.Padding = new Padding(3, 4, 3, 4); + groupBox.Size = new Size(648, 356); + groupBox.TabIndex = 0; + groupBox.TabStop = false; + // + // dataGridView + // + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnMaterials, ColumnCount }); + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(3, 24); + dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(642, 328); + dataGridView.TabIndex = 0; + // + // ColumnMaterials + // + ColumnMaterials.HeaderText = "Materials"; + ColumnMaterials.MinimumWidth = 6; + ColumnMaterials.Name = "ColumnMaterials"; + ColumnMaterials.Resizable = DataGridViewTriState.True; + ColumnMaterials.SortMode = DataGridViewColumnSortMode.Automatic; + // + // ColumnCount + // + ColumnCount.HeaderText = "Count"; + ColumnCount.MinimumWidth = 6; + ColumnCount.Name = "ColumnCount"; + // + // buttonAdd + // + buttonAdd.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonAdd.Location = new Point(96, 596); + buttonAdd.Margin = new Padding(3, 4, 3, 4); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(143, 31); + buttonAdd.TabIndex = 1; + buttonAdd.Text = "Сохранить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; + // + // buttonCancel + // + buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; + buttonCancel.Location = new Point(406, 596); + buttonCancel.Margin = new Padding(3, 4, 3, 4); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(143, 31); + buttonCancel.TabIndex = 2; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += buttonCancel_Click; + // + // labelName + // + labelName.AutoSize = true; + labelName.Location = new Point(35, 41); + labelName.Name = "labelName"; + labelName.Size = new Size(77, 20); + labelName.TabIndex = 3; + labelName.Text = "Название"; + // + // labelType + // + labelType.AutoSize = true; + labelType.Location = new Point(35, 104); + labelType.Name = "labelType"; + labelType.Size = new Size(96, 20); + labelType.TabIndex = 4; + labelType.Text = "Вид изделия"; + // + // labelCountInWarehouse + // + labelCountInWarehouse.AutoSize = true; + labelCountInWarehouse.Location = new Point(35, 173); + labelCountInWarehouse.Name = "labelCountInWarehouse"; + labelCountInWarehouse.Size = new Size(161, 20); + labelCountInWarehouse.TabIndex = 5; + labelCountInWarehouse.Text = "Количество на складе"; + // + // textBoxName + // + textBoxName.Location = new Point(215, 37); + textBoxName.Margin = new Padding(3, 4, 3, 4); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(161, 27); + textBoxName.TabIndex = 6; + // + // comboBoxProduct + // + comboBoxProduct.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxProduct.FormattingEnabled = true; + comboBoxProduct.Location = new Point(215, 104); + comboBoxProduct.Margin = new Padding(3, 4, 3, 4); + comboBoxProduct.Name = "comboBoxProduct"; + comboBoxProduct.Size = new Size(161, 28); + comboBoxProduct.TabIndex = 7; + // + // numericUpDownCount + // + numericUpDownCount.Location = new Point(215, 173); + numericUpDownCount.Margin = new Padding(3, 4, 3, 4); + numericUpDownCount.Name = "numericUpDownCount"; + numericUpDownCount.Size = new Size(161, 27); + numericUpDownCount.TabIndex = 8; + // + // FormProductMaterial + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(675, 643); + Controls.Add(numericUpDownCount); + Controls.Add(comboBoxProduct); + Controls.Add(textBoxName); + Controls.Add(labelCountInWarehouse); + Controls.Add(labelType); + Controls.Add(labelName); + Controls.Add(buttonCancel); + Controls.Add(buttonAdd); + Controls.Add(groupBox); + Margin = new Padding(3, 4, 3, 4); + Name = "FormProductMaterial"; + Text = "Материал и изделие"; + groupBox.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDownCount).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private GroupBox groupBox; + private DataGridView dataGridView; + private Button buttonAdd; + private Button buttonCancel; + private DataGridViewComboBoxColumn ColumnMaterials; + private DataGridViewTextBoxColumn ColumnCount; + private Label labelName; + private Label labelType; + private Label labelCountInWarehouse; + private TextBox textBoxName; + private ComboBox comboBoxProduct; + private NumericUpDown numericUpDownCount; + } +} \ No newline at end of file diff --git a/ProjectAtelier/Forms/FormProductMaterial.cs b/ProjectAtelier/Forms/FormProductMaterial.cs new file mode 100644 index 0000000..519a910 --- /dev/null +++ b/ProjectAtelier/Forms/FormProductMaterial.cs @@ -0,0 +1,92 @@ +using ProjectAtelier.Entities; +using ProjectAtelier.Repositories; + +namespace ProjectAtelier.Forms +{ + public partial class FormProductMaterial : Form + { + private readonly IProductRepository _productRepository; + private readonly IProductMaterialRepository _feedReplenishmentRepository; + private int? _productId; + public int Id + { + set + { + try + { + var product = _productRepository.ReadProductById(value); + if (product == null) + { + throw new InvalidDataException(nameof(product)); + } + textBoxName.Text = product.Name; + comboBoxProduct.SelectedItem = product.View; + numericUpDownCount.Value = product.CountMaterial; + _productId = value; + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при полученииданных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + public FormProductMaterial(IProductMaterialRepository materialConsumptionRepository, IProductRepository productRepository, IMaterialRepository materialRepository) + { + InitializeComponent(); + _feedReplenishmentRepository = materialConsumptionRepository ?? throw new ArgumentNullException(nameof(materialConsumptionRepository)); + _productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository)); + + comboBoxProduct.DataSource = Enum.GetValues(typeof(ProductView)); + + ColumnMaterials.DataSource = materialRepository.ReadMaterials(); + ColumnMaterials.DisplayMember = "Name"; + ColumnMaterials.ValueMember = "Id"; + } + private void buttonAdd_Click(object sender, EventArgs e) + { + if (dataGridView.RowCount < 1) + { + throw new Exception("Имеются незаполненны поля"); + } + try + { + if (string.IsNullOrWhiteSpace(textBoxName.Text) || comboBoxProduct.SelectedIndex < 1) + { + throw new Exception("Имеются незаполненные поля"); + } + if (_productId.HasValue) + { + _productRepository.UpdateProduct(CreateProduct(_productId.Value)); + } + else + { + _productRepository.CreateProduct(CreateProduct(0)); + } + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void buttonCancel_Click(object sender, EventArgs e) => Close(); + private List CreateListMaterialFromDataGrid() + { + var list = new List(); + foreach (DataGridViewRow row in dataGridView.Rows) + { + if (row.Cells["ColumProduct"].Value == null || row.Cells["ColumMaterials"].Value == null || row.Cells["ColumnCount"].Value == null) + { + continue; + } + list.Add(ProductMaterial.CreateOperation(0, Convert.ToInt32(row.Cells["ColumnMaterial"].Value), + Convert.ToInt32(row.Cells["ColumnProduct"].Value), Convert.ToInt32(row.Cells["ColumnCount"].Value))); + } + return list; + } + private Product CreateProduct(int id) => Product.CreateEntity(id, textBoxName.Text, (ProductView)comboBoxProduct.SelectedItem!, Convert.ToInt32(numericUpDownCount.Value), CreateListMaterialFromDataGrid()); + + + } +} diff --git a/ProjectAtelier/Forms/FormProductMaterial.resx b/ProjectAtelier/Forms/FormProductMaterial.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectAtelier/Forms/FormProductMaterial.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/ProjectAtelier/Forms/FormProductOrder.Designer.cs b/ProjectAtelier/Forms/FormProductOrder.Designer.cs new file mode 100644 index 0000000..0492cc8 --- /dev/null +++ b/ProjectAtelier/Forms/FormProductOrder.Designer.cs @@ -0,0 +1,224 @@ +namespace ProjectAtelier.Forms +{ + partial class FormProductOrder + { + /// + /// 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() + { + buttonAdd = new Button(); + buttonCancel = new Button(); + labelStatus = new Label(); + labelCharacteristic = new Label(); + textBoxCharacteristic = new TextBox(); + comboBoxStatus = new ComboBox(); + groupBox = new GroupBox(); + dataGridView = new DataGridView(); + ColumnProducts = new DataGridViewComboBoxColumn(); + ColumnCount = new DataGridViewTextBoxColumn(); + comboBoxClient = new ComboBox(); + labelClient = new Label(); + dateTimePicker = new DateTimePicker(); + label1 = new Label(); + groupBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // buttonAdd + // + buttonAdd.Location = new Point(36, 682); + buttonAdd.Margin = new Padding(3, 4, 3, 4); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(107, 31); + buttonAdd.TabIndex = 0; + buttonAdd.Text = "Сохранить"; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(197, 682); + buttonCancel.Margin = new Padding(3, 4, 3, 4); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(98, 31); + buttonCancel.TabIndex = 1; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // labelStatus + // + labelStatus.AutoSize = true; + labelStatus.Location = new Point(24, 65); + labelStatus.Name = "labelStatus"; + labelStatus.Size = new Size(134, 20); + labelStatus.TabIndex = 2; + labelStatus.Text = "Статус готовности"; + // + // labelCharacteristic + // + labelCharacteristic.AutoSize = true; + labelCharacteristic.Location = new Point(24, 194); + labelCharacteristic.Name = "labelCharacteristic"; + labelCharacteristic.Size = new Size(119, 20); + labelCharacteristic.TabIndex = 3; + labelCharacteristic.Text = "Характеристика"; + // + // textBoxCharacteristic + // + textBoxCharacteristic.Location = new Point(178, 157); + textBoxCharacteristic.Margin = new Padding(3, 4, 3, 4); + textBoxCharacteristic.Multiline = true; + textBoxCharacteristic.Name = "textBoxCharacteristic"; + textBoxCharacteristic.Size = new Size(267, 57); + textBoxCharacteristic.TabIndex = 4; + // + // comboBoxStatus + // + comboBoxStatus.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxStatus.FormattingEnabled = true; + comboBoxStatus.Location = new Point(178, 62); + comboBoxStatus.Margin = new Padding(3, 4, 3, 4); + comboBoxStatus.Name = "comboBoxStatus"; + comboBoxStatus.Size = new Size(267, 28); + comboBoxStatus.TabIndex = 5; + // + // groupBox + // + groupBox.Controls.Add(dataGridView); + groupBox.Location = new Point(12, 238); + groupBox.Margin = new Padding(3, 4, 3, 4); + groupBox.Name = "groupBox"; + groupBox.Padding = new Padding(3, 4, 3, 4); + groupBox.Size = new Size(505, 436); + groupBox.TabIndex = 6; + groupBox.TabStop = false; + // + // dataGridView + // + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnProducts, ColumnCount }); + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(3, 24); + dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(499, 408); + dataGridView.TabIndex = 0; + // + // ColumnProducts + // + ColumnProducts.HeaderText = "Изделие"; + ColumnProducts.MinimumWidth = 6; + ColumnProducts.Name = "ColumnProducts"; + ColumnProducts.ReadOnly = true; + // + // ColumnCount + // + ColumnCount.HeaderText = "Количество"; + ColumnCount.MinimumWidth = 6; + ColumnCount.Name = "ColumnCount"; + // + // comboBoxClient + // + comboBoxClient.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxClient.FormattingEnabled = true; + comboBoxClient.Location = new Point(178, 106); + comboBoxClient.Margin = new Padding(3, 4, 3, 4); + comboBoxClient.Name = "comboBoxClient"; + comboBoxClient.Size = new Size(267, 28); + comboBoxClient.TabIndex = 8; + // + // labelClient + // + labelClient.AutoSize = true; + labelClient.Location = new Point(24, 123); + labelClient.Name = "labelClient"; + labelClient.Size = new Size(83, 20); + labelClient.TabIndex = 9; + labelClient.Text = "ID клиента"; + // + // dateTimePicker + // + dateTimePicker.Location = new Point(178, 17); + dateTimePicker.Name = "dateTimePicker"; + dateTimePicker.Size = new Size(267, 27); + dateTimePicker.TabIndex = 10; + // + // label1 + // + label1.AutoSize = true; + label1.Location = new Point(24, 22); + label1.Name = "label1"; + label1.Size = new Size(41, 20); + label1.TabIndex = 11; + label1.Text = "Дата"; + // + // FormProductOrder + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(612, 738); + Controls.Add(label1); + Controls.Add(dateTimePicker); + Controls.Add(labelClient); + Controls.Add(comboBoxClient); + Controls.Add(groupBox); + Controls.Add(comboBoxStatus); + Controls.Add(textBoxCharacteristic); + Controls.Add(labelCharacteristic); + Controls.Add(labelStatus); + Controls.Add(buttonCancel); + Controls.Add(buttonAdd); + Margin = new Padding(3, 4, 3, 4); + Name = "FormProductOrder"; + Text = "Заказ"; + groupBox.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Button buttonAdd; + private Button buttonCancel; + private Label labelStatus; + private Label labelCharacteristic; + private TextBox textBoxCharacteristic; + private ComboBox comboBoxStatus; + private GroupBox groupBox; + private DataGridView dataGridView; + private ComboBox comboBoxClient; + private Label labelClient; + private DataGridViewComboBoxColumn ColumnProducts; + private DataGridViewTextBoxColumn ColumnCount; + private DateTimePicker dateTimePicker; + private Label label1; + } +} \ No newline at end of file diff --git a/ProjectAtelier/Forms/FormProductOrder.cs b/ProjectAtelier/Forms/FormProductOrder.cs new file mode 100644 index 0000000..89e63f8 --- /dev/null +++ b/ProjectAtelier/Forms/FormProductOrder.cs @@ -0,0 +1,74 @@ +using ProjectAtelier.Entities; +using ProjectAtelier.Repositories; +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace ProjectAtelier.Forms +{ + public partial class FormProductOrder : Form + { + private readonly IOrderRepository _orderRepository; + private readonly IProductRepository _productRepository; + private readonly IClientRepository _clientRepository; // Добавляем репозиторий для клиентов + + public FormProductOrder(IOrderRepository orderRepository, IProductRepository productRepository, IClientRepository clientRepository) + { + InitializeComponent(); + _orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository)); + _productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository)); + _clientRepository = clientRepository ?? throw new ArgumentNullException(nameof(clientRepository)); + + comboBoxStatus.DataSource = Enum.GetValues(typeof(OrderStatus)); + + ColumnProducts.DataSource = productRepository.ReadProducts(); + ColumnProducts.DisplayMember = "Name"; + ColumnProducts.ValueMember = "Id"; + + // Заполняем ComboBox для выбора клиента + comboBoxClient.DataSource = clientRepository.ReadClient(); + comboBoxClient.DisplayMember = "Name"; + comboBoxClient.ValueMember = "Id"; + + // Инициализация DateTimePicker + dateTimePicker.Format = DateTimePickerFormat.Custom; + dateTimePicker.CustomFormat = "yyyy-MM-dd HH:mm:ss"; + dateTimePicker.Value = DateTime.Now; // Устанавливаем текущую дату и время по умолчанию + } + + private void ButtonAdd_Click(object sender, EventArgs e) + { + if (dataGridView.RowCount < 1 || textBoxCharacteristic.Text == null || comboBoxStatus.SelectedIndex < 0 || comboBoxClient.SelectedIndex < 0) + { + throw new Exception("Имеются незаполненные поля"); + } + try + { + int clientId = (int)comboBoxClient.SelectedValue; + DateTime selectedDateTime = dateTimePicker.Value; // Получаем выбранную дату и время + _orderRepository.CreateOrder(Order.CreateOperation(0, (OrderStatus)comboBoxStatus.SelectedValue!, textBoxCharacteristic.Text, CreateListProductFromDataGrid(), clientId, selectedDateTime)); + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) => Close(); + + private List CreateListProductFromDataGrid() + { + var list = new List(); + foreach (DataGridViewRow row in dataGridView.Rows) + { + if (row.Cells["ColumProduct"].Value == null || row.Cells["ColumMaterials"].Value == null || row.Cells["ColumnCount"].Value == null) + { + continue; + } + list.Add(OrderProduct.CreateOperation(0, Convert.ToInt32(row.Cells["ColumnProduct"].Value), Convert.ToInt32(row.Cells["ColumnCount"].Value))); + } + return list; + } + } +} \ No newline at end of file diff --git a/ProjectAtelier/Forms/FormProductOrder.resx b/ProjectAtelier/Forms/FormProductOrder.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectAtelier/Forms/FormProductOrder.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/ProjectAtelier/Forms/FormProducts.Designer.cs b/ProjectAtelier/Forms/FormProducts.Designer.cs new file mode 100644 index 0000000..9aca103 --- /dev/null +++ b/ProjectAtelier/Forms/FormProducts.Designer.cs @@ -0,0 +1,126 @@ +namespace ProjectAtelier.Forms +{ + partial class FormProducts + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + dataGridView = new DataGridView(); + panel = new Panel(); + buttonUpdate = new Button(); + buttonRemove = new Button(); + buttonAdd = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panel.SuspendLayout(); + SuspendLayout(); + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Left; + dataGridView.Location = new Point(0, 0); + dataGridView.Margin = new Padding(3, 4, 3, 4); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.RowHeadersWidth = 51; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(628, 450); + dataGridView.TabIndex = 2; + // + // panel + // + panel.Anchor = AnchorStyles.Right; + panel.Controls.Add(buttonUpdate); + panel.Controls.Add(buttonRemove); + panel.Controls.Add(buttonAdd); + panel.Location = new Point(625, 0); + panel.Name = "panel"; + panel.Size = new Size(173, 448); + panel.TabIndex = 3; + // + // buttonUpdate + // + buttonUpdate.BackgroundImage = Properties.Resources.pencil1; + buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch; + buttonUpdate.Location = new Point(37, 326); + buttonUpdate.Name = "buttonUpdate"; + buttonUpdate.Size = new Size(94, 92); + buttonUpdate.TabIndex = 2; + buttonUpdate.UseVisualStyleBackColor = true; + buttonUpdate.Click += buttonUpdate_Click; + // + // buttonRemove + // + buttonRemove.BackgroundImage = Properties.Resources._; + buttonRemove.BackgroundImageLayout = ImageLayout.Stretch; + buttonRemove.Location = new Point(37, 163); + buttonRemove.Name = "buttonRemove"; + buttonRemove.Size = new Size(94, 92); + buttonRemove.TabIndex = 1; + buttonRemove.UseVisualStyleBackColor = true; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources._77_; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(37, 28); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(94, 92); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += buttonAdd_Click; + // + // FormProducts + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(804, 450); + Controls.Add(panel); + Controls.Add(dataGridView); + Name = "FormProducts"; + Text = "Изделия"; + Load += FormProductS_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panel.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panel; + private Button buttonUpdate; + private Button buttonRemove; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/ProjectAtelier/Forms/FormProducts.cs b/ProjectAtelier/Forms/FormProducts.cs new file mode 100644 index 0000000..b0160a4 --- /dev/null +++ b/ProjectAtelier/Forms/FormProducts.cs @@ -0,0 +1,102 @@ +using ProjectAtelier.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 ProjectAtelier.Forms +{ + public partial class FormProducts : Form + { + + private readonly IUnityContainer _container; + private readonly IProductRepository _productRepository; + public FormProducts(IUnityContainer container, IProductRepository productRepository) + { + InitializeComponent(); + _container = container ?? throw new ArgumentNullException(nameof(container)); + _productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository)); + } + private void FormProductS_Load(object sender, EventArgs e) + { + try + { + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void buttonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void buttonRemove_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _productRepository.DeleteProduct(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void buttonUpdate_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + try + { + var form = _container.Resolve(); + form.Id = findId; + form.ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при изменении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void LoadList() => dataGridView.DataSource = _productRepository.ReadProducts(); + private bool TryGetIdentifierFromSelectedRow(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/ProjectAtelier/Forms/FormProducts.resx b/ProjectAtelier/Forms/FormProducts.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/ProjectAtelier/Forms/FormProducts.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ProjectAtelier/Program.cs b/ProjectAtelier/Program.cs index 91520ef..b58f412 100644 --- a/ProjectAtelier/Program.cs +++ b/ProjectAtelier/Program.cs @@ -1,3 +1,9 @@ +using ProjectAtelier.Repositories.Implementations; +using ProjectAtelier.Repositories; +using ProjectAtelier.REPOSITORY.Implementations; +using ProjectAtelier.REPOSITORY; +using Unity; + namespace ProjectAtelier { internal static class Program @@ -11,7 +17,19 @@ namespace ProjectAtelier // 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(); + container.RegisterType(); + + return container; } } } \ No newline at end of file diff --git a/ProjectAtelier/ProjectAtelier.csproj b/ProjectAtelier/ProjectAtelier.csproj index 663fdb8..accbdf0 100644 --- a/ProjectAtelier/ProjectAtelier.csproj +++ b/ProjectAtelier/ProjectAtelier.csproj @@ -8,4 +8,23 @@ enable + + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + \ No newline at end of file diff --git a/ProjectAtelier/Properties/Resources.Designer.cs b/ProjectAtelier/Properties/Resources.Designer.cs new file mode 100644 index 0000000..db8299d --- /dev/null +++ b/ProjectAtelier/Properties/Resources.Designer.cs @@ -0,0 +1,153 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ProjectAtelier.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("ProjectAtelier.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 _ { + get { + object obj = ResourceManager.GetObject("-", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap _14 { + get { + object obj = ResourceManager.GetObject("14", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap _77_ { + get { + object obj = ResourceManager.GetObject("77+", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap _99999 { + get { + object obj = ResourceManager.GetObject("99999", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap i { + get { + object obj = ResourceManager.GetObject("i", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap pencil1 { + get { + object obj = ResourceManager.GetObject("pencil1", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap XXL { + get { + object obj = ResourceManager.GetObject("XXL", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap XXL_height { + get { + object obj = ResourceManager.GetObject("XXL_height", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap ателье1 { + get { + object obj = ResourceManager.GetObject("ателье1", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/ProjectAtelier/Properties/Resources.resx b/ProjectAtelier/Properties/Resources.resx new file mode 100644 index 0000000..5bdc5ed --- /dev/null +++ b/ProjectAtelier/Properties/Resources.resx @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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\-.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ателье1.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\i.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\pencil1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\XXL.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\14.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\XXL_height.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\77+.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\99999.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ProjectAtelier/REPOSITORY/IMaterialReplenishmentRepository.cs b/ProjectAtelier/REPOSITORY/IMaterialReplenishmentRepository.cs new file mode 100644 index 0000000..69ed20e --- /dev/null +++ b/ProjectAtelier/REPOSITORY/IMaterialReplenishmentRepository.cs @@ -0,0 +1,16 @@ +using ProjectAtelier.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.REPOSITORY; + +public interface IMaterialReplenishmentRepository +{ + IEnumerable ReadMaterialsSpent(); + MaterialReplenishment ReadMaterialSpentById(int id); + void CreateMaterialSpent(MaterialReplenishment material); + void UpdateMaterialSpent(MaterialReplenishment material); +} diff --git a/ProjectAtelier/REPOSITORY/Implementations/MaterialReplenishmentRepository.cs b/ProjectAtelier/REPOSITORY/Implementations/MaterialReplenishmentRepository.cs new file mode 100644 index 0000000..48e93a9 --- /dev/null +++ b/ProjectAtelier/REPOSITORY/Implementations/MaterialReplenishmentRepository.cs @@ -0,0 +1,29 @@ +using ProjectAtelier.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.REPOSITORY.Implementations; + +public class MaterialReplenishmentRepository : IMaterialReplenishmentRepository +{ + public void CreateMaterialSpent(MaterialReplenishment material) + { + } + + public MaterialReplenishment ReadMaterialSpentById(int id) + { + return MaterialReplenishment.CreateOperation(0, 0, DateTime.Now, 0); + } + + public IEnumerable ReadMaterialsSpent() + { + return []; + } + + public void UpdateMaterialSpent(MaterialReplenishment material) + { + } +} \ No newline at end of file diff --git a/ProjectAtelier/Repositories/IClientRepository.cs b/ProjectAtelier/Repositories/IClientRepository.cs new file mode 100644 index 0000000..79e5277 --- /dev/null +++ b/ProjectAtelier/Repositories/IClientRepository.cs @@ -0,0 +1,17 @@ +using ProjectAtelier.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Repositories; + +public interface IClientRepository +{ + IEnumerable ReadClient(); + Client ReadClientById(int id); + void CreateClient(Client client); + void UpdateClient(Client client); + void DeleteClient(int id); +} diff --git a/ProjectAtelier/Repositories/IMaterialRepository.cs b/ProjectAtelier/Repositories/IMaterialRepository.cs new file mode 100644 index 0000000..d17bf39 --- /dev/null +++ b/ProjectAtelier/Repositories/IMaterialRepository.cs @@ -0,0 +1,17 @@ +using ProjectAtelier.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Repositories; +public interface IMaterialRepository + { + IEnumerable ReadMaterials(); + Material ReadMaterialById(int id); + void CreateMaterial(Material material); + void UpdateMaterial(Material material); + void DeleteMaterial(int id); +} + diff --git a/ProjectAtelier/Repositories/IOrderRepository.cs b/ProjectAtelier/Repositories/IOrderRepository.cs new file mode 100644 index 0000000..3c2aa7b --- /dev/null +++ b/ProjectAtelier/Repositories/IOrderRepository.cs @@ -0,0 +1,16 @@ +using ProjectAtelier.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Repositories; + +public interface IOrderRepository +{ + IEnumerable ReadOrders(DateTime? dateForm = null, DateTime? dateTo = null, int? orderStatus = null, int? orderId = null); + Order ReadOrderById(int orderId); + void CreateOrder(Order order); + void DeleteOrder(int id); +} diff --git a/ProjectAtelier/Repositories/IProductMaterialRepository.cs b/ProjectAtelier/Repositories/IProductMaterialRepository.cs new file mode 100644 index 0000000..f7170ac --- /dev/null +++ b/ProjectAtelier/Repositories/IProductMaterialRepository.cs @@ -0,0 +1,16 @@ +using ProjectAtelier.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Repositories; + +public interface IProductMaterialRepository +{ + + IEnumerable ReadMaterialsConsumption(); + ProductMaterial ReadMaterialConsumptionById(int id); + void CreateMaterialConsumption(ProductMaterial materialConsumption); +} diff --git a/ProjectAtelier/Repositories/IProductRepository.cs b/ProjectAtelier/Repositories/IProductRepository.cs new file mode 100644 index 0000000..5cfc5af --- /dev/null +++ b/ProjectAtelier/Repositories/IProductRepository.cs @@ -0,0 +1,17 @@ +using ProjectAtelier.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Repositories; + +public interface IProductRepository +{ + IEnumerable ReadProducts(); + Product ReadProductById(int id); + void CreateProduct(Product product); + void UpdateProduct(Product product); + void DeleteProduct(int id); +} diff --git a/ProjectAtelier/Repositories/Implementations/ClientRepository.cs b/ProjectAtelier/Repositories/Implementations/ClientRepository.cs new file mode 100644 index 0000000..40b2463 --- /dev/null +++ b/ProjectAtelier/Repositories/Implementations/ClientRepository.cs @@ -0,0 +1,33 @@ +using ProjectAtelier.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Repositories.Implementations; + +public class ClientRepository : IClientRepository +{ + public void CreateClient(Client client) + { + } + + public void DeleteClient(int id) + { + } + + public IEnumerable ReadClient() + { + return []; + } + + public Client ReadClientById(int id) + { + return Client.CreateEntity(id, string.Empty, string.Empty, Gender.None); + } + + public void UpdateClient(Client client) + { + } +} diff --git a/ProjectAtelier/Repositories/Implementations/MaterialRepository.cs b/ProjectAtelier/Repositories/Implementations/MaterialRepository.cs new file mode 100644 index 0000000..5b1dedd --- /dev/null +++ b/ProjectAtelier/Repositories/Implementations/MaterialRepository.cs @@ -0,0 +1,33 @@ +using ProjectAtelier.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Repositories.Implementations; + +public class MaterialRepository : IMaterialRepository +{ + public void CreateMaterial(Material material) + { + } + + public void DeleteMaterial(int id) + { + } + + public IEnumerable ReadMaterials() + { + return []; + } + + public Material ReadMaterialById(int id) + { + return Material.CreateEntity(id, string.Empty, 0, 0); + } + + public void UpdateMaterial(Material material) + { + } +} diff --git a/ProjectAtelier/Repositories/Implementations/OrderRepository.cs b/ProjectAtelier/Repositories/Implementations/OrderRepository.cs new file mode 100644 index 0000000..a9ae836 --- /dev/null +++ b/ProjectAtelier/Repositories/Implementations/OrderRepository.cs @@ -0,0 +1,28 @@ +using ProjectAtelier.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Repositories.Implementations; + +public class OrderRepository : IOrderRepository +{ + public void CreateOrder(Order feedReplenishment) + { + } + + public void DeleteOrder(int id) + { + } + + public IEnumerable ReadOrders(DateTime? dateForm = null, DateTime? dateTo = null, int? orderStatus = null, int? orderId = null) + { + return []; + } + public Order ReadOrderById(int id) + { + return Order.CreateOperation(id, 0, string.Empty, [], 0, DateTime.Now); + } +} diff --git a/ProjectAtelier/Repositories/Implementations/ProductMaterialRepository.cs b/ProjectAtelier/Repositories/Implementations/ProductMaterialRepository.cs new file mode 100644 index 0000000..88a3042 --- /dev/null +++ b/ProjectAtelier/Repositories/Implementations/ProductMaterialRepository.cs @@ -0,0 +1,25 @@ +using ProjectAtelier.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Repositories.Implementations; + +public class ProductMaterialRepository : IProductMaterialRepository +{ + public void CreateMaterialConsumption(ProductMaterial materialConsumption) + { + } + + public IEnumerable ReadMaterialsConsumption() + { + return []; + } + + public ProductMaterial ReadMaterialConsumptionById(int id) + { + return ProductMaterial.CreateOperation(id, 0, 0, 0); + } +} diff --git a/ProjectAtelier/Repositories/Implementations/ProductRepository.cs b/ProjectAtelier/Repositories/Implementations/ProductRepository.cs new file mode 100644 index 0000000..7f2436a --- /dev/null +++ b/ProjectAtelier/Repositories/Implementations/ProductRepository.cs @@ -0,0 +1,33 @@ +using ProjectAtelier.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectAtelier.Repositories.Implementations; + +public class ProductRepository : IProductRepository +{ + public void CreateProduct(Product product) + { + } + + public void DeleteProduct(int id) + { + } + + public IEnumerable ReadProducts() + { + return []; + } + + public Product ReadProductById(int id) + { + return Product.CreateEntity(id, string.Empty, 0, 0, []); + } + + public void UpdateProduct(Product product) + { + } +} diff --git a/ProjectAtelier/Resources/-.jpg b/ProjectAtelier/Resources/-.jpg new file mode 100644 index 0000000..fa1bb50 Binary files /dev/null and b/ProjectAtelier/Resources/-.jpg differ diff --git a/ProjectAtelier/Resources/14.jpg b/ProjectAtelier/Resources/14.jpg new file mode 100644 index 0000000..cabe722 Binary files /dev/null and b/ProjectAtelier/Resources/14.jpg differ diff --git a/ProjectAtelier/Resources/77+.jpg b/ProjectAtelier/Resources/77+.jpg new file mode 100644 index 0000000..b31fb1a Binary files /dev/null and b/ProjectAtelier/Resources/77+.jpg differ diff --git a/ProjectAtelier/Resources/99999.jpg b/ProjectAtelier/Resources/99999.jpg new file mode 100644 index 0000000..a6d3ea7 Binary files /dev/null and b/ProjectAtelier/Resources/99999.jpg differ diff --git a/ProjectAtelier/Resources/XXL.jpg b/ProjectAtelier/Resources/XXL.jpg new file mode 100644 index 0000000..f2eb9f4 Binary files /dev/null and b/ProjectAtelier/Resources/XXL.jpg differ diff --git a/ProjectAtelier/Resources/XXL_height.jpg b/ProjectAtelier/Resources/XXL_height.jpg new file mode 100644 index 0000000..55d0e8f Binary files /dev/null and b/ProjectAtelier/Resources/XXL_height.jpg differ diff --git a/ProjectAtelier/Resources/i.jpg b/ProjectAtelier/Resources/i.jpg new file mode 100644 index 0000000..8bb0cf7 Binary files /dev/null and b/ProjectAtelier/Resources/i.jpg differ diff --git a/ProjectAtelier/Resources/pencil1.png b/ProjectAtelier/Resources/pencil1.png new file mode 100644 index 0000000..bd979d4 Binary files /dev/null and b/ProjectAtelier/Resources/pencil1.png differ diff --git a/ProjectAtelier/Resources/ателье1.jpg b/ProjectAtelier/Resources/ателье1.jpg new file mode 100644 index 0000000..d71d530 Binary files /dev/null and b/ProjectAtelier/Resources/ателье1.jpg differ