private void getSchedule(Date selectedDate) { if (currentCrew != null) { EntryTime entry = entryTimeDao.getByDateAndCrew(getDate(selectedDate), currentCrew); if (entry != null) { timeSheet.setSchedule(entry.getSchedule()); txtComments.setText(entry.getComments()); } else { ScheduleTemplate template = new ScheduleTemplateDAO() .getByCrew(currentCrew, chkOnPort.isSelected(), currentCrew.isWatchKeeper()); if (template != null) timeSheet.setSchedule(template.getSchedule()); } } }
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>"); } } }