using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace СУБД_Швейная_фабрика { public partial class FormClient : Form { public FormClient() { InitializeComponent(); } class ClothPanel : Panel { public System.Windows.Forms.TextBox tbxDescription; public System.Windows.Forms.TextBox tbxHeight; public System.Windows.Forms.TextBox tbxWeight; public System.Windows.Forms.TextBox tbxColor; public System.Windows.Forms.TextBox tbxTitle; public System.Windows.Forms.Label label5; public System.Windows.Forms.Label label4; public System.Windows.Forms.Label label3; public System.Windows.Forms.Label label2; public System.Windows.Forms.Label label1; public System.Windows.Forms.PictureBox pbxPhoto; public ClothPanel() { // this.panel1 = new System.Windows.Forms.Panel(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.tbxTitle = new System.Windows.Forms.TextBox(); this.tbxColor = new System.Windows.Forms.TextBox(); this.tbxWeight = new System.Windows.Forms.TextBox(); this.tbxHeight = new System.Windows.Forms.TextBox(); this.tbxDescription = new System.Windows.Forms.TextBox(); this.pbxPhoto = new System.Windows.Forms.PictureBox(); this.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.BackColor = System.Drawing.Color.White; this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Controls.Add(this.tbxDescription); this.Controls.Add(this.tbxHeight); this.Controls.Add(this.tbxWeight); this.Controls.Add(this.tbxColor); this.Controls.Add(this.tbxTitle); this.Controls.Add(this.label5); this.Controls.Add(this.label4); this.Controls.Add(this.label3); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.pbxPhoto); this.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Location = new System.Drawing.Point(28, 27); this.MinimumSize = new System.Drawing.Size(505, 171); this.Name = "panel1"; this.Size = new System.Drawing.Size(674, 171); this.TabIndex = 0; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(137, 15); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(68, 16); this.label1.TabIndex = 1; this.label1.Text = "Название:"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(137, 43); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(40, 16); this.label2.TabIndex = 2; this.label2.Text = "Цвет:"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(137, 71); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(57, 16); this.label3.TabIndex = 3; this.label3.Text = "Ширина:"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(137, 99); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(48, 16); this.label4.TabIndex = 4; this.label4.Text = "Длина:"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(137, 127); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(70, 16); this.label5.TabIndex = 5; this.label5.Text = "Описание:"; // // tbxTitle // this.tbxTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tbxTitle.Location = new System.Drawing.Point(211, 12); this.tbxTitle.Name = "tbxTitle"; this.tbxTitle.ReadOnly = true; this.tbxTitle.Size = new System.Drawing.Size(535, 22); this.tbxTitle.TabIndex = 6; // // tbxColor // this.tbxColor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tbxColor.Location = new System.Drawing.Point(211, 40); this.tbxColor.Name = "tbxColor"; this.tbxColor.ReadOnly = true; this.tbxColor.Size = new System.Drawing.Size(535, 22); this.tbxColor.TabIndex = 7; // // tbxWeight // this.tbxWeight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tbxWeight.Location = new System.Drawing.Point(211, 68); this.tbxWeight.Name = "tbxWeight"; this.tbxWeight.ReadOnly = true; this.tbxWeight.Size = new System.Drawing.Size(535, 22); this.tbxWeight.TabIndex = 8; // // tbxHeight // this.tbxHeight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tbxHeight.Location = new System.Drawing.Point(211, 96); this.tbxHeight.Name = "tbxHeight"; this.tbxHeight.ReadOnly = true; this.tbxHeight.Size = new System.Drawing.Size(535, 22); this.tbxHeight.TabIndex = 9; // // tbxDescription // this.tbxDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tbxDescription.Location = new System.Drawing.Point(211, 124); this.tbxDescription.Multiline = true; this.tbxDescription.Name = "tbxDescription"; this.tbxDescription.ReadOnly = true; this.tbxDescription.Size = new System.Drawing.Size(535, 19); this.tbxDescription.TabIndex = 10; // // pbxPhoto // this.pbxPhoto.Location = new System.Drawing.Point(14, 12); this.pbxPhoto.Name = "pbxPhoto"; this.pbxPhoto.Size = new System.Drawing.Size(117, 131); this.pbxPhoto.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pbxPhoto.TabIndex = 0; this.pbxPhoto.TabStop = false; } } class FurnituraPanel : Panel { public System.Windows.Forms.TextBox tbxCount; public System.Windows.Forms.TextBox tbxTitle; public System.Windows.Forms.Label label5; public System.Windows.Forms.Label label1; public System.Windows.Forms.PictureBox pbxPhoto; public FurnituraPanel() { this.label1 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.tbxTitle = new System.Windows.Forms.TextBox(); this.tbxCount = new System.Windows.Forms.TextBox(); this.pbxPhoto = new System.Windows.Forms.PictureBox(); this.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.BackColor = System.Drawing.Color.White; this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Controls.Add(this.tbxCount); this.Controls.Add(this.tbxTitle); this.Controls.Add(this.label5); this.Controls.Add(this.label1); this.Controls.Add(this.pbxPhoto); this.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Location = new System.Drawing.Point(35, 27); this.Name = "panel1"; this.Size = new System.Drawing.Size(284, 171); this.TabIndex = 0; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(3, 110); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(68, 16); this.label1.TabIndex = 1; this.label1.Text = "Название:"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(3, 138); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(115, 16); this.label5.TabIndex = 5; this.label5.Text = "Кол-во на складе:"; // // tbxTitle // this.tbxTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tbxTitle.Location = new System.Drawing.Point(77, 107); this.tbxTitle.Name = "tbxTitle"; this.tbxTitle.ReadOnly = true; this.tbxTitle.Size = new System.Drawing.Size(143, 22); this.tbxTitle.TabIndex = 6; // // tbxCount // this.tbxCount.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tbxCount.Location = new System.Drawing.Point(124, 135); this.tbxCount.Multiline = true; this.tbxCount.Name = "tbxCount"; this.tbxCount.ReadOnly = true; this.tbxCount.Size = new System.Drawing.Size(57, 19); this.tbxCount.TabIndex = 10; // // pbxPhoto // this.pbxPhoto.Location = new System.Drawing.Point(77, 9); this.pbxPhoto.Name = "pbxPhoto"; this.pbxPhoto.Size = new System.Drawing.Size(143, 92); this.pbxPhoto.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pbxPhoto.TabIndex = 0; this.pbxPhoto.TabStop = false; } } class ProductPanel : Panel { public System.Windows.Forms.TextBox tbxLenght; public System.Windows.Forms.TextBox tbxTitle; public System.Windows.Forms.Label label5; public System.Windows.Forms.Label label1; public System.Windows.Forms.PictureBox pbxPhoto; public System.Windows.Forms.TextBox tbxWight; public System.Windows.Forms.Label label2; public ProductPanel() { this.tbxLenght = new System.Windows.Forms.TextBox(); this.tbxTitle = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.pbxPhoto = new System.Windows.Forms.PictureBox(); this.label2 = new System.Windows.Forms.Label(); this.tbxWight = new System.Windows.Forms.TextBox(); this.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.BackColor = System.Drawing.Color.White; this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Controls.Add(this.tbxWight); this.Controls.Add(this.label2); this.Controls.Add(this.tbxLenght); this.Controls.Add(this.tbxTitle); this.Controls.Add(this.label5); this.Controls.Add(this.label1); this.Controls.Add(this.pbxPhoto); this.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Location = new System.Drawing.Point(35, 27); this.Name = "panel1"; this.Size = new System.Drawing.Size(657, 105); this.TabIndex = 0; // // tbxLenght // this.tbxLenght.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tbxLenght.Location = new System.Drawing.Point(229, 34); this.tbxLenght.Multiline = true; this.tbxLenght.Name = "tbxLenght"; this.tbxLenght.ReadOnly = true; this.tbxLenght.Size = new System.Drawing.Size(328, 19); this.tbxLenght.TabIndex = 10; // // tbxTitle // this.tbxTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tbxTitle.Location = new System.Drawing.Point(229, 6); this.tbxTitle.Name = "tbxTitle"; this.tbxTitle.ReadOnly = true; this.tbxTitle.Size = new System.Drawing.Size(375, 22); this.tbxTitle.TabIndex = 6; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(164, 37); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(48, 16); this.label5.TabIndex = 5; this.label5.Text = "Длина:"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(155, 9); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(68, 16); this.label1.TabIndex = 1; this.label1.Text = "Название:"; // // pbxPhoto // this.pbxPhoto.Location = new System.Drawing.Point(6, 6); this.pbxPhoto.Name = "pbxPhoto"; this.pbxPhoto.Size = new System.Drawing.Size(143, 92); this.pbxPhoto.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pbxPhoto.TabIndex = 0; this.pbxPhoto.TabStop = false; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(155, 64); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(57, 16); this.label2.TabIndex = 11; this.label2.Text = "Ширина:"; // // tbxWight // this.tbxWight.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tbxWight.Location = new System.Drawing.Point(229, 64); this.tbxWight.Multiline = true; this.tbxWight.Name = "tbxWight"; this.tbxWight.ReadOnly = true; this.tbxWight.Size = new System.Drawing.Size(328, 19); this.tbxWight.TabIndex = 12; } } class OrdersPanel : Panel { public System.Windows.Forms.TextBox tbxLenght; public System.Windows.Forms.TextBox tbxTitle; public System.Windows.Forms.Label label5; public System.Windows.Forms.Label label1; public System.Windows.Forms.TextBox tbxWight; public System.Windows.Forms.Label label2; public System.Windows.Forms.TextBox tbxCountProducts; public System.Windows.Forms.Label label8; public System.Windows.Forms.TextBox tbxCountFur; public System.Windows.Forms.Label label7; public System.Windows.Forms.TextBox tbxFur; public System.Windows.Forms.Label label6; public System.Windows.Forms.TextBox tbxClothColor; public System.Windows.Forms.Label label4; public System.Windows.Forms.TextBox tbxCloth; public System.Windows.Forms.Label label3; public OrdersPanel() { this.tbxLenght = new System.Windows.Forms.TextBox(); this.tbxTitle = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.tbxWight = new System.Windows.Forms.TextBox(); this.tbxCloth = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.tbxClothColor = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.tbxFur = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); this.tbxCountFur = new System.Windows.Forms.TextBox(); this.label7 = new System.Windows.Forms.Label(); this.tbxCountProducts = new System.Windows.Forms.TextBox(); this.label8 = new System.Windows.Forms.Label(); this.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.BackColor = System.Drawing.Color.White; this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.Controls.Add(this.tbxCountProducts); this.Controls.Add(this.label8); this.Controls.Add(this.tbxCountFur); this.Controls.Add(this.label7); this.Controls.Add(this.tbxFur); this.Controls.Add(this.label6); this.Controls.Add(this.tbxClothColor); this.Controls.Add(this.label4); this.Controls.Add(this.tbxCloth); this.Controls.Add(this.label3); this.Controls.Add(this.tbxWight); this.Controls.Add(this.label2); this.Controls.Add(this.tbxLenght); this.Controls.Add(this.tbxTitle); this.Controls.Add(this.label5); this.Controls.Add(this.label1); this.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.Location = new System.Drawing.Point(35, 27); this.Name = "panel1"; this.Size = new System.Drawing.Size(657, 145); this.TabIndex = 0; // // tbxLenght // this.tbxLenght.Location = new System.Drawing.Point(77, 37); this.tbxLenght.Multiline = true; this.tbxLenght.Name = "tbxLenght"; this.tbxLenght.ReadOnly = true; this.tbxLenght.Size = new System.Drawing.Size(136, 19); this.tbxLenght.TabIndex = 10; // // tbxTitle // this.tbxTitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tbxTitle.Location = new System.Drawing.Point(77, 6); this.tbxTitle.Name = "tbxTitle"; this.tbxTitle.ReadOnly = true; this.tbxTitle.Size = new System.Drawing.Size(575, 22); this.tbxTitle.TabIndex = 6; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(23, 40); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(48, 16); this.label5.TabIndex = 5; this.label5.Text = "Длина:"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(5, 9); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(68, 16); this.label1.TabIndex = 1; this.label1.Text = "Название:"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(229, 37); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(57, 16); this.label2.TabIndex = 11; this.label2.Text = "Ширина:"; // // tbxWight // this.tbxWight.Location = new System.Drawing.Point(290, 37); this.tbxWight.Multiline = true; this.tbxWight.Name = "tbxWight"; this.tbxWight.ReadOnly = true; this.tbxWight.Size = new System.Drawing.Size(136, 19); this.tbxWight.TabIndex = 12; // // tbxCloth // this.tbxCloth.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.tbxCloth.Location = new System.Drawing.Point(77, 62); this.tbxCloth.Multiline = true; this.tbxCloth.Name = "tbxCloth"; this.tbxCloth.ReadOnly = true; this.tbxCloth.Size = new System.Drawing.Size(573, 19); this.tbxCloth.TabIndex = 14; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(27, 62); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(44, 16); this.label3.TabIndex = 13; this.label3.Text = "Ткань:"; // // tbxClothColor // this.tbxClothColor.Location = new System.Drawing.Point(105, 84); this.tbxClothColor.Multiline = true; this.tbxClothColor.Name = "tbxClothColor"; this.tbxClothColor.ReadOnly = true; this.tbxClothColor.Size = new System.Drawing.Size(136, 19); this.tbxClothColor.TabIndex = 16; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(23, 84); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(76, 16); this.label4.TabIndex = 15; this.label4.Text = "Цвет ткани:"; // // tbxFur // this.tbxFur.Location = new System.Drawing.Point(321, 84); this.tbxFur.Multiline = true; this.tbxFur.Name = "tbxFur"; this.tbxFur.ReadOnly = true; this.tbxFur.Size = new System.Drawing.Size(137, 19); this.tbxFur.TabIndex = 18; // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(247, 84); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(76, 16); this.label6.TabIndex = 17; this.label6.Text = "Фурнитура:"; // // tbxCountFur // this.tbxCountFur.Location = new System.Drawing.Point(125, 109); this.tbxCountFur.Multiline = true; this.tbxCountFur.Name = "tbxCountFur"; this.tbxCountFur.ReadOnly = true; this.tbxCountFur.Size = new System.Drawing.Size(88, 19); this.tbxCountFur.TabIndex = 20; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(3, 109); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(120, 16); this.label7.TabIndex = 19; this.label7.Text = "Кол-во фурнитуры:"; // // tbxCountProducts // this.tbxCountProducts.Location = new System.Drawing.Point(358, 109); this.tbxCountProducts.Multiline = true; this.tbxCountProducts.Name = "tbxCountProducts"; this.tbxCountProducts.ReadOnly = true; this.tbxCountProducts.Size = new System.Drawing.Size(100, 19); this.tbxCountProducts.TabIndex = 22; // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(248, 109); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(104, 16); this.label8.TabIndex = 21; this.label8.Text = "Кол-во изделий:"; // } } private void FormClient_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(FormAuthorization.StrCon); con.Open(); SqlCommand cmd = new SqlCommand($@"select Fam,Name,Otch from Users where IdUser = {FormAuthorization.IdUser}", con); SqlDataReader res = cmd.ExecuteReader(); res.Read(); lblFIO.Text = $"{res["Fam"]} {res["Name"]} {res["Otch"]}"; res.Close(); con.Close(); GetClothFromDB(); GetFurnituraFromDB(); GetProductsFromDB(); GetOrdersFromDB(); } //struct Cloths //{ // public string id, Title, idColor, Weight, Height, Note, Photo; //} void GetOrdersFromDB() { SqlConnection con = new SqlConnection(FormAuthorization.StrCon); SqlCommand cmd = new SqlCommand($@"Select Orders.IdOrder,Products.TitleProduct,Products.Lenght,Products.Width,Orders.IdClient,Cloth.Title as ClothTitle, Colors.Title as ColorTitle, Furnitura.namefur,Orders.CountFurnitura, Orders.CountProduct from Orders join Users on Users.IdUser = Orders.IdClient join Products on Products.IdProduct = Orders.IdProduct join Cloth on Cloth.IdCloth = Orders.IdCloth join Furnitura on Furnitura.idfur = Orders.IdFur join Colors on Cloth.IdColor = Colors.IdColor where Users.IdUser = {FormAuthorization.IdUser} ", con); con.Open(); SqlDataReader res = cmd.ExecuteReader(); while (res.Read()) { OrdersPanel or = new OrdersPanel(); or.tbxTitle.Text = res["TitleProduct"].ToString(); or.tbxWight.Text = res["Width"].ToString(); or.tbxLenght.Text = res["Lenght"].ToString(); or.tbxCloth.Text = res["ClothTitle"].ToString(); or.tbxClothColor.Text = res["ColorTitle"].ToString(); or.tbxCountFur.Text = res["CountFurnitura"].ToString(); or.tbxFur.Text = res["namefur"].ToString(); or.tbxCountProducts.Text = res["CountProduct"].ToString(); tlpOrders.Controls.Add(or); } res.Close(); con.Close(); } void GetProductsFromDB() { SqlConnection con = new SqlConnection(FormAuthorization.StrCon); SqlCommand cmd = new SqlCommand(@"select * from Products", con); con.Open(); SqlDataReader res = cmd.ExecuteReader(); while (res.Read()) { ProductPanel p = new ProductPanel(); p.tbxTitle.Text = res["TitleProduct"].ToString(); p.tbxLenght.Text = res["Lenght"].ToString(); p.tbxWight.Text = res["Width"].ToString(); //try //{ // p.pbxPhoto.Image = Image.FromFile(Application.StartupPath + "\\Фото фурнитур\\" + res["Photo"]); //} //catch //{ // p.pbxPhoto.Image = Image.FromFile(Application.StartupPath + "\\Фото фурнитур\\picture.png"); //} tlpProducts.Controls.Add(p); } res.Close(); con.Close(); } void GetClothFromDB() { SqlConnection con = new SqlConnection(FormAuthorization.StrCon); // Возможны ошибки с названием цвета SqlCommand cmd = new SqlCommand(@"SELECT Cloth.IdCloth, Cloth.Title, Cloth.IdColor, Cloth.Weight, Cloth.Height, Cloth.Note, Cloth.Photo, Colors.IdColor AS Expr1, Colors.Title AS ColorTitle FROM Cloth INNER JOIN Colors ON Cloth.IdColor = Colors.IdColor", con); con.Open(); SqlDataReader res = cmd.ExecuteReader(); while (res.Read()) { ClothPanel p = new ClothPanel(); p.tbxTitle.Text = res["Title"].ToString(); p.tbxColor.Text = res["ColorTitle"].ToString(); p.tbxWeight.Text = res["Weight"].ToString(); p.tbxHeight.Text = res["Height"].ToString(); p.tbxDescription.Text = res["Note"].ToString(); try { p.pbxPhoto.Image = Image.FromFile(Application.StartupPath + "\\Фото тканей\\" + res["Photo"]); } catch { p.pbxPhoto.Image = Image.FromFile(Application.StartupPath + "\\Фото тканей\\picture.png"); } tlpPanelCloth.Controls.Add(p); } res.Close(); con.Close(); } void GetFurnituraFromDB() { SqlConnection con = new SqlConnection(FormAuthorization.StrCon); SqlCommand cmd = new SqlCommand(@"select * from Furnitura", con); con.Open(); SqlDataReader res = cmd.ExecuteReader(); while (res.Read()) { FurnituraPanel f = new FurnituraPanel(); f.tbxTitle.Text = res["namefur"].ToString(); f.tbxCount.Text = res["countfur"].ToString(); try { f.pbxPhoto.Image = Image.FromFile(Application.StartupPath + "\\Фото фурнитур\\" + res["Photo"]); } catch { f.pbxPhoto.Image = Image.FromFile(Application.StartupPath + "\\Фото фурнитур\\picture.png"); } tlpFur.Controls.Add(f); } res.Close(); con.Close(); } private void btnEdit_Click(object sender, EventArgs e) { FormEditUser frm = new FormEditUser(); this.Hide(); frm.ShowDialog(); this.Show(); } private void btnNewOrder_Click(object sender, EventArgs e) { FormNewOrder frm = new FormNewOrder(); this.Hide(); frm.ShowDialog(); this.Show(); } private void btnFind_Click(object sender, EventArgs e) { FormClothFind frm = new FormClothFind(); this.Hide(); frm.ShowDialog(); this.Show(); } } }