// --------------  Остатки
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Remains remains = new Remains();

            if (comboBox1.Text == "Все товары" && comboBox2.Text == "Все")
            {
                selectDbCategory = "SELECT * FROM Products";
                remains.getAllProducts(connection, selectDbCategory, dataGridView1);
                return;
            }

            if (comboBox1.Text == "Все товары" && comboBox2.Text == "В наличии")
            {
                selectDbCategory = "SELECT * FROM Products WHERE (remains > 0)";
                remains.getAllProducts(connection, selectDbCategory, dataGridView1);
                return;
            }

            if (comboBox1.Text == "Все товары" && comboBox2.Text == "Нет на складе")
            {
                selectDbCategory = "SELECT * FROM Products WHERE (remains = 0)";
                remains.getAllProducts(connection, selectDbCategory, dataGridView1);
                return;
            }

            if (comboBox1.Text == "Все товары" && comboBox2.Text == "Меньше мин. остатка")
            {
                selectDbCategory = "SELECT * FROM Products WHERE (remains < min_remains)";
                remains.getAllProducts(connection, selectDbCategory, dataGridView1);
                return;
            }

            if (comboBox2.Text == "Все")
            {
                selectDbCategory = "SELECT * FROM Products WHERE category = N'" + comboBox1.Text + "'";
            }

            if (comboBox2.Text == "В наличии")
            {
                selectDbCategory = "SELECT * FROM Products WHERE category = N'" + comboBox1.Text + "' AND (remains > 0)";
            }

            if (comboBox2.Text == "Нет на складе")
            {
                selectDbCategory = "SELECT * FROM Products WHERE category = N'" + comboBox1.Text + "' AND (remains = 0)";
            }

            if (comboBox2.Text == "Меньше мин. остатка")
            {
                selectDbCategory = "SELECT * FROM Products WHERE category = N'" + comboBox1.Text + "' AND (remains < min_remains)";
            }

            remains.getAllProducts(connection, selectDbCategory, dataGridView1);
        }
        private async void Form1_Load(object sender, EventArgs e)
        {
            await connection.OpenAsync();

            if (tabControl1.SelectedTab == tabPage1)
            {
                Remains remains = new Remains();
                remains.getAllProducts(connection, selectDbCategory, dataGridView1);
            }
            if (tabControl1.SelectedTab == tabPage2)
            {
                Postings postings = new Postings();
                postings.getAllDocuments(connection, selectDbPostings, dataGridView2);
            }
            if (tabControl1.SelectedTab == tabPage3)
            {
                Postings writeOff = new Postings();
                writeOff.getAllDocuments(connection, selectDbWriteOff, dataGridView3);
            }


            /*Remains remains = new Remains();
             * remains.getAllProducts(connection, selectDbCategory, dataGridView1);
             *
             * Postings postings = new Postings();
             * postings.getAllDocuments(connection, selectDbPostings, dataGridView2);
             *
             * Postings writeOff = new Postings();
             * writeOff.getAllDocuments(connection, selectDbWriteOff, dataGridView3);*/
        }
        // Поиск товаров по названию
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            selectDbCategory = "SELECT * FROM Products WHERE name LIKE N'%" + textBox1.Text + "%'";

            Remains remains = new Remains();

            remains.getAllProducts(connection, selectDbCategory, dataGridView1);
        }
 private void tabControl1_Selected(object sender, TabControlEventArgs e)
 {
     if (tabControl1.SelectedTab == tabPage1)
     {
         Remains remains = new Remains();
         remains.getAllProducts(connection, selectDbCategory, dataGridView1);
     }
     if (tabControl1.SelectedTab == tabPage2)
     {
         Postings postings = new Postings();
         postings.getAllDocuments(connection, selectDbPostings, dataGridView2);
     }
     if (tabControl1.SelectedTab == tabPage3)
     {
         Postings writeOff = new Postings();
         writeOff.getAllDocuments(connection, selectDbWriteOff, dataGridView3);
     }
 }