Esempio n. 1
0
  public static Date getDate(Date date) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    CalendarUtil.toBeginningOfTheDay(cal);

    return cal.getTime();
  }
Esempio n. 2
0
  private void saveRestingHour() {

    if (currentCrew != null) {
      EntryTime entryTime = new EntryTime();

      entryTime.setEntryDate(getDate(currentDate));
      entryTime.setCrewId(currentCrew.getId());
      entryTime.setComments(txtComments.getText());
      entryTime.setOnPort(chkOnPort.isSelected());
      entryTime.setSchedule(timeSheet.getSchedule());
      entryTime.setWorkIn24Hours(timeSheet.getTotalWork());
      entryTime.setRestIn24Hours(timeSheet.getTotalRest());

      if (entryTimeDao.addUpdateEntry(entryTime) > 0) {

        if (errorReportEntry != null) new ReportDAO().addErrorReportEntry(errorReportEntry);

        NotificationManager.showNotification(
            "<html>Resting hours has been saved for<br/>"
                + CalendarUtil.format("MMM dd, yyyy", getDate(currentDate))
                + "</html>");
      }
    }
  }