Beispiel #1
0
        private void редактироватьЗаписьОКурсантеToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Students_dGV.SelectedRows.Count <= 0)
            {
                MessageBox.Show("Не выбрана строка для редактирования", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            AutoschoolDataSet dataSetForAllStudent;

            dataSetForAllStudent = BusinessLogic.ReadStudents();
            AddEditStudentForm EditStudent;

            if (GroupName != "")
            {
                EditStudent = new AddEditStudentForm(GroupName, dataSetForAllStudent.Students, dataSetForAllStudent.Groups,
                                                     dataSetForAllStudent.Instructors, dataSetForAllStudent.Students.Rows.Find(Students_dGV.SelectedRows[0].Cells["ID"].Value));
            }
            else
            {
                EditStudent = new AddEditStudentForm(null, dataSetForAllStudent.Students, dataSetForAllStudent.Groups,
                                                     dataSetForAllStudent.Instructors, dataSetForAllStudent.Students.Rows.Find(Students_dGV.SelectedRows[0].Cells["ID"].Value));
            }

            EditStudent.Text = "Редактирование курсанта";
            EditStudent.ShowDialog();
            if (EditStudent.DialogResult == DialogResult.OK)
            {
                dataSetForAllStudent = BusinessLogic.WriteStudents(dataSetForAllStudent);
                if (GroupName != "")
                {
                    ReloadStudents(GroupName);
                }
            }
        }
Beispiel #2
0
        private void добавитьНовогоКурсантаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AutoschoolDataSet dataSetForAllStudent;

            dataSetForAllStudent = BusinessLogic.ReadStudents();
            AddEditStudentForm AddStudent;

            if (GroupName != "")
            {
                AddStudent = new AddEditStudentForm(GroupName, dataSetForAllStudent.Students, dataSetForAllStudent.Groups,
                                                    dataSetForAllStudent.Instructors, null);
            }
            else
            {
                AddStudent = new AddEditStudentForm(null, dataSetForAllStudent.Students, dataSetForAllStudent.Groups,
                                                    dataSetForAllStudent.Instructors, null);
            }

            AddStudent.Text = "Добавление курсанта";

            редактироватьЗаписьОКурсантеToolStripMenuItem.Enabled = false;
            удалитьКурсантаToolStripMenuItem.Enabled        = false;
            добавитьНовогоКурсантаToolStripMenuItem.Enabled = false;

            AddStudent.ShowDialog();
            if (AddStudent.DialogResult == DialogResult.OK)
            {
                dataSetForAllStudent = BusinessLogic.WriteStudents(dataSetForAllStudent);
                if (GroupName != "")
                {
                    ReloadStudents(GroupName);
                }
            }

            добавитьНовогоКурсантаToolStripMenuItem.Enabled = true;
            Students_dGV_SelectionChanged(sender, e);
        }