diff --git a/Confectionery/FormAddPastryInShop.Designer.cs b/Confectionery/FormAddPastryInShop.Designer.cs new file mode 100644 index 0000000..76738b9 --- /dev/null +++ b/Confectionery/FormAddPastryInShop.Designer.cs @@ -0,0 +1,151 @@ +namespace ConfectioneryView +{ + partial class FormAddPastryInShop + { + /// + /// 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.comboBoxShop = new System.Windows.Forms.ComboBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.comboBoxPastry = new System.Windows.Forms.ComboBox(); + this.numericUpDownCount = new System.Windows.Forms.NumericUpDown(); + this.buttonSave = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).BeginInit(); + this.SuspendLayout(); + // + // comboBoxShop + // + this.comboBoxShop.FormattingEnabled = true; + this.comboBoxShop.Location = new System.Drawing.Point(214, 17); + this.comboBoxShop.Name = "comboBoxShop"; + this.comboBoxShop.Size = new System.Drawing.Size(222, 23); + this.comboBoxShop.TabIndex = 3; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(84, 20); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(124, 15); + this.label1.TabIndex = 2; + this.label1.Text = "Выбранный магазин:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 47); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(196, 15); + this.label2.TabIndex = 4; + this.label2.Text = "Изделие которое нужно добавить:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(133, 73); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(75, 15); + this.label3.TabIndex = 5; + this.label3.Text = "Количество:"; + // + // comboBoxPastry + // + this.comboBoxPastry.FormattingEnabled = true; + this.comboBoxPastry.Location = new System.Drawing.Point(214, 44); + this.comboBoxPastry.Name = "comboBoxPastry"; + this.comboBoxPastry.Size = new System.Drawing.Size(222, 23); + this.comboBoxPastry.TabIndex = 6; + // + // numericUpDownCount + // + this.numericUpDownCount.Location = new System.Drawing.Point(215, 71); + this.numericUpDownCount.Maximum = new decimal(new int[] { + 1410065408, + 2, + 0, + 0}); + this.numericUpDownCount.Name = "numericUpDownCount"; + this.numericUpDownCount.Size = new System.Drawing.Size(221, 23); + this.numericUpDownCount.TabIndex = 7; + // + // buttonSave + // + this.buttonSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonSave.Location = new System.Drawing.Point(280, 123); + this.buttonSave.Name = "buttonSave"; + this.buttonSave.Size = new System.Drawing.Size(75, 23); + this.buttonSave.TabIndex = 8; + this.buttonSave.Text = "Сохранить"; + this.buttonSave.UseVisualStyleBackColor = true; + this.buttonSave.Click += new System.EventHandler(this.ButtonSave_Click); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.Location = new System.Drawing.Point(361, 123); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 9; + this.buttonCancel.Text = "Отмена"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click); + // + // FormAddPastryInShop + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(448, 158); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonSave); + this.Controls.Add(this.numericUpDownCount); + this.Controls.Add(this.comboBoxPastry); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.comboBoxShop); + this.Controls.Add(this.label1); + this.Name = "FormAddPastryInShop"; + this.Text = "FormAddPastryInShop"; + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownCount)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private ComboBox comboBoxShop; + private Label label1; + private Label label2; + private Label label3; + private ComboBox comboBoxPastry; + private NumericUpDown numericUpDownCount; + private Button buttonSave; + private Button buttonCancel; + } +} \ No newline at end of file diff --git a/Confectionery/FormAddPastryInShop.cs b/Confectionery/FormAddPastryInShop.cs new file mode 100644 index 0000000..e5c786b --- /dev/null +++ b/Confectionery/FormAddPastryInShop.cs @@ -0,0 +1,49 @@ +using ConfectioneryContracts.BusinessLogicsContracts; +using ConfectioneryContracts.ViewModels; +using Microsoft.Extensions.Logging; +using System; +using System.Collections; +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 ConfectioneryView +{ + public partial class FormAddPastryInShop : Form + { + private readonly ILogger _logger; + private readonly List? _listShops; + private readonly List? _listPastries; + + public FormAddPastryInShop(ILogger logger, IShopLogic shopLogic, IPastryLogic pastryLogic) + { + InitializeComponent(); + _logger = logger; + _listShops = shopLogic.ReadList(null); + if (_listShops != null) + { + comboBoxShop.DisplayMember = "ComponentName"; + comboBoxShop.ValueMember = "Id"; + comboBoxShop.DataSource = _listShops; + comboBoxShop.SelectedItem = null; + } + + _listPastries + } + + private void ButtonSave_Click(object sender, EventArgs e) + { + + } + + private void ButtonCancel_Click(object sender, EventArgs e) + { + + } + } +} diff --git a/Confectionery/FormAddPastryInShop.resx b/Confectionery/FormAddPastryInShop.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/Confectionery/FormAddPastryInShop.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/Confectionery/FormMain.Designer.cs b/Confectionery/FormMain.Designer.cs index 3522d86..190dc44 100644 --- a/Confectionery/FormMain.Designer.cs +++ b/Confectionery/FormMain.Designer.cs @@ -38,6 +38,7 @@ this.button2 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); + this.ShopsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); this.SuspendLayout(); @@ -56,7 +57,8 @@ // this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.pastryToolStripMenuItem, - this.componentToolStripMenuItem}); + this.componentToolStripMenuItem, + this.ShopsToolStripMenuItem}); this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem"; this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(94, 20); this.справочникиToolStripMenuItem.Text = "Справочники"; @@ -64,14 +66,14 @@ // pastryToolStripMenuItem // this.pastryToolStripMenuItem.Name = "pastryToolStripMenuItem"; - this.pastryToolStripMenuItem.Size = new System.Drawing.Size(145, 22); + this.pastryToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.pastryToolStripMenuItem.Text = "Изделия"; this.pastryToolStripMenuItem.Click += new System.EventHandler(this.PastryToolStripMenuItem_Click); // // componentToolStripMenuItem // this.componentToolStripMenuItem.Name = "componentToolStripMenuItem"; - this.componentToolStripMenuItem.Size = new System.Drawing.Size(145, 22); + this.componentToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.componentToolStripMenuItem.Text = "Компоненты"; this.componentToolStripMenuItem.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click); // @@ -142,6 +144,13 @@ this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.ButtonRef_Click); // + // ShopsToolStripMenuItem + // + this.ShopsToolStripMenuItem.Name = "ShopsToolStripMenuItem"; + this.ShopsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.ShopsToolStripMenuItem.Text = "Магазины"; + this.ShopsToolStripMenuItem.Click += new System.EventHandler(this.ShopsToolStripMenuItem_Click); + // // FormMain // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); @@ -177,5 +186,6 @@ private Button button4; private ToolStripMenuItem pastryToolStripMenuItem; private ToolStripMenuItem componentToolStripMenuItem; + private ToolStripMenuItem ShopsToolStripMenuItem; } } \ No newline at end of file diff --git a/Confectionery/FormMain.cs b/Confectionery/FormMain.cs index 628ea63..489ec5c 100644 --- a/Confectionery/FormMain.cs +++ b/Confectionery/FormMain.cs @@ -62,8 +62,7 @@ namespace ConfectioneryView private void ButtonCreateOrder_Click(object sender, EventArgs e) { - var service = - Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); + var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); if (service is FormCreateOrder form) { form.ShowDialog(); @@ -152,5 +151,15 @@ namespace ConfectioneryView { LoadData(); } + + private void ShopsToolStripMenuItem_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormViewShops)); + if (service is FormViewShops form) + { + form.ShowDialog(); + LoadData(); + } + } } } \ No newline at end of file diff --git a/Confectionery/FormShop.cs b/Confectionery/FormShop.cs index f677a26..5026ff8 100644 --- a/Confectionery/FormShop.cs +++ b/Confectionery/FormShop.cs @@ -28,7 +28,7 @@ namespace ConfectioneryView _logic = logic; if (_list != null) { - comboBoxShop.DisplayMember = "ComponentName"; + comboBoxShop.DisplayMember = "Name"; comboBoxShop.ValueMember = "Id"; comboBoxShop.DataSource = _list; comboBoxShop.SelectedItem = null;