Ejemplo n.º 1
0
  public void doClockOut(AttendenceHistory attendenceHistory, Shift shift, Calendar currentTime) {
    setClockedIn(false);
    setCurrentShift(null);
    setCurrentTerminal(null);
    setLastClockInTime(null);

    attendenceHistory.setClockedOut(true);
    attendenceHistory.setClockOutTime(currentTime.getTime());
    attendenceHistory.setClockOutHour(Short.valueOf((short) currentTime.get(Calendar.HOUR)));

    UserDAO.getInstance().saveClockOut(this, attendenceHistory, shift, currentTime);
  }
Ejemplo n.º 2
0
  private void doLogin() throws RuntimeException {

    Application application = Application.getInstance();

    UserDAO dao = new UserDAO();
    User user = dao.findUser(Integer.valueOf(userId));
    if (!user.getPassword().equals(PasswordHasher.hashPassword(userPassword))) {
      throw new RuntimeException(POSConstants.WRONG_PASSWORD);
    }

    Shift currentShift = ShiftUtil.getCurrentShift();
    if (currentShift == null) {
      throw new RuntimeException(POSConstants.NO_SHIFT_CONFIGURED);
    }

    adjustUserShift(user, currentShift);

    application.setCurrentUser(user);
    application.setCurrentShift(currentShift);

    application.getRootView().showView(SwitchboardView.VIEW_NAME);
  }
Ejemplo n.º 3
0
  public void doClockIn(Terminal terminal, Shift shift, Calendar currentTime) {
    setClockedIn(true);
    setCurrentShift(shift);
    setCurrentTerminal(terminal);
    setLastClockInTime(currentTime.getTime());

    LogFactory.getLog(Application.class)
        .info("terminal id befor saving clockIn=" + terminal.getId());

    AttendenceHistory attendenceHistory = new AttendenceHistory();
    attendenceHistory.setClockInTime(currentTime.getTime());
    attendenceHistory.setClockInHour(Short.valueOf((short) currentTime.get(Calendar.HOUR)));
    attendenceHistory.setUser(this);
    attendenceHistory.setTerminal(terminal);
    attendenceHistory.setShift(shift);

    UserDAO.getInstance().saveClockIn(this, attendenceHistory, shift, currentTime);
  }