Advertisement
OlivierArgentieri

Inscriptions Covoiturage

Apr 25th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.68 KB | None | 0 0
  1. // Clic sur ENVOYER.
  2.         // Doit effectuer des VÉRIFICATIONS sur le NOM, MAIL et TELEPHONE saisis.
  3.         // Si tout est OK :
  4.         //      a. S'adresser à la classe METIER pour obtenir un LOGIN et un MDP
  5.         //      b. Ajouter l'objet métier CHAUFFEUR à la COLLECTION de chauffeurs
  6.         private void btnEnvoyer_Click(object sender, RoutedEventArgs e)
  7.         {
  8.             bool nomOk = false;
  9.             bool telOk = false;
  10.             bool mailOk = false;
  11.  
  12.             #region TEST
  13.             if (string.IsNullOrWhiteSpace(this.txtNom.Text))
  14.                 Traiter_Erreur(txtNom, "Nom Obligatoire !");
  15.             else
  16.                 nomOk = true;
  17.  
  18.             if (txtTel.Text.Length < 10)
  19.                 Traiter_Erreur(txtTel, "Telephone invalide !");
  20.             else
  21.                 telOk = true;
  22.  
  23.             if (string.IsNullOrWhiteSpace(this.txtMail.Text) || !txtMail.Text.Contains("@"))
  24.                 Traiter_Erreur(txtMail, "Mail invalide !");
  25.             else
  26.                 mailOk = true;
  27.  
  28.             #endregion
  29.  
  30.             if (nomOk && telOk && mailOk)
  31.             {
  32.                 string[] Ids= Donnees_Covoiturage.getLogin(txtNom.Text, txtPrenom.Text);
  33.  
  34.                 unChauffeur.nom = txtNom.Text;
  35.                 unChauffeur.tel = txtTel.Text;
  36.                 unChauffeur.mail = txtMail.Text;
  37.                 unChauffeur.user = Ids[0];
  38.                 unChauffeur.mdp = Ids[1];
  39.                 unChauffeur.prenom = txtPrenom.Text;
  40.                 txtUser.Text = Ids[0];                                  
  41.                 txtMdp.Text = Ids[1];
  42.  
  43.                 Donnees_Covoiturage.ajouteChauffeur(unChauffeur);
  44.             }
  45.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement