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); } } }
private void ListBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { if (e.Key == System.Windows.Input.Key.Delete) //проверяем нажата ли делит { // удаление по клавише delete if (listBox.SelectedIndex > -1) //проверяем чтобы хоть кто то был выделен { int si = cBoxGroup.SelectedIndex; GroupViewModel groupViewModel = cBoxGroup.SelectedItem as GroupViewModel; StudentViewModel studentViewModel = listBox.SelectedItem as StudentViewModel; groupService.RemoveStudentFromGroup(groupViewModel.GroupId, studentViewModel.StudentId); groups = groupService.GetAll(); // для обновления окна cBoxGroup.DataContext = groups; // для обновления окна cBoxGroup.SelectedIndex = si; // для обновления окна } } if (e.Key == System.Windows.Input.Key.Insert) {// обновление по клавише Insert // не работает if (listBox.SelectedIndex > -1) { StudentViewModel studentViewModel = listBox.SelectedItem as StudentViewModel; var dialog = new EditStudent(studentViewModel); var result = dialog.ShowDialog(); if (result == true) { groupService.UpdateStudent(studentViewModel); dialog.Close(); } } } }
private void button1_Click(object sender, EventArgs e) { EditStudent EditStudentForm = new EditStudent(datosBin, EstudianteActual); EditStudentForm.ShowDialog(); datosBin.RecargarEstudiantes(); EstudianteActual = datosBin.Estudiantes.First(x => x.ID_Estudiante == EstudianteActual.ID_Estudiante); StudentsMenu_Load(null, null); }
private void TablaEstudiantes_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { Estudiante student = datosBin.Estudiantes.First(x => x.ID_Estudiante == (int)TablaEstudiantes.SelectedRows[0].Cells[0].Value); EditStudent EditStudentForm = new EditStudent(datosBin, student, true); EditStudentForm.ShowDialog(); datosBin.RecargarEstudiantes(); TablaEstudiantes.DataSource = datosBin.Estudiantes; TablaEstudiantes.Refresh(); }
private void EdytujStudenta_Click(object sender, RoutedEventArgs e) { var row = (StudentsTable)ListaStudentowDg.SelectedItem; EditStudent EdytujStudenta = new EditStudent(row); bool? result = EdytujStudenta.ShowDialog(); if (result == true) { WyszykajTb_KeyUp(null, null); ListaStudentowDg_SelectionChanged(null, null); } }
private void Button_Click(object sender, RoutedEventArgs e) { var student = new StudentViewModel(); student.DateOfBirth = new DateTime(1990, 01, 01); var dialog = new EditStudent(student); var result = dialog.ShowDialog(); if (result == true) { var group = (GroupViewModel)cBoxGroup.SelectedItem; group.Students.Add(student); groupService.AddStudentToGroup(group.GroupId, student); dialog.Close(); } }
private void editbtn_Click(object sender, EventArgs e) { EditStudent editcourse = new EditStudent(stud); editcourse.ShowDialog(); }
private void button4_Click(object sender, EventArgs e) { EditStudent ed = new EditStudent(); ed.ShowDialog(); }