Создана форма для добавления изделий в магазин

This commit is contained in:
Данияр Аглиуллов 2023-02-05 19:37:08 +04:00
parent 475face563
commit 6ea2ac3a75
6 changed files with 285 additions and 6 deletions

View File

@ -0,0 +1,151 @@
namespace ConfectioneryView
{
partial class FormAddPastryInShop
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@ -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<ShopViewModel>? _listShops;
private readonly List<PastryViewModel>? _listPastries;
public FormAddPastryInShop(ILogger<FormAddPastryInShop> 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)
{
}
}
}

View File

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -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;
}
}

View File

@ -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();
}
}
}
}

View File

@ -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;