Advertisement
Guest User

Untitled

a guest
Apr 26th, 2018
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.23 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. byte b;
  77. try {
  78. b = inscrireAbonne(nom,prenom,date,
  79. categorie ,username,password,txtFonction.getText(),
  80. txtSpecialite.getText(),txtNiveauEtude.getText());
  81. } catch (IOException ex) {
  82. Logger.getLogger(InscriptionFen.class.getName()).log(Level.SEVERE, null, ex);
  83. b=2;
  84. }
  85.  
  86. switch(b) {
  87.  
  88. case 0:
  89. {
  90. try {
  91. seConnecter(username,password);
  92. } catch (IOException ex) {
  93. Logger.getLogger(InscriptionFen.class.getName()).log(Level.SEVERE, null, ex);
  94. } catch (ClassNotFoundException ex) {
  95. Logger.getLogger(InscriptionFen.class.getName()).log(Level.SEVERE, null, ex);
  96. }
  97. }
  98. this.dispose();
  99. break;
  100. case 1:
  101. msgErreur1.setText("Username déjà existant");
  102. break;
  103. case 2:
  104. msgErreur1.setText("Problème connexion");
  105. break;
  106.  
  107. }
  108.  
  109. }
  110.  
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement