private void FormInvSer_Load object sender EventArgs pictureBoxCat Vis

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
private void FormInvSer_Load(object sender, EventArgs e)
{
pictureBoxCat.Visible = false;
label1.Visible = false;
groupBoxInv.Visible = true;
string sqlSelect = "";
SqlConnection connection = new SqlConnection(Properties.Settings.Default.beauty_saloon_MarigoldConnectionString);
SqlCommand command = connection.CreateCommand();
sqlSelect = @"Select A.ID_Inventory AS 'ID Инвентаря', C.Name_inventory AS 'Название', A.Required_quantity_inventory 'Необходимое количество', C.Last_quantity_inventory AS 'Остаток', C.Unit_inventory AS 'Единицы измерения', C.Description_inventory AS Описание
FROM ServiceInventory A, [Services] B, Inventory C
Where A.ID_Inventory = C.ID_Inventory AND
A.ID_Service = B.ID_Service AND
A.ID_Service = @ID";
command.CommandText = sqlSelect;
command.Parameters.AddWithValue("@ID", idCurrent);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = command;
DataTable table = new DataTable();
adapter.Fill(table);
dataGridViewInv.DataSource = table;
if (table.Rows.Count == 0)
{
label1.Visible = true;
label1.Text = "Нет назначенного инвентаря";
groupBoxInv.Visible = false;
pictureBoxCat.Visible = true;
}
}