private void F_save_it() { Benutzer1 b = new Benutzer1(this.curr_id); b.vorname = this.vorname.Text; b.nachname = this.nachname.Text; b.email = this.email.Text; b.setPasswort(this.passwort.Password); int cb_typ_index = this.cb_typ.SelectedIndex; if (cb_typ_index != -1) { if (this.cb_typ.Text == "Admin") { b.typ = 1; } if (this.cb_typ.Text == "Kunde") { b.typ = 2; } if (this.cb_typ.Text == "Mitarbeiter") { b.typ = 3; } } b.save(); this.refreshList(); }
// Holt die Daten aus der Datenbank private void listing_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (this.listing.SelectedIndex >= 0) { this.curr_id = ((Benutzer1)this.listing.Items[this.listing.SelectedIndex]).id; this.listing.Visibility = Visibility.Collapsed; Benutzer1 b = new Benutzer1(this.curr_id); this.vorname.Text = b.vorname; this.nachname.Text = b.nachname; this.cb_typ.SelectedItem = b.typ; this.email.Text = b.email; if (b.typ == 1) { this.cb_typ.SelectedIndex = 0; } if (b.typ == 2) { this.cb_typ.SelectedIndex = 1; } if (b.typ == 3) { this.cb_typ.SelectedIndex = 2; } this.formular.Visibility = Visibility.Visible; } }
private void kd_delete_Click(object sender, RoutedEventArgs e) { Benutzer1 foo = new Benutzer1(this.curr_id); foo.delete(); this.refreshList(); }
public void refreshList() { this.listing.Items.Clear(); Benutzer1 f_neu = new Benutzer1(); f_neu.vorname = " >>> NEUEN Benutzer anlegen <<< "; this.listing.Items.Add(f_neu); ArrayList alleBenutzer = Benutzer1.getAll(); foreach (Benutzer1 f in alleBenutzer) { this.listing.Items.Add(f); } this.curr_id = 0; this.formular.Visibility = Visibility.Collapsed; this.listing.Visibility = Visibility.Visible; }