merkylov_isp_41
This commit is contained in:
commit
7a2c13872c
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.vs/
|
||||
bin/
|
||||
obj/
|
||||
333
DUMP_UML_ER/MerkylovISP41_Dump.sql
Normal file
333
DUMP_UML_ER/MerkylovISP41_Dump.sql
Normal file
File diff suppressed because one or more lines are too long
BIN
DUMP_UML_ER/MerkylovISP41_ER.pdf
Normal file
BIN
DUMP_UML_ER/MerkylovISP41_ER.pdf
Normal file
Binary file not shown.
BIN
DUMP_UML_ER/UML.jpg
Normal file
BIN
DUMP_UML_ER/UML.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
25
WinFormsApp1.sln
Normal file
25
WinFormsApp1.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36915.13 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsApp1", "WinFormsApp1\WinFormsApp1.csproj", "{640976E5-3DC4-421F-A6E5-BD05DD9D08BC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{640976E5-3DC4-421F-A6E5-BD05DD9D08BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{640976E5-3DC4-421F-A6E5-BD05DD9D08BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{640976E5-3DC4-421F-A6E5-BD05DD9D08BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{640976E5-3DC4-421F-A6E5-BD05DD9D08BC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {2F0041A0-7308-4BD5-AB23-38ED95B9D881}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
370
WinFormsApp1/AddForm.Designer.cs
generated
Normal file
370
WinFormsApp1/AddForm.Designer.cs
generated
Normal file
@ -0,0 +1,370 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
partial class AddForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
comboBoxSupplier = new ComboBox();
|
||||
textBoxArticle = new TextBox();
|
||||
textBoxProdName = new TextBox();
|
||||
textBoxDesc = new TextBox();
|
||||
comboBoxUnitType = new ComboBox();
|
||||
comboBoxManufacturer = new ComboBox();
|
||||
button1 = new Button();
|
||||
comboBoxCategories = new ComboBox();
|
||||
textBoxPrice = new TextBox();
|
||||
textBoxSale = new TextBox();
|
||||
textBoxStockQuan = new TextBox();
|
||||
imageList1 = new ImageList(components);
|
||||
button2 = new Button();
|
||||
label11 = new Label();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
label4 = new Label();
|
||||
label5 = new Label();
|
||||
label6 = new Label();
|
||||
label7 = new Label();
|
||||
label8 = new Label();
|
||||
label9 = new Label();
|
||||
label10 = new Label();
|
||||
button3 = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxSupplier
|
||||
//
|
||||
comboBoxSupplier.BackColor = Color.FromArgb(133, 242, 189);
|
||||
comboBoxSupplier.Font = new Font("Comic Sans MS", 9F);
|
||||
comboBoxSupplier.FormattingEnabled = true;
|
||||
comboBoxSupplier.Location = new Point(160, 258);
|
||||
comboBoxSupplier.Name = "comboBoxSupplier";
|
||||
comboBoxSupplier.Size = new Size(208, 25);
|
||||
comboBoxSupplier.TabIndex = 0;
|
||||
//
|
||||
// textBoxArticle
|
||||
//
|
||||
textBoxArticle.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxArticle.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxArticle.Location = new Point(160, 113);
|
||||
textBoxArticle.Name = "textBoxArticle";
|
||||
textBoxArticle.Size = new Size(208, 24);
|
||||
textBoxArticle.TabIndex = 1;
|
||||
//
|
||||
// textBoxProdName
|
||||
//
|
||||
textBoxProdName.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxProdName.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxProdName.Location = new Point(160, 142);
|
||||
textBoxProdName.Name = "textBoxProdName";
|
||||
textBoxProdName.Size = new Size(208, 24);
|
||||
textBoxProdName.TabIndex = 2;
|
||||
//
|
||||
// textBoxDesc
|
||||
//
|
||||
textBoxDesc.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxDesc.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxDesc.Location = new Point(160, 200);
|
||||
textBoxDesc.Name = "textBoxDesc";
|
||||
textBoxDesc.Size = new Size(208, 24);
|
||||
textBoxDesc.TabIndex = 3;
|
||||
//
|
||||
// comboBoxUnitType
|
||||
//
|
||||
comboBoxUnitType.BackColor = Color.FromArgb(133, 242, 189);
|
||||
comboBoxUnitType.Font = new Font("Comic Sans MS", 9F);
|
||||
comboBoxUnitType.FormattingEnabled = true;
|
||||
comboBoxUnitType.Location = new Point(160, 374);
|
||||
comboBoxUnitType.Name = "comboBoxUnitType";
|
||||
comboBoxUnitType.Size = new Size(208, 25);
|
||||
comboBoxUnitType.TabIndex = 4;
|
||||
//
|
||||
// comboBoxManufacturer
|
||||
//
|
||||
comboBoxManufacturer.BackColor = Color.FromArgb(133, 242, 189);
|
||||
comboBoxManufacturer.Font = new Font("Comic Sans MS", 9F);
|
||||
comboBoxManufacturer.FormattingEnabled = true;
|
||||
comboBoxManufacturer.Location = new Point(160, 229);
|
||||
comboBoxManufacturer.Name = "comboBoxManufacturer";
|
||||
comboBoxManufacturer.Size = new Size(208, 25);
|
||||
comboBoxManufacturer.TabIndex = 5;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.BackColor = Color.Red;
|
||||
button1.Font = new Font("Comic Sans MS", 9F);
|
||||
button1.Location = new Point(447, 12);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(36, 31);
|
||||
button1.TabIndex = 6;
|
||||
button1.Text = "X";
|
||||
button1.UseVisualStyleBackColor = false;
|
||||
button1.Click += button1_Click;
|
||||
//
|
||||
// comboBoxCategories
|
||||
//
|
||||
comboBoxCategories.BackColor = Color.FromArgb(133, 242, 189);
|
||||
comboBoxCategories.Font = new Font("Comic Sans MS", 9F);
|
||||
comboBoxCategories.FormattingEnabled = true;
|
||||
comboBoxCategories.Location = new Point(160, 171);
|
||||
comboBoxCategories.Name = "comboBoxCategories";
|
||||
comboBoxCategories.Size = new Size(208, 25);
|
||||
comboBoxCategories.TabIndex = 7;
|
||||
//
|
||||
// textBoxPrice
|
||||
//
|
||||
textBoxPrice.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxPrice.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxPrice.Location = new Point(160, 287);
|
||||
textBoxPrice.Name = "textBoxPrice";
|
||||
textBoxPrice.Size = new Size(208, 24);
|
||||
textBoxPrice.TabIndex = 8;
|
||||
//
|
||||
// textBoxSale
|
||||
//
|
||||
textBoxSale.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxSale.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxSale.Location = new Point(160, 316);
|
||||
textBoxSale.Name = "textBoxSale";
|
||||
textBoxSale.Size = new Size(208, 24);
|
||||
textBoxSale.TabIndex = 9;
|
||||
//
|
||||
// textBoxStockQuan
|
||||
//
|
||||
textBoxStockQuan.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxStockQuan.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxStockQuan.Location = new Point(160, 345);
|
||||
textBoxStockQuan.Name = "textBoxStockQuan";
|
||||
textBoxStockQuan.Size = new Size(208, 24);
|
||||
textBoxStockQuan.TabIndex = 10;
|
||||
//
|
||||
// imageList1
|
||||
//
|
||||
imageList1.ColorDepth = ColorDepth.Depth32Bit;
|
||||
imageList1.ImageSize = new Size(16, 16);
|
||||
imageList1.TransparentColor = Color.Transparent;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
button2.BackColor = Color.Red;
|
||||
button2.Font = new Font("Comic Sans MS", 9F);
|
||||
button2.Location = new Point(219, 405);
|
||||
button2.Name = "button2";
|
||||
button2.Size = new Size(98, 23);
|
||||
button2.TabIndex = 11;
|
||||
button2.Text = "Добавить";
|
||||
button2.UseVisualStyleBackColor = false;
|
||||
button2.Click += btnAdd_Click;
|
||||
//
|
||||
// label11
|
||||
//
|
||||
label11.AutoSize = true;
|
||||
label11.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label11.Location = new Point(69, 378);
|
||||
label11.Name = "label11";
|
||||
label11.Size = new Size(91, 17);
|
||||
label11.TabIndex = 21;
|
||||
label11.Text = "Ед. измерения";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label1.Location = new Point(69, 116);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(56, 17);
|
||||
label1.TabIndex = 22;
|
||||
label1.Text = "Артикул";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label2.Location = new Point(69, 174);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(67, 17);
|
||||
label2.TabIndex = 23;
|
||||
label2.Text = "Категория";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label3.Location = new Point(69, 348);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(76, 17);
|
||||
label3.TabIndex = 24;
|
||||
label3.Text = "Количество";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label4.Location = new Point(69, 319);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(48, 17);
|
||||
label4.TabIndex = 25;
|
||||
label4.Text = "Скидка";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label5.Location = new Point(69, 290);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(36, 17);
|
||||
label5.TabIndex = 26;
|
||||
label5.Text = "Цена";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
label6.AutoSize = true;
|
||||
label6.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label6.Location = new Point(69, 261);
|
||||
label6.Name = "label6";
|
||||
label6.Size = new Size(74, 17);
|
||||
label6.TabIndex = 27;
|
||||
label6.Text = "Поставщик";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
label7.AutoSize = true;
|
||||
label7.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label7.Location = new Point(61, 232);
|
||||
label7.Name = "label7";
|
||||
label7.Size = new Size(99, 17);
|
||||
label7.TabIndex = 28;
|
||||
label7.Text = "Производитель";
|
||||
//
|
||||
// label8
|
||||
//
|
||||
label8.AutoSize = true;
|
||||
label8.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label8.Location = new Point(69, 203);
|
||||
label8.Name = "label8";
|
||||
label8.Size = new Size(67, 17);
|
||||
label8.TabIndex = 29;
|
||||
label8.Text = "Описание";
|
||||
//
|
||||
// label9
|
||||
//
|
||||
label9.AutoSize = true;
|
||||
label9.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label9.Location = new Point(69, 145);
|
||||
label9.Name = "label9";
|
||||
label9.Size = new Size(61, 17);
|
||||
label9.TabIndex = 30;
|
||||
label9.Text = "Название";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
label10.AutoSize = true;
|
||||
label10.Font = new Font("Comic Sans MS", 26.25F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label10.Location = new Point(121, 9);
|
||||
label10.Name = "label10";
|
||||
label10.Size = new Size(269, 49);
|
||||
label10.TabIndex = 31;
|
||||
label10.Text = "ДОБАВЛЕНИЕ";
|
||||
//
|
||||
// button3
|
||||
//
|
||||
button3.BackColor = Color.Red;
|
||||
button3.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
button3.Location = new Point(408, 415);
|
||||
button3.Name = "button3";
|
||||
button3.Size = new Size(75, 23);
|
||||
button3.TabIndex = 37;
|
||||
button3.Text = "Назад";
|
||||
button3.UseVisualStyleBackColor = false;
|
||||
button3.Click += button3_Click;
|
||||
//
|
||||
// AddForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(192, 237, 215);
|
||||
ClientSize = new Size(495, 450);
|
||||
Controls.Add(button3);
|
||||
Controls.Add(label10);
|
||||
Controls.Add(label9);
|
||||
Controls.Add(label8);
|
||||
Controls.Add(label7);
|
||||
Controls.Add(label6);
|
||||
Controls.Add(label5);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(label11);
|
||||
Controls.Add(button2);
|
||||
Controls.Add(textBoxStockQuan);
|
||||
Controls.Add(textBoxSale);
|
||||
Controls.Add(textBoxPrice);
|
||||
Controls.Add(comboBoxCategories);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(comboBoxManufacturer);
|
||||
Controls.Add(comboBoxUnitType);
|
||||
Controls.Add(textBoxDesc);
|
||||
Controls.Add(textBoxProdName);
|
||||
Controls.Add(textBoxArticle);
|
||||
Controls.Add(comboBoxSupplier);
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Name = "AddForm";
|
||||
Text = "AddForm";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxSupplier;
|
||||
private TextBox textBoxArticle;
|
||||
private TextBox textBoxProdName;
|
||||
private TextBox textBoxDesc;
|
||||
private ComboBox comboBoxUnitType;
|
||||
private ComboBox comboBoxManufacturer;
|
||||
private Button button1;
|
||||
private ComboBox comboBoxCategories;
|
||||
private TextBox textBoxPrice;
|
||||
private TextBox textBoxSale;
|
||||
private TextBox textBoxStockQuan;
|
||||
private ImageList imageList1;
|
||||
private Button button2;
|
||||
private Label label11;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
private Label label5;
|
||||
private Label label6;
|
||||
private Label label7;
|
||||
private Label label8;
|
||||
private Label label9;
|
||||
private Label label10;
|
||||
private Button button3;
|
||||
}
|
||||
}
|
||||
198
WinFormsApp1/AddForm.cs
Normal file
198
WinFormsApp1/AddForm.cs
Normal file
@ -0,0 +1,198 @@
|
||||
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 MySql.Data.MySqlClient;
|
||||
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
public partial class AddForm : Form
|
||||
{
|
||||
public AddForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadCategories();
|
||||
LoadManufacteries();
|
||||
LoadUnitType();
|
||||
LoadSuppliers();
|
||||
}
|
||||
private void LoadCategories()
|
||||
{
|
||||
DB db = new DB();
|
||||
DataTable categories = new DataTable();
|
||||
MySqlDataAdapter adapter = new MySqlDataAdapter();
|
||||
MySqlCommand command = new MySqlCommand("SELECT idCategory, CategoryName FROM Category", db.getConnection());
|
||||
|
||||
try
|
||||
{
|
||||
db.openConnection();
|
||||
adapter.SelectCommand = command;
|
||||
adapter.Fill(categories);
|
||||
|
||||
comboBoxCategories.DataSource = categories;
|
||||
comboBoxCategories.DisplayMember = "CategoryName";
|
||||
comboBoxCategories.ValueMember = "idCategory";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка загрузки категорий " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.closeConnection();
|
||||
}
|
||||
}
|
||||
private void LoadManufacteries()
|
||||
{
|
||||
DB db = new DB();
|
||||
DataTable manufacturer = new DataTable();
|
||||
MySqlDataAdapter adapter = new MySqlDataAdapter();
|
||||
MySqlCommand command = new MySqlCommand("SELECT idManufacturer, ManufacturerName FROM Manufacturer", db.getConnection());
|
||||
|
||||
try
|
||||
{
|
||||
db.openConnection();
|
||||
adapter.SelectCommand = command;
|
||||
adapter.Fill(manufacturer);
|
||||
|
||||
comboBoxManufacturer.DataSource = manufacturer;
|
||||
comboBoxManufacturer.DisplayMember = "ManufacturerName";
|
||||
comboBoxManufacturer.ValueMember = "idManufacturer";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка загрузки категорий " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.closeConnection();
|
||||
}
|
||||
}
|
||||
private void LoadUnitType()
|
||||
{
|
||||
DB db = new DB();
|
||||
DataTable UnitType = new DataTable();
|
||||
MySqlDataAdapter adapter = new MySqlDataAdapter();
|
||||
MySqlCommand command = new MySqlCommand("SELECT idUnitType, UnitTypeName FROM UnitType", db.getConnection());
|
||||
|
||||
try
|
||||
{
|
||||
db.openConnection();
|
||||
adapter.SelectCommand = command;
|
||||
adapter.Fill(UnitType);
|
||||
|
||||
comboBoxUnitType.DataSource = UnitType;
|
||||
comboBoxUnitType.DisplayMember = "UnitTypeName";
|
||||
comboBoxUnitType.ValueMember = "idUnitType";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка загрузки категорий " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.closeConnection();
|
||||
}
|
||||
}
|
||||
private void LoadSuppliers()
|
||||
{
|
||||
DB db = new DB();
|
||||
DataTable suppliers = new DataTable();
|
||||
MySqlDataAdapter adapter = new MySqlDataAdapter();
|
||||
MySqlCommand command = new MySqlCommand("SELECT idSupplier, SupplierName FROM Supplier", db.getConnection());
|
||||
|
||||
try
|
||||
{
|
||||
db.openConnection();
|
||||
adapter.SelectCommand = command;
|
||||
adapter.Fill(suppliers);
|
||||
|
||||
comboBoxSupplier.DataSource = suppliers;
|
||||
comboBoxSupplier.DisplayMember = "SupplierName";
|
||||
comboBoxSupplier.ValueMember = "idSupplier";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка загрузки категорий " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.closeConnection();
|
||||
}
|
||||
}
|
||||
private async void btnAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
DB db = new DB();
|
||||
|
||||
try
|
||||
{
|
||||
db.openConnection();
|
||||
|
||||
string query = "INSERT INTO Products (Article, ProductName, Category_id, ProductDescryption, Manufacturer_id, Supplier_id, Price, Discount, QuantityStock, UnitType_id)" +
|
||||
"VALUES (@art, @prodname, @cat, @des, @manu, @supp, @price, @sale, @quan, @Unit)";
|
||||
|
||||
using (MySqlCommand command = new MySqlCommand(query, db.getConnection()))
|
||||
{
|
||||
command.Parameters.AddWithValue("@art", textBoxArticle.Text);
|
||||
command.Parameters.AddWithValue("@prodname", textBoxProdName.Text);
|
||||
command.Parameters.AddWithValue("@cat", comboBoxCategories.SelectedValue.ToString());
|
||||
command.Parameters.AddWithValue("@des", textBoxDesc.Text);
|
||||
command.Parameters.AddWithValue("@manu", comboBoxManufacturer.SelectedValue.ToString());
|
||||
command.Parameters.AddWithValue("@supp", comboBoxSupplier.SelectedValue.ToString());
|
||||
command.Parameters.AddWithValue("@price", textBoxPrice.Text);
|
||||
command.Parameters.AddWithValue("@sale", textBoxSale.Text);
|
||||
command.Parameters.AddWithValue("@quan", textBoxStockQuan.Text);
|
||||
command.Parameters.AddWithValue("@Unit", comboBoxUnitType.SelectedValue.ToString());
|
||||
|
||||
|
||||
int rowsAffected = await command.ExecuteNonQueryAsync();
|
||||
|
||||
if (rowsAffected > 0)
|
||||
{
|
||||
MessageBox.Show("Заказ успешно добавлен!");
|
||||
DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
AdmMainForm ado = new AdmMainForm();
|
||||
ado.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Ошибка при добавлении заказа.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка базы данных: " + ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Произошла: " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.closeConnection();
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
AdmMainForm Adm = new AdmMainForm();
|
||||
Adm.Show();
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
AdmMainForm af = new AdmMainForm();
|
||||
af.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
123
WinFormsApp1/AddForm.resx
Normal file
123
WinFormsApp1/AddForm.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
||||
<metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
359
WinFormsApp1/AdmMainForm.Designer.cs
generated
Normal file
359
WinFormsApp1/AdmMainForm.Designer.cs
generated
Normal file
@ -0,0 +1,359 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
partial class AdmMainForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridViewProduct = new DataGridView();
|
||||
NameLabel = new Label();
|
||||
CategoryLabel = new Label();
|
||||
comboBoxSort = new ComboBox();
|
||||
comboBoxFilter = new ComboBox();
|
||||
textBoxSearch = new TextBox();
|
||||
button1 = new Button();
|
||||
button2 = new Button();
|
||||
delete = new Button();
|
||||
labelFIO = new Label();
|
||||
ExitButton = new Button();
|
||||
panel1 = new Panel();
|
||||
panel2 = new Panel();
|
||||
CountLabel = new Label();
|
||||
PriceLabel = new Label();
|
||||
pictureBox1 = new PictureBox();
|
||||
panel3 = new Panel();
|
||||
Descyption = new Label();
|
||||
SupplierLabel = new Label();
|
||||
ManufacturerLabel = new Label();
|
||||
label10 = new Label();
|
||||
button3 = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProduct).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
panel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||
panel3.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewProduct
|
||||
//
|
||||
dataGridViewProduct.AllowUserToAddRows = false;
|
||||
dataGridViewProduct.AllowUserToDeleteRows = false;
|
||||
dataGridViewProduct.AllowUserToResizeColumns = false;
|
||||
dataGridViewProduct.AllowUserToResizeRows = false;
|
||||
dataGridViewProduct.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
dataGridViewProduct.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells;
|
||||
dataGridViewProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewProduct.Location = new Point(12, 112);
|
||||
dataGridViewProduct.Name = "dataGridViewProduct";
|
||||
dataGridViewProduct.Size = new Size(764, 245);
|
||||
dataGridViewProduct.TabIndex = 0;
|
||||
dataGridViewProduct.Click += dataGridViewProd_Click;
|
||||
//
|
||||
// NameLabel
|
||||
//
|
||||
NameLabel.AutoSize = true;
|
||||
NameLabel.Font = new Font("Comic Sans MS", 15F, FontStyle.Bold);
|
||||
NameLabel.Location = new Point(162, -1);
|
||||
NameLabel.Name = "NameLabel";
|
||||
NameLabel.Size = new Size(157, 29);
|
||||
NameLabel.TabIndex = 4;
|
||||
NameLabel.Text = "Наименование";
|
||||
//
|
||||
// CategoryLabel
|
||||
//
|
||||
CategoryLabel.AutoSize = true;
|
||||
CategoryLabel.Font = new Font("Comic Sans MS", 13F);
|
||||
CategoryLabel.Location = new Point(162, 28);
|
||||
CategoryLabel.Name = "CategoryLabel";
|
||||
CategoryLabel.Size = new Size(97, 24);
|
||||
CategoryLabel.TabIndex = 5;
|
||||
CategoryLabel.Text = "Категория";
|
||||
//
|
||||
// comboBoxSort
|
||||
//
|
||||
comboBoxSort.BackColor = Color.FromArgb(133, 242, 189);
|
||||
comboBoxSort.Font = new Font("Comic Sans MS", 9F);
|
||||
comboBoxSort.FormattingEnabled = true;
|
||||
comboBoxSort.Location = new Point(12, 83);
|
||||
comboBoxSort.Name = "comboBoxSort";
|
||||
comboBoxSort.Size = new Size(121, 25);
|
||||
comboBoxSort.TabIndex = 6;
|
||||
comboBoxSort.SelectedIndexChanged += comboBoxSort_SelectedIndexChanged;
|
||||
//
|
||||
// comboBoxFilter
|
||||
//
|
||||
comboBoxFilter.BackColor = Color.FromArgb(133, 242, 189);
|
||||
comboBoxFilter.Font = new Font("Comic Sans MS", 9F);
|
||||
comboBoxFilter.FormattingEnabled = true;
|
||||
comboBoxFilter.Location = new Point(200, 83);
|
||||
comboBoxFilter.Name = "comboBoxFilter";
|
||||
comboBoxFilter.Size = new Size(121, 25);
|
||||
comboBoxFilter.TabIndex = 7;
|
||||
comboBoxFilter.SelectedIndexChanged += comboBoxFilter_SelectedIndexChanged;
|
||||
//
|
||||
// textBoxSearch
|
||||
//
|
||||
textBoxSearch.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxSearch.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxSearch.Location = new Point(378, 83);
|
||||
textBoxSearch.Name = "textBoxSearch";
|
||||
textBoxSearch.Size = new Size(141, 24);
|
||||
textBoxSearch.TabIndex = 8;
|
||||
textBoxSearch.TextChanged += textBoxSearch_TextChanged;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.BackColor = Color.Red;
|
||||
button1.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
button1.Location = new Point(681, 376);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(107, 23);
|
||||
button1.TabIndex = 9;
|
||||
button1.Text = "Добавить";
|
||||
button1.UseVisualStyleBackColor = false;
|
||||
button1.Click += button1_Click;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
button2.BackColor = Color.Red;
|
||||
button2.Font = new Font("Comic Sans MS", 9F);
|
||||
button2.Location = new Point(681, 463);
|
||||
button2.Name = "button2";
|
||||
button2.Size = new Size(107, 23);
|
||||
button2.TabIndex = 10;
|
||||
button2.Text = "Редактировать";
|
||||
button2.UseVisualStyleBackColor = false;
|
||||
button2.Click += button2_Click;
|
||||
//
|
||||
// delete
|
||||
//
|
||||
delete.BackColor = Color.Red;
|
||||
delete.Font = new Font("Comic Sans MS", 9F);
|
||||
delete.Location = new Point(681, 419);
|
||||
delete.Name = "delete";
|
||||
delete.Size = new Size(107, 23);
|
||||
delete.TabIndex = 11;
|
||||
delete.Text = "Удалить";
|
||||
delete.UseVisualStyleBackColor = false;
|
||||
delete.Click += btnDelete_Click;
|
||||
//
|
||||
// labelFIO
|
||||
//
|
||||
labelFIO.AutoSize = true;
|
||||
labelFIO.Font = new Font("Comic Sans MS", 9F);
|
||||
labelFIO.Location = new Point(547, 87);
|
||||
labelFIO.Name = "labelFIO";
|
||||
labelFIO.Size = new Size(35, 17);
|
||||
labelFIO.TabIndex = 12;
|
||||
labelFIO.Text = "ФИО";
|
||||
//
|
||||
// ExitButton
|
||||
//
|
||||
ExitButton.BackColor = Color.Red;
|
||||
ExitButton.Location = new Point(757, 9);
|
||||
ExitButton.Name = "ExitButton";
|
||||
ExitButton.Size = new Size(31, 26);
|
||||
ExitButton.TabIndex = 13;
|
||||
ExitButton.Text = "X";
|
||||
ExitButton.UseVisualStyleBackColor = false;
|
||||
ExitButton.Click += ExitButton_Click;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.BackColor = Color.FromArgb(133, 242, 189);
|
||||
panel1.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel1.Controls.Add(panel2);
|
||||
panel1.Controls.Add(pictureBox1);
|
||||
panel1.Controls.Add(panel3);
|
||||
panel1.Controls.Add(SupplierLabel);
|
||||
panel1.Controls.Add(ManufacturerLabel);
|
||||
panel1.Controls.Add(NameLabel);
|
||||
panel1.Controls.Add(CategoryLabel);
|
||||
panel1.Location = new Point(66, 363);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(609, 150);
|
||||
panel1.TabIndex = 14;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
panel2.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel2.Controls.Add(CountLabel);
|
||||
panel2.Controls.Add(PriceLabel);
|
||||
panel2.Location = new Point(444, -1);
|
||||
panel2.Name = "panel2";
|
||||
panel2.Size = new Size(164, 150);
|
||||
panel2.TabIndex = 15;
|
||||
//
|
||||
// CountLabel
|
||||
//
|
||||
CountLabel.AutoSize = true;
|
||||
CountLabel.Font = new Font("Comic Sans MS", 9.75F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
CountLabel.Location = new Point(58, 43);
|
||||
CountLabel.Name = "CountLabel";
|
||||
CountLabel.Size = new Size(82, 18);
|
||||
CountLabel.TabIndex = 1;
|
||||
CountLabel.Text = "Количество";
|
||||
//
|
||||
// PriceLabel
|
||||
//
|
||||
PriceLabel.AutoSize = true;
|
||||
PriceLabel.Font = new Font("Comic Sans MS", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
PriceLabel.Location = new Point(35, 10);
|
||||
PriceLabel.Name = "PriceLabel";
|
||||
PriceLabel.Size = new Size(0, 23);
|
||||
PriceLabel.TabIndex = 0;
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
pictureBox1.BorderStyle = BorderStyle.FixedSingle;
|
||||
pictureBox1.Location = new Point(19, 10);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new Size(137, 127);
|
||||
pictureBox1.TabIndex = 19;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
panel3.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel3.Controls.Add(Descyption);
|
||||
panel3.Location = new Point(162, 55);
|
||||
panel3.Name = "panel3";
|
||||
panel3.Size = new Size(276, 44);
|
||||
panel3.TabIndex = 18;
|
||||
//
|
||||
// Descyption
|
||||
//
|
||||
Descyption.AutoSize = true;
|
||||
Descyption.Font = new Font("Comic Sans MS", 9.5F);
|
||||
Descyption.Location = new Point(-1, -1);
|
||||
Descyption.Name = "Descyption";
|
||||
Descyption.Size = new Size(70, 18);
|
||||
Descyption.TabIndex = 15;
|
||||
Descyption.Text = "Описание";
|
||||
//
|
||||
// SupplierLabel
|
||||
//
|
||||
SupplierLabel.AutoSize = true;
|
||||
SupplierLabel.Font = new Font("Comic Sans MS", 10F);
|
||||
SupplierLabel.Location = new Point(162, 99);
|
||||
SupplierLabel.Name = "SupplierLabel";
|
||||
SupplierLabel.Size = new Size(119, 19);
|
||||
SupplierLabel.TabIndex = 17;
|
||||
SupplierLabel.Text = "Производитель:";
|
||||
//
|
||||
// ManufacturerLabel
|
||||
//
|
||||
ManufacturerLabel.AutoSize = true;
|
||||
ManufacturerLabel.Font = new Font("Comic Sans MS", 10F);
|
||||
ManufacturerLabel.Location = new Point(162, 118);
|
||||
ManufacturerLabel.Name = "ManufacturerLabel";
|
||||
ManufacturerLabel.Size = new Size(89, 19);
|
||||
ManufacturerLabel.TabIndex = 16;
|
||||
ManufacturerLabel.Text = "Поставщик:";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
label10.AutoSize = true;
|
||||
label10.Font = new Font("Comic Sans MS", 26.25F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label10.Location = new Point(67, 9);
|
||||
label10.Name = "label10";
|
||||
label10.Size = new Size(684, 49);
|
||||
label10.TabIndex = 32;
|
||||
label10.Text = "ГЛАВНАЯ ФОРМА АДМИНИСТРАТОРА";
|
||||
//
|
||||
// button3
|
||||
//
|
||||
button3.BackColor = Color.Red;
|
||||
button3.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
button3.Location = new Point(701, 504);
|
||||
button3.Name = "button3";
|
||||
button3.Size = new Size(75, 23);
|
||||
button3.TabIndex = 37;
|
||||
button3.Text = "Назад";
|
||||
button3.UseVisualStyleBackColor = false;
|
||||
button3.Click += button3_Click;
|
||||
//
|
||||
// AdmMainForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(192, 237, 215);
|
||||
ClientSize = new Size(800, 539);
|
||||
Controls.Add(button3);
|
||||
Controls.Add(label10);
|
||||
Controls.Add(panel1);
|
||||
Controls.Add(ExitButton);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(labelFIO);
|
||||
Controls.Add(delete);
|
||||
Controls.Add(button2);
|
||||
Controls.Add(textBoxSearch);
|
||||
Controls.Add(comboBoxFilter);
|
||||
Controls.Add(comboBoxSort);
|
||||
Controls.Add(dataGridViewProduct);
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Name = "AdmMainForm";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "AdmMainForm";
|
||||
Load += AdmMainForm_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProduct).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
panel1.PerformLayout();
|
||||
panel2.ResumeLayout(false);
|
||||
panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||
panel3.ResumeLayout(false);
|
||||
panel3.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewProduct;
|
||||
private Label NameLabel;
|
||||
private Label CategoryLabel;
|
||||
private ComboBox comboBoxSort;
|
||||
private ComboBox comboBoxFilter;
|
||||
private TextBox textBoxSearch;
|
||||
private Button button1;
|
||||
private Button button2;
|
||||
private Button delete;
|
||||
private Label labelFIO;
|
||||
private Button ExitButton;
|
||||
private Panel panel1;
|
||||
private Label Descyption;
|
||||
private Panel panel2;
|
||||
private Label SupplierLabel;
|
||||
private Label ManufacturerLabel;
|
||||
private Label CountLabel;
|
||||
private Label PriceLabel;
|
||||
private Panel panel3;
|
||||
private PictureBox pictureBox1;
|
||||
private Label label10;
|
||||
private Button button3;
|
||||
}
|
||||
}
|
||||
290
WinFormsApp1/AdmMainForm.cs
Normal file
290
WinFormsApp1/AdmMainForm.cs
Normal file
@ -0,0 +1,290 @@
|
||||
using MySql.Data.MySqlClient;
|
||||
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 WinFormsApp1;
|
||||
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
public partial class AdmMainForm : Form
|
||||
{
|
||||
public AdmMainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadProdData();
|
||||
LoadSortOptions();
|
||||
LoadFilterOptions();
|
||||
}
|
||||
private MySqlDataAdapter dataAdapter;
|
||||
private DataTable prodTable;
|
||||
private BindingSource bindingSource = new BindingSource();
|
||||
private void LoadProdData()
|
||||
{
|
||||
try
|
||||
{
|
||||
DB db = new DB();
|
||||
using (MySqlConnection connection = db.getConnection())
|
||||
{
|
||||
connection.Open();
|
||||
string query = "SELECT idProducts, Article AS `Артикул`, ProductName AS `название товара`, CategoryName AS `Категория`, ProductDescryption AS `Описание`, ManufacturerName AS `Производитель`, SupplierName AS `Поставщик`, Price AS `Цена`, Discount AS `Возможная скидка`, QuantityStock AS `Количество на складе`, UnitTypeName AS `Единица измерения` FROM Products LEFT JOIN Category ON Products.Category_id = Category.idCategory JOIN Manufacturer ON Products.Manufacturer_id = Manufacturer.idManufacturer JOIN Supplier ON Products.Supplier_id = Supplier.idSupplier JOIN UnitType ON Products.UnitType_id = UnitType.idUnitType";
|
||||
|
||||
dataAdapter = new MySqlDataAdapter(query, connection);
|
||||
prodTable = new DataTable();
|
||||
dataAdapter.Fill(prodTable);
|
||||
dataGridViewProduct.RowTemplate.Height = 60;
|
||||
bindingSource.DataSource = prodTable;
|
||||
dataGridViewProduct.DataSource = bindingSource;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch (MySqlException ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка при подключении к базе данных или выполнении запроса: " + ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Произошла общая ошибка: " + ex.Message);
|
||||
}
|
||||
}
|
||||
private void dataGridViewProd_Click(object sender, EventArgs e)
|
||||
{
|
||||
CategoryLabel.Text = dataGridViewProduct.CurrentRow.Cells[3].Value.ToString();
|
||||
NameLabel.Text = dataGridViewProduct.CurrentRow.Cells[2].Value.ToString();
|
||||
Descyption.Text = dataGridViewProduct.CurrentRow.Cells[4].Value.ToString();
|
||||
PriceLabel.Text = dataGridViewProduct.CurrentRow.Cells[7].Value.ToString();
|
||||
CountLabel.Text = dataGridViewProduct.CurrentRow.Cells[9].Value.ToString();
|
||||
ManufacturerLabel.Text = dataGridViewProduct.CurrentRow.Cells[5].Value.ToString();
|
||||
SupplierLabel.Text = dataGridViewProduct.CurrentRow.Cells[6].Value.ToString();
|
||||
}
|
||||
private void LoadSortOptions()
|
||||
{
|
||||
comboBoxSort.Items.Add("По умолчанию");
|
||||
comboBoxSort.Items.Add("Цена (возрастающая)");
|
||||
comboBoxSort.Items.Add("Цена (убывающая)");
|
||||
comboBoxSort.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void comboBoxSort_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string sortOption = comboBoxSort.SelectedItem.ToString();
|
||||
|
||||
switch (sortOption)
|
||||
{
|
||||
case "По умолчанию":
|
||||
bindingSource.Sort = "";
|
||||
break;
|
||||
case "Цена (возрастающая)":
|
||||
bindingSource.Sort = "Цена ASC";
|
||||
break;
|
||||
case "Цена (убывающая)":
|
||||
bindingSource.Sort = "Цена DESC";
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void LoadFilterOptions()
|
||||
{
|
||||
comboBoxFilter.Items.Add("Все производители");
|
||||
comboBoxFilter.Items.Add("Adidas");
|
||||
comboBoxFilter.Items.Add("Barbell");
|
||||
comboBoxFilter.Items.Add("Demix");
|
||||
comboBoxFilter.Items.Add("Deuter");
|
||||
comboBoxFilter.Items.Add("Everlast");
|
||||
comboBoxFilter.Items.Add("Fischer");
|
||||
comboBoxFilter.Items.Add("Head");
|
||||
comboBoxFilter.Items.Add("Joss");
|
||||
comboBoxFilter.Items.Add("Kettler");
|
||||
comboBoxFilter.Items.Add("Mikasa");
|
||||
comboBoxFilter.Items.Add("Nike");
|
||||
comboBoxFilter.Items.Add("Nordway");
|
||||
comboBoxFilter.Items.Add("Outventure");
|
||||
comboBoxFilter.Items.Add("Puma");
|
||||
comboBoxFilter.Items.Add("Reebok");
|
||||
comboBoxSort.SelectedIndex = 0;
|
||||
}
|
||||
private void comboBoxFilter_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string filterOption = comboBoxFilter.SelectedItem.ToString().Trim();
|
||||
switch (filterOption)
|
||||
{
|
||||
case "Все производители":
|
||||
bindingSource.Filter = "";
|
||||
break;
|
||||
|
||||
case "Adidas":
|
||||
bindingSource.Filter = "[Производитель] = 'Adidas'";
|
||||
break;
|
||||
|
||||
case "Barbell":
|
||||
bindingSource.Filter = "[Производитель] = 'Barbell'";
|
||||
break;
|
||||
|
||||
case "Demix":
|
||||
bindingSource.Filter = "[Производитель] = 'Demix'";
|
||||
break;
|
||||
|
||||
case "Deuter":
|
||||
bindingSource.Filter = "[Производитель] = 'Deuter'";
|
||||
break;
|
||||
|
||||
case "Everlast":
|
||||
bindingSource.Filter = "[Производитель] = 'Everlast'";
|
||||
break;
|
||||
|
||||
case "Fischer":
|
||||
bindingSource.Filter = "[Производитель] = 'Fischer'";
|
||||
break;
|
||||
|
||||
case "Head":
|
||||
bindingSource.Filter = "[Производитель] = 'Head'";
|
||||
break;
|
||||
|
||||
case "Joss":
|
||||
bindingSource.Filter = "[Производитель] = 'Joss'";
|
||||
break;
|
||||
|
||||
case "Kettler":
|
||||
bindingSource.Filter = "[Производитель] = 'Kettler'";
|
||||
break;
|
||||
|
||||
case "Mikasa":
|
||||
bindingSource.Filter = "[Производитель] = 'Mikasa'";
|
||||
break;
|
||||
|
||||
case "Nike":
|
||||
bindingSource.Filter = "[Производитель] = 'Nike'";
|
||||
break;
|
||||
|
||||
case "Nordway":
|
||||
bindingSource.Filter = "[Производитель] = 'Nordway'";
|
||||
break;
|
||||
|
||||
case "Outventure":
|
||||
bindingSource.Filter = "[Производитель] = 'Outventure'";
|
||||
break;
|
||||
|
||||
case "Puma":
|
||||
bindingSource.Filter = "[Производитель] = 'Puma'";
|
||||
break;
|
||||
|
||||
case "Reebok":
|
||||
bindingSource.Filter = "[Производитель] = 'Reebok'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void textBoxSearch_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
var value = textBoxSearch.Text.Trim().Replace("'", "''");
|
||||
|
||||
bindingSource.Filter = string.IsNullOrWhiteSpace(value)
|
||||
? ""
|
||||
: $"[Артикул] LIKE '%{value}%' OR " +
|
||||
$"[Производитель] LIKE '%{value}%' OR " +
|
||||
$"[Поставщик] LIKE '%{value}%' OR " +
|
||||
$"[Категория] LIKE '%{value}%' OR " +
|
||||
$"Convert([Цена], 'System.String') LIKE '%{value}%' OR " +
|
||||
$"Convert([Возможная скидка], 'System.String') LIKE '%{value}%'";
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
AddForm adm = new AddForm();
|
||||
adm.Show();
|
||||
}
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridViewProduct.SelectedRows.Count > 0)
|
||||
{
|
||||
string articleToEdit = Convert.ToString(dataGridViewProduct.SelectedRows[0].Cells["idProducts"].Value);
|
||||
|
||||
this.Hide();
|
||||
|
||||
Reduct2 editProductForm = new Reduct2(articleToEdit);
|
||||
|
||||
DialogResult result = editProductForm.ShowDialog();
|
||||
|
||||
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
LoadProdData();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Пожалуйста, выберите строку для редактирования.");
|
||||
}
|
||||
}
|
||||
private void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridViewProduct.SelectedRows.Count > 0)
|
||||
{
|
||||
int rowIndex = dataGridViewProduct.SelectedRows[0].Index;
|
||||
int idToDelete = Convert.ToInt32(dataGridViewProduct.SelectedRows[0].Cells["idProducts"].Value);
|
||||
DeleteData(idToDelete);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Пожалуйста, выберите строку для удаления.");
|
||||
}
|
||||
}
|
||||
private void DeleteData(int idToDelete)
|
||||
{
|
||||
try
|
||||
{
|
||||
DB db = new DB();
|
||||
using (MySqlConnection connection = db.getConnection())
|
||||
{
|
||||
connection.Open();
|
||||
string query = "DELETE FROM Products WHERE idProducts = @id";
|
||||
using (MySqlCommand command = new MySqlCommand(query, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@id", idToDelete);
|
||||
|
||||
int rowsAffected = command.ExecuteNonQuery();
|
||||
|
||||
if (rowsAffected > 0)
|
||||
{
|
||||
MessageBox.Show("Запись успешно удалена.");
|
||||
LoadProdData();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Не удалось удалить запись.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException ex) when (ex.Number == 1451)
|
||||
{
|
||||
MessageBox.Show("Невозможно удалить товар который находится в заказе.");
|
||||
}
|
||||
catch (MySqlException ex)
|
||||
{
|
||||
MessageBox.Show("Произошла общая ошибка при удалении: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void ExitButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
private void AdmMainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
labelFIO.Text = loginForm.FIO;
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
loginForm lf = new loginForm();
|
||||
lf.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
WinFormsApp1/AdmMainForm.resx
Normal file
120
WinFormsApp1/AdmMainForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
||||
110
WinFormsApp1/AdmOrderForm.Designer.cs
generated
Normal file
110
WinFormsApp1/AdmOrderForm.Designer.cs
generated
Normal file
@ -0,0 +1,110 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
partial class AdmOrderForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
button1 = new Button();
|
||||
label10 = new Label();
|
||||
dataGridViewProduct = new DataGridView();
|
||||
ExitButton = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProduct).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.BackColor = Color.Red;
|
||||
button1.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
button1.Location = new Point(713, 415);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(75, 23);
|
||||
button1.TabIndex = 37;
|
||||
button1.Text = "Назад";
|
||||
button1.UseVisualStyleBackColor = false;
|
||||
button1.Click += button1_Click;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
label10.AutoSize = true;
|
||||
label10.Font = new Font("Comic Sans MS", 26.25F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label10.Location = new Point(62, 9);
|
||||
label10.Name = "label10";
|
||||
label10.Size = new Size(679, 49);
|
||||
label10.TabIndex = 39;
|
||||
label10.Text = "ФОРМА ЗАКАЗОВ АДМИНИСТРАТОРА";
|
||||
//
|
||||
// dataGridViewProduct
|
||||
//
|
||||
dataGridViewProduct.AllowUserToAddRows = false;
|
||||
dataGridViewProduct.AllowUserToDeleteRows = false;
|
||||
dataGridViewProduct.AllowUserToResizeColumns = false;
|
||||
dataGridViewProduct.AllowUserToResizeRows = false;
|
||||
dataGridViewProduct.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
dataGridViewProduct.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells;
|
||||
dataGridViewProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewProduct.Location = new Point(12, 84);
|
||||
dataGridViewProduct.Name = "dataGridViewProduct";
|
||||
dataGridViewProduct.Size = new Size(776, 308);
|
||||
dataGridViewProduct.TabIndex = 38;
|
||||
//
|
||||
// ExitButton
|
||||
//
|
||||
ExitButton.BackColor = Color.Red;
|
||||
ExitButton.Location = new Point(758, 9);
|
||||
ExitButton.Name = "ExitButton";
|
||||
ExitButton.Size = new Size(30, 27);
|
||||
ExitButton.TabIndex = 40;
|
||||
ExitButton.Text = "X";
|
||||
ExitButton.UseVisualStyleBackColor = false;
|
||||
ExitButton.Click += ExitButton_Click;
|
||||
//
|
||||
// AdmOrderForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(192, 237, 215);
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(ExitButton);
|
||||
Controls.Add(label10);
|
||||
Controls.Add(dataGridViewProduct);
|
||||
Controls.Add(button1);
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Name = "AdmOrderForm";
|
||||
Text = "AdmOrderForm";
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProduct).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button button1;
|
||||
private Label label10;
|
||||
private DataGridView dataGridViewProduct;
|
||||
private Button ExitButton;
|
||||
}
|
||||
}
|
||||
32
WinFormsApp1/AdmOrderForm.cs
Normal file
32
WinFormsApp1/AdmOrderForm.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
public partial class AdmOrderForm : Form
|
||||
{
|
||||
public AdmOrderForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
AdmMainForm af = new AdmMainForm();
|
||||
af.Show();
|
||||
}
|
||||
|
||||
private void ExitButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
WinFormsApp1/AdmOrderForm.resx
Normal file
120
WinFormsApp1/AdmOrderForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
||||
29
WinFormsApp1/DB.cs
Normal file
29
WinFormsApp1/DB.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MySql.Data.MySqlClient;
|
||||
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
internal class DB
|
||||
{
|
||||
MySqlConnection connection = new MySqlConnection("server=85.239.57.125;port=3306;username=ISP41_Merkylov;password=ISP41_Merkylov;database=Merkylov_Sportmag");
|
||||
public void openConnection()
|
||||
{
|
||||
if (connection.State == System.Data.ConnectionState.Closed)
|
||||
connection.Open();
|
||||
}
|
||||
public void closeConnection()
|
||||
{
|
||||
if (connection.State == System.Data.ConnectionState.Open)
|
||||
connection.Close();
|
||||
}
|
||||
public MySqlConnection getConnection()
|
||||
{
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
251
WinFormsApp1/GuestForm.Designer.cs
generated
Normal file
251
WinFormsApp1/GuestForm.Designer.cs
generated
Normal file
@ -0,0 +1,251 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
partial class GuestForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
ExitButton = new Button();
|
||||
dataGridViewGuest = new DataGridView();
|
||||
panel1 = new Panel();
|
||||
panel2 = new Panel();
|
||||
CountLabel = new Label();
|
||||
PriceLabel = new Label();
|
||||
pictureBox1 = new PictureBox();
|
||||
panel3 = new Panel();
|
||||
Descyption = new Label();
|
||||
SupplierLabel = new Label();
|
||||
ManufacturerLabel = new Label();
|
||||
NameLabel = new Label();
|
||||
CategoryLabel = new Label();
|
||||
label10 = new Label();
|
||||
button1 = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewGuest).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
panel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||
panel3.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// ExitButton
|
||||
//
|
||||
ExitButton.BackColor = Color.Red;
|
||||
ExitButton.Location = new Point(758, 12);
|
||||
ExitButton.Name = "ExitButton";
|
||||
ExitButton.Size = new Size(30, 27);
|
||||
ExitButton.TabIndex = 0;
|
||||
ExitButton.Text = "X";
|
||||
ExitButton.UseVisualStyleBackColor = false;
|
||||
ExitButton.Click += ExitButton_Click;
|
||||
//
|
||||
// dataGridViewGuest
|
||||
//
|
||||
dataGridViewGuest.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewGuest.Location = new Point(91, 71);
|
||||
dataGridViewGuest.Name = "dataGridViewGuest";
|
||||
dataGridViewGuest.Size = new Size(643, 259);
|
||||
dataGridViewGuest.TabIndex = 1;
|
||||
dataGridViewGuest.Click += dataGridViewGuest_Click;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel1.Controls.Add(panel2);
|
||||
panel1.Controls.Add(pictureBox1);
|
||||
panel1.Controls.Add(panel3);
|
||||
panel1.Controls.Add(SupplierLabel);
|
||||
panel1.Controls.Add(ManufacturerLabel);
|
||||
panel1.Controls.Add(NameLabel);
|
||||
panel1.Controls.Add(CategoryLabel);
|
||||
panel1.Location = new Point(107, 347);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(609, 150);
|
||||
panel1.TabIndex = 15;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
panel2.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel2.Controls.Add(CountLabel);
|
||||
panel2.Controls.Add(PriceLabel);
|
||||
panel2.Location = new Point(444, -1);
|
||||
panel2.Name = "panel2";
|
||||
panel2.Size = new Size(164, 150);
|
||||
panel2.TabIndex = 15;
|
||||
//
|
||||
// CountLabel
|
||||
//
|
||||
CountLabel.AutoSize = true;
|
||||
CountLabel.Font = new Font("Comic Sans MS", 9.75F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
CountLabel.Location = new Point(44, 44);
|
||||
CountLabel.Name = "CountLabel";
|
||||
CountLabel.Size = new Size(82, 18);
|
||||
CountLabel.TabIndex = 1;
|
||||
CountLabel.Text = "Количество";
|
||||
//
|
||||
// PriceLabel
|
||||
//
|
||||
PriceLabel.AutoSize = true;
|
||||
PriceLabel.Font = new Font("Comic Sans MS", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
PriceLabel.Location = new Point(35, 10);
|
||||
PriceLabel.Name = "PriceLabel";
|
||||
PriceLabel.Size = new Size(0, 23);
|
||||
PriceLabel.TabIndex = 0;
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
pictureBox1.BorderStyle = BorderStyle.FixedSingle;
|
||||
pictureBox1.Location = new Point(19, 10);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new Size(137, 127);
|
||||
pictureBox1.TabIndex = 19;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
panel3.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel3.Controls.Add(Descyption);
|
||||
panel3.Location = new Point(162, 55);
|
||||
panel3.Name = "panel3";
|
||||
panel3.Size = new Size(276, 44);
|
||||
panel3.TabIndex = 18;
|
||||
//
|
||||
// Descyption
|
||||
//
|
||||
Descyption.AutoSize = true;
|
||||
Descyption.Font = new Font("Comic Sans MS", 9.5F);
|
||||
Descyption.Location = new Point(-1, -1);
|
||||
Descyption.Name = "Descyption";
|
||||
Descyption.Size = new Size(70, 18);
|
||||
Descyption.TabIndex = 15;
|
||||
Descyption.Text = "Описание";
|
||||
//
|
||||
// SupplierLabel
|
||||
//
|
||||
SupplierLabel.AutoSize = true;
|
||||
SupplierLabel.Font = new Font("Comic Sans MS", 10F);
|
||||
SupplierLabel.Location = new Point(162, 99);
|
||||
SupplierLabel.Name = "SupplierLabel";
|
||||
SupplierLabel.Size = new Size(119, 19);
|
||||
SupplierLabel.TabIndex = 17;
|
||||
SupplierLabel.Text = "Производитель:";
|
||||
//
|
||||
// ManufacturerLabel
|
||||
//
|
||||
ManufacturerLabel.AutoSize = true;
|
||||
ManufacturerLabel.Font = new Font("Comic Sans MS", 10F);
|
||||
ManufacturerLabel.Location = new Point(162, 118);
|
||||
ManufacturerLabel.Name = "ManufacturerLabel";
|
||||
ManufacturerLabel.Size = new Size(89, 19);
|
||||
ManufacturerLabel.TabIndex = 16;
|
||||
ManufacturerLabel.Text = "Поставщик:";
|
||||
//
|
||||
// NameLabel
|
||||
//
|
||||
NameLabel.AutoSize = true;
|
||||
NameLabel.Font = new Font("Comic Sans MS", 15F, FontStyle.Bold);
|
||||
NameLabel.Location = new Point(162, -1);
|
||||
NameLabel.Name = "NameLabel";
|
||||
NameLabel.Size = new Size(157, 29);
|
||||
NameLabel.TabIndex = 4;
|
||||
NameLabel.Text = "Наименование";
|
||||
//
|
||||
// CategoryLabel
|
||||
//
|
||||
CategoryLabel.AutoSize = true;
|
||||
CategoryLabel.Font = new Font("Comic Sans MS", 13F);
|
||||
CategoryLabel.Location = new Point(162, 28);
|
||||
CategoryLabel.Name = "CategoryLabel";
|
||||
CategoryLabel.Size = new Size(97, 24);
|
||||
CategoryLabel.TabIndex = 5;
|
||||
CategoryLabel.Text = "Категория";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
label10.AutoSize = true;
|
||||
label10.Font = new Font("Comic Sans MS", 26.25F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label10.Location = new Point(160, 9);
|
||||
label10.Name = "label10";
|
||||
label10.Size = new Size(524, 49);
|
||||
label10.TabIndex = 32;
|
||||
label10.Text = "ГЛАВНАЯ ГОСТЕВАЯ ФОРМА";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.BackColor = Color.Red;
|
||||
button1.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
button1.Location = new Point(713, 503);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(75, 23);
|
||||
button1.TabIndex = 37;
|
||||
button1.Text = "Назад";
|
||||
button1.UseVisualStyleBackColor = false;
|
||||
button1.Click += button1_Click;
|
||||
//
|
||||
// GuestForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(192, 237, 215);
|
||||
ClientSize = new Size(800, 539);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(label10);
|
||||
Controls.Add(panel1);
|
||||
Controls.Add(dataGridViewGuest);
|
||||
Controls.Add(ExitButton);
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Name = "GuestForm";
|
||||
Text = "GuestForm";
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewGuest).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
panel1.PerformLayout();
|
||||
panel2.ResumeLayout(false);
|
||||
panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||
panel3.ResumeLayout(false);
|
||||
panel3.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button ExitButton;
|
||||
private DataGridView dataGridViewGuest;
|
||||
private Panel panel1;
|
||||
private Panel panel2;
|
||||
private Label CountLabel;
|
||||
private Label PriceLabel;
|
||||
private PictureBox pictureBox1;
|
||||
private Panel panel3;
|
||||
private Label Descyption;
|
||||
private Label SupplierLabel;
|
||||
private Label ManufacturerLabel;
|
||||
private Label NameLabel;
|
||||
private Label CategoryLabel;
|
||||
private Label label10;
|
||||
private Button button1;
|
||||
}
|
||||
}
|
||||
76
WinFormsApp1/GuestForm.cs
Normal file
76
WinFormsApp1/GuestForm.cs
Normal file
@ -0,0 +1,76 @@
|
||||
using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
public partial class GuestForm : Form
|
||||
{
|
||||
public GuestForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadGuestData();
|
||||
}
|
||||
|
||||
private void ExitButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
private MySqlDataAdapter dataAdapter;
|
||||
private DataTable prodTable;
|
||||
private BindingSource bindingSource = new BindingSource();
|
||||
private void LoadGuestData()
|
||||
{
|
||||
try
|
||||
{
|
||||
DB db = new DB();
|
||||
using (MySqlConnection connection = db.getConnection())
|
||||
{
|
||||
connection.Open();
|
||||
string query = "SELECT idProducts, Article AS `Артикул`, ProductName AS `название товара`, CategoryName AS `Название категории`, ProductDescryption AS `Описание`, ManufacturerName AS `Производитель`, SupplierName AS `Поставщик`, Price AS `Цена`, Discount AS `Процент скидки`, QuantityStock AS `Количество на складе`, UnitTypeName AS `Единица измерения` FROM Products LEFT JOIN Category ON Products.Category_id = Category.idCategory JOIN Manufacturer ON Products.Manufacturer_id = Manufacturer.idManufacturer JOIN Supplier ON Products.Supplier_id = Supplier.idSupplier JOIN UnitType ON Products.UnitType_id = UnitType.idUnitType";
|
||||
|
||||
dataAdapter = new MySqlDataAdapter(query, connection);
|
||||
prodTable = new DataTable();
|
||||
dataAdapter.Fill(prodTable);
|
||||
dataGridViewGuest.RowTemplate.Height = 60;
|
||||
bindingSource.DataSource = prodTable;
|
||||
dataGridViewGuest.DataSource = bindingSource;
|
||||
|
||||
}
|
||||
}
|
||||
catch (MySqlException ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка при подключении к базе данных или выполнении запроса: " + ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Произошла общая ошибка: " + ex.Message);
|
||||
}
|
||||
}
|
||||
private void dataGridViewGuest_Click(object sender, EventArgs e)
|
||||
{
|
||||
CategoryLabel.Text = dataGridViewGuest.CurrentRow.Cells[3].Value.ToString();
|
||||
NameLabel.Text = dataGridViewGuest.CurrentRow.Cells[2].Value.ToString();
|
||||
Descyption.Text = dataGridViewGuest.CurrentRow.Cells[4].Value.ToString();
|
||||
PriceLabel.Text = dataGridViewGuest.CurrentRow.Cells[7].Value.ToString();
|
||||
CountLabel.Text = dataGridViewGuest.CurrentRow.Cells[9].Value.ToString();
|
||||
ManufacturerLabel.Text = dataGridViewGuest.CurrentRow.Cells[5].Value.ToString();
|
||||
SupplierLabel.Text = dataGridViewGuest.CurrentRow.Cells[6].Value.ToString();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
loginForm loginForm = new loginForm();
|
||||
loginForm.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
WinFormsApp1/GuestForm.resx
Normal file
120
WinFormsApp1/GuestForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
||||
129
WinFormsApp1/LoginForm.Designer.cs
generated
Normal file
129
WinFormsApp1/LoginForm.Designer.cs
generated
Normal file
@ -0,0 +1,129 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
partial class loginForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
passField = new TextBox();
|
||||
loginField = new TextBox();
|
||||
button1 = new Button();
|
||||
button2 = new Button();
|
||||
button3 = new Button();
|
||||
label1 = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// passField
|
||||
//
|
||||
passField.BackColor = Color.FromArgb(133, 242, 189);
|
||||
passField.Font = new Font("Comic Sans MS", 9F);
|
||||
passField.Location = new Point(158, 229);
|
||||
passField.Name = "passField";
|
||||
passField.Size = new Size(170, 24);
|
||||
passField.TabIndex = 0;
|
||||
//
|
||||
// loginField
|
||||
//
|
||||
loginField.BackColor = Color.FromArgb(133, 242, 189);
|
||||
loginField.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
loginField.Location = new Point(158, 174);
|
||||
loginField.Name = "loginField";
|
||||
loginField.Size = new Size(170, 24);
|
||||
loginField.TabIndex = 1;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.BackColor = Color.Red;
|
||||
button1.Font = new Font("Comic Sans MS", 9F);
|
||||
button1.Location = new Point(202, 271);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(75, 23);
|
||||
button1.TabIndex = 2;
|
||||
button1.Text = "Войти";
|
||||
button1.UseVisualStyleBackColor = false;
|
||||
button1.Click += ButtonLogin_Click;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
button2.Location = new Point(427, 12);
|
||||
button2.Name = "button2";
|
||||
button2.Size = new Size(32, 23);
|
||||
button2.TabIndex = 3;
|
||||
button2.Text = "X";
|
||||
button2.UseVisualStyleBackColor = true;
|
||||
button2.Click += button2_Click;
|
||||
//
|
||||
// button3
|
||||
//
|
||||
button3.BackColor = Color.Red;
|
||||
button3.Font = new Font("Comic Sans MS", 9F);
|
||||
button3.Location = new Point(202, 375);
|
||||
button3.Name = "button3";
|
||||
button3.Size = new Size(75, 23);
|
||||
button3.TabIndex = 4;
|
||||
button3.Text = "Гость";
|
||||
button3.UseVisualStyleBackColor = false;
|
||||
button3.Click += button3_Click;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Font = new Font("Comic Sans MS", 18F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label1.Location = new Point(142, 23);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(196, 33);
|
||||
label1.TabIndex = 5;
|
||||
label1.Text = "АВТОРИЗАЦИЯ";
|
||||
//
|
||||
// loginForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(192, 237, 215);
|
||||
ClientSize = new Size(471, 433);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(button3);
|
||||
Controls.Add(button2);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(loginField);
|
||||
Controls.Add(passField);
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Name = "loginForm";
|
||||
Text = "LoginForm";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private TextBox passField;
|
||||
private TextBox loginField;
|
||||
private Button button1;
|
||||
private Button button2;
|
||||
private Button button3;
|
||||
private Label label1;
|
||||
}
|
||||
}
|
||||
121
WinFormsApp1/LoginForm.cs
Normal file
121
WinFormsApp1/LoginForm.cs
Normal file
@ -0,0 +1,121 @@
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Data;
|
||||
using WinFormsApp1;
|
||||
using MySql.Data.MySqlClient;
|
||||
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 WinFormsApp1;
|
||||
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
public partial class loginForm : Form
|
||||
{
|
||||
public loginForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public static string FIO { get; private set; }
|
||||
|
||||
private void ButtonLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
string loginUser = loginField.Text;
|
||||
string passUser = passField.Text;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(loginField.Text))
|
||||
{
|
||||
MessageBox.Show("Введите логин.", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(passField.Text))
|
||||
{
|
||||
MessageBox.Show("Введите пароль.", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
DB db = new DB();
|
||||
|
||||
using (MySqlConnection connection = db.getConnection())
|
||||
{
|
||||
DataTable table = new DataTable();
|
||||
MySqlDataAdapter adapter = new MySqlDataAdapter();
|
||||
MySqlCommand command = new MySqlCommand("SELECT idClients, Login, FIO, Role_id FROM Clients WHERE Login = @uL AND Password = @uP", connection);
|
||||
command.Parameters.Add("@uL", MySqlDbType.VarChar).Value = loginUser;
|
||||
command.Parameters.Add("@uP", MySqlDbType.VarChar).Value = passUser;
|
||||
adapter.SelectCommand = command;
|
||||
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
adapter.Fill(table);
|
||||
|
||||
if (table.Rows.Count == 1)
|
||||
{
|
||||
string roleID = table.Rows[0]["Role_id"].ToString();
|
||||
string userLogin = table.Rows[0]["Login"].ToString();
|
||||
|
||||
FIO = Convert.ToString(table.Rows[0]["FIO"]);
|
||||
|
||||
switch (roleID)
|
||||
{
|
||||
case "1":
|
||||
MessageBox.Show("Авторизация успешна, добро пожаловать! Вы авторизовались под ролью: Admin");
|
||||
this.Hide();
|
||||
AdmMainForm adm = new AdmMainForm();
|
||||
adm.Show();
|
||||
break;
|
||||
|
||||
case "2":
|
||||
MessageBox.Show("Авторизация успешна, добро пожаловать! Вы авторизовались под ролью: Manager");
|
||||
this.Hide();
|
||||
ManagerMainForm usManager = new ManagerMainForm();
|
||||
usManager.Show();
|
||||
break;
|
||||
|
||||
case "3":
|
||||
MessageBox.Show("Авторизация успешна, добро пожаловать! Вы авторизовались под ролью: Authorized Client");
|
||||
this.Hide();
|
||||
UserForm usClient = new UserForm();
|
||||
usClient.Show();
|
||||
break;
|
||||
default:
|
||||
MessageBox.Show("У вашего пользователя указана неизвестная роль: " + roleID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Введен неверный логин или пароль", "Ошибка авторизации", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
catch (MySqlException ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка подключения к базе данных или выполнения запроса: " + ex.Message, "Ошибка БД", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.closeConnection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
GuestForm guest = new GuestForm();
|
||||
guest.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
WinFormsApp1/LoginForm.resx
Normal file
120
WinFormsApp1/LoginForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
||||
328
WinFormsApp1/ManagerMainForm.Designer.cs
generated
Normal file
328
WinFormsApp1/ManagerMainForm.Designer.cs
generated
Normal file
@ -0,0 +1,328 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
partial class ManagerMainForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
panel2 = new Panel();
|
||||
CountLabel = new Label();
|
||||
PriceLabel = new Label();
|
||||
pictureBox1 = new PictureBox();
|
||||
panel3 = new Panel();
|
||||
Descyption = new Label();
|
||||
SupplierLabel = new Label();
|
||||
ManufacturerLabel = new Label();
|
||||
NameLabel = new Label();
|
||||
CategoryLabel = new Label();
|
||||
ExitButton = new Button();
|
||||
labelFIO = new Label();
|
||||
textBoxSearch = new TextBox();
|
||||
comboBoxFilter = new ComboBox();
|
||||
comboBoxSort = new ComboBox();
|
||||
dataGridViewProduct = new DataGridView();
|
||||
Orders = new Button();
|
||||
label10 = new Label();
|
||||
button1 = new Button();
|
||||
panel1.SuspendLayout();
|
||||
panel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||
panel3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProduct).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.BackColor = Color.FromArgb(133, 242, 189);
|
||||
panel1.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel1.Controls.Add(panel2);
|
||||
panel1.Controls.Add(pictureBox1);
|
||||
panel1.Controls.Add(panel3);
|
||||
panel1.Controls.Add(SupplierLabel);
|
||||
panel1.Controls.Add(ManufacturerLabel);
|
||||
panel1.Controls.Add(NameLabel);
|
||||
panel1.Controls.Add(CategoryLabel);
|
||||
panel1.Location = new Point(81, 340);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(609, 150);
|
||||
panel1.TabIndex = 24;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
panel2.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel2.Controls.Add(CountLabel);
|
||||
panel2.Controls.Add(PriceLabel);
|
||||
panel2.Location = new Point(444, -1);
|
||||
panel2.Name = "panel2";
|
||||
panel2.Size = new Size(164, 150);
|
||||
panel2.TabIndex = 15;
|
||||
//
|
||||
// CountLabel
|
||||
//
|
||||
CountLabel.AutoSize = true;
|
||||
CountLabel.Font = new Font("Comic Sans MS", 9.75F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
CountLabel.Location = new Point(58, 43);
|
||||
CountLabel.Name = "CountLabel";
|
||||
CountLabel.Size = new Size(82, 18);
|
||||
CountLabel.TabIndex = 1;
|
||||
CountLabel.Text = "Количество";
|
||||
//
|
||||
// PriceLabel
|
||||
//
|
||||
PriceLabel.AutoSize = true;
|
||||
PriceLabel.Font = new Font("Comic Sans MS", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
PriceLabel.Location = new Point(35, 10);
|
||||
PriceLabel.Name = "PriceLabel";
|
||||
PriceLabel.Size = new Size(0, 23);
|
||||
PriceLabel.TabIndex = 0;
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
pictureBox1.BorderStyle = BorderStyle.FixedSingle;
|
||||
pictureBox1.Location = new Point(19, 10);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new Size(137, 127);
|
||||
pictureBox1.TabIndex = 19;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
panel3.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel3.Controls.Add(Descyption);
|
||||
panel3.Location = new Point(162, 55);
|
||||
panel3.Name = "panel3";
|
||||
panel3.Size = new Size(276, 44);
|
||||
panel3.TabIndex = 18;
|
||||
//
|
||||
// Descyption
|
||||
//
|
||||
Descyption.AutoSize = true;
|
||||
Descyption.Font = new Font("Comic Sans MS", 9.5F);
|
||||
Descyption.Location = new Point(-1, -1);
|
||||
Descyption.Name = "Descyption";
|
||||
Descyption.Size = new Size(70, 18);
|
||||
Descyption.TabIndex = 15;
|
||||
Descyption.Text = "Описание";
|
||||
//
|
||||
// SupplierLabel
|
||||
//
|
||||
SupplierLabel.AutoSize = true;
|
||||
SupplierLabel.Font = new Font("Comic Sans MS", 10F);
|
||||
SupplierLabel.Location = new Point(162, 99);
|
||||
SupplierLabel.Name = "SupplierLabel";
|
||||
SupplierLabel.Size = new Size(119, 19);
|
||||
SupplierLabel.TabIndex = 17;
|
||||
SupplierLabel.Text = "Производитель:";
|
||||
//
|
||||
// ManufacturerLabel
|
||||
//
|
||||
ManufacturerLabel.AutoSize = true;
|
||||
ManufacturerLabel.Font = new Font("Comic Sans MS", 10F);
|
||||
ManufacturerLabel.Location = new Point(162, 118);
|
||||
ManufacturerLabel.Name = "ManufacturerLabel";
|
||||
ManufacturerLabel.Size = new Size(89, 19);
|
||||
ManufacturerLabel.TabIndex = 16;
|
||||
ManufacturerLabel.Text = "Поставщик:";
|
||||
//
|
||||
// NameLabel
|
||||
//
|
||||
NameLabel.AutoSize = true;
|
||||
NameLabel.Font = new Font("Comic Sans MS", 15F, FontStyle.Bold);
|
||||
NameLabel.Location = new Point(162, -1);
|
||||
NameLabel.Name = "NameLabel";
|
||||
NameLabel.Size = new Size(157, 29);
|
||||
NameLabel.TabIndex = 4;
|
||||
NameLabel.Text = "Наименование";
|
||||
//
|
||||
// CategoryLabel
|
||||
//
|
||||
CategoryLabel.AutoSize = true;
|
||||
CategoryLabel.Font = new Font("Comic Sans MS", 13F);
|
||||
CategoryLabel.Location = new Point(162, 28);
|
||||
CategoryLabel.Name = "CategoryLabel";
|
||||
CategoryLabel.Size = new Size(97, 24);
|
||||
CategoryLabel.TabIndex = 5;
|
||||
CategoryLabel.Text = "Категория";
|
||||
//
|
||||
// ExitButton
|
||||
//
|
||||
ExitButton.BackColor = Color.Red;
|
||||
ExitButton.Location = new Point(766, 59);
|
||||
ExitButton.Name = "ExitButton";
|
||||
ExitButton.Size = new Size(31, 26);
|
||||
ExitButton.TabIndex = 23;
|
||||
ExitButton.Text = "X";
|
||||
ExitButton.UseVisualStyleBackColor = false;
|
||||
ExitButton.Click += button1_Click;
|
||||
//
|
||||
// labelFIO
|
||||
//
|
||||
labelFIO.AutoSize = true;
|
||||
labelFIO.Font = new Font("Comic Sans MS", 9F);
|
||||
labelFIO.Location = new Point(547, 64);
|
||||
labelFIO.Name = "labelFIO";
|
||||
labelFIO.Size = new Size(35, 17);
|
||||
labelFIO.TabIndex = 22;
|
||||
labelFIO.Text = "ФИО";
|
||||
//
|
||||
// textBoxSearch
|
||||
//
|
||||
textBoxSearch.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxSearch.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxSearch.Location = new Point(378, 60);
|
||||
textBoxSearch.Name = "textBoxSearch";
|
||||
textBoxSearch.Size = new Size(141, 24);
|
||||
textBoxSearch.TabIndex = 18;
|
||||
textBoxSearch.TextChanged += textBoxSearch_TextChanged;
|
||||
//
|
||||
// comboBoxFilter
|
||||
//
|
||||
comboBoxFilter.BackColor = Color.FromArgb(133, 242, 189);
|
||||
comboBoxFilter.Font = new Font("Comic Sans MS", 9F);
|
||||
comboBoxFilter.FormattingEnabled = true;
|
||||
comboBoxFilter.Location = new Point(200, 60);
|
||||
comboBoxFilter.Name = "comboBoxFilter";
|
||||
comboBoxFilter.Size = new Size(121, 25);
|
||||
comboBoxFilter.TabIndex = 17;
|
||||
comboBoxFilter.SelectedIndexChanged += comboBoxFilter_SelectedIndexChanged;
|
||||
//
|
||||
// comboBoxSort
|
||||
//
|
||||
comboBoxSort.BackColor = Color.FromArgb(133, 242, 189);
|
||||
comboBoxSort.Font = new Font("Comic Sans MS", 9F);
|
||||
comboBoxSort.FormattingEnabled = true;
|
||||
comboBoxSort.Location = new Point(12, 60);
|
||||
comboBoxSort.Name = "comboBoxSort";
|
||||
comboBoxSort.Size = new Size(121, 25);
|
||||
comboBoxSort.TabIndex = 16;
|
||||
comboBoxSort.SelectedIndexChanged += comboBoxSort_SelectedIndexChanged;
|
||||
//
|
||||
// dataGridViewProduct
|
||||
//
|
||||
dataGridViewProduct.AllowUserToAddRows = false;
|
||||
dataGridViewProduct.AllowUserToDeleteRows = false;
|
||||
dataGridViewProduct.AllowUserToResizeColumns = false;
|
||||
dataGridViewProduct.AllowUserToResizeRows = false;
|
||||
dataGridViewProduct.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
dataGridViewProduct.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells;
|
||||
dataGridViewProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewProduct.Location = new Point(12, 89);
|
||||
dataGridViewProduct.Name = "dataGridViewProduct";
|
||||
dataGridViewProduct.Size = new Size(764, 245);
|
||||
dataGridViewProduct.TabIndex = 15;
|
||||
dataGridViewProduct.Click += dataGridViewProd_Click;
|
||||
//
|
||||
// Orders
|
||||
//
|
||||
Orders.BackColor = Color.Red;
|
||||
Orders.Font = new Font("Comic Sans MS", 10F);
|
||||
Orders.Location = new Point(701, 440);
|
||||
Orders.Name = "Orders";
|
||||
Orders.Size = new Size(75, 23);
|
||||
Orders.TabIndex = 25;
|
||||
Orders.Text = "Заказы";
|
||||
Orders.UseVisualStyleBackColor = false;
|
||||
Orders.Click += Orders_Click;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
label10.AutoSize = true;
|
||||
label10.Font = new Font("Comic Sans MS", 26.25F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label10.Location = new Point(143, 8);
|
||||
label10.Name = "label10";
|
||||
label10.Size = new Size(561, 49);
|
||||
label10.TabIndex = 33;
|
||||
label10.Text = "ГЛАВНАЯ ФОРМА МЕНЕДЖЕРА";
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.BackColor = Color.Red;
|
||||
button1.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
button1.Location = new Point(701, 469);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(75, 23);
|
||||
button1.TabIndex = 37;
|
||||
button1.Text = "Назад";
|
||||
button1.UseVisualStyleBackColor = false;
|
||||
button1.Click += button1_Click_1;
|
||||
//
|
||||
// ManagerMainForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(192, 237, 215);
|
||||
ClientSize = new Size(800, 503);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(label10);
|
||||
Controls.Add(Orders);
|
||||
Controls.Add(panel1);
|
||||
Controls.Add(ExitButton);
|
||||
Controls.Add(labelFIO);
|
||||
Controls.Add(textBoxSearch);
|
||||
Controls.Add(comboBoxFilter);
|
||||
Controls.Add(comboBoxSort);
|
||||
Controls.Add(dataGridViewProduct);
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Name = "ManagerMainForm";
|
||||
Text = "ManagerMainForm";
|
||||
Load += ManagerMainForm_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
panel1.PerformLayout();
|
||||
panel2.ResumeLayout(false);
|
||||
panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||
panel3.ResumeLayout(false);
|
||||
panel3.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProduct).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Panel panel2;
|
||||
private Label CountLabel;
|
||||
private Label PriceLabel;
|
||||
private PictureBox pictureBox1;
|
||||
private Panel panel3;
|
||||
private Label Descyption;
|
||||
private Label SupplierLabel;
|
||||
private Label ManufacturerLabel;
|
||||
private Label NameLabel;
|
||||
private Label CategoryLabel;
|
||||
private Button ExitButton;
|
||||
private Label labelFIO;
|
||||
private TextBox textBoxSearch;
|
||||
private ComboBox comboBoxFilter;
|
||||
private ComboBox comboBoxSort;
|
||||
private DataGridView dataGridViewProduct;
|
||||
private Button Orders;
|
||||
private Label label10;
|
||||
private Button button1;
|
||||
}
|
||||
}
|
||||
219
WinFormsApp1/ManagerMainForm.cs
Normal file
219
WinFormsApp1/ManagerMainForm.cs
Normal file
@ -0,0 +1,219 @@
|
||||
using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
public partial class ManagerMainForm : Form
|
||||
{
|
||||
public ManagerMainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadProdData();
|
||||
LoadSortOptions();
|
||||
LoadFilterOptions();
|
||||
}
|
||||
|
||||
private MySqlDataAdapter dataAdapter;
|
||||
private DataTable prodTable;
|
||||
private BindingSource bindingSource = new BindingSource();
|
||||
private void LoadProdData()
|
||||
{
|
||||
try
|
||||
{
|
||||
DB db = new DB();
|
||||
using (MySqlConnection connection = db.getConnection())
|
||||
{
|
||||
connection.Open();
|
||||
string query = "SELECT idProducts, Article AS `Артикул`, ProductName AS `название товара`, CategoryName AS `Категория`, ProductDescryption AS `Описание`, ManufacturerName AS `Производитель`, SupplierName AS `Поставщик`, Price AS `Цена`, Discount AS `Возможная скидка`, QuantityStock AS `Количество на складе`, UnitTypeName AS `Единица измерения` FROM Products LEFT JOIN Category ON Products.Category_id = Category.idCategory JOIN Manufacturer ON Products.Manufacturer_id = Manufacturer.idManufacturer JOIN Supplier ON Products.Supplier_id = Supplier.idSupplier JOIN UnitType ON Products.UnitType_id = UnitType.idUnitType";
|
||||
|
||||
dataAdapter = new MySqlDataAdapter(query, connection);
|
||||
prodTable = new DataTable();
|
||||
dataAdapter.Fill(prodTable);
|
||||
dataGridViewProduct.RowTemplate.Height = 60;
|
||||
bindingSource.DataSource = prodTable;
|
||||
dataGridViewProduct.DataSource = bindingSource;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch (MySqlException ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка при подключении к базе данных или выполнении запроса: " + ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Произошла общая ошибка: " + ex.Message);
|
||||
}
|
||||
}
|
||||
private void dataGridViewProd_Click(object sender, EventArgs e)
|
||||
{
|
||||
CategoryLabel.Text = dataGridViewProduct.CurrentRow.Cells[3].Value.ToString();
|
||||
NameLabel.Text = dataGridViewProduct.CurrentRow.Cells[2].Value.ToString();
|
||||
Descyption.Text = dataGridViewProduct.CurrentRow.Cells[4].Value.ToString();
|
||||
PriceLabel.Text = dataGridViewProduct.CurrentRow.Cells[7].Value.ToString();
|
||||
CountLabel.Text = dataGridViewProduct.CurrentRow.Cells[9].Value.ToString();
|
||||
ManufacturerLabel.Text = dataGridViewProduct.CurrentRow.Cells[5].Value.ToString();
|
||||
SupplierLabel.Text = dataGridViewProduct.CurrentRow.Cells[6].Value.ToString();
|
||||
}
|
||||
private void LoadSortOptions()
|
||||
{
|
||||
comboBoxSort.Items.Add("По умолчанию");
|
||||
comboBoxSort.Items.Add("Цена (возрастающая)");
|
||||
comboBoxSort.Items.Add("Цена (убывающая)");
|
||||
comboBoxSort.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void comboBoxSort_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string sortOption = comboBoxSort.SelectedItem.ToString();
|
||||
|
||||
switch (sortOption)
|
||||
{
|
||||
case "По умолчанию":
|
||||
bindingSource.Sort = "";
|
||||
break;
|
||||
case "Цена (возрастающая)":
|
||||
bindingSource.Sort = "Цена ASC";
|
||||
break;
|
||||
case "Цена (убывающая)":
|
||||
bindingSource.Sort = "Цена DESC";
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void LoadFilterOptions()
|
||||
{
|
||||
comboBoxFilter.Items.Add("Все производители");
|
||||
comboBoxFilter.Items.Add("Adidas");
|
||||
comboBoxFilter.Items.Add("Barbell");
|
||||
comboBoxFilter.Items.Add("Demix");
|
||||
comboBoxFilter.Items.Add("Deuter");
|
||||
comboBoxFilter.Items.Add("Everlast");
|
||||
comboBoxFilter.Items.Add("Fischer");
|
||||
comboBoxFilter.Items.Add("Head");
|
||||
comboBoxFilter.Items.Add("Joss");
|
||||
comboBoxFilter.Items.Add("Kettler");
|
||||
comboBoxFilter.Items.Add("Mikasa");
|
||||
comboBoxFilter.Items.Add("Nike");
|
||||
comboBoxFilter.Items.Add("Nordway");
|
||||
comboBoxFilter.Items.Add("Outventure");
|
||||
comboBoxFilter.Items.Add("Puma");
|
||||
comboBoxFilter.Items.Add("Reebok");
|
||||
comboBoxSort.SelectedIndex = 0;
|
||||
}
|
||||
private void comboBoxFilter_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
string filterOption = comboBoxFilter.SelectedItem.ToString().Trim();
|
||||
switch (filterOption)
|
||||
{
|
||||
case "Все производители":
|
||||
bindingSource.Filter = "";
|
||||
break;
|
||||
|
||||
case "Adidas":
|
||||
bindingSource.Filter = "[Производитель] = 'Adidas'";
|
||||
break;
|
||||
|
||||
case "Barbell":
|
||||
bindingSource.Filter = "[Производитель] = 'Barbell'";
|
||||
break;
|
||||
|
||||
case "Demix":
|
||||
bindingSource.Filter = "[Производитель] = 'Demix'";
|
||||
break;
|
||||
|
||||
case "Deuter":
|
||||
bindingSource.Filter = "[Производитель] = 'Deuter'";
|
||||
break;
|
||||
|
||||
case "Everlast":
|
||||
bindingSource.Filter = "[Производитель] = 'Everlast'";
|
||||
break;
|
||||
|
||||
case "Fischer":
|
||||
bindingSource.Filter = "[Производитель] = 'Fischer'";
|
||||
break;
|
||||
|
||||
case "Head":
|
||||
bindingSource.Filter = "[Производитель] = 'Head'";
|
||||
break;
|
||||
|
||||
case "Joss":
|
||||
bindingSource.Filter = "[Производитель] = 'Joss'";
|
||||
break;
|
||||
|
||||
case "Kettler":
|
||||
bindingSource.Filter = "[Производитель] = 'Kettler'";
|
||||
break;
|
||||
|
||||
case "Mikasa":
|
||||
bindingSource.Filter = "[Производитель] = 'Mikasa'";
|
||||
break;
|
||||
|
||||
case "Nike":
|
||||
bindingSource.Filter = "[Производитель] = 'Nike'";
|
||||
break;
|
||||
|
||||
case "Nordway":
|
||||
bindingSource.Filter = "[Производитель] = 'Nordway'";
|
||||
break;
|
||||
|
||||
case "Outventure":
|
||||
bindingSource.Filter = "[Производитель] = 'Outventure'";
|
||||
break;
|
||||
|
||||
case "Puma":
|
||||
bindingSource.Filter = "[Производитель] = 'Puma'";
|
||||
break;
|
||||
|
||||
case "Reebok":
|
||||
bindingSource.Filter = "[Производитель] = 'Reebok'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void textBoxSearch_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
var value = textBoxSearch.Text.Trim().Replace("'", "''");
|
||||
|
||||
bindingSource.Filter = string.IsNullOrWhiteSpace(value)
|
||||
? ""
|
||||
: $"[Артикул] LIKE '%{value}%' OR " +
|
||||
$"[Производитель] LIKE '%{value}%' OR " +
|
||||
$"[Поставщик] LIKE '%{value}%' OR " +
|
||||
$"[Категория] LIKE '%{value}%' OR " +
|
||||
$"Convert([Цена], 'System.String') LIKE '%{value}%' OR " +
|
||||
$"Convert([Возможная скидка], 'System.String') LIKE '%{value}%'";
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
private void ManagerMainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
labelFIO.Text = loginForm.FIO;
|
||||
}
|
||||
|
||||
private void Orders_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
ManagerOrder mo = new ManagerOrder();
|
||||
mo.Show();
|
||||
}
|
||||
|
||||
private void button1_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
loginForm loginForm = new loginForm();
|
||||
loginForm.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
WinFormsApp1/ManagerMainForm.resx
Normal file
120
WinFormsApp1/ManagerMainForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
||||
111
WinFormsApp1/ManagerOrder.Designer.cs
generated
Normal file
111
WinFormsApp1/ManagerOrder.Designer.cs
generated
Normal file
@ -0,0 +1,111 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
partial class ManagerOrder
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridViewProduct = new DataGridView();
|
||||
label10 = new Label();
|
||||
ExitButton = new Button();
|
||||
button1 = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProduct).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridViewProduct
|
||||
//
|
||||
dataGridViewProduct.AllowUserToAddRows = false;
|
||||
dataGridViewProduct.AllowUserToDeleteRows = false;
|
||||
dataGridViewProduct.AllowUserToResizeColumns = false;
|
||||
dataGridViewProduct.AllowUserToResizeRows = false;
|
||||
dataGridViewProduct.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
||||
dataGridViewProduct.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells;
|
||||
dataGridViewProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewProduct.Location = new Point(12, 77);
|
||||
dataGridViewProduct.Name = "dataGridViewProduct";
|
||||
dataGridViewProduct.Size = new Size(776, 308);
|
||||
dataGridViewProduct.TabIndex = 16;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
label10.AutoSize = true;
|
||||
label10.Font = new Font("Comic Sans MS", 26.25F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label10.Location = new Point(119, 9);
|
||||
label10.Name = "label10";
|
||||
label10.Size = new Size(561, 49);
|
||||
label10.TabIndex = 34;
|
||||
label10.Text = "ГЛАВНАЯ ФОРМА МЕНЕДЖЕРА";
|
||||
//
|
||||
// ExitButton
|
||||
//
|
||||
ExitButton.BackColor = Color.Red;
|
||||
ExitButton.Location = new Point(757, 9);
|
||||
ExitButton.Name = "ExitButton";
|
||||
ExitButton.Size = new Size(31, 26);
|
||||
ExitButton.TabIndex = 35;
|
||||
ExitButton.Text = "X";
|
||||
ExitButton.UseVisualStyleBackColor = false;
|
||||
ExitButton.Click += ExitButton_Click;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.BackColor = Color.Red;
|
||||
button1.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
button1.Location = new Point(697, 406);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(75, 23);
|
||||
button1.TabIndex = 36;
|
||||
button1.Text = "Назад";
|
||||
button1.UseVisualStyleBackColor = false;
|
||||
button1.Click += button1_Click;
|
||||
//
|
||||
// ManagerOrder
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(192, 237, 215);
|
||||
ClientSize = new Size(800, 450);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(ExitButton);
|
||||
Controls.Add(label10);
|
||||
Controls.Add(dataGridViewProduct);
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Name = "ManagerOrder";
|
||||
Text = "ManagerOrder";
|
||||
Load += ManagerOrder_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProduct).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridViewProduct;
|
||||
private Label label10;
|
||||
private Button ExitButton;
|
||||
private Button button1;
|
||||
}
|
||||
}
|
||||
73
WinFormsApp1/ManagerOrder.cs
Normal file
73
WinFormsApp1/ManagerOrder.cs
Normal file
@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using MySql.Data.MySqlClient;
|
||||
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
public partial class ManagerOrder : Form
|
||||
{
|
||||
public ManagerOrder()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadProdData();
|
||||
}
|
||||
|
||||
private MySqlDataAdapter dataAdapter;
|
||||
private DataTable prodTable;
|
||||
private BindingSource bindingSource = new BindingSource();
|
||||
|
||||
private void ExitButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
private void LoadProdData()
|
||||
{
|
||||
try
|
||||
{
|
||||
DB db = new DB();
|
||||
using (MySqlConnection connection = db.getConnection())
|
||||
{
|
||||
connection.Open();
|
||||
string query = "SELECT idOrders AS `Идентификатор заказа`, Article AS `Артикул`, FIO AS `Клиент`, StatusName AS `Статус заказа`, PickUpPoint AS `Пункт выдачи`, Order_date AS `Дата заказа`, Delivery_date AS `Дата доставки` FROM Orders LEFT JOIN Clients ON Orders.Clients_id = Clients.idClients JOIN Status ON Orders.Status_id = Status.idStatus JOIN PickUp ON Orders.PickUp_id = PickUp.idPickUp";
|
||||
|
||||
dataAdapter = new MySqlDataAdapter(query, connection);
|
||||
prodTable = new DataTable();
|
||||
dataAdapter.Fill(prodTable);
|
||||
dataGridViewProduct.RowTemplate.Height = 60;
|
||||
bindingSource.DataSource = prodTable;
|
||||
dataGridViewProduct.DataSource = bindingSource;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch (MySqlException ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка при подключении к базе данных или выполнении запроса: " + ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Произошла общая ошибка: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
ManagerMainForm mf = new ManagerMainForm();
|
||||
mf.Show();
|
||||
}
|
||||
|
||||
private void ManagerOrder_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
120
WinFormsApp1/ManagerOrder.resx
Normal file
120
WinFormsApp1/ManagerOrder.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
||||
17
WinFormsApp1/Program.cs
Normal file
17
WinFormsApp1/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[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 loginForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
63
WinFormsApp1/Properties/Resources.Designer.cs
generated
Normal file
63
WinFormsApp1/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WinFormsApp1.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом 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() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[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("WinFormsApp1.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
120
WinFormsApp1/Properties/Resources.resx
Normal file
120
WinFormsApp1/Properties/Resources.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
||||
386
WinFormsApp1/Reduct2.Designer.cs
generated
Normal file
386
WinFormsApp1/Reduct2.Designer.cs
generated
Normal file
@ -0,0 +1,386 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
partial class Reduct2
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
button2 = new Button();
|
||||
button1 = new Button();
|
||||
textBoxStockQuan = new TextBox();
|
||||
textBoxSale = new TextBox();
|
||||
textBoxPrice = new TextBox();
|
||||
comboBoxCategories = new ComboBox();
|
||||
comboBoxManufacturer = new ComboBox();
|
||||
comboBoxUnitType = new ComboBox();
|
||||
textBoxDesc = new TextBox();
|
||||
textBoxProdName = new TextBox();
|
||||
textBoxArticle = new TextBox();
|
||||
comboBoxSupplier = new ComboBox();
|
||||
textBoxID = new TextBox();
|
||||
label9 = new Label();
|
||||
label8 = new Label();
|
||||
label7 = new Label();
|
||||
label6 = new Label();
|
||||
label5 = new Label();
|
||||
label4 = new Label();
|
||||
label3 = new Label();
|
||||
label2 = new Label();
|
||||
label1 = new Label();
|
||||
label11 = new Label();
|
||||
label10 = new Label();
|
||||
label12 = new Label();
|
||||
button3 = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// button2
|
||||
//
|
||||
button2.BackColor = Color.Red;
|
||||
button2.Font = new Font("Comic Sans MS", 9F);
|
||||
button2.Location = new Point(448, 12);
|
||||
button2.Name = "button2";
|
||||
button2.Size = new Size(38, 29);
|
||||
button2.TabIndex = 34;
|
||||
button2.Text = "X";
|
||||
button2.UseVisualStyleBackColor = false;
|
||||
button2.Click += button2_Click;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.BackColor = Color.Red;
|
||||
button1.Font = new Font("Comic Sans MS", 9F);
|
||||
button1.Location = new Point(225, 408);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(108, 23);
|
||||
button1.TabIndex = 33;
|
||||
button1.Text = "Редактировать";
|
||||
button1.UseVisualStyleBackColor = false;
|
||||
button1.Click += btnSave_Click;
|
||||
//
|
||||
// textBoxStockQuan
|
||||
//
|
||||
textBoxStockQuan.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxStockQuan.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxStockQuan.Location = new Point(165, 337);
|
||||
textBoxStockQuan.Name = "textBoxStockQuan";
|
||||
textBoxStockQuan.Size = new Size(225, 24);
|
||||
textBoxStockQuan.TabIndex = 32;
|
||||
//
|
||||
// textBoxSale
|
||||
//
|
||||
textBoxSale.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxSale.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxSale.Location = new Point(165, 308);
|
||||
textBoxSale.Name = "textBoxSale";
|
||||
textBoxSale.Size = new Size(225, 24);
|
||||
textBoxSale.TabIndex = 31;
|
||||
//
|
||||
// textBoxPrice
|
||||
//
|
||||
textBoxPrice.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxPrice.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxPrice.Location = new Point(165, 279);
|
||||
textBoxPrice.Name = "textBoxPrice";
|
||||
textBoxPrice.Size = new Size(225, 24);
|
||||
textBoxPrice.TabIndex = 30;
|
||||
//
|
||||
// comboBoxCategories
|
||||
//
|
||||
comboBoxCategories.BackColor = Color.FromArgb(133, 242, 189);
|
||||
comboBoxCategories.Font = new Font("Comic Sans MS", 9F);
|
||||
comboBoxCategories.FormattingEnabled = true;
|
||||
comboBoxCategories.Location = new Point(165, 163);
|
||||
comboBoxCategories.Name = "comboBoxCategories";
|
||||
comboBoxCategories.Size = new Size(225, 25);
|
||||
comboBoxCategories.TabIndex = 29;
|
||||
//
|
||||
// comboBoxManufacturer
|
||||
//
|
||||
comboBoxManufacturer.BackColor = Color.FromArgb(133, 242, 189);
|
||||
comboBoxManufacturer.Font = new Font("Comic Sans MS", 9F);
|
||||
comboBoxManufacturer.FormattingEnabled = true;
|
||||
comboBoxManufacturer.Location = new Point(165, 221);
|
||||
comboBoxManufacturer.Name = "comboBoxManufacturer";
|
||||
comboBoxManufacturer.Size = new Size(225, 25);
|
||||
comboBoxManufacturer.TabIndex = 28;
|
||||
//
|
||||
// comboBoxUnitType
|
||||
//
|
||||
comboBoxUnitType.BackColor = Color.FromArgb(133, 242, 189);
|
||||
comboBoxUnitType.Font = new Font("Comic Sans MS", 9F);
|
||||
comboBoxUnitType.FormattingEnabled = true;
|
||||
comboBoxUnitType.Location = new Point(165, 366);
|
||||
comboBoxUnitType.Name = "comboBoxUnitType";
|
||||
comboBoxUnitType.Size = new Size(225, 25);
|
||||
comboBoxUnitType.TabIndex = 27;
|
||||
//
|
||||
// textBoxDesc
|
||||
//
|
||||
textBoxDesc.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxDesc.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxDesc.Location = new Point(165, 192);
|
||||
textBoxDesc.Name = "textBoxDesc";
|
||||
textBoxDesc.Size = new Size(225, 24);
|
||||
textBoxDesc.TabIndex = 26;
|
||||
//
|
||||
// textBoxProdName
|
||||
//
|
||||
textBoxProdName.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxProdName.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxProdName.Location = new Point(165, 134);
|
||||
textBoxProdName.Name = "textBoxProdName";
|
||||
textBoxProdName.Size = new Size(225, 24);
|
||||
textBoxProdName.TabIndex = 25;
|
||||
//
|
||||
// textBoxArticle
|
||||
//
|
||||
textBoxArticle.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxArticle.Font = new Font("Comic Sans MS", 9F);
|
||||
textBoxArticle.Location = new Point(165, 105);
|
||||
textBoxArticle.Name = "textBoxArticle";
|
||||
textBoxArticle.Size = new Size(225, 24);
|
||||
textBoxArticle.TabIndex = 24;
|
||||
//
|
||||
// comboBoxSupplier
|
||||
//
|
||||
comboBoxSupplier.BackColor = Color.FromArgb(133, 242, 189);
|
||||
comboBoxSupplier.Font = new Font("Comic Sans MS", 9F);
|
||||
comboBoxSupplier.FormattingEnabled = true;
|
||||
comboBoxSupplier.Location = new Point(165, 250);
|
||||
comboBoxSupplier.Name = "comboBoxSupplier";
|
||||
comboBoxSupplier.Size = new Size(225, 25);
|
||||
comboBoxSupplier.TabIndex = 23;
|
||||
//
|
||||
// textBoxID
|
||||
//
|
||||
textBoxID.BackColor = Color.FromArgb(133, 242, 189);
|
||||
textBoxID.Location = new Point(165, 76);
|
||||
textBoxID.Name = "textBoxID";
|
||||
textBoxID.ReadOnly = true;
|
||||
textBoxID.Size = new Size(225, 23);
|
||||
textBoxID.TabIndex = 35;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
label9.AutoSize = true;
|
||||
label9.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label9.Location = new Point(68, 136);
|
||||
label9.Name = "label9";
|
||||
label9.Size = new Size(61, 17);
|
||||
label9.TabIndex = 45;
|
||||
label9.Text = "Название";
|
||||
//
|
||||
// label8
|
||||
//
|
||||
label8.AutoSize = true;
|
||||
label8.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label8.Location = new Point(68, 194);
|
||||
label8.Name = "label8";
|
||||
label8.Size = new Size(67, 17);
|
||||
label8.TabIndex = 44;
|
||||
label8.Text = "Описание";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
label7.AutoSize = true;
|
||||
label7.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label7.Location = new Point(60, 223);
|
||||
label7.Name = "label7";
|
||||
label7.Size = new Size(99, 17);
|
||||
label7.TabIndex = 43;
|
||||
label7.Text = "Производитель";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
label6.AutoSize = true;
|
||||
label6.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label6.Location = new Point(68, 252);
|
||||
label6.Name = "label6";
|
||||
label6.Size = new Size(74, 17);
|
||||
label6.TabIndex = 42;
|
||||
label6.Text = "Поставщик";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label5.Location = new Point(68, 281);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(36, 17);
|
||||
label5.TabIndex = 41;
|
||||
label5.Text = "Цена";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label4.Location = new Point(68, 310);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(48, 17);
|
||||
label4.TabIndex = 40;
|
||||
label4.Text = "Скидка";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label3.Location = new Point(68, 339);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(76, 17);
|
||||
label3.TabIndex = 39;
|
||||
label3.Text = "Количество";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label2.Location = new Point(68, 165);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(67, 17);
|
||||
label2.TabIndex = 38;
|
||||
label2.Text = "Категория";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label1.Location = new Point(68, 107);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(56, 17);
|
||||
label1.TabIndex = 37;
|
||||
label1.Text = "Артикул";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
label11.AutoSize = true;
|
||||
label11.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label11.Location = new Point(68, 369);
|
||||
label11.Name = "label11";
|
||||
label11.Size = new Size(91, 17);
|
||||
label11.TabIndex = 36;
|
||||
label11.Text = "Ед. измерения";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
label10.AutoSize = true;
|
||||
label10.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label10.Location = new Point(59, 78);
|
||||
label10.Name = "label10";
|
||||
label10.Size = new Size(100, 17);
|
||||
label10.TabIndex = 46;
|
||||
label10.Text = "Идентификатор";
|
||||
//
|
||||
// label12
|
||||
//
|
||||
label12.AutoSize = true;
|
||||
label12.Font = new Font("Comic Sans MS", 26.25F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label12.Location = new Point(68, 9);
|
||||
label12.Name = "label12";
|
||||
label12.Size = new Size(356, 49);
|
||||
label12.TabIndex = 47;
|
||||
label12.Text = "РЕДАКТИРОВАНИЕ";
|
||||
//
|
||||
// button3
|
||||
//
|
||||
button3.BackColor = Color.Red;
|
||||
button3.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
button3.Location = new Point(411, 415);
|
||||
button3.Name = "button3";
|
||||
button3.Size = new Size(75, 23);
|
||||
button3.TabIndex = 48;
|
||||
button3.Text = "Назад";
|
||||
button3.UseVisualStyleBackColor = false;
|
||||
button3.Click += button3_Click;
|
||||
//
|
||||
// Reduct2
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(192, 237, 215);
|
||||
ClientSize = new Size(498, 450);
|
||||
Controls.Add(button3);
|
||||
Controls.Add(label12);
|
||||
Controls.Add(label10);
|
||||
Controls.Add(label9);
|
||||
Controls.Add(label8);
|
||||
Controls.Add(label7);
|
||||
Controls.Add(label6);
|
||||
Controls.Add(label5);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(label11);
|
||||
Controls.Add(textBoxID);
|
||||
Controls.Add(button2);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(textBoxStockQuan);
|
||||
Controls.Add(textBoxSale);
|
||||
Controls.Add(textBoxPrice);
|
||||
Controls.Add(comboBoxCategories);
|
||||
Controls.Add(comboBoxManufacturer);
|
||||
Controls.Add(comboBoxUnitType);
|
||||
Controls.Add(textBoxDesc);
|
||||
Controls.Add(textBoxProdName);
|
||||
Controls.Add(textBoxArticle);
|
||||
Controls.Add(comboBoxSupplier);
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Name = "Reduct2";
|
||||
Text = "Reduct2";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button button2;
|
||||
private Button button1;
|
||||
private TextBox textBoxStockQuan;
|
||||
private TextBox textBoxSale;
|
||||
private TextBox textBoxPrice;
|
||||
private ComboBox comboBoxCategories;
|
||||
private ComboBox comboBoxManufacturer;
|
||||
private ComboBox comboBoxUnitType;
|
||||
private TextBox textBoxDesc;
|
||||
private TextBox textBoxProdName;
|
||||
private TextBox textBoxArticle;
|
||||
private ComboBox comboBoxSupplier;
|
||||
private TextBox textBoxID;
|
||||
private Label label9;
|
||||
private Label label8;
|
||||
private Label label7;
|
||||
private Label label6;
|
||||
private Label label5;
|
||||
private Label label4;
|
||||
private Label label3;
|
||||
private Label label2;
|
||||
private Label label1;
|
||||
private Label label11;
|
||||
private Label label10;
|
||||
private Label label12;
|
||||
private Button button3;
|
||||
}
|
||||
}
|
||||
233
WinFormsApp1/Reduct2.cs
Normal file
233
WinFormsApp1/Reduct2.cs
Normal file
@ -0,0 +1,233 @@
|
||||
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 MySql.Data.MySqlClient;
|
||||
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
public partial class Reduct2 : Form
|
||||
{
|
||||
public Reduct2(string productId)
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadProductData(productId);
|
||||
LoadCategories();
|
||||
LoadSuppliers();
|
||||
LoadManufacteries();
|
||||
LoadUnitType();
|
||||
}
|
||||
private void LoadCategories()
|
||||
{
|
||||
DB db = new DB();
|
||||
DataTable categories = new DataTable();
|
||||
MySqlDataAdapter adapter = new MySqlDataAdapter();
|
||||
MySqlCommand command = new MySqlCommand("SELECT idCategory, CategoryName FROM Category", db.getConnection());
|
||||
|
||||
try
|
||||
{
|
||||
db.openConnection();
|
||||
adapter.SelectCommand = command;
|
||||
adapter.Fill(categories);
|
||||
|
||||
comboBoxCategories.DataSource = categories;
|
||||
comboBoxCategories.DisplayMember = "CategoryName";
|
||||
comboBoxCategories.ValueMember = "idCategory";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка загрузки категорий " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.closeConnection();
|
||||
}
|
||||
}
|
||||
private void LoadManufacteries()
|
||||
{
|
||||
DB db = new DB();
|
||||
DataTable manufacturer = new DataTable();
|
||||
MySqlDataAdapter adapter = new MySqlDataAdapter();
|
||||
MySqlCommand command = new MySqlCommand("SELECT idManufacturer, ManufacturerName FROM Manufacturer", db.getConnection());
|
||||
|
||||
try
|
||||
{
|
||||
db.openConnection();
|
||||
adapter.SelectCommand = command;
|
||||
adapter.Fill(manufacturer);
|
||||
|
||||
comboBoxManufacturer.DataSource = manufacturer;
|
||||
comboBoxManufacturer.DisplayMember = "ManufacturerName";
|
||||
comboBoxManufacturer.ValueMember = "idManufacturer";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка загрузки категорий " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.closeConnection();
|
||||
}
|
||||
}
|
||||
private void LoadUnitType()
|
||||
{
|
||||
DB db = new DB();
|
||||
DataTable UnitType = new DataTable();
|
||||
MySqlDataAdapter adapter = new MySqlDataAdapter();
|
||||
MySqlCommand command = new MySqlCommand("SELECT idUnitType, UnitTypeName FROM UnitType", db.getConnection());
|
||||
|
||||
try
|
||||
{
|
||||
db.openConnection();
|
||||
adapter.SelectCommand = command;
|
||||
adapter.Fill(UnitType);
|
||||
|
||||
comboBoxUnitType.DataSource = UnitType;
|
||||
comboBoxUnitType.DisplayMember = "UnitTypeName";
|
||||
comboBoxUnitType.ValueMember = "idUnitType";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка загрузки категорий " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.closeConnection();
|
||||
}
|
||||
}
|
||||
private void LoadSuppliers()
|
||||
{
|
||||
DB db = new DB();
|
||||
DataTable suppliers = new DataTable();
|
||||
MySqlDataAdapter adapter = new MySqlDataAdapter();
|
||||
MySqlCommand command = new MySqlCommand("SELECT idSupplier, SupplierName FROM Supplier", db.getConnection());
|
||||
|
||||
try
|
||||
{
|
||||
db.openConnection();
|
||||
adapter.SelectCommand = command;
|
||||
adapter.Fill(suppliers);
|
||||
|
||||
comboBoxSupplier.DataSource = suppliers;
|
||||
comboBoxSupplier.DisplayMember = "SupplierName";
|
||||
comboBoxSupplier.ValueMember = "idSupplier";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка загрузки категорий " + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.closeConnection();
|
||||
}
|
||||
}
|
||||
private void LoadProductData(string productId)
|
||||
{
|
||||
try
|
||||
{
|
||||
DB db = new DB();
|
||||
using (MySqlConnection connection = db.getConnection())
|
||||
{
|
||||
connection.Open();
|
||||
string query = "SELECT Article, ProductName, Category_id, ProductDescryption, Manufacturer_id, Supplier_id, Price, Discount, QuantityStock, UnitType_id FROM Products WHERE idProducts = @id";
|
||||
using (MySqlCommand command = new MySqlCommand(query, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@id", productId);
|
||||
using (MySqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
if (reader.Read())
|
||||
{
|
||||
textBoxArticle.Text = reader["Article"].ToString();
|
||||
textBoxID.Text = productId;
|
||||
textBoxProdName.Text = reader["ProductName"].ToString();
|
||||
comboBoxCategories.Text = reader["Category_id"].ToString();
|
||||
textBoxDesc.Text = reader["ProductDescryption"].ToString();
|
||||
comboBoxManufacturer.Text = reader["Manufacturer_id"].ToString();
|
||||
comboBoxSupplier.Text = reader["Supplier_id"].ToString();
|
||||
textBoxPrice.Text = reader["Price"].ToString();
|
||||
textBoxSale.Text = reader["Discount"].ToString();
|
||||
textBoxStockQuan.Text = reader["QuantityStock"].ToString();
|
||||
comboBoxUnitType.Text = reader["UnitType_id"].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Продукт с указанным ID не найден.");
|
||||
this.DialogResult = DialogResult.Cancel;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка при загрузке данных продукта: " + ex.Message);
|
||||
}
|
||||
}
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
object supplierId = comboBoxSupplier.SelectedValue;
|
||||
object manufacturerId = comboBoxManufacturer.SelectedValue;
|
||||
object categoryId = comboBoxCategories.SelectedValue;
|
||||
object unittypeId = comboBoxUnitType.SelectedValue;
|
||||
|
||||
DB db = new DB();
|
||||
using (MySqlConnection connection = db.getConnection())
|
||||
{
|
||||
connection.Open();
|
||||
string query = "UPDATE Products SET Article = @art, ProductName = @pr_name, Category_id = @cat, ProductDescryption = @desc, Manufacturer_id = @manu, Supplier_id = @supp, Price = @base, Discount = @sale, QuantityStock = @stock, UnitType_id = @unit WHERE idProducts = @id";
|
||||
using (MySqlCommand command = new MySqlCommand(query, connection))
|
||||
{
|
||||
command.Parameters.AddWithValue("@art", textBoxArticle.Text);
|
||||
command.Parameters.AddWithValue("@pr_name", textBoxProdName.Text);
|
||||
command.Parameters.AddWithValue("@desc", textBoxDesc.Text);
|
||||
command.Parameters.AddWithValue("@sale", textBoxSale.Text);
|
||||
command.Parameters.AddWithValue("@id", textBoxID.Text);
|
||||
command.Parameters.AddWithValue("@stock", textBoxStockQuan.Text);
|
||||
command.Parameters.AddWithValue("@base", textBoxPrice.Text);
|
||||
command.Parameters.AddWithValue("@supp", supplierId);
|
||||
command.Parameters.AddWithValue("@manu", manufacturerId);
|
||||
command.Parameters.AddWithValue("@cat", categoryId);
|
||||
command.Parameters.AddWithValue("@unit", unittypeId);
|
||||
|
||||
int rowsAffected = command.ExecuteNonQuery();
|
||||
if (rowsAffected > 0)
|
||||
{
|
||||
MessageBox.Show("Данные продукта успешно обновлены.");
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Hide();
|
||||
AdmMainForm main = new AdmMainForm();
|
||||
main.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка при сохранении данных продукта: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
AdmMainForm mainForm = new AdmMainForm();
|
||||
mainForm.Show();
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
AdmMainForm af = new AdmMainForm();
|
||||
af.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
120
WinFormsApp1/Reduct2.resx
Normal file
120
WinFormsApp1/Reduct2.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
||||
266
WinFormsApp1/UserForm.Designer.cs
generated
Normal file
266
WinFormsApp1/UserForm.Designer.cs
generated
Normal file
@ -0,0 +1,266 @@
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
partial class UserForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
panel2 = new Panel();
|
||||
CountLabel = new Label();
|
||||
PriceLabel = new Label();
|
||||
pictureBox1 = new PictureBox();
|
||||
panel3 = new Panel();
|
||||
Descyption = new Label();
|
||||
SupplierLabel = new Label();
|
||||
ManufacturerLabel = new Label();
|
||||
NameLabel = new Label();
|
||||
CategoryLabel = new Label();
|
||||
dataGridViewUser = new DataGridView();
|
||||
ExitButton = new Button();
|
||||
labelFIO = new Label();
|
||||
label10 = new Label();
|
||||
button3 = new Button();
|
||||
panel1.SuspendLayout();
|
||||
panel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
|
||||
panel3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewUser).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.BackColor = Color.FromArgb(133, 242, 189);
|
||||
panel1.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel1.Controls.Add(panel2);
|
||||
panel1.Controls.Add(pictureBox1);
|
||||
panel1.Controls.Add(panel3);
|
||||
panel1.Controls.Add(SupplierLabel);
|
||||
panel1.Controls.Add(ManufacturerLabel);
|
||||
panel1.Controls.Add(NameLabel);
|
||||
panel1.Controls.Add(CategoryLabel);
|
||||
panel1.Location = new Point(79, 345);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(609, 150);
|
||||
panel1.TabIndex = 18;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
panel2.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel2.Controls.Add(CountLabel);
|
||||
panel2.Controls.Add(PriceLabel);
|
||||
panel2.Location = new Point(444, -1);
|
||||
panel2.Name = "panel2";
|
||||
panel2.Size = new Size(164, 150);
|
||||
panel2.TabIndex = 15;
|
||||
//
|
||||
// CountLabel
|
||||
//
|
||||
CountLabel.AutoSize = true;
|
||||
CountLabel.Font = new Font("Comic Sans MS", 9.75F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
CountLabel.Location = new Point(44, 44);
|
||||
CountLabel.Name = "CountLabel";
|
||||
CountLabel.Size = new Size(82, 18);
|
||||
CountLabel.TabIndex = 1;
|
||||
CountLabel.Text = "Количество";
|
||||
//
|
||||
// PriceLabel
|
||||
//
|
||||
PriceLabel.AutoSize = true;
|
||||
PriceLabel.Font = new Font("Comic Sans MS", 12F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
PriceLabel.Location = new Point(35, 10);
|
||||
PriceLabel.Name = "PriceLabel";
|
||||
PriceLabel.Size = new Size(0, 23);
|
||||
PriceLabel.TabIndex = 0;
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
pictureBox1.BorderStyle = BorderStyle.FixedSingle;
|
||||
pictureBox1.Location = new Point(19, 10);
|
||||
pictureBox1.Name = "pictureBox1";
|
||||
pictureBox1.Size = new Size(137, 127);
|
||||
pictureBox1.TabIndex = 19;
|
||||
pictureBox1.TabStop = false;
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
panel3.BorderStyle = BorderStyle.FixedSingle;
|
||||
panel3.Controls.Add(Descyption);
|
||||
panel3.Location = new Point(162, 55);
|
||||
panel3.Name = "panel3";
|
||||
panel3.Size = new Size(276, 44);
|
||||
panel3.TabIndex = 18;
|
||||
//
|
||||
// Descyption
|
||||
//
|
||||
Descyption.AutoSize = true;
|
||||
Descyption.Font = new Font("Comic Sans MS", 9.5F);
|
||||
Descyption.Location = new Point(-1, -1);
|
||||
Descyption.Name = "Descyption";
|
||||
Descyption.Size = new Size(70, 18);
|
||||
Descyption.TabIndex = 15;
|
||||
Descyption.Text = "Описание";
|
||||
//
|
||||
// SupplierLabel
|
||||
//
|
||||
SupplierLabel.AutoSize = true;
|
||||
SupplierLabel.Font = new Font("Comic Sans MS", 10F);
|
||||
SupplierLabel.Location = new Point(162, 99);
|
||||
SupplierLabel.Name = "SupplierLabel";
|
||||
SupplierLabel.Size = new Size(119, 19);
|
||||
SupplierLabel.TabIndex = 17;
|
||||
SupplierLabel.Text = "Производитель:";
|
||||
//
|
||||
// ManufacturerLabel
|
||||
//
|
||||
ManufacturerLabel.AutoSize = true;
|
||||
ManufacturerLabel.Font = new Font("Comic Sans MS", 10F);
|
||||
ManufacturerLabel.Location = new Point(162, 118);
|
||||
ManufacturerLabel.Name = "ManufacturerLabel";
|
||||
ManufacturerLabel.Size = new Size(89, 19);
|
||||
ManufacturerLabel.TabIndex = 16;
|
||||
ManufacturerLabel.Text = "Поставщик:";
|
||||
//
|
||||
// NameLabel
|
||||
//
|
||||
NameLabel.AutoSize = true;
|
||||
NameLabel.Font = new Font("Comic Sans MS", 15F, FontStyle.Bold);
|
||||
NameLabel.Location = new Point(162, -1);
|
||||
NameLabel.Name = "NameLabel";
|
||||
NameLabel.Size = new Size(157, 29);
|
||||
NameLabel.TabIndex = 4;
|
||||
NameLabel.Text = "Наименование";
|
||||
//
|
||||
// CategoryLabel
|
||||
//
|
||||
CategoryLabel.AutoSize = true;
|
||||
CategoryLabel.Font = new Font("Comic Sans MS", 13F);
|
||||
CategoryLabel.Location = new Point(162, 28);
|
||||
CategoryLabel.Name = "CategoryLabel";
|
||||
CategoryLabel.Size = new Size(97, 24);
|
||||
CategoryLabel.TabIndex = 5;
|
||||
CategoryLabel.Text = "Категория";
|
||||
//
|
||||
// dataGridViewUser
|
||||
//
|
||||
dataGridViewUser.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewUser.Location = new Point(61, 103);
|
||||
dataGridViewUser.Name = "dataGridViewUser";
|
||||
dataGridViewUser.Size = new Size(643, 236);
|
||||
dataGridViewUser.TabIndex = 17;
|
||||
dataGridViewUser.Click += dataGridViewUser_Click;
|
||||
//
|
||||
// ExitButton
|
||||
//
|
||||
ExitButton.BackColor = Color.Red;
|
||||
ExitButton.Location = new Point(758, 12);
|
||||
ExitButton.Name = "ExitButton";
|
||||
ExitButton.Size = new Size(30, 27);
|
||||
ExitButton.TabIndex = 16;
|
||||
ExitButton.Text = "X";
|
||||
ExitButton.UseVisualStyleBackColor = false;
|
||||
ExitButton.Click += ExitButton_Click;
|
||||
//
|
||||
// labelFIO
|
||||
//
|
||||
labelFIO.AutoSize = true;
|
||||
labelFIO.Font = new Font("Comic Sans MS", 9F);
|
||||
labelFIO.Location = new Point(591, 74);
|
||||
labelFIO.Name = "labelFIO";
|
||||
labelFIO.Size = new Size(35, 17);
|
||||
labelFIO.TabIndex = 19;
|
||||
labelFIO.Text = "ФИО";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
label10.AutoSize = true;
|
||||
label10.Font = new Font("Comic Sans MS", 26.25F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
label10.Location = new Point(88, 9);
|
||||
label10.Name = "label10";
|
||||
label10.Size = new Size(635, 49);
|
||||
label10.TabIndex = 33;
|
||||
label10.Text = "ГЛАВНАЯ ФОРМА ПОЛЬЗОВАТЕЛЯ";
|
||||
//
|
||||
// button3
|
||||
//
|
||||
button3.BackColor = Color.Red;
|
||||
button3.Font = new Font("Comic Sans MS", 9F, FontStyle.Regular, GraphicsUnit.Point, 204);
|
||||
button3.Location = new Point(713, 477);
|
||||
button3.Name = "button3";
|
||||
button3.Size = new Size(75, 23);
|
||||
button3.TabIndex = 49;
|
||||
button3.Text = "Назад";
|
||||
button3.UseVisualStyleBackColor = false;
|
||||
button3.Click += button3_Click;
|
||||
//
|
||||
// UserForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = Color.FromArgb(192, 237, 215);
|
||||
ClientSize = new Size(800, 512);
|
||||
Controls.Add(button3);
|
||||
Controls.Add(label10);
|
||||
Controls.Add(labelFIO);
|
||||
Controls.Add(panel1);
|
||||
Controls.Add(dataGridViewUser);
|
||||
Controls.Add(ExitButton);
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Name = "UserForm";
|
||||
Text = "UserForm";
|
||||
Load += UserForm_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
panel1.PerformLayout();
|
||||
panel2.ResumeLayout(false);
|
||||
panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
|
||||
panel3.ResumeLayout(false);
|
||||
panel3.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewUser).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Panel panel2;
|
||||
private Label CountLabel;
|
||||
private Label PriceLabel;
|
||||
private PictureBox pictureBox1;
|
||||
private Panel panel3;
|
||||
private Label Descyption;
|
||||
private Label SupplierLabel;
|
||||
private Label ManufacturerLabel;
|
||||
private Label NameLabel;
|
||||
private Label CategoryLabel;
|
||||
private DataGridView dataGridViewUser;
|
||||
private Button ExitButton;
|
||||
private Label labelFIO;
|
||||
private Label label10;
|
||||
private Button button3;
|
||||
}
|
||||
}
|
||||
84
WinFormsApp1/UserForm.cs
Normal file
84
WinFormsApp1/UserForm.cs
Normal file
@ -0,0 +1,84 @@
|
||||
using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace WinFormsApp1
|
||||
{
|
||||
public partial class UserForm : Form
|
||||
{
|
||||
public UserForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadUserData();
|
||||
}
|
||||
|
||||
private void ExitButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
private MySqlDataAdapter dataAdapter;
|
||||
private DataTable prodTable;
|
||||
private BindingSource bindingSource = new BindingSource();
|
||||
private void LoadUserData()
|
||||
{
|
||||
try
|
||||
{
|
||||
DB db = new DB();
|
||||
using (MySqlConnection connection = db.getConnection())
|
||||
{
|
||||
connection.Open();
|
||||
string query = "SELECT idProducts, Article AS `Артикул`, ProductName AS `название товара`, CategoryName AS `Название категории`, ProductDescryption AS `Описание`, ManufacturerName AS `Производитель`, SupplierName AS `Поставщик`, Price AS `Цена`, Discount AS `Процент скидки`, QuantityStock AS `Количество на складе`, UnitTypeName AS `Единица измерения` FROM Products LEFT JOIN Category ON Products.Category_id = Category.idCategory JOIN Manufacturer ON Products.Manufacturer_id = Manufacturer.idManufacturer JOIN Supplier ON Products.Supplier_id = Supplier.idSupplier JOIN UnitType ON Products.UnitType_id = UnitType.idUnitType";
|
||||
|
||||
dataAdapter = new MySqlDataAdapter(query, connection);
|
||||
prodTable = new DataTable();
|
||||
dataAdapter.Fill(prodTable);
|
||||
dataGridViewUser.RowTemplate.Height = 60;
|
||||
bindingSource.DataSource = prodTable;
|
||||
dataGridViewUser.DataSource = bindingSource;
|
||||
|
||||
}
|
||||
}
|
||||
catch (MySqlException ex)
|
||||
{
|
||||
MessageBox.Show("Ошибка при подключении к базе данных или выполнении запроса: " + ex.Message);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Произошла общая ошибка: " + ex.Message);
|
||||
}
|
||||
}
|
||||
private void dataGridViewUser_Click(object sender, EventArgs e)
|
||||
{
|
||||
CategoryLabel.Text = dataGridViewUser.CurrentRow.Cells[3].Value.ToString();
|
||||
NameLabel.Text = dataGridViewUser.CurrentRow.Cells[2].Value.ToString();
|
||||
Descyption.Text = dataGridViewUser.CurrentRow.Cells[4].Value.ToString();
|
||||
PriceLabel.Text = dataGridViewUser.CurrentRow.Cells[7].Value.ToString();
|
||||
CountLabel.Text = dataGridViewUser.CurrentRow.Cells[9].Value.ToString();
|
||||
ManufacturerLabel.Text = dataGridViewUser.CurrentRow.Cells[5].Value.ToString();
|
||||
SupplierLabel.Text = dataGridViewUser.CurrentRow.Cells[6].Value.ToString();
|
||||
}
|
||||
|
||||
private void UserForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
{
|
||||
labelFIO.Text = loginForm.FIO;
|
||||
}
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
loginForm lf = new loginForm();
|
||||
lf.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
120
WinFormsApp1/UserForm.resx
Normal file
120
WinFormsApp1/UserForm.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<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>
|
||||
30
WinFormsApp1/WinFormsApp1.csproj
Normal file
30
WinFormsApp1/WinFormsApp1.csproj
Normal file
@ -0,0 +1,30 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MySql.Data" Version="9.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
32
WinFormsApp1/WinFormsApp1.csproj.user
Normal file
32
WinFormsApp1/WinFormsApp1.csproj.user
Normal file
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Compile Update="AddForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="AdmMainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="AdmOrderForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="GuestForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="LoginForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="ManagerMainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="ManagerOrder.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Reduct2.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="UserForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Loading…
Reference in New Issue
Block a user