private void Edit_Contact_btn_Click(object sender, RoutedEventArgs e) { ContactsBinding selectedContact = (ContactsBinding)ContactsListItems.SelectedItem; if (selectedContact == null) { MessageBox.Show("You have to select a contact to edit."); return; } else { int idToPass = selectedContact.ID; string first = selectedContact.firstName; string last = selectedContact.lastName; string address = selectedContact.address; string phone = selectedContact.phoneNumber; string email = selectedContact.email; AddContactWindow ACW1 = new AddContactWindow(idToPass, first, last, address, phone, email); ACW1.ShowDialog(); } contacts = DBH.getContacts(); ContactsListItems.ItemsSource = contacts; MessageBox.Show("All changes have been saved to the database."); }
public DetailsWindow(int id) { InitializeComponent(); DBHelper DBH = DBHelper.instance; CB = DBH.getDetails(id); nametxt.Text = "Name:\n" + CB.fullName.ToString(); contactInfotxt.Text = "Points of Contact:\n" + CB.contactMeth.ToString(); }
private void Del_Contact_btn_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Deleting the selected contact..."); ContactsBinding CB1 = (ContactsBinding)ContactsListItems.SelectedItem; DBH.deleteContacts(CB1.ID); contacts = DBH.getContacts(); ContactsListItems.ItemsSource = contacts; }
private void ContactsListItems_MouseDoubleClick(object sender, MouseButtonEventArgs e) { ContactsBinding selectedContact = (ContactsBinding)ContactsListItems.SelectedItem; if (selectedContact != null) { DetailsWindow newWindow = new DetailsWindow(selectedContact.ID); newWindow.ShowDialog(); } contacts = DBH.getContacts(); ContactsListItems.ItemsSource = contacts; }