/**
  * delete a user and inserts audit
  *
  * @return
  */
 public String deleteMonitoringService() {
   if (this.selectedremotemonitoringService != null) {
     MonitoringServiceDAO.getInstance()
         .deleteMonitoringService(this.selectedremotemonitoringService.getId());
     UserAuditDAO.getInstance()
         .addUserAudit(
             "Delete Monitoring Service",
             "User deleted the monitoring service :"
                 + this.selectedremotemonitoringService.getCountry());
   }
   return "MonitoringServicesPage?faces-redirect=true";
 }
 public String updateDataTable() {
   ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
   HttpSession session = (HttpSession) ectx.getSession(false);
   UserInfoPageBean userInfo = (UserInfoPageBean) session.getAttribute("userInfo");
   this.userauditsList =
       UserAuditDAO.getInstance()
           .getUserAuditsList(
               userInfo.getUser().getUserId(),
               userInfo.getUser().getCompany().getId(),
               userInfo.getUser().getUsertype(),
               dateFrom,
               dateTo);
   return "UserAuditsPage.xhtml?faces-redirect=true";
 }
 public void initializeDates() {
   // if ((dateTo==null)||(dateFrom==null)){
   Calendar to = Calendar.getInstance();
   to.add(Calendar.DATE, 1);
   dateTo = to.getTime();
   Calendar before = Calendar.getInstance();
   before.add(Calendar.DATE, -29);
   dateFrom = before.getTime();
   // }
   ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
   HttpSession session = (HttpSession) ectx.getSession(false);
   UserInfoPageBean userInfo = (UserInfoPageBean) session.getAttribute("userInfo");
   this.userauditsList =
       UserAuditDAO.getInstance()
           .getUserAuditsList(
               userInfo.getUser().getUserId(),
               userInfo.getUser().getCompany().getId(),
               userInfo.getUser().getUsertype(),
               dateFrom,
               dateTo);
 }
 /**
  * adds a new user and inserts audit
  *
  * @return
  */
 public String addNewMonitoringService() {
   MonitoringServiceDAO.getInstance()
       .addMonitoringService(
           this.newremotemonitoringService.getThreeyeardisc(),
           this.newremotemonitoringService.getFiveyeardisc(),
           this.newremotemonitoringService.getFactor2(),
           this.newremotemonitoringService.getCountry(),
           this.newremotemonitoringService.getCurrency(),
           this.newremotemonitoringService.getDescription(),
           this.newremotemonitoringService.getStepvalue1(),
           this.newremotemonitoringService.getStepvalue2(),
           this.newremotemonitoringService.getStepvalue3(),
           this.newremotemonitoringService.getStepvalue4(),
           this.newremotemonitoringService.getStepvalue5());
   UserAuditDAO.getInstance()
       .addUserAudit(
           "Add Monitoring Service",
           "User added the monitoring service : " + this.newremotemonitoringService.getCountry());
   newremotemonitoringService = new MonitoringService();
   return "MonitoringServicesPage?faces-redirect=true";
 }
 /**
  * modify a user and inserts audit
  *
  * @return
  */
 public String modifyMonitoringService() {
   if (this.selectedremotemonitoringService != null) {
     MonitoringServiceDAO.getInstance()
         .modifyMonitoringService(
             this.selectedremotemonitoringService.getThreeyeardisc(),
             this.selectedremotemonitoringService.getFiveyeardisc(),
             this.selectedremotemonitoringService.getFactor2(),
             this.selectedremotemonitoringService.getCountry(),
             this.selectedremotemonitoringService.getCurrency(),
             this.selectedremotemonitoringService.getId(),
             this.selectedremotemonitoringService.getDescription(),
             this.selectedremotemonitoringService.getStepvalue1(),
             this.selectedremotemonitoringService.getStepvalue2(),
             this.selectedremotemonitoringService.getStepvalue3(),
             this.selectedremotemonitoringService.getStepvalue4(),
             this.selectedremotemonitoringService.getStepvalue5());
     UserAuditDAO.getInstance()
         .addUserAudit(
             "Modify Monitoring Service",
             "User modified the monitoring service : "
                 + this.selectedremotemonitoringService.getCountry());
   }
   return "MonitoringServicesPage?faces-redirect=true";
 }