Example #1
0
        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.");
        }
Example #2
0
        private void Add_Contact_btn_Click(object sender, RoutedEventArgs e)
        {
            AddContactWindow ACW1 = new AddContactWindow();

            ACW1.ShowDialog();

            contacts = DBH.getContacts();

            ContactsListItems.ItemsSource = contacts;

            MessageBox.Show("Contact successfully added.");
        }