Esempio n. 1
0
        private void BtnAddCourse_Click(object sender, EventArgs e)
        {
            AddEditDocument frm = new AddEditDocument(k);

            frm.BtnEditDoc.Enabled = false;
            frm.Show();
            this.Hide();
        }
Esempio n. 2
0
        private void BtnEditDoc_Click(object sender, EventArgs e)
        {
            //Редактирование данных о документе

            AddEditDocument frm = new AddEditDocument(p);

            //Передача данных о документе на форму редактирования

            using (SqlConnection connecting = new SqlConnection(Program.connection))
            {
                connecting.Open();

                // Данные из таблицы Документы


                SqlCommand typedoc = connecting.CreateCommand();
                typedoc.CommandText = "SELECT TypeDoc FROM [Documents] WHERE ID= " + p;
                typedoc.ExecuteScalar();

                SqlCommand group = connecting.CreateCommand();
                group.CommandText = "SELECT [Group] FROM [Documents] WHERE ID= " + p;
                group.ExecuteScalar();

                SqlCommand idstudent = connecting.CreateCommand();
                idstudent.CommandText = "SELECT IdStudent FROM [Documents] WHERE ID= " + p;
                idstudent.ExecuteScalar();

                SqlCommand statusdoc = connecting.CreateCommand();
                statusdoc.CommandText = "SELECT StatusDoc  FROM [Documents] WHERE ID= " + p;
                statusdoc.ExecuteScalar();

                SqlCommand utrata = connecting.CreateCommand();
                utrata.CommandText = "SELECT Utrata  FROM [Documents] WHERE ID= " + p;
                utrata.ExecuteScalar();

                SqlCommand obmen = connecting.CreateCommand();
                obmen.CommandText = "SELECT Obmen FROM [Documents] WHERE ID= " + p;
                obmen.ExecuteScalar();

                SqlCommand unichtog = connecting.CreateCommand();
                unichtog.CommandText = "SELECT Unichtog FROM [Documents] WHERE ID= " + p;
                unichtog.ExecuteScalar();

                SqlCommand seriesdoc = connecting.CreateCommand();
                seriesdoc.CommandText = "SELECT SeriesDoc FROM [Documents] WHERE ID= " + p;
                seriesdoc.ExecuteScalar();

                SqlCommand numberdoc = connecting.CreateCommand();
                numberdoc.CommandText = "SELECT NumberDoc  FROM [Documents] WHERE ID= " + p;
                numberdoc.ExecuteScalar();

                SqlCommand regnumber = connecting.CreateCommand();
                regnumber.CommandText = "SELECT RegNumber  FROM [Documents] WHERE ID= " + p;
                regnumber.ExecuteScalar();

                //Заполнение полей на форме редактирования данных о студенте
                frm.CbTypeDoc.Text   = Convert.ToString(typedoc.ExecuteScalar());
                frm.CbUtrata.Text    = Convert.ToString(utrata.ExecuteScalar());
                frm.CbUnichtog.Text  = Convert.ToString(unichtog.ExecuteScalar());
                frm.TbRegNumber.Text = Convert.ToString(regnumber.ExecuteScalar());
                frm.CbGroup.Text     = Convert.ToString(group.ExecuteScalar());
                frm.TbStudent.Text   = Convert.ToString(idstudent.ExecuteScalar());
                frm.CbStatusDoc.Text = Convert.ToString(statusdoc.ExecuteScalar());
                frm.CbObmen.Text     = Convert.ToString(obmen.ExecuteScalar());
                frm.TbSeriesDoc.Text = Convert.ToString(seriesdoc.ExecuteScalar());
                frm.TbNumberDoc.Text = Convert.ToString(numberdoc.ExecuteScalar());


                frm.BtnEditDoc.Enabled = true;
                frm.BtnAddDoc.Enabled  = false;

                frm.Show();
                this.Hide();
                connecting.Close();
            }
        }