Example #1
0
 /**
  * Logs in user, eventually
  *
  * @param username
  * @param password
  */
 public static Boolean login(String username, String password) {
   Boolean status;
   if (username.equals("sigve") && password.equals("1337")) {
     setUser(User.getUser(1)); // get user 1 for now
     GregorianCalendar now = new GregorianCalendar(2012, 3, 23); // arbitrary date for now
     System.out.println("User logged in");
     pushView(new CalendarView());
     Client.setNotifications(Message.getMessages(Client.user));
     Client.setActiveWeek(
         now.get(GregorianCalendar.YEAR),
         now.get(GregorianCalendar.MONTH),
         now.get(GregorianCalendar.DATE));
     status = true;
   } else {
     System.out.println("Wrong username and/or password");
     status = false;
   }
   return status;
 }
Example #2
-18
 public static void setActiveWeek(GregorianCalendar g) {
   GregorianCalendar endG = (GregorianCalendar) g.clone();
   endG.add(GregorianCalendar.DATE, 7);
   Client.addAppointments(Appointment.getAppointments(user, g, endG));
   setActiveWeek(
       g.get(GregorianCalendar.YEAR),
       g.get(GregorianCalendar.MONTH),
       g.get(GregorianCalendar.DATE));
 }