80 lines
3.3 KiB
C#
80 lines
3.3 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 demo25052026
|
|
{
|
|
public partial class Form3 : Form
|
|
{
|
|
static string connS = "Server=localhost;Port=5432;Database=newdemo26;Username=postgres;Password=Swa2sWA13;";
|
|
public Form3()
|
|
{
|
|
InitializeComponent();
|
|
NpgsqlConnection npgsqlConnection = new NpgsqlConnection(connS);
|
|
npgsqlConnection.Open();
|
|
NpgsqlCommand command = new NpgsqlCommand(@$"SELECT ""Data_Z"", ""Data_P"", (SELECT ""Imia"" FROM public.""Punkti"" WHERE ""Punkti"".""ID_Punkt"" = ""Zakaz"".""ID_Punkt""), (SELECT ""Imia"" FROM public.""Status_Zakaz"" WHERE ""ID_StatusZakaz"" = ""Status_Zakaz""), ""ID_Zakaz"" FROM public.""Zakaz"";", npgsqlConnection);
|
|
DataTable data = new DataTable();
|
|
data.Load(command.ExecuteReader());
|
|
|
|
for (int i = 0; i < data.Rows.Count; i++)
|
|
{
|
|
UCZakaz zakaz = new UCZakaz();
|
|
zakaz.textBox4.Text = data.Rows[i].ItemArray[0].ToString();
|
|
zakaz.textBox5.Text = data.Rows[i].ItemArray[1].ToString();
|
|
zakaz.textBox3.Text = data.Rows[i].ItemArray[2].ToString();
|
|
zakaz.textBox2.Text = data.Rows[i].ItemArray[3].ToString();
|
|
zakaz.Name = data.Rows[i].ItemArray[4].ToString();
|
|
|
|
////////////////////
|
|
///
|
|
NpgsqlConnection npgsqlConnections = new NpgsqlConnection(connS);
|
|
npgsqlConnections.Open();
|
|
NpgsqlCommand commands = new NpgsqlCommand(@$"SELECT ""ID_Sostav"" FROM public.""ZakazSostav"" WHERE ""ID_Zakaz"" = {data.Rows[i].ItemArray[4].ToString()};", npgsqlConnections);
|
|
DataTable datas = new DataTable();
|
|
datas.Load(commands.ExecuteReader());
|
|
|
|
string resultArt = "";
|
|
for (int j = 0; j < datas.Rows.Count; j++)
|
|
{
|
|
|
|
NpgsqlConnection npgsqlConnectionss = new NpgsqlConnection(connS);
|
|
npgsqlConnectionss.Open();
|
|
NpgsqlCommand commandss = new NpgsqlCommand(@$"SELECT (SELECT ""Articul"" FROM public.""Tovar"" WHERE ""Tovar"".""ID_Tovar"" = ""Sostav"".""ID_Tovar""), ""Kolichestvo"" FROM public.""Sostav"" WHERE ""ID_Sostav"" = {datas.Rows[j].ItemArray[0].ToString()};", npgsqlConnectionss);
|
|
DataTable datass = new DataTable();
|
|
datass.Load(commandss.ExecuteReader());
|
|
resultArt = resultArt + " " + datass.Rows[0].ItemArray[0] + ", " + datass.Rows[0].ItemArray[1];
|
|
}
|
|
|
|
zakaz.textBox1.Text = resultArt;
|
|
///
|
|
////////////////////////////
|
|
|
|
flowLayoutPanel1.Controls.Add(zakaz);
|
|
}
|
|
|
|
npgsqlConnection.Close();
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
this.Hide();
|
|
Form1 form = new Form1();
|
|
form.ShowDialog();
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
this.Hide();
|
|
Form4 form = new Form4();
|
|
form.ShowDialog();
|
|
}
|
|
}
|
|
}
|