public Boolean deleteTimeSlot(AllocateTime at) {
   Boolean b;
   SQLCmd cmd = new DeleteTimeSlot(at);
   cmd.execute();
   b = (Boolean) (cmd.getResult()).get(0);
   return b;
 }
 public String addAppointmentType(AdvisorUser user, AppointmentType at) {
   String msg = null;
   SQLCmd cmd = new GetUserID(user.getEmail());
   cmd.execute();
   cmd = new AddAppointmentType(at, (int) cmd.getResult().get(0));
   cmd.execute();
   return (String) cmd.getResult().get(0);
 }
  public Boolean updateAppointment(Appointment a) {
    Boolean result = false;
    try {
      SQLCmd cmd = new UpdateAppointment(a);
      cmd.execute();
      result = (Boolean) (cmd.getResult()).get(0);
    } catch (Exception e) {

    }
    return result;
  }
  // user login checking, check username and password against database
  // then return role if a match is found
  // using command pattern
  public LoginUser checkUser(GetSet set) throws SQLException {
    LoginUser user = null;
    try {
      SQLCmd cmd = new CheckUser(set.getEmailAddress(), set.getPassword());
      cmd.execute();
      user = (LoginUser) (cmd.getResult()).get(0);

    } catch (Exception e) {
      System.out.println(e);
    }
    return user;
  }
 public Appointment getAppointment(String d, String e) {
   Appointment app = null;
   try {
     SQLCmd cmd = new GetAppointment(d, e);
     cmd.execute();
     if (cmd.getResult().size() > 0) {
       app = (Appointment) (cmd.getResult()).get(0);
     }
   } catch (Exception ex) {
     System.out.println(ex);
   }
   return app;
 }
 // using command pattern
 public ArrayList<String> getAdvisors() throws SQLException {
   ArrayList<String> arraylist = new ArrayList<String>();
   try {
     SQLCmd cmd = new GetAdvisors();
     cmd.execute();
     ArrayList<Object> tmp = cmd.getResult();
     for (int i = 0; i < tmp.size(); i++) {
       arraylist.add(((String) tmp.get(i)));
     }
   } catch (Exception sq) {
     System.out.printf(sq.toString());
   }
   return arraylist;
 }
 public String addTimeSlot(AllocateTime at) {
   SQLCmd cmd = new GetUserID(at.getEmail());
   cmd.execute();
   int id = (int) cmd.getResult().get(0);
   cmd = new CheckTimeSlot(at, id);
   cmd.execute();
   if ((Boolean) cmd.getResult().get(0) == true) {
     cmd = new AddTimeSlot(at, id);
     cmd.execute();
     return (String) cmd.getResult().get(0);
   } else {
     return "Unable to add time slot.";
   }
 }
  public Boolean createAdvisor(CreateAdvisorBean ca) {
    try {
      SQLCmd cmd = new CreateAdvisor(ca);
      cmd.execute();
      if ((Boolean) cmd.getResult().get(0)) {
        cmd = new GetUserID(ca.getEmail());
        cmd.execute();
        cmd = new CreateInitialAdvisorSettings((int) cmd.getResult().get(0), ca);
        cmd.execute();
        return (Boolean) cmd.getResult().get(0);
      } else {
        return false;
      }

    } catch (Exception e) {
      return false;
    }
  }