Advertisement
Guest User

Untitled

a guest
Apr 8th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
  2. // TODO add your handling code here:
  3. //char[] password = jPasswordField1.getPassword();
  4. String myPass = String.valueOf(jPasswordField1.getPassword());
  5. String myAccount = String.valueOf(jTextField1.getText());
  6. datorBas a = new datorBas();
  7. a.DBHandler();
  8. String adminUserName = a.sendQueryUsernameAdmin("select aId from admin where aId ='" + myAccount + "'");
  9. String guideUserName = a.sendQueryUsernameGuide("select gId from guide where gId ='" + myAccount + "'");
  10. String customerUserName = a.sendQueryUsernameCustomer("select cId from custumer where cId ='" + myAccount + "'");
  11.  
  12. // LOGIN FÖR ADMIN
  13. if (!adminUserName.equals(myAccount)){
  14. // System.out.println("This is not a correct admin username!");
  15. }
  16.  
  17. else {
  18. System.out.println(adminUserName);
  19. String adminPassword = a.sendQueryPasswordAdmin("select aPassword from admin where aId ='" + myAccount + "'");
  20. if (!adminPassword.equals(myPass)){
  21. // System.out.println("Wrong Password!");
  22. }
  23. else {
  24. // System.out.println("Correct password!");
  25. // System.out.println("ÖPPNA ADMININTERFACE!" + "\n");
  26. windowAdmin p = new windowAdmin();
  27. p.setVisible(true);
  28. this.dispose();
  29.  
  30. }
  31. }
  32.  
  33. // LOGIN FÖR GUIDE
  34. if (!guideUserName.equals(myAccount)){
  35. // System.out.println("This is not a correct guide username!");
  36. }
  37.  
  38. else {
  39. System.out.println(guideUserName);
  40. String guidePassword = a.sendQueryPasswordGuide("select gPassword from guide where gId ='" + myAccount + "'");
  41. if (!guidePassword.equals(myPass)){
  42. // System.out.println("Wrong Password for guide!");
  43. }
  44. else {
  45. // System.out.println("Correct password!");
  46. // System.out.println("ÖPPNA guideuserface!" + "\n");
  47. windowGuide p = new windowGuide();
  48. p.setVisible(true);
  49. this.dispose();
  50. }
  51. }
  52. // LOGIN FÖR CUSTOMER
  53. if (!customerUserName.equals(myAccount)){
  54. // System.out.println("This is not a correct Customer username!");
  55. }
  56.  
  57. else {
  58. System.out.println(customerUserName);
  59. String customerPassword = a.sendQueryPasswordCustomer("select cPassword from custumer where cId ='" + myAccount + "'");
  60. if (!customerPassword.equals(myPass)){
  61.  
  62. }
  63. else {
  64.  
  65.  
  66.  
  67.  
  68.  
  69. login x = new login();
  70. x.setmyAccount(myAccount);
  71.  
  72.  
  73. windowCustomer p = new windowCustomer();
  74. p.setVisible(true);
  75. this.dispose();
  76. }
  77. System.out.println("errorkompis");
  78. }
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85. /* if (myPass.equals("safarier")){
  86. adminFrame g = new adminFrame();
  87. g.setVisible(true);
  88. this.dispose();
  89. }
  90. else{
  91. errorMsg("Wrong Password");
  92.  
  93.  
  94. } */
  95.  
  96.  
  97.  
  98. }
  99.  
  100. -------- // THIS IS LOGIN.JAVA
  101. ---- // below is windowCostumer.java
  102.  
  103. private void button2ActionPerformed(java.awt.event.ActionEvent evt) {
  104.  
  105. login p = new login();
  106. String thisAccount = login.setmyAccount();
  107. System.out.println(thisAccount); // TODO add your handling code here:
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement