private void _btnEditMember_Click(object sender, RoutedEventArgs e) { var selected = _datagridMembers.SelectedItem; if (selected != null) { Member mem = (Member)selected; EditMember win = new EditMember(mem); win.ShowDialog(); _datagridMembers.ItemsSource = db.Members.ToList(); } else { MessageBox.Show("هیچ رکوردی انتخاب نشده", "پیغام", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void BtnEdit_Click(object sender, RoutedEventArgs e) { if (lbxMembers.SelectedItem is Member memberToEdit) { EditMember editMember = new EditMember(memberToEdit); editMember.ShowDialog(); Repository repo = Repository.GetInstance(); _member = repo.GetAllMembers(); lbxMembers.ItemsSource = _member; } else { MessageBox.Show("Kein Mitglied ausgewählt!"); } }
private void newMemberButton_Click(object sender, EventArgs e) { // Display the form as a modal dialog box. myEditMemberDialog.editMember(null); myEditMemberDialog.ShowDialog(this); // Determine if the OK button was clicked on the dialog box. if (myEditMemberDialog.DialogResult == DialogResult.OK) { searchMemberList(myEditMemberDialog.MemberId, null, null, null); myMemberListDataTable = searchMemberList(myEditMemberDialog.MemberId, null, null, null); if (myMemberListDataTable != null) { loadDataGridView(); DataGridView.Rows[0].Selected = true; AddButton_Click(null, null); } } }
//编辑 private void EditCheck_Click(object sender, RoutedEventArgs e) { Teacher teacher = MemberDataGrid.SelectedItem as Teacher; if (teacher != null) { EditMember editMember = new EditMember(teacher.memberId) { memberId = teacher.memberId }; editMember.ShowDialog(); if (editMember.DialogResult == true) { Init(); } } else { System.Windows.MessageBox.Show("请先选择要操作的人员", "提示"); } }