private void BtnChangePerson_click(object sender, RoutedEventArgs e) { if (lbPersonen.SelectedValue == null) { MessageBox.Show("Bitte zuerst eine Person auswählen!"); return; } int index = 0; { NameRolle nr = new NameRolle(); foreach (var item in cNameRolle) { if (item.currID == (Int32)lbPersonen.SelectedValue) { nr.currID = item.currID; nr.currRolleID = item.currRolleID; nr.name = item.name; nr.rolle = item.rolle; nr.currNameRolleID = item.currNameRolleID; EditNameRolle enr = new EditNameRolle(nr); enr.ShowDialog(); index = cNameRolle.IndexOf(item); } } cNameRolle[index] = nr; lbPersonen.ItemsSource = null; lbPersonen.ItemsSource = cNameRolle; } }
private void btnView_Click(object sender, RoutedEventArgs e) { try { NameRolle nr = DGPersonen.SelectedItem as NameRolle; int i = 0; foreach (var item in nr_list) { if (item.name.StartsWith(nr.name) == true) { i = nr_list.IndexOf(item); } } EditNameRolle enr = new EditNameRolle(nr); enr.ShowDialog(); nr_list[i].currID = enr.cNR.currID; nr_list[i].currRolleID = enr.cNR.currRolleID; nr_list[i].name = enr.cNR.name; DGPersonen.ItemsSource = null; DGPersonen.ItemsSource = nr_list; txtAutorSort.Text = GetAutorSort(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void btnView_Click(object sender, RoutedEventArgs e) { try { NameRolle nr = DGNamen.SelectedItem as NameRolle; if (nr.currID == -1) { MessageBox.Show("Form AddName aufrufen"); } else { EditNameRolle enr = new EditNameRolle(nr); enr.ShowDialog(); DGNamen.ItemsSource = nr_list; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }