Advertisement
Guest User

Untitled

a guest
Mar 9th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.55 KB | None | 0 0
  1. String title = (String) titleCB.getSelectedItem();
  2. String name = nameTF.getText();
  3. String surname = surnameTF.getText();
  4. String year = (String) yearCB.getSelectedItem();
  5. String month = (String) monthCB.getSelectedItem();
  6. String day = (String) dayCB.getSelectedItem();
  7. String email = emailTF.getText();
  8. String password = new String(passwordPF.getText());
  9. String emailcon = emailconfirmTF.getText();
  10. String passwordcon = new String(passwordconfirmPF.getText());
  11. Connection connection = null;
  12. Statement stmt = null;
  13.  
  14. if (emailcon.equals(email)) {
  15. if (passwordcon.equals(password)) {
  16. try {
  17. Class.forName("com.mysql.jdbc.Driver");
  18. connection = DriverManager
  19. .getConnection("jdbc:mysql://localhost:3306/healthapp", "root", "");
  20.  
  21. stmt = connection.createStatement();
  22. stmt.execute("INSERT INTO DOCTOR (DOCTOR_TITLE,DOCTOR_NAME,DOCTOR_SURNAME,DOCTOR_DOB,DOCTOR_EMAIL,DOCTOR_PASSWORD,DOCTOR_TELNUMBER,HOSPITAL_CODE) "
  23. + "VALUES ('" + title + "','" + name + "','" + surname + "','" + year + "-" + month + "-" + day + "','" + email + "','" + password + "','+353868728668','9')");
  24. } catch (Exception e) {
  25. e.printStackTrace();
  26. } finally {
  27. try {
  28. stmt.close();
  29. connection.close();
  30. } catch (Exception e) {
  31. e.printStackTrace();
  32. }
  33. }
  34.  
  35. LayoutManager layout = getParent().getLayout();
  36. if (layout instanceof CardLayout) {
  37. CardLayout cl = (CardLayout) layout;
  38. cl.show(getParent(), "WELCOME");
  39. }
  40. }
  41. else{
  42. JOptionPane.showMessageDialog(null, "passwords do not match, please try again");
  43. }
  44. } else {
  45. JOptionPane.showMessageDialog(null, "emails do not match, please try again");
  46. }
  47.  
  48.  
  49.  
  50.  
  51.  
  52. String title = (String) titleCB.getSelectedItem();
  53. String name = nameTF.getText();
  54. String surname = surnameTF.getText();
  55. String year = (String) yearCB.getSelectedItem();
  56. String month = (String) monthCB.getSelectedItem();
  57. String day = (String) dayCB.getSelectedItem();
  58. String email = emailTF.getText();
  59. String password = new String(passwordPF.getText());
  60. String emailcon = emailconfirmTF.getText();
  61. String passwordcon = new String(passwordconfirmPF.getText());
  62. String city = cityTF.getText();
  63. String country = (String) countryCB.getSelectedItem();
  64. String address = addressTF.getText();
  65.  
  66. Connection connection = null;
  67. Statement stmt = null;
  68.  
  69. if (emailcon.equals(email)) {
  70. if (passwordcon.equals(password)) {
  71. try {
  72. Class.forName("com.mysql.jdbc.Driver");
  73. connection = DriverManager
  74. .getConnection("jdbc:mysql://localhost:3306/healthapp", "root", "");
  75.  
  76. stmt = connection.createStatement();
  77. stmt.execute("INSERT INTO PATIENT (PATIENT_TITLE,PATIENT_NAME,PATIENT_SURNAME,PATIENT_DOB,PATIENT_EMAIL,PATIENT_PASSWORD,PATIENT_ADDRESS,PATIENT_CITY,PATIENT_COUNTRY) "
  78. + "VALUES ('" + title + "','" + name + "','" + surname + "','" + year + "-" + month + "-" + day + "','" + email + "','" + password + "','"+address+"', '"+city+"','"+country+"')");
  79. } catch (Exception e) {
  80. e.printStackTrace();
  81. } finally {
  82. try {
  83. stmt.close();
  84. connection.close();
  85. } catch (Exception e) {
  86. e.printStackTrace();
  87. }
  88. }
  89.  
  90. LayoutManager layout = getParent().getLayout();
  91. if (layout instanceof CardLayout) {
  92. CardLayout cl = (CardLayout) layout;
  93. cl.show(getParent(), "WELCOME");
  94. }
  95. }
  96. else{
  97. JOptionPane.showMessageDialog(null, "passwords do not match, please try again");
  98. }
  99. } else {
  100. JOptionPane.showMessageDialog(null, "emails do not match, please try again");
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement