示例#1
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            var wnd = new DeansOffice();

            wnd.ShowDialog();
            ResetSubjects();
            if (wnd.NewStudent != null)
            {
                var newStudent     = wnd.NewStudent;
                var isStudentAdded = StudentDbService.AddRecordToDb(newStudent);
                if (isStudentAdded)
                {
                    Student._ListaStudentow.Add(newStudent);
                    MessageBox.Show("Dodano studenta", "DeansOffice", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }
示例#2
0
        private void DataGridRow_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            var student = (Student)StudentsDataGrid.SelectedItem;
            var wnd     = new DeansOffice(student);

            wnd.ShowDialog();
            if (wnd.NewStudent != null)
            {
                var editedStudent    = wnd.NewStudent;
                var isStudentUpdated = StudentDbService.EditRecordInDb(student, editedStudent);
                if (isStudentUpdated)
                {
                    var orginalStudent = Student._ListaStudentow.First(s => s.Id == student.Id);
                    UpdateStudentDataInListaStudentow(orginalStudent, editedStudent);
                    MessageBox.Show("Uaktualniono dane studenta", "DeansOffice", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            ResetSubjects();
            //Student._ListaStudentow = StudentDbService.PullStudentsFromDbToList();
        }