private void addTeacher_MouseUp(object sender, MouseButtonEventArgs e) { TeacherAddEdit teacher = new TeacherAddEdit(); teacher.Owner = this; teacher.Closed += (s, eventarg) => { teachers_Initialized(s, eventarg); }; teacher.teacherPreferences.Visibility = Visibility.Hidden; teacher.labelTeacherPreferences.Visibility = Visibility.Hidden; teacher.ShowDialog(); }
private void editTeacher_MouseUp(object sender, MouseButtonEventArgs e) { DataRowView row = (DataRowView)teachersGrid.SelectedItem; if (row != null) { int id = (int)row["ID"]; string name = (string)row["Name"]; string surname = (string)row["Surname"]; string title = (string)row["Title"]; string email = (string)row["Email"]; string phone = (string)row["Phone"]; string code = (string)row["Code"]; string note = (string)row["Note"]; TeacherAddEdit teacher = new TeacherAddEdit(); teacher.Owner = this; teacher.Closed += (s, eventarg) => { teachers_Initialized(s, eventarg); }; teacher.txtId.Text = id.ToString(); teacher.txtName.Text = name; teacher.txtSurname.Text = surname; teacher.txtTitle.Text = title; teacher.txtEmail.Text = email; teacher.txtPhone.Text = phone; teacher.txtCode.Text = code; teacher.txtNote.Text = note; teacher.ShowDialog(); } else { MessageBox.Show("Please select a row to edit!", "Information", MessageBoxButton.OK, MessageBoxImage.Information); } }