/// <summary> /// Méthode pour vérifier la présence du contact dans le registre /// </summary> /// <param name="contact">Contact à vérifier</param> /// <returns>Booléen</returns> public bool VerifierContact(Contact contact) { for (int i = 0; i < Registre.Count; i++) { if (Registre[i].Equals(contact)) { throw new ContactDejaPresentException("Contact déjà présent", Registre[i], i); } } if (!Utilitaire.ValiderEmail(contact.Email)) { throw new EmailInvalideException("Mauvais format d'email", contact.Email); } if (!Utilitaire.ValiderCP(contact.Codepostal)) { throw new CodePostalException("Mauvais format de code postal", contact.Codepostal); } if (!Utilitaire.ValiderNoTel(contact.NoTel)) { throw new TelephoneInvalideException("Mauvais numéro de téléphone", contact.NoTel); } return(true); }