68 lines
2.9 KiB
C#
68 lines
2.9 KiB
C#
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 Npgsql;
|
|
|
|
namespace demo26052026
|
|
{
|
|
public partial class Form3 : Form
|
|
{
|
|
static string ConnString = "Server=localhost;Port=5432;Database=newdemo262;Username=postgres;Password=Swa2sWA13;";
|
|
public Form3()
|
|
{
|
|
InitializeComponent();
|
|
NpgsqlConnection npgsqlConnection = new NpgsqlConnection(ConnString);
|
|
npgsqlConnection.Open();
|
|
NpgsqlCommand npgsqlCommand = new NpgsqlCommand($@"SELECT ""Data_Z"", ""Data_P"", (SELECT ""Imia"" FROM public.""Adressa"" WHERE ""ID_Adress"" = ""Adress_ID""), (SELECT ""Imia"" FROM public.""Status"" WHERE ""ID_Status"" = ""Status"" ), ""ID_Zakaza"" FROM public.""Zakaz"";", npgsqlConnection);
|
|
DataTable dataTable = new DataTable();
|
|
dataTable.Load(npgsqlCommand.ExecuteReader());
|
|
npgsqlConnection.Close();
|
|
for (int i = 0; i < dataTable.Rows.Count; i++)
|
|
{
|
|
UserControl2 userControl2 = new UserControl2(this);
|
|
userControl2.textBox2.Text = dataTable.Rows[i].ItemArray[3].ToString();
|
|
userControl2.textBox3.Text = dataTable.Rows[i].ItemArray[2].ToString();
|
|
userControl2.textBox4.Text = dataTable.Rows[i].ItemArray[0].ToString();
|
|
userControl2.textBox5.Text = dataTable.Rows[i].ItemArray[1].ToString();
|
|
userControl2.Name = dataTable.Rows[i].ItemArray[4].ToString();
|
|
|
|
NpgsqlConnection npgsqlConnection2 = new NpgsqlConnection(ConnString);
|
|
npgsqlConnection2.Open();
|
|
NpgsqlCommand npgsqlCommand2 = new NpgsqlCommand($@"SELECT (SELECT ""Articul"" FROM public.""Tovar"" WHERE ""ID_Tovar"" =""Tovar_ID""), ""Kolichestvo"" FROM public.""Sostav"" WHERE ""Zakaz_ID"" = {dataTable.Rows[i].ItemArray[4].ToString()};", npgsqlConnection2);
|
|
DataTable dataTable2 = new DataTable();
|
|
dataTable2.Load(npgsqlCommand2.ExecuteReader());
|
|
npgsqlConnection2.Close();
|
|
string dataArt = "";
|
|
for(int j = 0; j < dataTable2.Rows.Count; j++)
|
|
{
|
|
dataArt = dataArt + dataTable2.Rows[j].ItemArray[0].ToString() + ", " + dataTable2.Rows[j].ItemArray[1].ToString() + " ";
|
|
}
|
|
userControl2.textBox1.Text = dataArt;
|
|
flowLayoutPanel1.Controls.Add(userControl2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
this.Hide();
|
|
Form1 form1 = new Form1();
|
|
form1.ShowDialog();
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
this.Hide();
|
|
Form4 form4 = new Form4(0);
|
|
form4.ShowDialog();
|
|
}
|
|
}
|
|
}
|