private void button3_Click(object sender, EventArgs e)
        {
            DateTime date        = dateTimePicker1.Value;
            string   number      = textBox1.Text;
            int      numberScore = Convert.ToInt32(textBox2.Text);
            DateTime dateScore   = dateTimePicker2.Value;
            string   forma       = textBox17.Text;
            int      summa       = Convert.ToInt32(textBox18.Text);
            string   numberDKP   = textBox19.Text;
            DateTime dateDKP     = dateTimePicker3.Value;
            string   numberAPP   = textBox22.Text;
            DateTime dateAPP     = dateTimePicker4.Value;
            string   payment     = textBox24.Text;
            string   delivery    = textBox23.Text;



            if ((number != "") && (numberScore != 0) && (forma != "") && (summa != 0) && (numberDKP != "") && (numberAPP != "") && (payment != "") && (delivery != ""))
            {
                int  flag1;
                bool flag2 = true;


                try
                {
                    flag1 = SQLFunction.addContract(date, number, Autorisation.id, idClient, id, numberScore, dateScore, forma, summa, numberDKP, dateDKP, numberAPP, dateAPP, payment, delivery);


                    for (int i = 0; i < dt_new.Rows.Count; i++)
                    {
                        string nameModel = dt_new.Rows[i][0].ToString();
                        int    count     = Convert.ToInt32(dt_new.Rows[i][1]);
                        int    price     = Convert.ToInt32(dt_new.Rows[i][2]);
                        int    idModel   = SQLFunction.getIdModel(nameModel);
                        string presence  = dt_new.Rows[i][3].ToString();
                        string guarante  = dt_new.Rows[i][4].ToString();
                        SQLFunction.addContractTechnique(flag1, idModel, count, price, presence, guarante, "не оформлен", "нет");
                    }


                    if (flag2)
                    {
                        this.Close();
                        MessageBox.Show("Договор успешно добавлен.", "Уведомление", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        SQLFunction.updateStatus(id, "Договор с клиентом оформлен");

                        DialogResult = DialogResult.OK;
                    }
                }

                catch { MessageBox.Show("Ошибка2", "Ошибка добавления", MessageBoxButtons.OK, MessageBoxIcon.Error); }
            }



            else
            {
                MessageBox.Show("Все поля должны быть заполнены.", "Ошибка добавления", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }