Advertisement
Guest User

Untitled

a guest
May 21st, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.23 KB | None | 0 0
  1. //Change student prefekt
  2.     public void updatePrefekt(JComboBox studentHome, JComboBox student) {
  3.         try {
  4.             String dorm = studentHome.getSelectedItem().toString();
  5.             String newPrefekt = student.getSelectedItem().toString();
  6.             String[] splitStr = newPrefekt.split("\\s+");
  7.             String newPrefektId = getId(splitStr[0], splitStr[1]);
  8.             String command = "UPDATE elevhem SET prefekt= " + newPrefektId + " WHERE elevhemsnamn= '" + dorm + "'";
  9.             hwdb.update(command);
  10.         } catch (InfException e) {
  11.             System.out.println(e.getMessage());
  12.         }
  13.     }
  14.    
  15.     //Change forestandre for a dorm
  16.     public void updateForestandare(JComboBox studentHome, JComboBox teacher) {
  17.     try {
  18.         String dorm = studentHome.getSelectedItem().toString();
  19.         String newForestandare = teacher.getSelectedItem().toString();
  20.         String[] splitStr = newForestandare.split("\\s+");
  21.         String newFore = getIdTeacher(splitStr[0], splitStr[1]);
  22.         String command = "UPDATE elevhem SET forestandare= " + newFore + " WHERE elevhemsnamn= '" + dorm + "'";
  23.         hwdb.update(command);
  24.     } catch (InfException e) {
  25.     System.out.println(e.getMessage());
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement