Advertisement
Guest User

Untitled

a guest
Apr 26th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.79 KB | None | 0 0
  1. String nom=new String(txtNom.getText()),
  2. prenom= new String(txtPrenom.getText()),
  3. username= new String(txtUsername.getText()),
  4. password=new String(txtPassword.getPassword()),
  5. passwordBis=new String(txtPasswordBis.getPassword());
  6. String fonction=txtFonction.getText();
  7. String specialite=txtSpecialite.getText();
  8. String niveauEtude=txtNiveauEtude.getText();
  9. String date="";
  10. if(dateNaissance.getDate()!=null)
  11. date = new String(dateNaissance.getDate().toString().substring(4,10)+dateNaissance.getDate().toString().substring(23));
  12. String categorie="";
  13. if(categorieH.isSelected())
  14. categorie="Homme";
  15. else
  16. if(categorieF.isSelected())
  17. categorie="Femme";
  18.  
  19.  
  20. if(nom.isEmpty() || prenom.isEmpty() || username.isEmpty()
  21. || password.isEmpty() || passwordBis.isEmpty() || categorie.isEmpty() || date.isEmpty())
  22. {
  23.  
  24. msgErreur1.setText("Remplissez les champs obligatoires");
  25.  
  26. if(nom.isEmpty())
  27. // txtPrenom.setForeground(Color.RED);
  28. nomF.setText("*");
  29. else
  30. // txtPrenom.setForeground(Color.LIGHT_GRAY);
  31. nomF.setText("");
  32.  
  33. if(prenom.isEmpty())
  34. //txtPrenom.setForeground(Color.RED);
  35. prenomF.setText("*");
  36. else
  37. //txtPrenom.setForeground(Color.LIGHT_GRAY);
  38. prenomF.setText("");
  39.  
  40. if(username.isEmpty())
  41. //lblUsername.setForeground(Color.RED);
  42. userF.setText("*");
  43. else
  44. //lblUsername.setForeground(Color.LIGHT_GRAY);
  45. userF.setText("");
  46.  
  47. if(password.isEmpty())
  48. //lblPassword.setForeground(Color.RED);
  49. mdpF.setText("*");
  50. else
  51. //lblPassword.setForeground(Color.LIGHT_GRAY);
  52. mdpF.setText("");
  53.  
  54. if(passwordBis.isEmpty())
  55. //lblPasswordBis.setForeground(Color.RED);
  56. mdpBisF.setText("*");
  57. else
  58. //lblPasswordBis.setForeground(Color.LIGHT_GRAY);
  59. mdpBisF.setText("");
  60.  
  61. if(categorie.isEmpty())
  62. catF.setText("*");
  63. else
  64. catF.setText("");
  65.  
  66. if(date.isEmpty())
  67. dateF.setText("*");
  68. else
  69. dateF.setText("");
  70.  
  71.  
  72. }else{
  73. if(!password.equals(passwordBis)){
  74. msgErreur1.setText("Mots de passe différents");
  75. }else{
  76. try {
  77. switch( inscrireAbonne(nom,prenom,date,
  78. categorie ,username,password,txtFonction.getText(),
  79. txtSpecialite.getText(),txtNiveauEtude.getText()) ){
  80.  
  81. case 0:
  82. new ConnexionFen().setVisible(true);
  83. this.dispose();
  84. break;
  85. case 1:
  86. msgErreur1.setText("Username déjà existant");
  87. break;
  88. case 2:
  89. msgErreur1.setText("Problème connexion");
  90. break;
  91.  
  92.  
  93. }
  94. } catch (IOException ex) {
  95. Logger.getLogger(InscriptionFen.class.getName()).log(Level.SEVERE, null, ex);
  96. }
  97.  
  98. }
  99.  
  100. }
  101.  
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement