public String actionOnFeedback() {
   String returnResult = ERROR;
   boolean sessionFlag = ValidateSession.checkSession();
   if (sessionFlag) {
     try {
       if (dashFor != null && getDeptId() == null && feedStatus.equals("Pending")) {
         headingTitle = "Pending Feedback >> View";
         returnResult = SUCCESS;
       } else if ((dashFor != null && getDeptId() == null) && feedStatus.equals("Snooze")) {
         headingTitle = "Snooze Feedback >> View";
         returnResult = SUCCESS;
       } else if ((dashFor != null && getDeptId() == null) && feedStatus.equals("High Priority")) {
         headingTitle = "High Priority Feedback >> View";
         returnResult = SUCCESS;
       } else if ((dashFor != null && getDeptId() == null) && feedStatus.equals("Resolved")) {
         fromDate = DateUtil.getNewDate("month", -1, DateUtil.getCurrentDateUSFormat());
         toDate = DateUtil.getCurrentDateUSFormat();
         headingTitle = "Resolved Feedback >> View";
         returnResult = SUCCESS;
       }
       setGridColomnNames();
     } catch (Exception e) {
       e.printStackTrace();
     }
   } else {
     returnResult = LOGIN;
   }
   return returnResult;
 }
 @SuppressWarnings("unchecked")
 public void getTicketDetail(
     String status_for, String deptid, String empName, SessionFactory connectionSpace) {
   try {
     //	System.out.println("ddddddd  "+deptid);
     List ticketData =
         new AssetDashboardHelper().getLodgedTickets(deptid, status_for, empName, connectionSpace);
     ticketsList = new ArrayList<FeedbackPojo>();
     System.out.println(">>>>>>> " + ticketData.size());
     if (ticketData != null && ticketData.size() > 0) {
       for (Iterator iterator = ticketData.iterator(); iterator.hasNext(); ) {
         Object[] object = (Object[]) iterator.next();
         FeedbackPojo fp = new FeedbackPojo();
         fp.setId(Integer.parseInt(object[0].toString()));
         fp.setTicket_no(object[1].toString());
         fp.setFeed_by(DateUtil.makeTitle(object[2].toString()));
         fp.setOpen_date(DateUtil.convertDateToIndianFormat(object[3].toString()));
         fp.setOpen_time(object[4].toString().substring(0, 5));
         fp.setStatus(object[5].toString());
         ticketsList.add(fp);
       }
     }
     System.out.println(" >>>>>> " + ticketsList.size());
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
 public String beforeResModeView() {
   boolean valid = ValidateSession.checkSession();
   if (valid) {
     try {
       if (getMode() != null && getMode().equalsIgnoreCase("App")) {
         setMainHeaderName("Feedback >>Response Mobile App ");
         setGridColomnNamesNegative();
       } else if (getMode() != null && getMode().equalsIgnoreCase("Online")) {
         setMainHeaderName("Feedback >>Response Online ");
         setGridColomnNamesNegative();
       } else if (getMode() != null && getMode().equalsIgnoreCase("SMS")) {
         setMainHeaderName("Feedback >>Response SMS ");
         setGridColomnNamesNegative();
       } else if (getMode() != null && getMode().equalsIgnoreCase("Voice")) {
         setMainHeaderName("Feedback >>Response Voice ");
         setGridColomnNamesNegative();
       }
       return SUCCESS;
     } catch (Exception e) {
       e.printStackTrace();
       log.error(
           "Problem in method beforeResModeView of class"
               + getClass()
               + " on "
               + DateUtil.getCurrentDateIndianFormat()
               + " at "
               + DateUtil.getCurrentTimeHourMin(),
           e);
       return ERROR;
     }
   } else {
     return LOGIN;
   }
 }
 public String takeActionForAudit() {
   boolean validFlag = ValidateSession.checkSession();
   if (validFlag) {
     try {
       System.out.println(">>>>>edit>>>>>");
       Map<String, Object> wherClause = new HashMap<String, Object>();
       Map<String, Object> condtnBlock = new HashMap<String, Object>();
       wherClause.put("action_type", request.getParameter("actionType"));
       wherClause.put("comments", request.getParameter("comments"));
       wherClause.put("action_by", userName);
       wherClause.put(
           "action_date_time",
           DateUtil.getCurrentDateUSFormat() + ", " + DateUtil.getCurrentTime());
       System.out.println("id>>>>>" + getId());
       condtnBlock.put("id", getId());
       boolean b =
           cbt.updateTableColomn(
               "feedback_audit_report", wherClause, condtnBlock, connectionSpace);
       if (b) {
         addActionMessage("Action Taken Successfullly!!!");
         return SUCCESS;
       } else {
         addActionMessage("Oops!!! There is some error.");
         return ERROR;
       }
     } catch (Exception e) {
       e.printStackTrace();
       return ERROR;
     }
   } else {
     return LOGIN;
   }
 }
 public String beforeAuditHeader() {
   boolean sessionFlag = ValidateSession.checkSession();
   if (sessionFlag) {
     try {
       fromDate = DateUtil.getNewDate("day", -6, DateUtil.getCurrentDateUSFormat());
       toDate = DateUtil.getCurrentDateUSFormat();
       return SUCCESS;
     } catch (Exception e) {
       e.printStackTrace();
       return ERROR;
     }
   } else {
     return LOGIN;
   }
 }
  public void run() {
    try {
      // method calling Alert generation.
      VSAH.alertGeneration(connection, VSAHU, CH);
      Runtime rt = Runtime.getRuntime();
      rt.gc();
      System.out.println(
          "Sleeping......................"
              + DateUtil.getCurrentDateIndianFormat()
              + " at "
              + DateUtil.getCurrentTime());
      Thread.sleep(1000 * 60);
      System.out.println(
          "Woke Up......................."
              + DateUtil.getCurrentDateIndianFormat()
              + " at "
              + DateUtil.getCurrentTime());

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  public String beforeShowClientBirthdayTable() {
    String returnValue = ERROR;
    if (ValidateSession.checkSession()) {
      try {
        StringBuilder query7 = new StringBuilder("");
        query7.append(
            "select cbd.clientName, ccd.personName, ccd.birthday from client_basic_data as cbd, "
                + "client_contact_data as ccd where cbd.id = ccd.clientName  "
                + "and (ccd.birthday >= '"
                + DateUtil.getCurrentDateUSFormat()
                + "' and ccd.birthday <= '"
                + DateUtil.getDateAfterDays(7)
                + "') order by ccd.birthday ");
        List dataCount7 = coi.executeAllSelectQuery(query7.toString(), connectionSpace);

        if (dataCount7 != null && dataCount7.size() > 0) {
          birthdayList = new ArrayList<ArrayList<String>>();
          for (Iterator iterator = dataCount7.iterator(); iterator.hasNext(); ) {
            Object[] object = (Object[]) iterator.next();
            if (object != null && object[2] != null && !object[2].toString().equalsIgnoreCase("")) {
              ArrayList<String> data = new ArrayList<String>();
              data.add(object[0].toString());
              data.add(object[1].toString());
              data.add(DateUtil.convertDateToIndianFormat(object[2].toString()));

              birthdayList.add(data);
            }
          }
        }

        returnValue = SUCCESS;
      } catch (Exception e) {
        e.printStackTrace();
      }
    } else {
      returnValue = LOGIN;
    }
    return returnValue;
  }
 public String beforeActionOnFeedback() {
   String returnResult = ERROR;
   boolean sessionFlag = ValidateSession.checkSession();
   if (sessionFlag) {
     try {
       if (moduleName != null
           && !moduleName.equals("")
           && moduleName.equalsIgnoreCase("DREAM_HDM")
           && feedStatus != null
           && !feedStatus.equals("")
           && (feedStatus.equals("Pending")
               || feedStatus.equals("Snooze")
               || feedStatus.equals("High Priority"))) {
         setFromDate(DateUtil.getNewDate("week", -1, DateUtil.getCurrentDateUSFormat()));
         toDate = DateUtil.getCurrentDateUSFormat();
         statusList();
         deptList();
         returnResult = SUCCESS;
       } else if (moduleName != null
           && !moduleName.equals("")
           && moduleName.equalsIgnoreCase("DREAM_HDM")
           && feedStatus != null
           && !feedStatus.equals("")
           && feedStatus.equals("Resolved")) {
         setFromDate(DateUtil.getNewDate("week", -1, DateUtil.getCurrentDateUSFormat()));
         toDate = DateUtil.getCurrentDateUSFormat();
         statusList();
         deptList();
         returnResult = SUCCESS;
       }
       if (moduleName != null
           && !moduleName.equals("")
           && moduleName.equalsIgnoreCase("DREAM_HDM")) {
         setGridColomnNames();
       }
     } catch (Exception e) {
       e.printStackTrace();
     }
   } else {
     returnResult = LOGIN;
   }
   return returnResult;
 }
  @SuppressWarnings("rawtypes")
  public String updateFeedbackStatus() {
    String returnResult = ERROR;
    boolean sessionFlag = ValidateSession.checkSession();
    if (sessionFlag) {
      try {
        HelpdeskUniversalHelper HUH = new HelpdeskUniversalHelper();
        new HelpdeskUniversalAction();
        MsgMailCommunication MMC = new MsgMailCommunication();
        FeedbackPojo fbp = new FeedbackPojo();
        String duration = "NA";
        Map<String, Object> wherClause = new HashMap<String, Object>();
        Map<String, Object> condtnBlock = new HashMap<String, Object>();

        String snDate = "", snTime = "", snUpToDate = "", snUpToTime = "", snDuration = "";
        List ticketData =
            new HelpdeskUniversalAction()
                .getMultipleColumns(
                    "complaint_status",
                    "sn_on_date",
                    "sn_on_time",
                    "sn_upto_date",
                    "sn_upto_time",
                    "sn_duration",
                    "id",
                    getFeedid(),
                    "",
                    "",
                    connectionSpace);
        if (ticketData != null && ticketData.size() > 0) {
          for (Iterator iterator = ticketData.iterator(); iterator.hasNext(); ) {
            Object[] object = (Object[]) iterator.next();
            if (object[0] != null && !object[0].toString().equals("")) {
              snDate = object[0].toString();
            } else {
              snDate = "NA";
            }
            if (object[1] != null && !object[1].toString().equals("")) {
              snTime = object[1].toString();
            } else {
              snTime = "NA";
            }
            if (object[2] != null && !object[2].toString().equals("")) {
              snUpToDate = object[2].toString();
            } else {
              snUpToDate = "NA";
            }
            if (object[3] != null && !object[3].toString().equals("")) {
              snUpToTime = object[3].toString();
            } else {
              snUpToTime = "NA";
            }
            if (object[4] != null && !object[4].toString().equals("")) {
              snDuration = object[4].toString();
            } else {
              snDuration = "NA";
            }
          }
        }

        if (getStatus().equalsIgnoreCase("Resolved")) {
          String cal_duration = "";
          if (open_date != null
              && !open_date.equals("")
              && open_time != null
              && !open_time.equals("")) {
            duration =
                DateUtil.time_difference(
                    DateUtil.convertDateToUSFormat(open_date),
                    open_time,
                    DateUtil.getCurrentDateUSFormat(),
                    DateUtil.getCurrentTime());
          }
          if (!snDuration.equals("") && !snDuration.equals("NA")) {
            boolean flag = DateUtil.time_update(snUpToDate, snUpToTime);
            if (flag) {
              cal_duration = DateUtil.getTimeDifference(duration, snDuration);
              if (cal_duration != null && !cal_duration.equals("") && !cal_duration.contains("-")) {
                duration = cal_duration;
              }
            } else {
              String newduration =
                  DateUtil.time_difference(
                      snDate, snTime, DateUtil.getCurrentDateUSFormat(), DateUtil.getCurrentTime());
              if (newduration != null && !newduration.equals("") && !newduration.equals("NA")) {
                String new_cal_duration = DateUtil.getTimeDifference(duration, newduration);
                if (new_cal_duration != null
                    && !new_cal_duration.equals("")
                    && !new_cal_duration.contains("-")) {
                  duration = new_cal_duration;
                }
              }
            }
          }
          wherClause.put("status", getStatus());
          wherClause.put("action_by", userName);
          wherClause.put("resolve_date", DateUtil.getCurrentDateUSFormat());
          wherClause.put("resolve_time", DateUtil.getCurrentTime());
          wherClause.put("resolve_duration", duration);
          wherClause.put("resolve_remark", DateUtil.makeTitle(getRemark()));
          wherClause.put("resolve_by", getResolver());
          wherClause.put("spare_used", getSpareused());
          wherClause.put("resolve_rca", getRca());
          wherClause.put("resolve_capa", getCapa());
          condtnBlock.put("id", getFeedid());
        } else if (getStatus().equalsIgnoreCase("Snooze")) {
          if (snDate.equals("NA") || snTime.equals("NA")) {
            if (snoozeDate != null
                && !snoozeDate.equals("")
                && snoozeTime != null
                && !snoozeTime.equals("")) {
              duration =
                  DateUtil.time_difference(
                      DateUtil.getCurrentDateUSFormat(),
                      DateUtil.getCurrentTime(),
                      DateUtil.convertDateToUSFormat(snoozeDate),
                      snoozeTime);
            }
          } else {
            if (snoozeDate != null
                && !snoozeDate.equals("")
                && snoozeTime != null
                && !snoozeTime.equals("")) {
              duration =
                  DateUtil.time_difference(
                      snDate, snTime, DateUtil.convertDateToUSFormat(snoozeDate), snoozeTime);
            }
          }

          wherClause.put("status", getStatus());
          wherClause.put("sn_reason", DateUtil.makeTitle(getSnoozecomment()));
          if (snDate.equals("NA") || snTime.equals("NA")) {
            wherClause.put("sn_on_date", DateUtil.getCurrentDateUSFormat());
            wherClause.put("sn_on_time", DateUtil.getCurrentTime());
          }
          wherClause.put("sn_upto_date", DateUtil.convertDateToUSFormat(snoozeDate));
          wherClause.put("sn_upto_time", snoozeTime);
          wherClause.put("sn_duration", duration);
          wherClause.put("action_by", userName);
          condtnBlock.put("id", getFeedid());
        } else if (getStatus().equalsIgnoreCase("High Priority")) {
          wherClause.put("status", getStatus());
          wherClause.put("hp_date", DateUtil.getCurrentDateUSFormat());
          wherClause.put("hp_time", DateUtil.getCurrentTime());
          wherClause.put("hp_reason", DateUtil.makeTitle(getHpcomment()));
          wherClause.put("action_by", userName);
          condtnBlock.put("id", getFeedid());
        } else if (getStatus().equalsIgnoreCase("Ignore")) {
          wherClause.put("status", getStatus());
          wherClause.put("ig_date", DateUtil.getCurrentDateUSFormat());
          wherClause.put("ig_time", DateUtil.getCurrentTime());
          wherClause.put("ig_reason", DateUtil.makeTitle(getIgnorecomment()));
          wherClause.put("action_by", userName);
          condtnBlock.put("id", getFeedid());
        }
        /*else if (getStatus().equalsIgnoreCase("Re-Assign"))
        {
        	String feedBy="NA",mobNo="NA",emailId="NA",bysubdept="NA",feedBrief="NA",location="NA";
        	List existTicketData = new HelpdeskUniversalHelper().getTransferTicketData(getFeedid(), connectionSpace);
        	if (existTicketData!=null && existTicketData.size()>0) {
        		for (Iterator iterator = existTicketData.iterator(); iterator
        				.hasNext();) {
        			Object[] object = (Object[]) iterator.next();
        			if (object[0]!=null && !object[0].toString().equals("")) {
        				feedBy=object[0].toString();
        			}
        			if (object[1]!=null && !object[1].toString().equals("")) {
        				mobNo=object[1].toString();
        			}
        			if (object[2]!=null && !object[2].toString().equals("")) {
        				emailId=object[2].toString();
        			}
        			if (object[3]!=null && !object[3].toString().equals("")) {
        				bysubdept=object[3].toString();
        			}
        			if (object[4]!=null && !object[4].toString().equals("")) {
        				feedBrief=object[4].toString();
        			}
        			if (object[5]!=null && !object[5].toString().equals("")) {
        				location=object[5].toString();
        			}
        		}
        		boolean flag = transferComplaint(feedBy,mobNo,emailId,bysubdept,feedBrief,location,getFeedid());
        		if (flag) {
        			wherClause.put("status", "Transfer");
        			wherClause.put("transfer_date", DateUtil.getCurrentDateUSFormat());
        			wherClause.put("transfer_time", DateUtil.getCurrentTime());
        			wherClause.put("transfer_reason", DateUtil.makeTitle(getReAssignRemark()));
        			wherClause.put("action_by", userName);
        			condtnBlock.put("id", getFeedid());
        		}
        	}

        }*/
        boolean updateFeed =
            HUH.updateTableColomn("complaint_status", wherClause, condtnBlock, connectionSpace);
        if (updateFeed) {
          ComplaintLodgeHelper CLH = new ComplaintLodgeHelper();

          String levelMsg = "",
              complainatMsg = "",
              mailText = "",
              mailSubject = "",
              mailheading = "";
          List data = CLH.getFeedbackDetail(getFeedid(), getStatus(), connectionSpace);
          if (data != null && data.size() > 0) {
            fbp = CLH.setFeedbackDataValues(data, getStatus(), connectionSpace);
          }
          if (getStatus().equalsIgnoreCase("Resolved")) {
            // levelMsg = "Close Feedback Alert: Ticket No: " + fbp.getTicket_no() + ", Reg. By: " +
            // DateUtil.makeTitle(fbp.getFeed_registerby().trim()) + ", Location: " +
            // fbp.getLocation() + ", Brief: " + remark + " is Closed.";
            // complainatMsg = "Dear " + DateUtil.makeTitle(fbp.getFeed_registerby().trim()) + ",
            // Ticket No: " + fbp.getTicket_no() + ", Location: " + fbp.getLocation() + ", Brief: "
            // + remark + " is Closed.";
            mailSubject = "Close Ticket Alert: " + fbp.getTicket_no();
            mailheading = "Close Ticket Alert: " + fbp.getTicket_no();
          } else if (getStatus().equalsIgnoreCase("High Priority")) {
            // levelMsg = "High Priority Alert: Ticket No: " + fbp.getTicket_no() + ", Reg. By : " +
            // DateUtil.makeTitle(fbp.getFeed_registerby().trim()) + ", Location: " +
            // fbp.getLocation() + ", Brief: " + fbp.getFeed_brief() + ",Reason: " +
            // fbp.getHp_reason() + ".";
            // complainatMsg = "Dear " + DateUtil.makeTitle(fbp.getFeed_registerby().trim()) + ",
            // Ticket No: " + fbp.getTicket_no() + ", Location: " + fbp.getLocation() + ", Brief: "
            // + fbp.getFeed_brief() + ",Reason: " + fbp.getHp_reason() + " is on High Priority.";
            mailSubject = "High Priority Feedback Alert: " + fbp.getTicket_no();
            mailheading = "High Priority Case Ticket Alert";
          } else if (getStatus().equalsIgnoreCase("Snooze")) {
            // levelMsg = "Snooze Alert: Ticket No: " + fbp.getTicket_no() + ", Reg. By: " +
            // DateUtil.makeTitle(fbp.getFeed_registerby().trim()) + ", Location: " +
            // fbp.getLocation() + ", Brief: " + fbp.getFeed_brief() + " will be Snoozed till " +
            // fbp.getSn_duration() + ",Reason: " + fbp.getSn_reason() + ".";
            // complainatMsg = "Dear " + DateUtil.makeTitle(fbp.getFeed_registerby().trim()) + ",
            // Ticket No: " + fbp.getTicket_no() + ", Location: " + fbp.getLocation() + ", Brief: "
            // + fbp.getFeed_brief() + ",Status: Snoozed to " + fbp.getSn_on_date() + " " +
            // fbp.getSn_on_time() + " Hrs, Reason:" + fbp.getSn_reason() + ".";
            mailSubject = "Snooze Feedback Alert: " + fbp.getTicket_no();
            mailheading = "Snooze Case Ticket Alert";
          } else if (getStatus().equalsIgnoreCase("Ignore")) {
            // levelMsg = "Ignore Feedback Alert: Ticket No: " + fbp.getTicket_no() + ", Reg. By: "
            // + DateUtil.makeTitle(fbp.getFeed_registerby()) + ", Location: " + fbp.getLocation() +
            // ", Brief: " + fbp.getFeed_brief() + ",Reason: " + fbp.getIg_reason() + " should be
            // Ignored.";
            // complainatMsg = "Dear " + DateUtil.makeTitle(fbp.getFeed_registerby()) + ", Ticket
            // No: " + fbp.getTicket_no() + ", Location: " + fbp.getLocation() + ", Brief: " +
            // fbp.getFeed_brief() + ",Reason: " + fbp.getIg_reason() + " is Ignored.";
            mailSubject = "Ignore Feedback Alert: " + fbp.getTicket_no();
            mailheading = "Ignore Case Ticket Alert";
          }

          if (getStatus().equalsIgnoreCase("Resolved")) {
            /*if (fbp.getFeedback_by_mobno() != null && fbp.getFeedback_by_mobno() != "" && fbp.getFeedback_by_mobno().trim().length() == 10 && (fbp.getFeedback_by_mobno().startsWith("9") || fbp.getFeedback_by_mobno().startsWith("8") || fbp.getFeedback_by_mobno().startsWith("7")))
            {
            	MMC.addMessage(fbp.getFeed_registerby(), fbp.getFeedback_by_dept(), fbp.getFeedback_by_mobno(), complainatMsg, ticket_no, getStatus(), "0", "HDM");
            }*/
            if (fbp.getFeedback_by_emailid() != null && !fbp.getFeedback_by_emailid().equals("")) {
              mailText =
                  CLH.getConfigMessage(
                      fbp,
                      mailheading,
                      getStatus(),
                      false,
                      fbp.getClientFor(),
                      fbp.getClientName(),
                      fbp.getOfferingName());
              MMC.addMail(
                  fbp.getFeed_registerby(),
                  fbp.getFeedback_by_dept(),
                  fbp.getFeedback_by_emailid(),
                  mailSubject,
                  mailText,
                  ticket_no,
                  getStatus(),
                  "0",
                  "",
                  "DREAM_HDM");
            }
            /*if (fbp.getResolve_by_mobno() != null && fbp.getResolve_by_mobno() != "" && fbp.getResolve_by_mobno().trim().length() == 10 && (fbp.getResolve_by_mobno().startsWith("9") || fbp.getResolve_by_mobno().startsWith("8") || fbp.getResolve_by_mobno().startsWith("7")))
            {
            	MMC.addMessage(fbp.getResolve_by(), fbp.getFeedback_to_dept(), fbp.getResolve_by_mobno(), levelMsg, ticket_no, getStatus(), "0", "HDM");
            }*/
            if (fbp.getResolve_by_emailid() != null && !fbp.getResolve_by_emailid().equals("")) {
              mailText =
                  CLH.getConfigMessage(
                      fbp,
                      mailheading,
                      getStatus(),
                      true,
                      fbp.getClientFor(),
                      fbp.getClientName(),
                      fbp.getOfferingName());
              MMC.addMail(
                  fbp.getResolve_by(),
                  fbp.getFeedback_to_dept(),
                  fbp.getResolve_by_emailid(),
                  mailSubject,
                  mailText,
                  fbp.getTicket_no(),
                  "Pending",
                  "0",
                  "",
                  "DREAM_HDM");
            }
          } else if (getStatus().equalsIgnoreCase("High Priority")
              || getStatus().equalsIgnoreCase("Snooze")
              || getStatus().equalsIgnoreCase("Ignore")) {

            /*	if (fbp.getFeedback_by_mobno() != null && fbp.getFeedback_by_mobno() != "" && fbp.getFeedback_by_mobno().trim().length() == 10 && (fbp.getFeedback_by_mobno().startsWith("9") || fbp.getFeedback_by_mobno().startsWith("8") || fbp.getFeedback_by_mobno().startsWith("7")))
            {
            	MMC.addMessage(fbp.getFeed_registerby(), fbp.getFeedback_by_dept(), fbp.getFeedback_by_mobno(), complainatMsg, ticket_no, getStatus(), "0", "HDM");
            }
            	*/
            if (fbp.getFeedback_by_emailid() != null && !fbp.getFeedback_by_emailid().equals("")) {
              mailText =
                  CLH.getConfigMessage(
                      fbp,
                      mailheading,
                      getStatus(),
                      false,
                      fbp.getClientFor(),
                      fbp.getClientName(),
                      fbp.getOfferingName());
              MMC.addMail(
                  fbp.getFeed_registerby(),
                  fbp.getFeedback_by_dept(),
                  fbp.getFeedback_by_emailid(),
                  mailSubject,
                  mailText,
                  ticket_no,
                  getStatus(),
                  "0",
                  "",
                  "DREAM_HDM");
            }
            /*if (fbp.getMobOne() != null && fbp.getMobOne() != "" && fbp.getMobOne().trim().length() == 10 && (fbp.getMobOne().startsWith("9") || fbp.getMobOne().startsWith("8") || fbp.getMobOne().startsWith("7")))
            {
            	MMC.addMessage(fbp.getFeedback_allot_to(), fbp.getFeedback_to_dept(), fbp.getMobOne(), levelMsg, ticket_no, getStatus(), "0", "HDM");
            }*/

            if (fbp.getEmailIdOne() != null && !fbp.getEmailIdOne().equals("")) {
              mailText =
                  CLH.getConfigMessage(
                      fbp,
                      mailheading,
                      getStatus(),
                      true,
                      fbp.getClientFor(),
                      fbp.getClientName(),
                      fbp.getOfferingName());
              MMC.addMail(
                  fbp.getFeedback_allot_to(),
                  fbp.getFeedback_to_dept(),
                  fbp.getEmailIdOne(),
                  mailSubject,
                  mailText,
                  fbp.getTicket_no(),
                  "Pending",
                  "0",
                  "",
                  "DREAM_HDM");
            }
          }
          addActionMessage("Feedback Updated in " + getStatus() + " Successfully !!!");
          returnResult = SUCCESS;
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    } else {
      returnResult = LOGIN;
    }
    return returnResult;
  }
  @SuppressWarnings("rawtypes")
  public String getFeedbackDetail() {
    String returnResult = ERROR;
    boolean sessionFlag = ValidateSession.checkSession();
    if (sessionFlag) {
      try {
        String userName = (String) session.get("uName");
        SessionFactory connectionSpace = (SessionFactory) session.get("connectionSpace");
        ComplaintLodgeHelper CLH = new ComplaintLodgeHelper();
        feedbackList = new ArrayList<FeedbackPojo>();
        List data = null;
        String dept_subdept_id = "";
        String contactLoggedId = null;

        String[] empData =
            CLH.getEmpDetailsByUserName(
                "DREAM_HDM", Cryptography.encrypt(userName, DES_ENCRYPTION_KEY), connectionSpace);
        if (empData != null && empData.length > 0) {
          dept_subdept_id = empData[4];
          contactLoggedId = empData[0];
        }

        if (dept_subdept_id != null && !dept_subdept_id.equals("")) {
          if (dataFlag != null && dataFlag.equals("M")) {
            toDate = DateUtil.convertDateToUSFormat(toDate);
            fromDate = DateUtil.convertDateToUSFormat(fromDate);
          } else {
            toDate = toDate;
            fromDate = fromDate;
          }
          data =
              CLH.getFeedbackDetail(
                  "complaint_status",
                  getFeedStatus(),
                  fromDate,
                  toDate,
                  dept_subdept_id,
                  contactLoggedId,
                  "feedback.id",
                  "ASC",
                  "DREAM_HDM",
                  searchField,
                  searchString,
                  searchOper,
                  connectionSpace);
        }
        if (data != null && data.size() > 0) {
          setRecords(data.size());
          int to = (getRows() * getPage());
          @SuppressWarnings("unused")
          int from = to - getRows();
          if (to > getRecords()) to = getRecords();

          feedbackList = CLH.setFeedbackValues(data, getFeedStatus(), connectionSpace);

          setTotal((int) Math.ceil((double) getRecords() / (double) getRows()));
        }
        returnResult = SUCCESS;
      } catch (Exception e) {
        addActionError("Ooops!!! There is some problem in getting Feedback Data");
        e.printStackTrace();
      }
    } else {
      returnResult = LOGIN;
    }
    return returnResult;
  }
  public boolean addMail(
      String emailid,
      String subject,
      String mailtext,
      String ticketno,
      String status,
      String statusflag,
      String attachment,
      String module,
      SessionFactory connection) {
    boolean flag = false;

    try {
      CommonOperInterface cot = new CommonConFactory().createInterface();

      InsertDataTable ob = new InsertDataTable();
      List<InsertDataTable> insertData = new ArrayList<InsertDataTable>();
      ob.setColName("ticket_no");
      ob.setDataName(ticketno);
      insertData.add(ob);

      ob = new InsertDataTable();
      ob.setColName("emailid");
      ob.setDataName(emailid);
      insertData.add(ob);

      ob = new InsertDataTable();
      ob.setColName("subject");
      ob.setDataName(subject);
      insertData.add(ob);

      ob = new InsertDataTable();
      ob.setColName("mail_text");
      ob.setDataName(mailtext);
      insertData.add(ob);

      ob = new InsertDataTable();
      ob.setColName("flag");
      ob.setDataName(statusflag);
      insertData.add(ob);

      ob = new InsertDataTable();
      ob.setColName("status");
      ob.setDataName(status);
      insertData.add(ob);

      ob = new InsertDataTable();
      ob.setColName("attachment");
      ob.setDataName(attachment);
      insertData.add(ob);

      ob = new InsertDataTable();
      ob.setColName("module");
      ob.setDataName(module);
      insertData.add(ob);

      ob = new InsertDataTable();
      ob.setColName("userName");
      ob.setDataName("escalate");
      insertData.add(ob);

      ob = new InsertDataTable();
      ob.setColName("date");
      ob.setDataName(DateUtil.getCurrentDateUSFormat());
      insertData.add(ob);

      ob = new InsertDataTable();
      ob.setColName("time");
      ob.setDataName(DateUtil.getCurrentTime());
      insertData.add(ob);

      cot.insertIntoTable("instant_mail", insertData, connection);
      insertData.clear();
      flag = true;
    } catch (Exception e) {
      e.printStackTrace();
    }
    return flag;
  }
  // Add Sms to client and server.
  public boolean addMessageClientServer(
      String mobone,
      String msg,
      String ticketno,
      String status,
      String statusflag,
      String module,
      SessionFactory connection) {
    boolean flag = false;
    boolean statusserver = false;
    try {
      // CommonOperInterface cot = new CommonConFactory().createInterface();
      CommonOperInterface cbt = new CommonConFactory().createInterface();

      /* InsertDataTable ob=new InsertDataTable();
         List <InsertDataTable> insertData=new ArrayList<InsertDataTable>();
      ob.setColName("ticket_no");
      ob.setDataName(ticketno);
      insertData.add(ob);

      ob=new InsertDataTable();
      ob.setColName("mobno");
      ob.setDataName(mobone);
      insertData.add(ob);

      ob=new InsertDataTable();
      ob.setColName("msg_text");
      ob.setDataName(msg);
      insertData.add(ob);

      ob=new InsertDataTable();
      ob.setColName("flag");
      ob.setDataName(statusflag);
      insertData.add(ob);

      ob=new InsertDataTable();
      ob.setColName("status");
      ob.setDataName(status);
      insertData.add(ob);

      ob=new InsertDataTable();
      ob.setColName("module");
      ob.setDataName(module);
      insertData.add(ob);

      ob=new InsertDataTable();
      ob.setColName("user");
      ob.setDataName("escalate");
      insertData.add(ob);


      ob=new InsertDataTable();
      ob.setColName("date");
      ob.setDataName(DateUtil.getCurrentDateUSFormat());
      insertData.add(ob);

      ob=new InsertDataTable();
      ob.setColName("time");
      ob.setDataName(DateUtil.getCurrentTime());
      insertData.add(ob);

            cot.insertIntoTable("instant_msg",insertData,connection);
            insertData.clear();*/

      /** Code to insert data on server database. */
      PreRequestserviceStub objstatus = new PreRequestserviceStub();
      //	InsertIntoTable obj=new InsertIntoTable();
      List<String> Tablecolumename = new ArrayList<String>();
      List<String> Tablecolumevalue = new ArrayList<String>();
      /*Tablecolumename.add("ticket_no");
      Tablecolumevalue.add(ticketno);*/
      Tablecolumename.add("mobno");
      Tablecolumevalue.add(mobone);
      Tablecolumename.add("msg_text");
      Tablecolumevalue.add(msg);
      Tablecolumename.add("flag");
      Tablecolumevalue.add(statusflag);
      Tablecolumename.add("status");
      Tablecolumevalue.add(status);
      Tablecolumename.add("module");
      Tablecolumevalue.add(module);
      Tablecolumename.add("user");
      Tablecolumevalue.add("escalate");
      Tablecolumename.add("date");
      Tablecolumevalue.add(DateUtil.getCurrentDateUSFormat());
      Tablecolumename.add("time");
      Tablecolumevalue.add(DateUtil.getCurrentTime());
      StringBuilder createTableQuery = new StringBuilder("INSERT INTO " + "instant_msg" + " (");

      int i = 1;
      // append Column
      for (String h : Tablecolumename) {
        if (i < Tablecolumename.size()) createTableQuery.append(h + ", ");
        else createTableQuery.append(h + ")");
        i++;
      }

      createTableQuery.append(" VALUES (");
      i = 1;
      for (String h : Tablecolumevalue) {
        if (i < Tablecolumevalue.size()) createTableQuery.append("'" + h + "', ");
        else createTableQuery.append("'" + h + "')");
        i++;
      }
      createTableQuery.append(" ;");
      // System.out.println(">>>>>>>>>>>>>"+createTableQuery);
      //	obj.setCreateTableQuery(createTableQuery.toString());

      // insert into local database.
      int maxId = cbt.insertIntoTable(createTableQuery.toString(), connection);
      // insert into Server database.
      //    statusserver= objstatus.insertIntoTable(obj).get_return();
      if (statusserver) {
        flag = true;
      } else {
        flag = false;
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    return flag;
  }
  // Define A method for Creating Excel File
  public String createExcelformate(
      String titleString,
      String sheetString,
      String[] headerTitles,
      String titleKey,
      String filePath) {

    String file = null;
    Workbook wb;
    int col = 0;
    try {
      // check Header Title
      if (headerTitles != null && headerTitles.length > 0) col = headerTitles.length;

      wb = (Workbook) new HSSFWorkbook();
      // Hear we are getting whole property
      List<ConfigurationUtilBean> titleMap = new CustomerCommonPropertyMap().getTitles(titleKey);
      Map<String, CellStyle> styles = createStyles(wb);
      Sheet sheet = wb.createSheet(sheetString);
      PrintSetup printSetup = sheet.getPrintSetup();
      printSetup.setLandscape(true);
      sheet.setFitToPage(true);
      sheet.setHorizontallyCenter(true);

      Header header = sheet.getHeader();
      header.setCenter("Center Header");
      header.setLeft("Left Header");
      header.setRight("Right Footer");
      Footer footer = sheet.getFooter();
      footer.setCenter("center footer");
      footer.setLeft("left footer");
      footer.setRight("right footer");

      // Title Row....
      Row titleRow = sheet.createRow(0);
      titleRow.setHeightInPoints(20);
      Cell titleCell = titleRow.createCell(0);
      titleCell.setCellValue(titleString);
      titleCell.setCellStyle(styles.get("title"));
      sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, col - 1));

      //
      Row headerRow = sheet.createRow(1);
      headerRow.setHeightInPoints(15);
      Cell headerCell = null;
      if (headerTitles != null) {
        for (ConfigurationUtilBean cell : titleMap) {
          int titleIndex = 0;
          for (int i = 0; i < headerTitles.length; i++) {
            if (cell.getKey().equalsIgnoreCase(headerTitles[titleIndex].trim())) {
              headerCell = headerRow.createCell(titleIndex);
              headerCell.setCellValue(cell.getValue());
              headerCell.setCellStyle(styles.get("header"));
            }
            titleIndex++;
          }
        }
      }

      for (int titleIndex = 0; titleIndex < headerTitles.length; titleIndex++)
        sheet.autoSizeColumn(titleIndex); // adjust width of the column

      file =
          filePath
              + File.separator
              + "ContactReport"
              + DateUtil.getCurrentDateIndianFormat()
              + (DateUtil.getCurrentTime()).replaceAll(":", "-")
              + ".xls";

      if (wb instanceof XSSFWorkbook) file += "x";
      FileOutputStream out = new FileOutputStream(file);
      wb.write(out);
      out.close();

    } catch (Exception e) {
      e.printStackTrace();
    } finally {

    }
    return file;
  }
  @SuppressWarnings("rawtypes")
  public String viewAuditReport() {
    System.out.println("viewAuditReport");
    boolean sessionFlag = ValidateSession.checkSession();
    if (sessionFlag) {
      try {
        masterViewList = new ArrayList<Object>();
        List<Object> Listhb = new ArrayList<Object>();
        List dataList = null;
        StringBuilder query = new StringBuilder();
        query.append(
            "SELECT far.id,feed.clientId,feed.patientId,feed.clientName,far.feedDataId,action_type,far.comments,action_by FROM feedback_audit_report AS far ");
        query.append(" INNER JOIN feedbackdata AS feed ON feed.id=far.feedDataId ");
        query.append(" WHERE far.id!=0 ");
        if (getFromDate() != null
            && getToDate() != null
            && !getFromDate().equalsIgnoreCase("")
            && !getToDate().equalsIgnoreCase("")) {
          String str[] = getFromDate().split("-");
          if (str[0] != null && str[0].length() > 3) {
            query.append(
                " AND far.insert_date BETWEEN '"
                    + ((getFromDate()))
                    + "' AND '"
                    + ((getToDate()))
                    + "'");
          } else {
            query.append(
                " AND far.insert_date BETWEEN '"
                    + (DateUtil.convertDateToUSFormat(getFromDate()))
                    + "' AND '"
                    + (DateUtil.convertDateToUSFormat(getToDate()))
                    + "'");
          }
        }
        query.append(" ORDER BY far.id DESC ");
        System.out.println("query data:::::" + query);
        dataList = cbt.executeAllSelectQuery(query.toString(), connectionSpace);
        if (dataList != null && dataList.size() > 0) {
          for (Iterator iterator = dataList.iterator(); iterator.hasNext(); ) {
            Object[] object = (Object[]) iterator.next();
            Map<String, Object> one = new HashMap<String, Object>();
            one.put("id", (object[0]));
            if (object[1] != null) {
              one.put("clientId", (object[1]));
            }

            if (object[2] != null && !object[2].equals("-1")) {
              one.put("patientId", (object[2]));
            } else {
              one.put("patientId", "NA");
            }
            if (object[3] != null && !object[3].equals("-1")) {
              one.put("clientName", (object[3]));
            } else {
              one.put("clientName", "NA");
            }
            if (object[4] != null && !object[4].equals("-1")) {
              one.put("feedDataId", (object[4]));
            } else {
              one.put("feedDataId", "NA");
            }
            if (object[5] != null && !object[5].equals("-1")) {
              one.put("action_type", (object[5]));
            } else {
              one.put("action_type", "NA");
            }
            if (object[6] != null && !object[6].equals("-1")) {
              one.put("comments", (object[6]));
            } else {
              one.put("comments", "NA");
            }
            if (object[7] != null && !object[7].equals("-1")) {
              one.put("action_by", (object[7]));
            } else {
              one.put("action_by", "NA");
            }
            Listhb.add(one);
          }
        }
        setMasterViewList(Listhb);
        if (masterViewList != null && masterViewList.size() > 0) {
          setRecords(masterViewList.size());
          int to = (getRows() * getPage());
          @SuppressWarnings("unused")
          int from = to - getRows();
          if (to > getRecords()) to = getRecords();

          setTotal((int) Math.ceil((double) getRecords() / (double) getRows()));
        }
        return SUCCESS;
      } catch (Exception e) {
        e.printStackTrace();
        return ERROR;
      }
    } else {
      return LOGIN;
    }
  }
Esempio n. 15
0
@Entity
@org.hibernate.annotations.Proxy(lazy = false)
@Table(name = "registation_sinup")
public class Registation {
  @Id
  @Column(name = "id", nullable = false, unique = true)
  @GeneratedValue(strategy = GenerationType.AUTO)
  private int id;

  @Column(name = "org_reg_name")
  private String org_Registation_name;

  @Column(name = "org_name")
  private String orgname;

  @Column(name = "org_type")
  private String orgtype = "PRL";

  @Column(name = "industry")
  private String industry = "DS-10011";

  @Column(name = "regAddress")
  private String regaddress;

  @Column(name = "city")
  private String city;

  @Column(name = "pincode")
  private String pincode;

  @Column(name = "contactNo")
  private String contactNo;

  @Column(name = "contact_emailid")
  private String contact_emailid;

  @Column(name = "country")
  private String country;

  @Column(name = "confirm_key")
  private String confirm_key;

  @Column(name = "confirm_agreement")
  private boolean confirm_agreement;

  @Column(name = "created_datetime")
  private String create_datetime = "NA";

  @Column(name = "update_datetime")
  private String update_datetime = "NA";

  @Column(name = "brief")
  private String brief = "NA";

  @Column(name = "accountType")
  private String accountType = "NA";

  @Column(name = "accountid")
  private String accountid = "0";

  @Column(name = "uuid")
  private String uuid = "0";

  @Column(name = "isAccountActive")
  private String isAccountActive = "D";

  @Column(name = "signupstep")
  private String iscomplited = "N";

  @Column(name = "reg_user")
  private String reguser = null;

  @Column(name = "user_accountid")
  private String useraccountid;

  @Column(name = "companysize")
  private String companysize;

  @Column(name = "jobfunctionalArea")
  private String jobfunctionalArea;

  @Column(name = "jobtitle")
  private String jobtitle;

  @Column(name = "bPhonenumber")
  private String bPhonenumber;

  @Column(name = "demoAccount")
  private String demoAccount = "0";

  @Column(name = "date")
  private String date = DateUtil.getCurrentDateUSFormat();

  public Registation() {}

  public Registation(
      String city,
      boolean confirm_agreement,
      String confirm_key,
      String contactNo,
      String contact_emailid,
      String country,
      String create_datetime,
      String industry,
      String orgname,
      String orgtype,
      String pincode,
      String regaddress,
      String org_Registation_name,
      String bief,
      String accountType,
      String accountid,
      String uuid,
      String isAccountActive,
      String reguser,
      String useraccountid,
      String companysize,
      String jobfunctionalArea,
      String jobtitle,
      String bPhonenumber) {
    this.companysize = companysize;
    this.jobfunctionalArea = jobfunctionalArea;
    this.jobtitle = jobtitle;
    this.bPhonenumber = bPhonenumber;
    this.accountType = accountType;
    this.reguser = reguser;
    this.brief = bief;
    this.org_Registation_name = org_Registation_name;
    this.city = city;
    this.confirm_agreement = confirm_agreement;
    this.confirm_key = confirm_key;
    this.contactNo = contactNo;
    this.contact_emailid = contact_emailid;
    this.country = country;
    this.create_datetime = create_datetime;
    this.industry = industry;
    this.orgname = orgname;
    this.orgtype = orgtype;
    this.pincode = pincode;
    this.regaddress = regaddress;
    this.accountid = accountid;
    this.uuid = uuid;
    this.isAccountActive = isAccountActive;
    this.useraccountid = useraccountid;
  }

  public String getCompanysize() {
    return companysize;
  }

  public void setCompanysize(String companysize) {
    this.companysize = companysize;
  }

  public String getJobfunctionalArea() {
    return jobfunctionalArea;
  }

  public void setJobfunctionalArea(String jobfunctionalArea) {
    this.jobfunctionalArea = jobfunctionalArea;
  }

  public String getJobtitle() {
    return jobtitle;
  }

  public void setJobtitle(String jobtitle) {
    this.jobtitle = jobtitle;
  }

  public String getBPhonenumber() {
    return bPhonenumber;
  }

  public void setBPhonenumber(String phonenumber) {
    bPhonenumber = phonenumber;
  }

  public String getUseraccountid() {
    return useraccountid;
  }

  public void setUseraccountid(String useraccountid) {
    this.useraccountid = useraccountid;
  }

  public String getReguser() {
    return reguser;
  }

  public void setReguser(String reguser) {
    this.reguser = reguser;
  }

  public String getIscomplited() {
    return iscomplited;
  }

  public void setIscomplited(String iscomplited) {
    this.iscomplited = iscomplited;
  }

  public int getId() {
    return id;
  }

  public void setId(int id) {
    this.id = id;
  }

  public String getAccountid() {

    return accountid;
  }

  public void setAccountid(String accountid) {
    this.accountid = accountid;
  }

  public String getUuid() {
    return uuid;
  }

  public void setUuid(String uuid) {
    this.uuid = uuid;
  }

  public String getIsAccountActive() {
    return isAccountActive;
  }

  public void setIsAccountActive(String isAccountActive) {
    this.isAccountActive = isAccountActive;
  }

  public String getPincode() {
    return pincode;
  }

  public void setPincode(String pincode) {
    this.pincode = pincode;
  }

  public String getContactNo() {
    return contactNo;
  }

  public void setContactNo(String contactNo) {
    this.contactNo = contactNo;
  }

  public String getAccountType() {
    return accountType;
  }

  public void setAccountType(String accountType) {
    this.accountType = accountType;
  }

  public String getBrief() {
    return brief;
  }

  public void setBrief(String brief) {
    this.brief = brief;
  }

  public String getOrg_Registation_name() {
    return org_Registation_name;
  }

  public void setOrg_Registation_name(String org_Registation_name) {
    this.org_Registation_name = org_Registation_name;
  }

  public String getOrgname() {
    return orgname;
  }

  public void setOrgname(String orgname) {
    this.orgname = orgname;
  }

  public String getOrgtype() {
    return orgtype;
  }

  public void setOrgtype(String orgtype) {
    this.orgtype = orgtype;
  }

  public String getIndustry() {
    return industry;
  }

  public void setIndustry(String industry) {
    this.industry = industry;
  }

  public String getRegaddress() {
    return regaddress;
  }

  public void setRegaddress(String regaddress) {
    this.regaddress = regaddress;
  }

  public String getCity() {
    return city;
  }

  public void setCity(String city) {
    this.city = city;
  }

  public String getContact_emailid() {
    return contact_emailid;
  }

  public void setContact_emailid(String contact_emailid) {
    this.contact_emailid = contact_emailid;
  }

  public String getCountry() {
    return country;
  }

  public void setCountry(String country) {
    this.country = country;
  }

  public String getConfirm_key() {
    return confirm_key;
  }

  public void setConfirm_key(String confirm_key) {
    this.confirm_key = confirm_key;
  }

  public boolean isConfirm_agreement() {
    return confirm_agreement;
  }

  public void setConfirm_agreement(boolean confirm_agreement) {
    this.confirm_agreement = confirm_agreement;
  }

  public String getCreate_datetime() {
    return create_datetime;
  }

  public void setCreate_datetime(String create_datetime) {
    this.create_datetime = create_datetime;
  }

  public String getUpdate_datetime() {
    return update_datetime;
  }

  public void setUpdate_datetime(String update_datetime) {
    this.update_datetime = update_datetime;
  }

  public String getDemoAccount() {
    return demoAccount;
  }

  public void setDemoAccount(String demoAccount) {
    this.demoAccount = demoAccount;
  }

  public String getDate() {
    return date;
  }

  public void setDate(String date) {
    this.date = date;
  }
}
  public String viewCustomerResInGrid() {
    boolean valid = ValidateSession.checkSession();
    if (valid) {
      try {

        CommonOperInterface cbt = new CommonConFactory().createInterface();
        {
          custDataList = new ArrayList<CustomerPojo>();
          Map session = ActionContext.getContext().getSession();
          SessionFactory connectionSpace = (SessionFactory) session.get("connectionSpace");

          StringBuilder queryNew2 = new StringBuilder("");
          if (getMode() != null) {
            // System.out.println(">>>>>>>>>>>>Online"+getMode());
            queryNew2.append(
                "select feedbt.id as feedback_ticketId,feedbt.feedTicketNo,feedData.openDate,feedData.openTime,"
                    + " feedbck.escalation_date,feedbck.escalation_time,feedbck.level,feedData.clientId,feedData.clientName,feedData.mobNo,"
                    + " feedData.emailId,feedData.refNo,feedData.centerCode,feedData.centreName, feedData.id,feedData.problem,"
                    + " feedData.compType,feedData.handledBy,feedData.remarks,"
                    + " feedData.kword,feedData.ip from feedback_ticket as feedbt"
                    + " inner join feedback_status as feedbck on feedbt.feed_stat_id=feedbck.id "
                    + " inner join feedbackdata as feedData on feedbt.feed_data_id=feedData.id where (feedData.targetOn='No' || feedData.targetOn='Yes') && feedData.mode='"
                    + getMode()
                    + "'");

            queryNew2.append(" order by feedData.openDate DESC");
          }
          //   System.out.println("Querry is as >>>>>>>>>>>>>>>>"+queryNew2);
          List ticketDataList = cbt.executeAllSelectQuery(queryNew2.toString(), connectionSpace);
          // System.out.println("size of the list ticketDataList>>>>>>"+ticketDataList.size());
          List<CustomerPojo> tempList = new ArrayList<CustomerPojo>();
          int i = 1;
          if (ticketDataList != null && ticketDataList.size() > 0) {
            for (Iterator iterator = ticketDataList.iterator(); iterator.hasNext(); ) {
              CustomerPojo feed = new CustomerPojo();
              Object[] type = (Object[]) iterator.next();

              if (type[14] != null) {
                feed.setId(Integer.parseInt(type[14].toString()));
              }

              if (type[0] != null) {
                feed.setFeedTicketId(Integer.parseInt(type[0].toString()));
              }
              if (type[1] != null) {
                feed.setTicketNo(type[1].toString());
              }
              if (type[2] != null) {
                feed.setOpenDate(DateUtil.convertDateToIndianFormat(type[2].toString()));
              }

              if (type[3] != null) {
                feed.setOpenTime(type[3].toString());
              }

              if (type[4] != null) {
                feed.setEscalationDate(DateUtil.convertDateToIndianFormat(type[4].toString()));
              }

              if (type[5] != null) {
                feed.setEscalationTime(type[5].toString());
              }

              if (type[6] != null) {
                feed.setLevel(type[6].toString());
              }

              if (type[7] != null) {
                feed.setClientId(type[7].toString());
              }

              if (type[8] != null) {
                feed.setClientName(type[8].toString());
              }

              if (type[9] != null) {
                feed.setMobNo(type[9].toString());
              }

              if (type[10] != null) {
                feed.setEmailId(type[10].toString());
              }

              if (type[11] != null) {
                feed.setRefNo(type[12].toString());
              }

              if (type[12] != null) {
                feed.setCentreCode(type[12].toString());
              }

              if (type[13] != null) {
                feed.setCentreName(type[13].toString());
              }

              if (type[15] != null) {
                feed.setProblem(type[15].toString());
              }

              if (type[16] != null) {
                feed.setComplaintType(type[16].toString());
              }

              if (type[17] != null) {
                feed.setHandledBy(type[17].toString());
              }

              if (type[18] != null) {
                feed.setRemarks(type[18].toString());
              }

              if (type[19] != null) {
                feed.setKeyWord(type[19].toString());
              }

              if (type[20] != null) {
                feed.setIp(type[20].toString());
              }

              tempList.add(feed);
            }
            setCustDataList(tempList);
          }
        }
        return SUCCESS;
      } catch (Exception e) {
        e.printStackTrace();
        log.error(
            "Problem in method viewCustomerResInGrid of class "
                + getClass()
                + " on "
                + DateUtil.getCurrentDateIndianFormat()
                + " at "
                + DateUtil.getCurrentTimeHourMin(),
            e);
        return ERROR;
      }
    } else {
      return LOGIN;
    }
  }
  @SuppressWarnings("unchecked")
  public String createPdf(List data, String[] headerTitles, String titleKey, String filePath) {
    int col = 0;
    String fileName = null;
    PdfPCell cell = null;
    try {

      if (headerTitles != null && headerTitles.length > 0) col = headerTitles.length;

      List<ConfigurationUtilBean> titleMap = new CustomerCommonPropertyMap().getTitles(titleKey);
      Document document = new Document(PageSize.A4, 20, 20, 50, 50);
      fileName =
          filePath
              + File.separator
              + "Customer Report"
              + DateUtil.getCurrentDateIndianFormat()
              + (DateUtil.getCurrentTime()).replaceAll(":", "-")
              + ".pdf";
      PdfWriter.getInstance(document, new FileOutputStream(fileName));
      document.open();
      PdfPTable table = new PdfPTable(col);
      table.setWidthPercentage(100f);
      float[] widths = new float[col];
      for (int wx = 0; wx < col; wx++) widths[wx] = 100f / col;
      table.setWidths(widths);
      table.setHeaderRows(2);

      if (headerTitles != null) {
        for (ConfigurationUtilBean title : titleMap) {
          for (int i = 0; i < headerTitles.length; i++) {

            if (title.getKey().equalsIgnoreCase(headerTitles[i].trim())) {

              cell = new PdfPCell(new Paragraph(title.getValue()));
              cell.setBackgroundColor(new BaseColor(204, 204, 204));
              cell.setBorderColor(new BaseColor(170, 170, 170));
              cell.setHorizontalAlignment(Element.ALIGN_CENTER);
              cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
              table.addCell(cell);
            }
          }
        }
      }
      int altr = 1;
      String cellValue = "NA";
      try {
        if (data != null && data.size() > 0) {
          for (Iterator it = data.iterator(); it.hasNext(); ) {
            Object[] obdata = (Object[]) it.next();
            for (int cellIndex = 0; cellIndex < headerTitles.length; cellIndex++) {
              if (obdata[cellIndex] != null && !obdata[cellIndex].toString().equalsIgnoreCase("")) {
                cell = new PdfPCell(new Paragraph(obdata[cellIndex].toString()));
              } else {
                cell = new PdfPCell(new Paragraph(cellValue));
              }

              if (altr % 2 == 0) {
                cell.setBackgroundColor(new BaseColor(240, 240, 240));
                cell.setBorderColor(new BaseColor(170, 170, 170));

              } else {
                cell.setBackgroundColor(new BaseColor(255, 255, 255));
                cell.setBorderColor(new BaseColor(170, 170, 170));
              }
              cell.setHorizontalAlignment(Element.ALIGN_CENTER);
              cell.setVerticalAlignment(Element.ALIGN_MIDDLE);

              table.addCell(cell);
            }
            altr++;
          }
        }
      } catch (Exception e) {
        e.printStackTrace();
        // TODO: handle exception
      }
      document.add(table);
      document.close();

    } catch (Exception e) {
      e.printStackTrace();
      // TODO: handle exception
    }

    return fileName;
  }
@SuppressWarnings("serial")
public class AssetComplaintDashAction extends ActionSupport {

  public Map session = ActionContext.getContext().getSession();

  SessionFactory connectionSpace = (SessionFactory) session.get("connectionSpace");
  public static final String DES_ENCRYPTION_KEY = "ankitsin";

  String dept = "", dept_id = "", empName = "", loginType;
  List<FeedbackPojo> ticketsList = null;
  List<DashboardPojo> dept_counterList = null;
  List<DashboardPojo> dept_subdeptcounterList = null;
  DashboardPojo dashObj;
  Map<String, Integer> graphCatgMap = null;

  private String fromDate = DateUtil.getNextDateFromDate(DateUtil.getCurrentDateIndianFormat(), -5);
  private String toDate = DateUtil.getCurrentDateUSFormat();

  List<FeedbackPojo> catgCountList = null;

  public Integer rows = 0;
  // Get the requested page. By default grid sets this to 1.
  public Integer page = 0;
  // sorting order - asc or desc
  public String sord = "";
  // get index row - i.e. user click to sort.
  public String sidx = "";
  // Search Field
  public String searchField = "";
  // The Search String
  public String searchString = "";
  // The Search Operation
  // ['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc']
  public String searchOper = "";
  // Your Total Pages
  public Integer total = 0;
  // All Record
  public Integer records = 0;
  private boolean loadonce = true;
  // Grid colomn view
  public String oper;
  public String id;
  List<AssetDashboardBean> allAssetReminderList = null;
  List<AssetDashboardBean> allPendingPreventiveSupportList = null;

  // First method for Asset Complaint Dashboard
  public String beforeDashboardAction() {
    String returnResult = ERROR;
    boolean sessionFlag = ValidateSession.checkSession();
    if (sessionFlag) {
      try {
        String userName = (String) session.get("uName");
        ComplianceUniversalAction CUA = new ComplianceUniversalAction();
        AssetUniversalHelper AUH = new AssetUniversalHelper();
        String logedDeptId = null;
        logedDeptId = CUA.getEmpDataByUserName(userName)[3];
        String userEmpID = null;
        String empIdofuser = (String) session.get("empIdofuser");
        if (empIdofuser == null || empIdofuser.split("-")[1].trim().equals("")) return ERROR;
        userEmpID = empIdofuser.split("-")[1].trim();
        String userContID = null;
        userContID = CUA.getEmpDetailsByUserName("ASTM", userName)[0];

        if (logedDeptId != null) {
          allAssetReminderList = new ArrayList<AssetDashboardBean>();
          allAssetReminderList =
              AUH.getAllReminderOfAsset(logedDeptId, userEmpID, userContID, connectionSpace);
        }
        if (logedDeptId != null) {
          allPendingPreventiveSupportList = new ArrayList<AssetDashboardBean>();
          allPendingPreventiveSupportList =
              AUH.getPendingPreventiveSupportData(userEmpID, connectionSpace);
        }
        // ********************************************//
        // Scrolling Data(First Block)
        // getTicketDetail(loginType,dept_id,empName, connectionSpace);
        // ********************************************//

        // *******************************************/
        // Ticket Counters on the basis of status(Second Block)
        // getCounterData();
        // ********************************************//

        // ********************************************//
        // Level wise Ticket Detail in Table (Fifth Block)
        // getTicketDetailByLevel("T");

        // Level wise Ticket Detail in Graph (Fifth Block)
        // getTicketDetailByLevel("G");
        // ********************************************//

        // ********************************************//
        // Analytics for category in table (Third Block)
        // getAnalytics4SubCategory("T");

        // Analytics for category in graph (Third Block)
        // getAnalytics4SubCategory("G");
        // ********************************************//

        // getDataInBars(connectionSpace);
        return SUCCESS;
      } catch (Exception e) {
        addActionError(
            "Ooops There Is Some Problem In beforeDashboardAction in AssetComplaintDashAction !!!");
        e.printStackTrace();
        return ERROR;
      }
    } else {
      return LOGIN;
    }
  }

  public void generalMethod() {
    try {
      String userName = (String) session.get("uName");
      List empData =
          new HelpdeskUniversalAction()
              .getEmpDataByUserName(Cryptography.encrypt(userName, DES_ENCRYPTION_KEY), "2");
      if (empData != null && empData.size() > 0) {
        for (Iterator iterator = empData.iterator(); iterator.hasNext(); ) {
          Object[] object = (Object[]) iterator.next();
          empName = object[0].toString();
          dept_id = object[3].toString();
          dept = object[4].toString();
          loginType = object[7].toString();

          /*	if(loginType.equalsIgnoreCase("H"))
          {
          	hodFlag=true;
          	headerValue=dept;
          }
          else if (loginType.equalsIgnoreCase("M")) {
          	mgmtFlag=true;
          	headerValue="All Department";
          }
          else if (loginType.equalsIgnoreCase("N")) {
          	headerValue=DateUtil.makeTitle(empName);
          	normalFlag=true;
          }*/
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  @SuppressWarnings("unchecked")
  public void getTicketDetail(
      String status_for, String deptid, String empName, SessionFactory connectionSpace) {
    try {
      //	System.out.println("ddddddd  "+deptid);
      List ticketData =
          new AssetDashboardHelper().getLodgedTickets(deptid, status_for, empName, connectionSpace);
      ticketsList = new ArrayList<FeedbackPojo>();
      System.out.println(">>>>>>> " + ticketData.size());
      if (ticketData != null && ticketData.size() > 0) {
        for (Iterator iterator = ticketData.iterator(); iterator.hasNext(); ) {
          Object[] object = (Object[]) iterator.next();
          FeedbackPojo fp = new FeedbackPojo();
          fp.setId(Integer.parseInt(object[0].toString()));
          fp.setTicket_no(object[1].toString());
          fp.setFeed_by(DateUtil.makeTitle(object[2].toString()));
          fp.setOpen_date(DateUtil.convertDateToIndianFormat(object[3].toString()));
          fp.setOpen_time(object[4].toString().substring(0, 5));
          fp.setStatus(object[5].toString());
          ticketsList.add(fp);
        }
      }
      System.out.println(" >>>>>> " + ticketsList.size());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  // Ticket Counters on the basis of status At HOD Level
  @SuppressWarnings("unchecked")
  public void getCounterData() {
    dashObj = new DashboardPojo();
    // subdeptdashList=new ArrayList<DashboardPojo>();
    DashboardPojo DP = null;
    try {
      this.generalMethod();
      // dept_subdeptcounterList  = new ArrayList<DashboardPojo>();
      // String uid = new HelpdeskUniversalAction().getData("useraccount", "id", "userID",
      // Cryptography.encrypt(userName,DES_ENCRYPTION_KEY));
      List dept_subdeptNameList = new AssetDashboardHelper().getDeptList(connectionSpace);
      if (dept_subdeptNameList != null && dept_subdeptNameList.size() > 0) {
        for (Iterator iterator = dept_subdeptNameList.iterator(); iterator.hasNext(); ) {
          Object[] object1 = (Object[]) iterator.next();
          DP = new DashboardPojo();
          DP.setId(object1[0].toString());
          DP.setDeptName(object1[1].toString());
          // List for counters for Pending/ Snooze/ High Priority/ Ignore Status
          List dept_subdeptCounterList = new ArrayList();
          dept_subdeptCounterList =
              new AssetDashboardHelper()
                  .getDashboardCounter("All", empName, object1[0].toString(), connectionSpace);

          if (dept_subdeptCounterList != null && dept_subdeptCounterList.size() > 0) {
            for (Iterator iterator2 = dept_subdeptCounterList.iterator(); iterator2.hasNext(); ) {
              Object[] object2 = (Object[]) iterator2.next();
              if (object2[0].toString().equals("High Priority")) {
                DP.setHpc(object2[1].toString());
              } else if (object2[0].toString().equals("Ignore")) {
                DP.setIgc(object2[1].toString());
              } else if (object2[0].toString().equals("Pending")) {
                DP.setPc(object2[1].toString());
              } else if (object2[0].toString().equals("Snooze")) {
                DP.setSc(object2[1].toString());
              }
            }
          }
          // List for counters for Resolved Status
          List dept_subdeptRSCounterList = new ArrayList();
          dept_subdeptRSCounterList =
              new AssetDashboardHelper()
                  .getDashboardCounter("Resolved", empName, object1[0].toString(), connectionSpace);

          if (dept_subdeptRSCounterList != null && dept_subdeptRSCounterList.size() > 0) {
            for (Iterator iterator3 = dept_subdeptRSCounterList.iterator(); iterator3.hasNext(); ) {
              Object[] object3 = (Object[]) iterator3.next();
              if (object3[0].toString().equals("Resolved")) {
                DP.setRc(object3[1].toString());
              }
            }
          }
          dept_subdeptcounterList.add(DP);
          dashObj.setDashList(dept_subdeptcounterList);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  @SuppressWarnings("unchecked")
  public void getAnalytics4SubCategory(String status_for) {
    try {
      this.generalMethod();
      List catgData =
          new AssetDashboardHelper()
              .getAnalyticalData(
                  "C",
                  fromDate,
                  toDate,
                  dept_id,
                  "-1",
                  "",
                  empName,
                  searchField,
                  searchString,
                  searchOper,
                  connectionSpace);
      if (catgData != null && catgData.size() > 0) {
        if (status_for.equalsIgnoreCase("T")) {
          catgCountList = new ArrayList<FeedbackPojo>();
          for (Iterator iterator = catgData.iterator(); iterator.hasNext(); ) {
            Object[] object = (Object[]) iterator.next();
            if (status_for.equalsIgnoreCase("T")) {
              FeedbackPojo fp = new FeedbackPojo();
              fp.setId(Integer.parseInt(object[0].toString()));
              fp.setFeedback_catg(object[1].toString());
              fp.setCounter(object[2].toString());
              catgCountList.add(fp);
            }
          }
        } else if (status_for.equalsIgnoreCase("G")) {
          System.out.println("Inside G Block");
          graphCatgMap = new LinkedHashMap<String, Integer>();
          for (Iterator iterator = catgData.iterator(); iterator.hasNext(); ) {
            Object[] object = (Object[]) iterator.next();
            graphCatgMap.put(object[1].toString(), Integer.parseInt(object[2].toString()));
          }
          System.out.println(
              "Map Size for graph  is:::::::::::::::::::::::: " + graphCatgMap.size());
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  public List<FeedbackPojo> getCatgCountList() {
    return catgCountList;
  }

  public void setCatgCountList(List<FeedbackPojo> catgCountList) {
    this.catgCountList = catgCountList;
  }

  public List<FeedbackPojo> getTicketsList() {
    return ticketsList;
  }

  public void setTicketsList(List<FeedbackPojo> ticketsList) {
    this.ticketsList = ticketsList;
  }

  public List<DashboardPojo> getDept_counterList() {
    return dept_counterList;
  }

  public void setDept_counterList(List<DashboardPojo> dept_counterList) {
    this.dept_counterList = dept_counterList;
  }

  public Integer getRows() {
    return rows;
  }

  public void setRows(Integer rows) {
    this.rows = rows;
  }

  public Integer getPage() {
    return page;
  }

  public void setPage(Integer page) {
    this.page = page;
  }

  public String getSord() {
    return sord;
  }

  public void setSord(String sord) {
    this.sord = sord;
  }

  public String getSidx() {
    return sidx;
  }

  public void setSidx(String sidx) {
    this.sidx = sidx;
  }

  public String getSearchField() {
    return searchField;
  }

  public void setSearchField(String searchField) {
    this.searchField = searchField;
  }

  public String getSearchString() {
    return searchString;
  }

  public void setSearchString(String searchString) {
    this.searchString = searchString;
  }

  public String getSearchOper() {
    return searchOper;
  }

  public void setSearchOper(String searchOper) {
    this.searchOper = searchOper;
  }

  public Integer getTotal() {
    return total;
  }

  public void setTotal(Integer total) {
    this.total = total;
  }

  public Integer getRecords() {
    return records;
  }

  public void setRecords(Integer records) {
    this.records = records;
  }

  public boolean isLoadonce() {
    return loadonce;
  }

  public void setLoadonce(boolean loadonce) {
    this.loadonce = loadonce;
  }

  public String getOper() {
    return oper;
  }

  public void setOper(String oper) {
    this.oper = oper;
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public Map<String, Integer> getGraphCatgMap() {
    return graphCatgMap;
  }

  public void setGraphCatgMap(Map<String, Integer> graphCatgMap) {
    this.graphCatgMap = graphCatgMap;
  }

  public List<AssetDashboardBean> getAllAssetReminderList() {
    return allAssetReminderList;
  }

  public void setAllAssetReminderList(List<AssetDashboardBean> allAssetReminderList) {
    this.allAssetReminderList = allAssetReminderList;
  }

  public List<AssetDashboardBean> getAllPendingPreventiveSupportList() {
    return allPendingPreventiveSupportList;
  }

  public void setAllPendingPreventiveSupportList(
      List<AssetDashboardBean> allPendingPreventiveSupportList) {
    this.allPendingPreventiveSupportList = allPendingPreventiveSupportList;
  }
}
  // Define A method for Creating Excel File
  public String createExcel(
      String titleString,
      String sheetString,
      String subTitleString,
      List data,
      String[] headerTitles,
      String titleKey,
      String filePath) {

    String file = null;
    Workbook wb;
    int col = 0;
    try {
      // check Header Title
      if (headerTitles != null && headerTitles.length > 0) col = headerTitles.length;

      wb = (Workbook) new HSSFWorkbook();
      // Hear we are getting whole property
      List<ConfigurationUtilBean> titleMap = new CustomerCommonPropertyMap().getTitles(titleKey);
      Map<String, CellStyle> styles = createStyles(wb);
      Sheet sheet = wb.createSheet(sheetString);
      PrintSetup printSetup = sheet.getPrintSetup();
      printSetup.setLandscape(true);
      sheet.setFitToPage(true);
      sheet.setHorizontallyCenter(true);

      Header header = sheet.getHeader();
      header.setCenter("Center Header");
      header.setLeft("Left Header");
      header.setRight("Right Footer");
      Footer footer = sheet.getFooter();
      footer.setCenter("center footer");
      footer.setLeft("left footer");
      footer.setRight("right footer");

      // Title Row....
      Row titleRow = sheet.createRow(0);
      titleRow.setHeightInPoints(20);
      Cell titleCell = titleRow.createCell(0);
      titleCell.setCellValue(titleString);
      titleCell.setCellStyle(styles.get("title"));
      sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, col - 1));

      // Sub Title Row.....
      // System.out.println("Sub Title String >>>>>>"+subTitleString);
      Row headerRow = null;
      if (subTitleString != "") {
        Row subTitleRow = sheet.createRow(1);
        subTitleRow.setHeightInPoints(18);
        Cell subTitleCell = subTitleRow.createCell(0);
        subTitleCell.setCellValue(subTitleString);
        subTitleCell.setCellStyle(styles.get("subTitle"));
        sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, col - 1));
        headerRow = sheet.createRow(2);
        headerRow.setHeightInPoints(15);
        //
      } else {
        headerRow = sheet.createRow(1);
        headerRow.setHeightInPoints(15);
      }
      Cell headerCell = null;
      if (headerTitles != null) {
        for (ConfigurationUtilBean cell : titleMap) {
          int titleIndex = 0;
          for (int i = 0; i < headerTitles.length; i++) {
            if (cell.getKey().equalsIgnoreCase(headerTitles[titleIndex].trim())) {
              headerCell = headerRow.createCell(titleIndex);
              headerCell.setCellValue(cell.getValue());
              headerCell.setCellStyle(styles.get("header"));
            }
            titleIndex++;
          }
        }
      }
      Row dataRow = null;
      Cell dataCell = null;

      int rowIndex = 2;
      /* List Iteration text */
      try {
        if (data != null && data.size() > 0) {
          for (Iterator it = data.iterator(); it.hasNext(); ) {
            Object[] obdata = (Object[]) it.next();
            dataRow = sheet.createRow(rowIndex);
            for (int cellIndex = 0; cellIndex < headerTitles.length; cellIndex++) {
              dataCell = dataRow.createCell(cellIndex);

              if (obdata[cellIndex] != null && !obdata[cellIndex].toString().equalsIgnoreCase("")) {

                dataCell.setCellValue(obdata[cellIndex].toString());
              } else {
                dataCell.setCellValue("NA");
              }
            }

            rowIndex++;
          }
        }
      } catch (Exception e) {
        // TODO: handle exception
      }

      for (int titleIndex = 0; titleIndex < headerTitles.length; titleIndex++)
        sheet.autoSizeColumn(titleIndex); // adjust width of the column

      file =
          filePath
              + File.separator
              + "OpportunityReportDetail_"
              + DateUtil.getCurrentDateIndianFormat()
              + (DateUtil.getCurrentTimeHourMin()).replaceAll(":", "-")
              + ".xls";

      if (wb instanceof XSSFWorkbook) file += "x";
      FileOutputStream out = new FileOutputStream(file);
      wb.write(out);
      out.close();

    } catch (Exception e) {
      e.printStackTrace();
    } finally {

    }
    return file;
  }
Esempio n. 20
0
  @SuppressWarnings({"rawtypes", "unchecked"})
  public String viewDARReportData() {
    if (ValidateSession.checkSession()) {
      try {
        SessionFactory connectionSpace = (SessionFactory) session.get("connectionSpace");
        CommonOperInterface cbt = new CommonConFactory().createInterface();
        String accountID = (String) session.get("accountid");
        String userName = (String) session.get("uName");
        DARReportHelper DRH = new DARReportHelper();
        TaskRegistrationHelper TRH = new TaskRegistrationHelper();
        StringBuilder query = new StringBuilder("");
        query.append("select count(*) from task_registration");
        List dataCount = cbt.executeAllSelectQuery(query.toString(), connectionSpace);
        if (dataCount != null) {
          BigInteger count = new BigInteger("3");
          Object obdata = null;
          for (Iterator it = dataCount.iterator(); it.hasNext(); ) {
            obdata = (Object) it.next();
            count = (BigInteger) obdata;
          }
          setRecords(count.intValue());
          int to = (getRows() * getPage());
          if (to > getRecords()) to = getRecords();
          String userEmpID = null;
          String alltedTo = null;
          String empIdofuser = (String) session.get("empIdofuser");
          if (empIdofuser == null || empIdofuser.split("-")[1].trim().equals("")) return ERROR;
          userEmpID = empIdofuser.split("-")[1].trim();
          String userContID = null;
          userContID = TRH.getEmpDetailsByUserName("DAR", userName, connectionSpace)[0];
          alltedTo = TRH.getContactListForReports(userEmpID, userContID, connectionSpace);

          // System.out.println(">>>>>> FINAL CONTACT LIST IS AS ::::  "+alltedTo);
          query.setLength(0);
          query.append("SELECT  ");
          List fieldNames =
              Configuration.getColomnList(
                  "mapped_dar_configuration", accountID, connectionSpace, "dar_configuration");
          List<Object> Listhb = new ArrayList<Object>();
          int i = 0;
          for (Iterator it = fieldNames.iterator(); it.hasNext(); ) {
            obdata = (Object) it.next();
            if (obdata != null) {
              if (!obdata.toString().equalsIgnoreCase("userName")
                  && !obdata.toString().equalsIgnoreCase("date")
                  && !obdata.toString().equalsIgnoreCase("time")) {
                if (obdata.toString().equalsIgnoreCase("tasktype")) {
                  query.append("ty.tasktype" + ",");
                } else if (obdata.toString().equalsIgnoreCase("allotedto")) {
                  query.append("emp1.empName as allotedto,");
                } else if (obdata.toString().equalsIgnoreCase("allotedby")) {
                  query.append("emp2.empName as allotedby,");
                } else if (obdata.toString().equalsIgnoreCase("validate_By_2")) {
                  query.append("emp3.empName as val2,");
                } else if (obdata.toString().equalsIgnoreCase("validate_By_1")) {
                  query.append("emp4.empName as val1,");
                } else if (obdata.toString().equalsIgnoreCase("guidance")) {
                  query.append("emp5.empName as guidance,");
                } else {
                  query.append("tr." + obdata.toString() + ",");
                }
              }
            }
            i++;
          }
          fieldNames.remove("userName");
          fieldNames.remove("date");
          fieldNames.remove("time");

          i = 0;
          List gridFields = new ArrayList();
          List fieldNames1 =
              Configuration.getColomnList(
                  "mapped_dar_configuration",
                  accountID,
                  connectionSpace,
                  "dar_submission_configuration");
          for (Iterator it = fieldNames1.iterator(); it.hasNext(); ) {
            obdata = (Object) it.next();
            if (obdata != null) {
              if (!obdata.toString().equalsIgnoreCase("taskname")
                  && !obdata.toString().equalsIgnoreCase("id")
                  && !obdata.toString().equalsIgnoreCase("userName")) {
                gridFields.add(obdata.toString());
                if (i < fieldNames1.size() - 1) query.append("ds." + obdata.toString() + ",");
                else query.append("ds." + obdata.toString());
              }
            }
            i++;
          }
          query.append(" FROM task_registration AS tr ");
          query.append(" LEFT JOIN dar_submission AS ds ON ds.taskname=tr.id ");
          query.append("LEFT JOIN compliance_contacts AS cc1 ON tr.allotedto=cc1.id ");
          query.append("LEFT JOIN compliance_contacts AS cc2 ON tr.allotedby=cc2.id ");
          query.append("LEFT JOIN compliance_contacts AS cc3 ON tr.validate_By_2=cc3.id ");
          query.append("LEFT JOIN compliance_contacts AS cc4 ON tr.validate_By_1=cc4.id ");
          query.append("LEFT JOIN compliance_contacts AS cc5 ON tr.guidance=cc5.id  ");
          query.append("LEFT JOIN employee_basic emp1 ON cc1.emp_id= emp1.id  ");
          query.append("LEFT JOIN employee_basic emp2 ON cc2.emp_id= emp2.id  ");
          query.append("LEFT JOIN employee_basic emp3 ON cc3.emp_id= emp3.id ");
          query.append("LEFT JOIN employee_basic emp4 ON cc4.emp_id= emp4.id ");
          query.append("LEFT JOIN employee_basic emp5 ON cc5.emp_id= emp5.id ");
          query.append("LEFT JOIN task_type ty ON tr.tasktype= ty.id   ");
          if (fdate.split("-")[0].length() < 3) {
            fdate = DateUtil.convertDateToUSFormat(fdate);
            tdate = DateUtil.convertDateToUSFormat(tdate);
          }
          query.append(" WHERE  ds.date BETWEEN '" + fdate + "' AND '" + tdate + "'  ");
          if (allotTo != null && !allotTo.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.allotedTo='" + allotTo + "' ");
          }
          if (clientFor != null && !clientFor.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.clientfor='" + clientFor + "' ");
          }
          if (taskTyp != null && !taskTyp.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.tasktype='" + taskTyp + "' ");
          }
          if (taskPriority != null && !taskPriority.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.priority='" + taskPriority + "' ");
          }
          if (statusWork != null && !statusWork.equalsIgnoreCase("-1")) {
            query.append(" AND  tr.status='" + statusWork + "' ");
          }
          if (alltedTo != null && alltedTo.length() > 0) {
            query.append(" AND  tr.allotedTo IN (" + alltedTo + ") ");
          }
          if (getSearchField() != null
              && getSearchString() != null
              && !getSearchField().equalsIgnoreCase("")
              && !getSearchString().equalsIgnoreCase("")) {
            query.append(" and ");
            if (getSearchOper().equalsIgnoreCase("eq")) {
              query.append(" " + getSearchField() + " = '" + getSearchString() + "'");
            } else if (getSearchOper().equalsIgnoreCase("cn")) {
              query.append(" " + getSearchField() + " like '%" + getSearchString() + "%'");
            } else if (getSearchOper().equalsIgnoreCase("bw")) {
              query.append(" " + getSearchField() + " like '" + getSearchString() + "%'");
            } else if (getSearchOper().equalsIgnoreCase("ne")) {
              query.append(" " + getSearchField() + " <> '" + getSearchString() + "'");
            } else if (getSearchOper().equalsIgnoreCase("ew")) {
              query.append(" " + getSearchField() + " like '%" + getSearchString() + "'");
            }
          }
          System.out.println("QUERY OF REPORT IS AS ::::  " + query.toString());
          List data = cbt.executeAllSelectQuery(query.toString(), connectionSpace);
          for (int k = 0; k < gridFields.size(); k++) {
            fieldNames.add(gridFields.get(k).toString());
          }
          if (data != null && data.size() > 0) {

            String clientData = null;
            String clientVal = null;
            Object[] obdata11 = null;
            for (Iterator it = data.iterator(); it.hasNext(); ) {
              obdata11 = (Object[]) it.next();
              Map<String, Object> one = new HashMap<String, Object>();
              for (int k = 0; k < fieldNames.size(); k++) {
                if (fieldNames.get(k) != null
                    && obdata11[k] != null
                    && !obdata11[k].toString().equalsIgnoreCase("")) {
                  if (obdata11[k].toString().matches("\\d{4}-[01]\\d-[0-3]\\d")) {
                    one.put(
                        fieldNames.get(k).toString(),
                        DateUtil.convertDateToIndianFormat(obdata11[k].toString()));
                  }
                  /*else if(fieldNames.get(k).toString().equalsIgnoreCase("attachment")||  fieldNames.get(k).toString().equalsIgnoreCase("attachmentt")||fieldNames.get(k).toString().equalsIgnoreCase("reviewDoc")  )
                  {
                  	String str=obdata11[k].toString().substring(obdata11[k].toString().indexOf("//"), obdata11[k].toString().length());
                  	String docName=str.substring(14,str.length());
                  	one.put(fieldNames.get(k).toString(),docName);
                  }*/
                  else if (fieldNames.get(k).toString().equalsIgnoreCase("clientfor")) {
                    clientVal = obdata11[k].toString();
                    if (obdata11[k].toString().equalsIgnoreCase("PA")) {
                      one.put(fieldNames.get(k).toString(), "Prospect Associate");
                    } else if (obdata11[k].toString().equalsIgnoreCase("PC")) {
                      one.put(fieldNames.get(k).toString(), "Prospect Client");
                    } else if (obdata11[k].toString().equalsIgnoreCase("N")) {
                      one.put(fieldNames.get(k).toString(), "Other");
                    } else if (obdata11[k].toString().equalsIgnoreCase("EC")) {
                      one.put(fieldNames.get(k).toString(), "Existing Client");
                    } else if (obdata11[k].toString().equalsIgnoreCase("EA")) {
                      one.put(fieldNames.get(k).toString(), "Existing Associate");
                    } else if (obdata11[k].toString().equalsIgnoreCase("IN")) {
                      one.put(fieldNames.get(k).toString(), "Internal");
                    }
                  } else if (fieldNames.get(k).toString().equalsIgnoreCase("cName")) {
                    clientData = obdata11[k].toString();
                    one.put(
                        fieldNames.get(k).toString(),
                        DRH.clientName(clientVal, obdata11[k].toString(), connectionSpace));
                  } else if (fieldNames.get(k).toString().equalsIgnoreCase("offering")) {
                    one.put(
                        fieldNames.get(k).toString(),
                        DRH.offeringName(
                            clientVal, clientData, obdata11[k].toString(), connectionSpace));
                  } else {
                    one.put(fieldNames.get(k).toString(), obdata11[k].toString());
                  }
                } else {
                  one.put(fieldNames.get(k).toString(), "NA");
                }
              }
              Listhb.add(one);
            }
            setViewList(Listhb);
            setTotal((int) Math.ceil((double) getRecords() / (double) getRows()));
          }
        }
        return SUCCESS;
      } catch (Exception exp) {
        exp.printStackTrace();
        return ERROR;
      }
    } else {
      return ERROR;
    }
  }
  public boolean addMail(
      String name,
      String dept,
      String emailid,
      String subject,
      String mailtext,
      String ticketno,
      String status,
      String statusflag,
      String attachment,
      String module) {
    boolean flag = false;
    @SuppressWarnings("unused")
    String returnResult = ERROR;
    boolean sessionFlag = ValidateSession.checkSession();
    if (sessionFlag) {
      try {
        Map session = ActionContext.getContext().getSession();
        String userName = (String) session.get("uName");
        SessionFactory connectionSpace = (SessionFactory) session.get("connectionSpace");
        CommonOperInterface cot = new CommonConFactory().createInterface();
        List<TableColumes> tablecolumn = new ArrayList<TableColumes>();

        TableColumes tc = new TableColumes();

        tc.setColumnname("name");
        tc.setDatatype("varchar(80)");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        tc = new TableColumes();
        tc.setColumnname("sub_type_id");
        tc.setDatatype("varchar(80)");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        tc = new TableColumes();
        tc.setColumnname("email_id");
        tc.setDatatype("varchar(100)");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        tc = new TableColumes();
        tc.setColumnname("subject");
        tc.setDatatype("varchar(100)");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        tc = new TableColumes();
        tc.setColumnname("mail_text");
        tc.setDatatype("text");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        tc = new TableColumes();
        tc.setColumnname("flag");
        tc.setDatatype("varchar(10)");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        tc = new TableColumes();
        tc.setColumnname("status");
        tc.setDatatype("varchar(50)");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        tc = new TableColumes();
        tc.setColumnname("attachment");
        tc.setDatatype("varchar(300)");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        tc = new TableColumes();
        tc.setColumnname("module");
        tc.setDatatype("varchar(300)");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        tc = new TableColumes();
        tc.setColumnname("userName");
        tc.setDatatype("varchar(25)");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        tc = new TableColumes();
        tc.setColumnname("date");
        tc.setDatatype("varchar(10)");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        tc = new TableColumes();
        tc.setColumnname("time");
        tc.setDatatype("varchar(10)");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        tc = new TableColumes();
        tc.setColumnname("update_date");
        tc.setDatatype("varchar(10)");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        tc = new TableColumes();
        tc.setColumnname("update_time");
        tc.setDatatype("varchar(10)");
        tc.setConstraint("default NULL");
        tablecolumn.add(tc);

        @SuppressWarnings("unused")
        boolean aa = cot.createTable22("instant_mail", tablecolumn, connectionSpace);

        InsertDataTable ob = new InsertDataTable();
        List<InsertDataTable> insertData = new ArrayList<InsertDataTable>();
        ob.setColName("name");
        ob.setDataName(name);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("sub_type_id");
        ob.setDataName(dept);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("email_id");
        ob.setDataName(emailid);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("subject");
        ob.setDataName(subject);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("mail_text");
        ob.setDataName(mailtext);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("flag");
        ob.setDataName(statusflag);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("status");
        ob.setDataName(status);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("attachment");
        ob.setDataName(attachment);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("module");
        ob.setDataName(module);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("userName");
        ob.setDataName(userName);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("date");
        ob.setDataName(DateUtil.getCurrentDateUSFormat());
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("time");
        ob.setDataName(DateUtil.getCurrentTime());
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("update_date");
        ob.setDataName("0000:00:00");
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("update_time");
        ob.setDataName("00:00:00");
        insertData.add(ob);

        cot.insertIntoTable("instant_mail", insertData, connectionSpace);
        insertData.clear();
        flag = true;
      } catch (Exception e) {
        e.printStackTrace();
      }
    } else {
      returnResult = LOGIN;
    }
    return flag;
  }
Esempio n. 22
0
  @SuppressWarnings("rawtypes")
  public String beforeReportView() {
    if (ValidateSession.checkSession()) {
      try {
        String userName = (String) session.get("uName");
        CommonOperInterface cbt = new CommonConFactory().createInterface();
        SessionFactory connectionSpace = (SessionFactory) session.get("connectionSpace");
        TaskRegistrationHelper TRH = new TaskRegistrationHelper();
        StringBuilder query = new StringBuilder();
        String userEmpID = null;
        String alltedTo = null;
        String empIdofuser = (String) session.get("empIdofuser");
        if (empIdofuser == null || empIdofuser.split("-")[1].trim().equals("")) return ERROR;
        userEmpID = empIdofuser.split("-")[1].trim();
        String userContID = null;
        userContID = TRH.getEmpDetailsByUserName("DAR", userName, connectionSpace)[0];
        alltedTo = TRH.getContactListForReports(userEmpID, userContID, connectionSpace);

        query.append("SELECT DISTINCT (contact.id),emp.empName FROM task_registration AS tr ");
        query.append("INNER JOIN compliance_contacts as contact ON contact.id=tr.allotedto ");
        query.append(
            "INNER JOIN employee_basic as emp ON contact.emp_id=emp.id WHERE contact.id IN ("
                + alltedTo
                + ")");
        List data = cbt.executeAllSelectQuery(query.toString(), connectionSpace);
        allotedTo = new LinkedHashMap<Integer, String>();

        if (data != null && data.size() > 0) {
          for (Iterator iterator = data.iterator(); iterator.hasNext(); ) {
            Object[] object = (Object[]) iterator.next();
            if (object[1] != null) {
              allotedTo.put((Integer) object[0], object[1].toString());
            }
          }
        }
        allotedTo.put(-1, "All Employee");
        query.setLength(0);
        if (data != null && data.size() > 0) {
          data.clear();
        }
        query.append("SELECT id,tasktype FROM task_type");
        taskType = new LinkedHashMap<Integer, String>();
        data = cbt.executeAllSelectQuery(query.toString(), connectionSpace);
        if (data != null && data.size() > 0) {
          for (Iterator iterator = data.iterator(); iterator.hasNext(); ) {
            Object[] object = (Object[]) iterator.next();
            if (object[1] != null) {
              taskType.put((Integer) object[0], object[1].toString());
            }
          }
        }
        fromDate = DateUtil.getNewDate("day", -7, DateUtil.getCurrentDateUSFormat());
        return SUCCESS;
      } catch (Exception e) {
        e.printStackTrace();
        return ERROR;
      }
    } else {
      return ERROR;
    }
  }
  public boolean addMessageHR(
      String name,
      String dept,
      String mobone,
      String msg,
      String ticketno,
      String status,
      String statusflag,
      String module,
      SessionFactory connectionSpace) {
    System.out.println("mobone >>addMessageHR>>" + mobone);
    System.out.println("INSIDE THIS");
    boolean flag = false;
    @SuppressWarnings("unused")
    String returnResult = ERROR;
    // boolean sessionFlag = ValidateSession.checkSession();

    // System.out.println("sessionFlag"+sessionFlag);
    {
      try {
        // Map session = ActionContext.getContext().getSession();
        // String userName = (String)session.get("uName");
        // SessionFactory connectionSpace =(SessionFactory) session.get("connectionSpace");
        CommonOperInterface cot = new CommonConFactory().createInterface();
        TableColumes ob1 = new TableColumes();
        List<TableColumes> TableColumnName = new ArrayList<TableColumes>();

        ob1.setColumnname("name");
        ob1.setDatatype("varchar(80)");
        ob1.setConstraint("default NULL");
        TableColumnName.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("dept");
        ob1.setDatatype("varchar(80)");
        ob1.setConstraint("default NULL");
        TableColumnName.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("mobno");
        ob1.setDatatype("varchar(15)");
        ob1.setConstraint("default NULL");
        TableColumnName.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("msg_text");
        ob1.setDatatype("varchar(250)");
        ob1.setConstraint("default NULL");
        TableColumnName.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("flag");
        ob1.setDatatype("varchar(10)");
        ob1.setConstraint("default NULL");
        TableColumnName.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("status");
        ob1.setDatatype("varchar(100)");
        ob1.setConstraint("default NULL");
        TableColumnName.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("module");
        ob1.setDatatype("varchar(20)");
        ob1.setConstraint("default NULL");
        TableColumnName.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("user");
        ob1.setDatatype("varchar(100)");
        ob1.setConstraint("default NULL");
        TableColumnName.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("date");
        ob1.setDatatype("varchar(10)");
        ob1.setConstraint("default NULL");
        TableColumnName.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("time");
        ob1.setDatatype("varchar(10)");
        ob1.setConstraint("default NULL");
        TableColumnName.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("update_date");
        ob1.setDatatype("varchar(10)");
        ob1.setConstraint("default NULL");
        TableColumnName.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("update_time");
        ob1.setDatatype("varchar(10)");
        ob1.setConstraint("default NULL");
        TableColumnName.add(ob1);

        cot.createTable22("instant_msg", TableColumnName, connectionSpace);

        InsertDataTable ob = new InsertDataTable();
        List<InsertDataTable> insertData = new ArrayList<InsertDataTable>();
        ob.setColName("name");
        ob.setDataName(name);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("dept");
        ob.setDataName(dept);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("mobno");
        ob.setDataName(mobone);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("msg_text");
        ob.setDataName(msg);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("flag");
        ob.setDataName(statusflag);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("status");
        ob.setDataName(status);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("module");
        ob.setDataName(module);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("user");
        ob.setDataName("Shailendra");
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("date");
        ob.setDataName(DateUtil.getCurrentDateUSFormat());
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("time");
        ob.setDataName(DateUtil.getCurrentTime());
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("update_date");
        ob.setDataName("0000-00-00");
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("update_time");
        ob.setDataName("00-00-00");
        insertData.add(ob);

        cot.insertIntoTable("instant_msg", insertData, connectionSpace);
        insertData.clear();
        flag = true;
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    return flag;
  }
  public String addEscalationConfig() {
    boolean sessionFlag = ValidateSession.checkSession();
    if (sessionFlag) {
      try {
        String query = "SELECT esc_type FROM feedback_escalation_type_config";
        List dataList = cbt.executeAllSelectQuery(query, connectionSpace);
        if (dataList != null && dataList.size() > 0) {
          for (Iterator iterator = dataList.iterator(); iterator.hasNext(); ) {
            String type = (String) iterator.next();
            if (type.equalsIgnoreCase(request.getParameter("escType"))) {
              addActionMessage("Opps. Escalation Type is already exist!!!");
              return SUCCESS;
            }
          }
        }
        List<InsertDataTable> insertData = new ArrayList<InsertDataTable>();
        InsertDataTable ob = null;
        List<TableColumes> tableColume = new ArrayList<TableColumes>();
        TableColumes ob1 = new TableColumes();
        ob1.setColumnname("esc_type");
        ob1.setDatatype("varchar(20)");
        ob1.setConstraint("default NULL");
        tableColume.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("user_name");
        ob1.setDatatype("varchar(30)");
        ob1.setConstraint("default NULL");
        tableColume.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("date");
        ob1.setDatatype("varchar(20)");
        ob1.setConstraint("default NULL");
        tableColume.add(ob1);

        cbt.createTable22("feedback_escalation_type_config", tableColume, connectionSpace);

        ob = new InsertDataTable();
        ob.setColName("esc_type");
        ob.setDataName(request.getParameter("openType"));
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("user_name");
        ob.setDataName(userName);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("date");
        ob.setDataName(DateUtil.getCurrentDateUSFormat() + " " + DateUtil.getCurrentTimeHourMin());
        insertData.add(ob);

        boolean status =
            cbt.insertIntoTable("feedback_escalation_type_config", insertData, connectionSpace);
        if (status) {
          addActionMessage("Data saved sucessfully.");
          return SUCCESS;
        } else {
          addActionMessage("Opps. There are some problem in data save!!!");
          return ERROR;
        }
      } catch (Exception e) {
        e.printStackTrace();
        addActionMessage("Opps. There are some problem in data save!!!");
        return ERROR;
      }
    } else {
      return LOGIN;
    }
  }