diff --git a/ProjectShoeShop/ProjectShoeShop.sln b/ProjectShoeShop/ProjectShoeShop.sln new file mode 100644 index 0000000..17e2cdf --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34525.116 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectShoeShop", "ProjectShoeShop\ProjectShoeShop.csproj", "{9253775E-215D-40B1-9F33-4D3373A98561}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9253775E-215D-40B1-9F33-4D3373A98561}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9253775E-215D-40B1-9F33-4D3373A98561}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9253775E-215D-40B1-9F33-4D3373A98561}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9253775E-215D-40B1-9F33-4D3373A98561}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {52EB3D33-6529-4D6F-BCAB-55F16CBB5A2E} + EndGlobalSection +EndGlobal diff --git a/ProjectShoeShop/ProjectShoeShop/Entities/Client.cs b/ProjectShoeShop/ProjectShoeShop/Entities/Client.cs new file mode 100644 index 0000000..f570732 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Entities/Client.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectShoeShop.Entities; + +public class Client +{ + public int Id { get; private set; } + + public string Name { get; private set; } = string.Empty; + + public static Client CreateEntity(int id, string name) + { + return new Client + { + Id = id, + Name = name, + }; + + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Entities/Enums/ShoesType.cs b/ProjectShoeShop/ProjectShoeShop/Entities/Enums/ShoesType.cs new file mode 100644 index 0000000..f6f143e --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Entities/Enums/ShoesType.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectShoeShop.Entities.Enums; + +[Flags] +public enum ShoesType +{ + None = 0, + + Winter = 1, + + Spring = 2, + + Summer = 4, + + Autumn = 8 +} diff --git a/ProjectShoeShop/ProjectShoeShop/Entities/Enums/SupplyType.cs b/ProjectShoeShop/ProjectShoeShop/Entities/Enums/SupplyType.cs new file mode 100644 index 0000000..915564c --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Entities/Enums/SupplyType.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectShoeShop.Entities.Enums; + +public enum SupplyType +{ + None = 0, + + Small = 1, + + Medium = 2, + + Large = 3 +} diff --git a/ProjectShoeShop/ProjectShoeShop/Entities/Order.cs b/ProjectShoeShop/ProjectShoeShop/Entities/Order.cs new file mode 100644 index 0000000..22052bf --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Entities/Order.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectShoeShop.Entities; + +public class Order +{ + public int Id { get; private set; } + + public int ClientId { get; private set;} + + public DateTime OrderDate { get; private set; } + + public IEnumerable OrderItems { get; private set; } = []; + + public static Order CreateOperation(int id, int clientid, DateTime date, IEnumerable orderItems) + { + return new Order + { + Id = id, + ClientId = clientid, + OrderDate = date, + OrderItems = orderItems + }; + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Entities/OrderItem.cs b/ProjectShoeShop/ProjectShoeShop/Entities/OrderItem.cs new file mode 100644 index 0000000..558c2ff --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Entities/OrderItem.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectShoeShop.Entities; + +public class OrderItem +{ + public int Id { get; set; } + + public int ShoesId { get; set; } + + public int NumberOfPairs { get; set; } + + public int Size { get; set; } + + public static OrderItem CreateElement(int id, int shoesId, int numberOfPairs, int size) + { + return new OrderItem + { + Id = id, + ShoesId = shoesId, + NumberOfPairs = numberOfPairs, + Size = size + }; + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Entities/Shoes.cs b/ProjectShoeShop/ProjectShoeShop/Entities/Shoes.cs new file mode 100644 index 0000000..5035981 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Entities/Shoes.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ProjectShoeShop.Entities.Enums; + +namespace ProjectShoeShop.Entities; + +public class Shoes +{ + public int Id { get; private set; } + + public string Name { get; private set; } = string.Empty; + + public int Price { get; private set; } + + public ShoesType ShoesType { get; private set;} + + public static Shoes CreateEntity(int id, string name, int price, ShoesType shoestype) + { + return new Shoes + { + Id = id, + Name = name, + Price = price, + ShoesType = shoestype + }; + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Entities/Supply.cs b/ProjectShoeShop/ProjectShoeShop/Entities/Supply.cs new file mode 100644 index 0000000..047ed6e --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Entities/Supply.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ProjectShoeShop.Entities.Enums; + +namespace ProjectShoeShop.Entities; + +public class Supply +{ + public int Id { get; private set; } + + public DateTime DateOfReceipt { get; private set; } + + public SupplyType SupplyType { get; private set; } + + public IEnumerable SupplyShoes { get; private set; } = []; + + public static Supply CreateEntity(int id, SupplyType supplytype, DateTime date,IEnumerable supplyShoes) + { + return new Supply + { + Id = id, + DateOfReceipt = date, + SupplyType = supplytype, + SupplyShoes = supplyShoes + }; + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Entities/SupplyShoes.cs b/ProjectShoeShop/ProjectShoeShop/Entities/SupplyShoes.cs new file mode 100644 index 0000000..9193579 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Entities/SupplyShoes.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectShoeShop.Entities; + +public class SupplyShoes +{ + public int Id { get; private set; } + + public int ShoesId { get; private set; } + + public int Size { get; private set; } + + public int NumberOfPairs { get; private set; } + + public static SupplyShoes CreateElement(int id, int shoesid, int size, int numberofpairs) + { + return new SupplyShoes + { + Id = id, + ShoesId = shoesid, + Size = size, + NumberOfPairs = numberofpairs, + }; + } + + +} diff --git a/ProjectShoeShop/ProjectShoeShop/FormShoesShop.Designer.cs b/ProjectShoeShop/ProjectShoeShop/FormShoesShop.Designer.cs new file mode 100644 index 0000000..3c91162 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/FormShoesShop.Designer.cs @@ -0,0 +1,128 @@ +namespace ProjectShoeShop +{ + partial class FormShoesShop + { + /// + /// 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(); + clientToolStripMenuItem = new ToolStripMenuItem(); + shoeToolStripMenuItem = new ToolStripMenuItem(); + операцииToolStripMenuItem = new ToolStripMenuItem(); + orderToolStripMenuItem = new ToolStripMenuItem(); + supplyshoeToolStripMenuItem = new ToolStripMenuItem(); + отчетыToolStripMenuItem = new ToolStripMenuItem(); + menuStrip.SuspendLayout(); + SuspendLayout(); + // + // menuStrip + // + menuStrip.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, операцииToolStripMenuItem, отчетыToolStripMenuItem }); + menuStrip.Location = new Point(0, 0); + menuStrip.Name = "menuStrip"; + menuStrip.Size = new Size(800, 24); + menuStrip.TabIndex = 0; + menuStrip.Text = "menuStrip1"; + // + // справочникиToolStripMenuItem + // + справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { clientToolStripMenuItem, shoeToolStripMenuItem }); + справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; + справочникиToolStripMenuItem.Size = new Size(94, 20); + справочникиToolStripMenuItem.Text = "Справочники"; + // + // clientToolStripMenuItem + // + clientToolStripMenuItem.Name = "clientToolStripMenuItem"; + clientToolStripMenuItem.Size = new Size(180, 22); + clientToolStripMenuItem.Text = "Клиент"; + clientToolStripMenuItem.Click += clientToolStripMenuItem_Click; + // + // shoeToolStripMenuItem + // + shoeToolStripMenuItem.Name = "shoeToolStripMenuItem"; + shoeToolStripMenuItem.Size = new Size(180, 22); + shoeToolStripMenuItem.Text = "Обувь"; + shoeToolStripMenuItem.Click += shoeToolStripMenuItem_Click; + // + // операцииToolStripMenuItem + // + операцииToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { orderToolStripMenuItem, supplyshoeToolStripMenuItem }); + операцииToolStripMenuItem.Name = "операцииToolStripMenuItem"; + операцииToolStripMenuItem.Size = new Size(75, 20); + операцииToolStripMenuItem.Text = "Операции"; + // + // orderToolStripMenuItem + // + orderToolStripMenuItem.Name = "orderToolStripMenuItem"; + orderToolStripMenuItem.Size = new Size(184, 22); + orderToolStripMenuItem.Text = "Заказ"; + orderToolStripMenuItem.Click += orderToolStripMenuItem_Click; + // + // supplyshoeToolStripMenuItem + // + supplyshoeToolStripMenuItem.Name = "supplyshoeToolStripMenuItem"; + supplyshoeToolStripMenuItem.Size = new Size(184, 22); + supplyshoeToolStripMenuItem.Text = "Пополнение товара"; + supplyshoeToolStripMenuItem.Click += supplyshoeToolStripMenuItem_Click; + // + // отчетыToolStripMenuItem + // + отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem"; + отчетыToolStripMenuItem.Size = new Size(60, 20); + отчетыToolStripMenuItem.Text = "Отчеты"; + // + // FormShoesShop + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + BackgroundImage = Properties.Resources.orig; + BackgroundImageLayout = ImageLayout.Stretch; + ClientSize = new Size(800, 450); + Controls.Add(menuStrip); + MainMenuStrip = menuStrip; + Name = "FormShoesShop"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Магазин обуви"; + menuStrip.ResumeLayout(false); + menuStrip.PerformLayout(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private MenuStrip menuStrip; + private ToolStripMenuItem справочникиToolStripMenuItem; + private ToolStripMenuItem clientToolStripMenuItem; + private ToolStripMenuItem shoeToolStripMenuItem; + private ToolStripMenuItem операцииToolStripMenuItem; + private ToolStripMenuItem orderToolStripMenuItem; + private ToolStripMenuItem отчетыToolStripMenuItem; + private ToolStripMenuItem supplyshoeToolStripMenuItem; + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/FormShoesShop.cs b/ProjectShoeShop/ProjectShoeShop/FormShoesShop.cs new file mode 100644 index 0000000..dc3c9fd --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/FormShoesShop.cs @@ -0,0 +1,76 @@ +using ProjectShoeShop.Forms; +using Unity; + +namespace ProjectShoeShop +{ + public partial class FormShoesShop : Form + { + private readonly IUnityContainer _container; + public FormShoesShop(IUnityContainer container) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + } + + private void clientToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void shoeToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void supplyToolStripMenuItem_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 supplyshoeToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/FormShoesShop.resx b/ProjectShoeShop/ProjectShoeShop/FormShoesShop.resx new file mode 100644 index 0000000..6c82d08 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/FormShoesShop.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/ProjectShoeShop/ProjectShoeShop/Forms/FormClient.Designer.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormClient.Designer.cs new file mode 100644 index 0000000..d6a0056 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormClient.Designer.cs @@ -0,0 +1,96 @@ +namespace ProjectShoeShop.Forms +{ + partial class FormClient + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + labelName = new Label(); + buttonSave = new Button(); + buttonCancel = new Button(); + textBoxName = new TextBox(); + SuspendLayout(); + // + // labelName + // + labelName.AutoSize = true; + labelName.Location = new Point(12, 23); + labelName.Name = "labelName"; + labelName.Size = new Size(31, 15); + labelName.TabIndex = 0; + labelName.Text = "Имя"; + // + // buttonSave + // + buttonSave.Location = new Point(12, 66); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(75, 23); + buttonSave.TabIndex = 1; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(93, 66); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(75, 23); + buttonCancel.TabIndex = 2; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // textBoxName + // + textBoxName.Location = new Point(49, 20); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(119, 23); + textBoxName.TabIndex = 3; + // + // FormClient + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(187, 109); + Controls.Add(textBoxName); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(labelName); + Name = "FormClient"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Клиенты"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelName; + private Button buttonSave; + private Button buttonCancel; + private TextBox textBoxName; + } +} \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormClient.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormClient.cs new file mode 100644 index 0000000..7455bbf --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormClient.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ProjectShoeShop.Entities; +using ProjectShoeShop.Repositories; +using ProjectShoeShop.Repositories.Implementations; + +namespace ProjectShoeShop.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; + _clientId = value; + + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + public FormClient(ClientRepository clientRepository) + { + InitializeComponent(); + _clientRepository = clientRepository ?? + throw new ArgumentNullException(nameof(clientRepository)); + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrEmpty(textBoxName.Text)) + { + throw new Exception("Имеется незаполненное поле"); + } + + if (_clientId.HasValue) + { + _clientRepository.CreateClient(CreateClient(_clientId.Value)); + } + else + { + _clientRepository.CreateClient(CreateClient(0)); + } + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибкв при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) + { + Close(); + } + private Client CreateClient(int id) => Client.CreateEntity(id, textBoxName.Text); + + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/Form1.resx b/ProjectShoeShop/ProjectShoeShop/Forms/FormClient.resx similarity index 93% rename from ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/Form1.resx rename to ProjectShoeShop/ProjectShoeShop/Forms/FormClient.resx index 1af7de1..af32865 100644 --- a/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/Form1.resx +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormClient.resx @@ -1,17 +1,17 @@  - diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormClients.Designer.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormClients.Designer.cs new file mode 100644 index 0000000..4f5b8bf --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormClients.Designer.cs @@ -0,0 +1,126 @@ +namespace ProjectShoeShop.Forms +{ + partial class FormClients + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + panel1 = new Panel(); + buttonUpdate = new Button(); + buttonDelete = new Button(); + buttonAdd = new Button(); + dataGridView = new DataGridView(); + panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // panel1 + // + panel1.Controls.Add(buttonUpdate); + panel1.Controls.Add(buttonDelete); + panel1.Controls.Add(buttonAdd); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(604, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(196, 450); + panel1.TabIndex = 0; + // + // buttonUpdate + // + buttonUpdate.BackgroundImage = Properties.Resources._0_4348_objects_pencil_png; + buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch; + buttonUpdate.Location = new Point(65, 199); + buttonUpdate.Name = "buttonUpdate"; + buttonUpdate.Size = new Size(75, 67); + buttonUpdate.TabIndex = 2; + buttonUpdate.UseVisualStyleBackColor = true; + buttonUpdate.Click += ButtonUpdate_Click; + // + // buttonDelete + // + buttonDelete.BackgroundImage = Properties.Resources._; + buttonDelete.BackgroundImageLayout = ImageLayout.Stretch; + buttonDelete.Location = new Point(65, 117); + buttonDelete.Name = "buttonDelete"; + buttonDelete.Size = new Size(75, 67); + buttonDelete.TabIndex = 1; + buttonDelete.UseVisualStyleBackColor = true; + buttonDelete.Click += ButtonDelete_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources._jpg; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(65, 35); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(75, 64); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // dataGridView + // + dataGridView.AllowUserToAddRows = false; + dataGridView.AllowUserToDeleteRows = false; + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(604, 450); + dataGridView.TabIndex = 1; + // + // FormClients + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panel1); + Name = "FormClients"; + StartPosition = FormStartPosition.CenterScreen; + Text = "Клиенты"; + Load += FormClients_Load; + panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + } + + #endregion + + private Panel panel1; + private Button buttonDelete; + private Button buttonAdd; + private DataGridView dataGridView; + private Button buttonUpdate; + } +} \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormClients.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormClients.cs new file mode 100644 index 0000000..2d9bd09 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormClients.cs @@ -0,0 +1,115 @@ +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 ProjectShoeShop.Repositories; +using Unity; + +namespace ProjectShoeShop.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 ButtonAdd_Click(object sender, EventArgs e) + { + try + { + _container.Resolve().ShowDialog(); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при добавлении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonDelete_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 FormClients_Load(object sender, EventArgs e) + { + try + { + 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; + } + + 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); + } + } + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormClients.resx b/ProjectShoeShop/ProjectShoeShop/Forms/FormClients.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/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/ProjectShoeShop/ProjectShoeShop/Forms/FormOrder.Designer.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormOrder.Designer.cs new file mode 100644 index 0000000..cf711af --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormOrder.Designer.cs @@ -0,0 +1,153 @@ +namespace ProjectShoeShop.Forms +{ + partial class FormOrder + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + labelClient = new Label(); + buttonSave = new Button(); + buttonCancel = new Button(); + comboBox = new ComboBox(); + groupBox1 = new GroupBox(); + dataGridView = new DataGridView(); + ColumnShoe = new DataGridViewComboBoxColumn(); + ColumnNumberOfPairs = new DataGridViewTextBoxColumn(); + ColumnSize = new DataGridViewTextBoxColumn(); + groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // labelClient + // + labelClient.AutoSize = true; + labelClient.Location = new Point(66, 25); + labelClient.Name = "labelClient"; + labelClient.Size = new Size(46, 15); + labelClient.TabIndex = 0; + labelClient.Text = "Клиент"; + // + // buttonSave + // + buttonSave.Location = new Point(15, 262); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(75, 23); + buttonSave.TabIndex = 2; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(310, 262); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(75, 23); + buttonCancel.TabIndex = 3; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // comboBox + // + comboBox.DropDownStyle = ComboBoxStyle.DropDownList; + comboBox.FormattingEnabled = true; + comboBox.Location = new Point(118, 22); + comboBox.Name = "comboBox"; + comboBox.Size = new Size(264, 23); + comboBox.TabIndex = 4; + // + // groupBox1 + // + groupBox1.Controls.Add(dataGridView); + groupBox1.Location = new Point(12, 63); + groupBox1.Name = "groupBox1"; + groupBox1.Size = new Size(373, 193); + groupBox1.TabIndex = 5; + groupBox1.TabStop = false; + groupBox1.Text = "Обувь"; + // + // dataGridView + // + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnShoe, ColumnNumberOfPairs, ColumnSize }); + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(3, 19); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(367, 171); + dataGridView.TabIndex = 0; + // + // ColumnShoe + // + ColumnShoe.HeaderText = "Обувь"; + ColumnShoe.Name = "ColumnShoe"; + // + // ColumnNumberOfPairs + // + ColumnNumberOfPairs.HeaderText = "Количество"; + ColumnNumberOfPairs.Name = "ColumnNumberOfPairs"; + // + // ColumnSize + // + ColumnSize.HeaderText = "Размер обуви"; + ColumnSize.Name = "ColumnSize"; + // + // FormOrder + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(397, 297); + Controls.Add(groupBox1); + Controls.Add(comboBox); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(labelClient); + Name = "FormOrder"; + Text = "FormOrder"; + groupBox1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private Label labelClient; + private Button buttonSave; + private Button buttonCancel; + private ComboBox comboBox; + private GroupBox groupBox1; + private DataGridView dataGridView; + private DataGridViewComboBoxColumn ColumnShoe; + private DataGridViewTextBoxColumn ColumnNumberOfPairs; + private DataGridViewTextBoxColumn ColumnSize; + } +} \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormOrder.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormOrder.cs new file mode 100644 index 0000000..c4927bd --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormOrder.cs @@ -0,0 +1,67 @@ +using ProjectShoeShop.Entities; +using ProjectShoeShop.Repositories; + +namespace ProjectShoeShop.Forms +{ + public partial class FormOrder : Form + { + private readonly IOrderRepository _orderRepository; + public FormOrder(IOrderRepository orderRepository, IClientRepository clientRepository, IShoesRepository shoesRepository) + { + InitializeComponent(); + _orderRepository = orderRepository ?? + throw new ArgumentNullException(nameof(orderRepository)); + + comboBox.DataSource = clientRepository.ReadClient(); + comboBox.DisplayMember = "Name"; + comboBox.ValueMember = "Id"; + + ColumnShoe.DataSource = shoesRepository.ReadShoes(); + ColumnShoe.DisplayMember = "Name"; + ColumnShoe.ValueMember = "Id"; + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (comboBox.SelectedIndex < 0 || dataGridView.RowCount < 1) + { + throw new Exception("Имеется незаполненное поле"); + } + + _orderRepository.CreateOrder(Order.CreateOperation(0,(int)comboBox.SelectedValue!, DateTime.Now, CreateListOrderItemFromDataGrid())); + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибкв при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) + { + Close(); + } + + private List CreateListOrderItemFromDataGrid() + { + var list = new List(); + foreach (DataGridViewRow row in dataGridView.Rows) + { + if (row.Cells["ColumnShoe"].Value == null || + row.Cells["Size"].Value == null || + row.Cells["ColumnNumberOfPairs"].Value == null) + { + continue; + } + list.Add(OrderItem.CreateElement(0, + Convert.ToInt32(row.Cells["ColumnShoe"].Value), + Convert.ToInt32(row.Cells["ColumnNumberOfPairs"].Value), + Convert.ToInt32(row.Cells["Size"].Value))); + } + return list; + } + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormOrder.resx b/ProjectShoeShop/ProjectShoeShop/Forms/FormOrder.resx new file mode 100644 index 0000000..736d239 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormOrder.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormOrders.Designer.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormOrders.Designer.cs new file mode 100644 index 0000000..41006f8 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormOrders.Designer.cs @@ -0,0 +1,97 @@ +namespace ProjectShoeShop.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(); + panel1 = new Panel(); + buttonAdd = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panel1.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.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(604, 450); + dataGridView.TabIndex = 3; + // + // panel1 + // + panel1.Controls.Add(buttonAdd); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(604, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(196, 450); + panel1.TabIndex = 2; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources._jpg; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(65, 35); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(75, 64); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // FormOrders + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panel1); + Name = "FormOrders"; + Text = "FormOrders"; + Load += FormOrders_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panel1.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panel1; + private Button buttonAdd; + } +} \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormOrders.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormOrders.cs new file mode 100644 index 0000000..b016e37 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormOrders.cs @@ -0,0 +1,57 @@ +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 ProjectShoeShop.Repositories; +using ProjectShoeShop.Repositories.Implementations; +using Unity; + +namespace ProjectShoeShop.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 LoadList() => dataGridView.DataSource = _orderRepository.ReadOrder(); + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormOrders.resx b/ProjectShoeShop/ProjectShoeShop/Forms/FormOrders.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/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/ProjectShoeShop/ProjectShoeShop/Forms/FormShoe.Designer.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormShoe.Designer.cs new file mode 100644 index 0000000..13c12cb --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormShoe.Designer.cs @@ -0,0 +1,145 @@ +namespace ProjectShoeShop.Forms +{ + partial class FormShoe + { + /// + /// 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() + { + checkedListBox = new CheckedListBox(); + labelType = new Label(); + labelName = new Label(); + textBoxName = new TextBox(); + labelPrice = new Label(); + numericUpDown = new NumericUpDown(); + buttonSave = new Button(); + buttonCancel = new Button(); + ((System.ComponentModel.ISupportInitialize)numericUpDown).BeginInit(); + SuspendLayout(); + // + // checkedListBox + // + checkedListBox.FormattingEnabled = true; + checkedListBox.Location = new Point(81, 12); + checkedListBox.Name = "checkedListBox"; + checkedListBox.Size = new Size(120, 94); + checkedListBox.TabIndex = 0; + // + // labelType + // + labelType.AutoSize = true; + labelType.Location = new Point(12, 12); + labelType.Name = "labelType"; + labelType.Size = new Size(63, 15); + labelType.TabIndex = 1; + labelType.Text = "Тип обуви"; + // + // labelName + // + labelName.AutoSize = true; + labelName.Location = new Point(12, 129); + labelName.Name = "labelName"; + labelName.Size = new Size(59, 15); + labelName.TabIndex = 2; + labelName.Text = "Название"; + // + // textBoxName + // + textBoxName.Location = new Point(81, 129); + textBoxName.Name = "textBoxName"; + textBoxName.Size = new Size(120, 23); + textBoxName.TabIndex = 3; + // + // labelPrice + // + labelPrice.AutoSize = true; + labelPrice.Location = new Point(12, 169); + labelPrice.Name = "labelPrice"; + labelPrice.Size = new Size(35, 15); + labelPrice.TabIndex = 4; + labelPrice.Text = "Цена"; + // + // numericUpDown + // + numericUpDown.Location = new Point(81, 167); + numericUpDown.Maximum = new decimal(new int[] { 100000, 0, 0, 0 }); + numericUpDown.Minimum = new decimal(new int[] { 100, 0, 0, 0 }); + numericUpDown.Name = "numericUpDown"; + numericUpDown.Size = new Size(120, 23); + numericUpDown.TabIndex = 5; + numericUpDown.Value = new decimal(new int[] { 100, 0, 0, 0 }); + // + // buttonSave + // + buttonSave.Location = new Point(12, 219); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(90, 23); + buttonSave.TabIndex = 6; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(106, 219); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(95, 23); + buttonCancel.TabIndex = 7; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // FormShoe + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(251, 280); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(numericUpDown); + Controls.Add(labelPrice); + Controls.Add(textBoxName); + Controls.Add(labelName); + Controls.Add(labelType); + Controls.Add(checkedListBox); + Name = "FormShoe"; + Text = "Обувь"; + ((System.ComponentModel.ISupportInitialize)numericUpDown).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private CheckedListBox checkedListBox; + private Label labelType; + private Label labelName; + private TextBox textBoxName; + private Label labelPrice; + private NumericUpDown numericUpDown; + private Button buttonSave; + private Button buttonCancel; + } +} \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormShoe.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormShoe.cs new file mode 100644 index 0000000..4abb6bf --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormShoe.cs @@ -0,0 +1,109 @@ +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 ProjectShoeShop.Entities; +using ProjectShoeShop.Entities.Enums; +using ProjectShoeShop.Repositories; +using ProjectShoeShop.Repositories.Implementations; + +namespace ProjectShoeShop.Forms +{ + public partial class FormShoe : Form + { + private readonly IShoesRepository _shoesRepository; + private int? _shoesId; + + public int Id + { + set + { + try + { + var shoe = _shoesRepository.ReadShoesById(value); + if (shoe == null) + { + throw new InvalidDataException(nameof(shoe)); + } + + foreach (ShoesType elem in Enum.GetValues(typeof(ShoesType))) + { + if ((elem & shoe.ShoesType) != 0) + { + checkedListBox.SetItemChecked(checkedListBox.Items.IndexOf(elem), true); + } + } + + textBoxName.Text = shoe.Name; + numericUpDown.Value = shoe.Price; + _shoesId = value; + + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + public FormShoe(IShoesRepository shoesRepository) + { + InitializeComponent(); + _shoesRepository = shoesRepository ?? + throw new ArgumentNullException(nameof(shoesRepository)); + + foreach (var elem in Enum.GetValues(typeof (ShoesType))) + { + checkedListBox.Items.Add(elem); + } + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (string.IsNullOrEmpty(textBoxName.Text) || + checkedListBox.CheckedItems.Count == 0 || numericUpDown.Value < 1) + { + throw new Exception("Имеется незаполненное поле"); + } + + if (_shoesId.HasValue) + { + _shoesRepository.UpdateShoes(CreateShoes(_shoesId.Value)); + } + else + { + _shoesRepository.CreateShoes(CreateShoes(0)); + } + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибкв при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) + { + Close(); + } + + private Shoes CreateShoes(int id) + { + ShoesType shoesType = ShoesType.None; + foreach (var elem in checkedListBox.CheckedItems) + { + shoesType |= (ShoesType)elem; + } + + return Shoes.CreateEntity(id, textBoxName.Text, (int)numericUpDown.Value, shoesType); + } + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormShoe.resx b/ProjectShoeShop/ProjectShoeShop/Forms/FormShoe.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormShoe.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/ProjectShoeShop/ProjectShoeShop/Forms/FormShoes.Designer.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormShoes.Designer.cs new file mode 100644 index 0000000..ea2cf52 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormShoes.Designer.cs @@ -0,0 +1,125 @@ +namespace ProjectShoeShop.Forms +{ + partial class FormShoes + { + /// + /// 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(); + panel1 = new Panel(); + buttonDelete = new Button(); + buttonAdd = new Button(); + buttonUpdate = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panel1.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.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(604, 450); + dataGridView.TabIndex = 3; + // + // panel1 + // + panel1.Controls.Add(buttonUpdate); + panel1.Controls.Add(buttonDelete); + panel1.Controls.Add(buttonAdd); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(604, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(196, 450); + panel1.TabIndex = 2; + // + // buttonDelete + // + buttonDelete.BackgroundImage = Properties.Resources._; + buttonDelete.BackgroundImageLayout = ImageLayout.Stretch; + buttonDelete.Location = new Point(65, 117); + buttonDelete.Name = "buttonDelete"; + buttonDelete.Size = new Size(75, 67); + buttonDelete.TabIndex = 1; + buttonDelete.UseVisualStyleBackColor = true; + buttonDelete.Click += ButtonDelete_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources._jpg; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(65, 35); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(75, 64); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // buttonUpdate + // + buttonUpdate.BackgroundImage = Properties.Resources._0_4348_objects_pencil_png; + buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch; + buttonUpdate.Location = new Point(65, 202); + buttonUpdate.Name = "buttonUpdate"; + buttonUpdate.Size = new Size(75, 67); + buttonUpdate.TabIndex = 2; + buttonUpdate.UseVisualStyleBackColor = true; + buttonUpdate.Click += ButtonUpdate_Click; + // + // FormShoes + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panel1); + Name = "FormShoes"; + Text = "Обувь"; + Load += FormShoes_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panel1.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panel1; + private Button buttonDelete; + private Button buttonAdd; + private Button buttonUpdate; + } +} \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormShoes.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormShoes.cs new file mode 100644 index 0000000..9e37f04 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormShoes.cs @@ -0,0 +1,114 @@ +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 ProjectShoeShop.Repositories; +using ProjectShoeShop.Repositories.Implementations; +using Unity; + +namespace ProjectShoeShop.Forms +{ + public partial class FormShoes : Form + { + + private readonly IUnityContainer _container; + private readonly IShoesRepository _shoesRepository; + public FormShoes(IUnityContainer container, IShoesRepository shoesRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _shoesRepository = shoesRepository ?? + throw new ArgumentNullException(nameof(shoesRepository)); + } + + private void FormShoes_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 ButtonDelete_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", + MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _shoesRepository.DeleteShoes(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void LoadList() => dataGridView.DataSource = _shoesRepository.ReadShoes(); + + 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; + } + + 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); + } + } + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormShoes.resx b/ProjectShoeShop/ProjectShoeShop/Forms/FormShoes.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormShoes.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/ProjectShoeShop/ProjectShoeShop/Forms/FormSupply.Designer.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormSupply.Designer.cs new file mode 100644 index 0000000..8bcd752 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormSupply.Designer.cs @@ -0,0 +1,153 @@ +namespace ProjectShoeShop.Forms +{ + partial class FormSupply + { + /// + /// 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() + { + comboBox = new ComboBox(); + labelVolume = new Label(); + buttonSave = new Button(); + buttonCancel = new Button(); + groupBox = new GroupBox(); + dataGridView = new DataGridView(); + ColumnShoe = new DataGridViewComboBoxColumn(); + ColumnNumberOfPairs = new DataGridViewTextBoxColumn(); + ColumnSize = new DataGridViewTextBoxColumn(); + groupBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + SuspendLayout(); + // + // comboBox + // + comboBox.DropDownStyle = ComboBoxStyle.DropDownList; + comboBox.FormattingEnabled = true; + comboBox.Location = new Point(116, 9); + comboBox.Name = "comboBox"; + comboBox.Size = new Size(283, 23); + comboBox.TabIndex = 0; + // + // labelVolume + // + labelVolume.AutoSize = true; + labelVolume.Location = new Point(12, 9); + labelVolume.Name = "labelVolume"; + labelVolume.Size = new Size(98, 15); + labelVolume.TabIndex = 1; + labelVolume.Text = "Объем поставки"; + // + // buttonSave + // + buttonSave.Location = new Point(12, 216); + buttonSave.Name = "buttonSave"; + buttonSave.Size = new Size(75, 23); + buttonSave.TabIndex = 2; + buttonSave.Text = "Сохранить"; + buttonSave.UseVisualStyleBackColor = true; + buttonSave.Click += ButtonSave_Click; + // + // buttonCancel + // + buttonCancel.Location = new Point(324, 216); + buttonCancel.Name = "buttonCancel"; + buttonCancel.Size = new Size(75, 23); + buttonCancel.TabIndex = 3; + buttonCancel.Text = "Отмена"; + buttonCancel.UseVisualStyleBackColor = true; + buttonCancel.Click += ButtonCancel_Click; + // + // groupBox + // + groupBox.Controls.Add(dataGridView); + groupBox.Location = new Point(12, 38); + groupBox.Name = "groupBox"; + groupBox.Size = new Size(390, 172); + groupBox.TabIndex = 4; + groupBox.TabStop = false; + groupBox.Text = "Обувь"; + // + // dataGridView + // + dataGridView.AllowUserToResizeColumns = false; + dataGridView.AllowUserToResizeRows = false; + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnShoe, ColumnNumberOfPairs, ColumnSize }); + dataGridView.Dock = DockStyle.Fill; + dataGridView.Location = new Point(3, 19); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(384, 150); + dataGridView.TabIndex = 0; + // + // ColumnShoe + // + ColumnShoe.HeaderText = "Обувь"; + ColumnShoe.Name = "ColumnShoe"; + // + // ColumnNumberOfPairs + // + ColumnNumberOfPairs.HeaderText = "Количество"; + ColumnNumberOfPairs.Name = "ColumnNumberOfPairs"; + // + // ColumnSize + // + ColumnSize.HeaderText = "Размер"; + ColumnSize.Name = "ColumnSize"; + // + // FormSupply + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(414, 251); + Controls.Add(groupBox); + Controls.Add(buttonCancel); + Controls.Add(buttonSave); + Controls.Add(labelVolume); + Controls.Add(comboBox); + Name = "FormSupply"; + Text = "Поставка"; + groupBox.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private ComboBox comboBox; + private Label labelVolume; + private Button buttonSave; + private Button buttonCancel; + private GroupBox groupBox; + private DataGridView dataGridView; + private DataGridViewComboBoxColumn ColumnShoe; + private DataGridViewTextBoxColumn ColumnNumberOfPairs; + private DataGridViewTextBoxColumn ColumnSize; + } +} \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormSupply.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormSupply.cs new file mode 100644 index 0000000..accf504 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormSupply.cs @@ -0,0 +1,104 @@ +using ProjectShoeShop.Entities; +using ProjectShoeShop.Entities.Enums; +using ProjectShoeShop.Repositories; + +namespace ProjectShoeShop.Forms +{ + public partial class FormSupply : Form + { + private readonly ISupplyRepository _supplyRepository; + private readonly IShoesRepository _shoesRepository; + private int? _supplyId; + + public int Id + { + set + { + try + { + var supply = _supplyRepository.ReadSupplyById(value); + if (supply == null) + { + throw new InvalidDataException(nameof(supply)); + } + + comboBox.SelectedItem = supply.SupplyType; + _supplyId = value; + + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + } + } + + public FormSupply(ISupplyRepository supplyRepository, IShoesRepository shoesRepository) + { + InitializeComponent(); + _supplyRepository = supplyRepository ?? + throw new ArgumentNullException(nameof(supplyRepository)); + + comboBox.DataSource = Enum.GetValues(typeof(SupplyType)); + _shoesRepository = shoesRepository ?? + throw new ArgumentNullException(nameof(shoesRepository)); + + ColumnShoe.DataSource = shoesRepository.ReadShoes(); + ColumnShoe.DisplayMember = "Name"; + ColumnShoe.ValueMember = "Id"; + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + try + { + if (comboBox.SelectedIndex < 1 || dataGridView.RowCount < 1) + { + throw new Exception("Имеется незаполненное поле"); + } + + if (_supplyId.HasValue) + { + _supplyRepository.UpdateSupply(CreateSupply(_supplyId.Value)); + } + else + { + _supplyRepository.CreateSupply(CreateSupply(0)); + } + + Close(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибкв при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void ButtonCancel_Click(object sender, EventArgs e) + { + Close(); + } + + private Supply CreateSupply(int id) => Supply.CreateEntity(id,(SupplyType)comboBox.SelectedItem!, DateTime.Now, CreateListSupplyShoesFromDataGrid()); + + private List CreateListSupplyShoesFromDataGrid() + { + var list = new List(); + foreach (DataGridViewRow row in dataGridView.Rows) + { + if (row.Cells["ColumnShoe"].Value == null || + row.Cells["Size"].Value == null || + row.Cells["ColumnNumberOfPairs"].Value == null) + { + continue; + } + list.Add(Entities.SupplyShoes.CreateElement(0, + Convert.ToInt32(row.Cells["ColumnShoe"].Value), + Convert.ToInt32(row.Cells["ColumnNumberOfPairs"].Value), + Convert.ToInt32(row.Cells["Size"].Value))); + } + return list; + } + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormSupply.resx b/ProjectShoeShop/ProjectShoeShop/Forms/FormSupply.resx new file mode 100644 index 0000000..8da65c4 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormSupply.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormSupplys.Designer.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormSupplys.Designer.cs new file mode 100644 index 0000000..e6032f1 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormSupplys.Designer.cs @@ -0,0 +1,125 @@ +namespace ProjectShoeShop.Forms +{ + partial class FormSupplys + { + /// + /// 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(); + panel1 = new Panel(); + buttonDelete = new Button(); + buttonAdd = new Button(); + buttonUpdate = new Button(); + ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); + panel1.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.Fill; + dataGridView.Location = new Point(0, 0); + dataGridView.MultiSelect = false; + dataGridView.Name = "dataGridView"; + dataGridView.ReadOnly = true; + dataGridView.RowHeadersVisible = false; + dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dataGridView.Size = new Size(604, 450); + dataGridView.TabIndex = 3; + // + // panel1 + // + panel1.Controls.Add(buttonUpdate); + panel1.Controls.Add(buttonDelete); + panel1.Controls.Add(buttonAdd); + panel1.Dock = DockStyle.Right; + panel1.Location = new Point(604, 0); + panel1.Name = "panel1"; + panel1.Size = new Size(196, 450); + panel1.TabIndex = 2; + // + // buttonDelete + // + buttonDelete.BackgroundImage = Properties.Resources._; + buttonDelete.BackgroundImageLayout = ImageLayout.Stretch; + buttonDelete.Location = new Point(65, 117); + buttonDelete.Name = "buttonDelete"; + buttonDelete.Size = new Size(75, 67); + buttonDelete.TabIndex = 1; + buttonDelete.UseVisualStyleBackColor = true; + buttonDelete.Click += ButtonDelete_Click; + // + // buttonAdd + // + buttonAdd.BackgroundImage = Properties.Resources._jpg; + buttonAdd.BackgroundImageLayout = ImageLayout.Stretch; + buttonAdd.Location = new Point(65, 35); + buttonAdd.Name = "buttonAdd"; + buttonAdd.Size = new Size(75, 64); + buttonAdd.TabIndex = 0; + buttonAdd.UseVisualStyleBackColor = true; + buttonAdd.Click += ButtonAdd_Click; + // + // buttonUpdate + // + buttonUpdate.BackgroundImage = Properties.Resources._0_4348_objects_pencil_png; + buttonUpdate.BackgroundImageLayout = ImageLayout.Stretch; + buttonUpdate.Location = new Point(65, 203); + buttonUpdate.Name = "buttonUpdate"; + buttonUpdate.Size = new Size(75, 67); + buttonUpdate.TabIndex = 2; + buttonUpdate.UseVisualStyleBackColor = true; + buttonUpdate.Click += ButtonUpdate_Click; + // + // FormSupplys + // + AutoScaleDimensions = new SizeF(7F, 15F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(800, 450); + Controls.Add(dataGridView); + Controls.Add(panel1); + Name = "FormSupplys"; + Text = "Поставка"; + Load += FormSupplys_Load; + ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); + panel1.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private DataGridView dataGridView; + private Panel panel1; + private Button buttonDelete; + private Button buttonAdd; + private Button buttonUpdate; + } +} \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormSupplys.cs b/ProjectShoeShop/ProjectShoeShop/Forms/FormSupplys.cs new file mode 100644 index 0000000..b60547c --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormSupplys.cs @@ -0,0 +1,116 @@ +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 ProjectShoeShop.Repositories; +using ProjectShoeShop.Repositories.Implementations; +using Unity; + +namespace ProjectShoeShop.Forms +{ + public partial class FormSupplys : Form + { + private readonly IUnityContainer _container; + private readonly ISupplyRepository _supplyRepository; + + public FormSupplys(IUnityContainer container, ISupplyRepository supplyRepository) + { + InitializeComponent(); + _container = container ?? + throw new ArgumentNullException(nameof(container)); + _supplyRepository = supplyRepository ?? + throw new ArgumentNullException(nameof(supplyRepository)); + } + + private void FormSupplys_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 ButtonDelete_Click(object sender, EventArgs e) + { + if (!TryGetIdentifierFromSelectedRow(out var findId)) + { + return; + } + if (MessageBox.Show("Удалить запись?", "Удаление", + MessageBoxButtons.YesNo) != DialogResult.Yes) + { + return; + } + try + { + _supplyRepository.DeleteSupply(findId); + LoadList(); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Ошибка при удалении", + MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + + private void LoadList() => dataGridView.DataSource = _supplyRepository.ReadSupply(); + + 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; + } + + 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); + } + } + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Forms/FormSupplys.resx b/ProjectShoeShop/ProjectShoeShop/Forms/FormSupplys.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Forms/FormSupplys.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/ProjectShoeShop/ProjectShoeShop/Program.cs b/ProjectShoeShop/ProjectShoeShop/Program.cs new file mode 100644 index 0000000..afa8c55 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Program.cs @@ -0,0 +1,35 @@ +using ProjectShoeShop.Repositories; +using ProjectShoeShop.Repositories.Implementations; +using Unity; + +namespace ProjectShoeShop +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(CreateContainer().Resolve()); + } + + private static IUnityContainer CreateContainer() + { + var container = new UnityContainer(); + + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + container.RegisterType(); + + return container; + } + + } +} \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop.csproj b/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop.csproj new file mode 100644 index 0000000..6b260fe --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop.csproj @@ -0,0 +1,31 @@ + + + + WinExe + net8.0-windows + enable + true + enable + + + + + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/Form1.Designer.cs b/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/Form1.Designer.cs deleted file mode 100644 index 34f1074..0000000 --- a/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/Form1.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace ProjectShoeShop -{ - 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/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/Form1.cs b/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/Form1.cs deleted file mode 100644 index 16098af..0000000 --- a/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/Form1.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace ProjectShoeShop -{ - public partial class Form1 : Form - { - public Form1() - { - InitializeComponent(); - } - } -} diff --git a/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/Program.cs b/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/Program.cs deleted file mode 100644 index 76e9e80..0000000 --- a/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/Program.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace ProjectShoeShop -{ - internal static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - // To customize application configuration such as set high DPI settings or default font, - // see https://aka.ms/applicationconfiguration. - ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); - } - } -} \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop.csproj b/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop.csproj deleted file mode 100644 index 663fdb8..0000000 --- a/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop/ProjectShoeShop.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - WinExe - net8.0-windows - enable - true - enable - - - \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/Properties/Resources.Designer.cs b/ProjectShoeShop/ProjectShoeShop/Properties/Resources.Designer.cs new file mode 100644 index 0000000..0b12aa3 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Properties/Resources.Designer.cs @@ -0,0 +1,103 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ProjectShoeShop.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("ProjectShoeShop.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 _0_4348_objects_pencil_png { + get { + object obj = ResourceManager.GetObject("0-4348_objects-pencil-png", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap _jpg { + get { + object obj = ResourceManager.GetObject("+jpg", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Поиск локализованного ресурса типа System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap orig { + get { + object obj = ResourceManager.GetObject("orig", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Properties/Resources.resx b/ProjectShoeShop/ProjectShoeShop/Properties/Resources.resx new file mode 100644 index 0000000..161de46 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Properties/Resources.resx @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\-.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\orig.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\+jpg.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\0-4348_objects-pencil-png.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/ProjectShoeShop/ProjectShoeShop/Repositories/IClientRepository.cs b/ProjectShoeShop/ProjectShoeShop/Repositories/IClientRepository.cs new file mode 100644 index 0000000..fdbf1f4 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Repositories/IClientRepository.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ProjectShoeShop.Entities; + +namespace ProjectShoeShop.Repositories; + +public interface IClientRepository +{ + IEnumerable ReadClient(); + + Client ReadClientById(int id); + + void CreateClient(Client client); + + void DeleteClient(int id); +} diff --git a/ProjectShoeShop/ProjectShoeShop/Repositories/IOrderRepository.cs b/ProjectShoeShop/ProjectShoeShop/Repositories/IOrderRepository.cs new file mode 100644 index 0000000..80d3706 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Repositories/IOrderRepository.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ProjectShoeShop.Entities; + +namespace ProjectShoeShop.Repositories; + +public interface IOrderRepository +{ + IEnumerable ReadOrder(DateTime? dateForm = null, DateTime? dateTo = null); + + void CreateOrder(Order order); +} diff --git a/ProjectShoeShop/ProjectShoeShop/Repositories/IShoesRepository.cs b/ProjectShoeShop/ProjectShoeShop/Repositories/IShoesRepository.cs new file mode 100644 index 0000000..e924551 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Repositories/IShoesRepository.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ProjectShoeShop.Entities; + +namespace ProjectShoeShop.Repositories; + +public interface IShoesRepository +{ + IEnumerable ReadShoes(); + + Shoes ReadShoesById(int id); + + void CreateShoes(Shoes shoes); + + void UpdateShoes(Shoes shoes); + + void DeleteShoes(int id); +} diff --git a/ProjectShoeShop/ProjectShoeShop/Repositories/ISupplyRepository.cs b/ProjectShoeShop/ProjectShoeShop/Repositories/ISupplyRepository.cs new file mode 100644 index 0000000..3b9db96 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Repositories/ISupplyRepository.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ProjectShoeShop.Entities; + +namespace ProjectShoeShop.Repositories; + +public interface ISupplyRepository +{ + IEnumerable ReadSupply(DateTime? dateForm = null, DateTime? dateTo = null); + Supply ReadSupplyById(int id); + + void CreateSupply(Supply supply); + + void UpdateSupply(Supply supply); + + void DeleteSupply(int id); +} + diff --git a/ProjectShoeShop/ProjectShoeShop/Repositories/ISupplyShoesRepository.cs b/ProjectShoeShop/ProjectShoeShop/Repositories/ISupplyShoesRepository.cs new file mode 100644 index 0000000..624a676 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Repositories/ISupplyShoesRepository.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ProjectShoeShop.Entities; + +namespace ProjectShoeShop.Repositories; + +public interface ISupplyShoesRepository +{ + IEnumerable ReadSupplyShoes(int? supplyId = null, int? shoesId = null); + + void CreateSupplyShoes(SupplyShoes supplyShoes); + + void DeleteSupplyShoes(int id); +} diff --git a/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/ClientRepository.cs b/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/ClientRepository.cs new file mode 100644 index 0000000..428ffd7 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/ClientRepository.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ProjectShoeShop.Entities; + +namespace ProjectShoeShop.Repositories.Implementations; + +public class ClientRepository : IClientRepository +{ + public void CreateClient(Client client) + { + } + + public void DeleteClient(int id) + { + } + + public IEnumerable ReadClient() + { + return []; + } + + public Client ReadClientById(int id) + { + return Client.CreateEntity(0, string.Empty); + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/OrderRepository.cs b/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/OrderRepository.cs new file mode 100644 index 0000000..f20eb71 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/OrderRepository.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ProjectShoeShop.Entities; + +namespace ProjectShoeShop.Repositories.Implementations; + +public class OrderRepository : IOrderRepository +{ + public void CreateOrder(Order order) + { + + } + + public IEnumerable ReadOrder(DateTime? dateForm = null, DateTime? dateTo = null) + { + return []; + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/ShoesRepository.cs b/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/ShoesRepository.cs new file mode 100644 index 0000000..44f6082 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/ShoesRepository.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ProjectShoeShop.Entities; + +namespace ProjectShoeShop.Repositories.Implementations; + +public class ShoesRepository : IShoesRepository +{ + public void CreateShoes(Shoes shoes) + { + + } + + public void DeleteShoes(int id) + { + + } + + public IEnumerable ReadShoes() + { + return []; + } + + public Shoes ReadShoesById(int id) + { + throw new NotImplementedException(); + } + + public void UpdateShoes(Shoes shoes) + { + + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/SupplyRepository.cs b/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/SupplyRepository.cs new file mode 100644 index 0000000..3ac1298 --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/SupplyRepository.cs @@ -0,0 +1,32 @@ +using ProjectShoeShop.Entities; + +namespace ProjectShoeShop.Repositories.Implementations; + +public class SupplyRepository : ISupplyRepository +{ + public void CreateSupply(Supply supply) + { + + } + + public IEnumerable ReadSupply(DateTime? dateForm = null, DateTime? dateTo = null) + { + return []; + } + + public Supply ReadSupplyById(int id) + { + return Supply.CreateEntity(0, Entities.Enums.SupplyType.None, DateTime.Now, []); + } + + + public void UpdateSupply(Supply supply) + { + + } + + public void DeleteSupply(int id) + { + + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/SupplyShoes.cs b/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/SupplyShoes.cs new file mode 100644 index 0000000..2ebc0fc --- /dev/null +++ b/ProjectShoeShop/ProjectShoeShop/Repositories/Implementations/SupplyShoes.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectShoeShop.Repositories.Implementations; + +public class SupplyShoes : ISupplyShoesRepository +{ + public void CreateSupplyShoes(Entities.SupplyShoes supplyShoes) + { + + } + + public void DeleteSupplyShoes(int id) + { + + } + + public IEnumerable ReadSupplyShoes(int? supplyId = null, int? shoesId = null) + { + return []; + } +} diff --git a/ProjectShoeShop/ProjectShoeShop/Resources/+jpg.jpg b/ProjectShoeShop/ProjectShoeShop/Resources/+jpg.jpg new file mode 100644 index 0000000..fadf25c Binary files /dev/null and b/ProjectShoeShop/ProjectShoeShop/Resources/+jpg.jpg differ diff --git a/ProjectShoeShop/ProjectShoeShop/Resources/-.jpg b/ProjectShoeShop/ProjectShoeShop/Resources/-.jpg new file mode 100644 index 0000000..5afc292 Binary files /dev/null and b/ProjectShoeShop/ProjectShoeShop/Resources/-.jpg differ diff --git a/ProjectShoeShop/ProjectShoeShop/Resources/0-4348_objects-pencil-png.jpg b/ProjectShoeShop/ProjectShoeShop/Resources/0-4348_objects-pencil-png.jpg new file mode 100644 index 0000000..9808512 Binary files /dev/null and b/ProjectShoeShop/ProjectShoeShop/Resources/0-4348_objects-pencil-png.jpg differ diff --git a/ProjectShoeShop/ProjectShoeShop/Resources/orig.jpg b/ProjectShoeShop/ProjectShoeShop/Resources/orig.jpg new file mode 100644 index 0000000..c05e7f5 Binary files /dev/null and b/ProjectShoeShop/ProjectShoeShop/Resources/orig.jpg differ