Exemplo n.º 1
0
        } // tsbQuery13_MouseEnter

        private void tsbQuery13_Click(object sender, EventArgs e)
        {
            if (dvwProfessors.SelectedRows == null)
            {
                return;
            }

            AddEditProfessorForm addEditProfessor = new AddEditProfessorForm(dvwProfessors.CurrentRow.Cells[1].Value.ToString(),
                                                                             dvwProfessors.CurrentRow.Cells[2].Value.ToString(), dvwProfessors.CurrentRow.Cells[3].Value.ToString(),
                                                                             int.Parse(dvwProfessors.CurrentRow.Cells[4].Value.ToString()));

            addEditProfessor.ShowDialog();

            if (addEditProfessor.DialogResult == DialogResult.OK)
            {
                tbcMain.SelectedTab = tbpProfessors;

                // индекс текущей строки
                int row = dvwProfessors.CurrentRow.Index;
                // id экзамена в выбранной строке
                int id = int.Parse(dvwProfessors[0, row].Value.ToString());

                _queries.Query13(addEditProfessor.Surname, addEditProfessor.PName, addEditProfessor.Patronymic,
                                 addEditProfessor.Payment, id);

                dvwProfessors.DataSource = _queries.QueryShowProfessors();

                MessageBox.Show("Выбранная вами запись изменена",
                                "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Information);
            } // if
        }     // tsbQuery13_Click
Exemplo n.º 2
0
        } // tsbQuery16_MouseEnter

        private void tsbQuery16_Click(object sender, EventArgs e)
        {
            AddEditProfessorForm addEditProfessor = new AddEditProfessorForm();

            addEditProfessor.ShowDialog();

            if (addEditProfessor.DialogResult == DialogResult.OK)
            {
                tbcMain.SelectedTab = tbpProfessors;

                _queries.Query16(addEditProfessor.Surname, addEditProfessor.PName,
                                 addEditProfessor.Patronymic, addEditProfessor.Payment);

                dvwProfessors.DataSource = _queries.QueryShowProfessors();

                MessageBox.Show("В конец добавлен новый экзаменатор",
                                "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Information);
            } // if
        }     // tsbQuery16_Click