예제 #1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            ListeContacts w = new ListeContacts();

            w.Show();
            Close();
        }
예제 #2
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (EditContact == null)
     {
         Contact c = new Contact {
             Nom = nom.Text, Prenom = prenom.Text, Telephone = telephone.Text
         };
         c.Save();
         if (c.Id > 0)
         {
             foreach (Email mail in listeEmails)
             {
                 mail.ContactId = c.Id;
                 mail.Save();
             }
             MessageBox.Show("Contact ajouté ");
             ListeContacts window = new ListeContacts();
             window.Show();
             Close();
         }
         else
         {
             MessageBox.Show("Erreur serveur");
         }
     }
     else
     {
         EditContact.Nom       = nom.Text;
         EditContact.Prenom    = prenom.Text;
         EditContact.Telephone = prenom.Text;
         if (EditContact.Update())
         {
             MessageBox.Show("Contact modifé ");
             ListeContacts window = new ListeContacts();
             window.Show();
             Close();
         }
         else
         {
             MessageBox.Show("Erreur serveur");
         }
     }
 }