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 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;
 }
 public String redirectToJSP() {
   String returnResult = ERROR;
   boolean sessionFlag = ValidateSession.checkSession();
   if (sessionFlag) {
     try {
       statusList = new ArrayList<String>();
       statusList.add("Resolved");
       if (feedStatus.equalsIgnoreCase("Pending")) {
         statusList.add("Snooze");
         statusList.add("High Priority");
       } else if (feedStatus.equalsIgnoreCase("Snooze")) {
         statusList.add("High Priority");
       } else if (feedStatus.equalsIgnoreCase("High Priority")) {
         statusList.add("Snooze");
       }
       statusList.add("Ignore");
       // statusList.add("Re-Assign");
       returnResult = SUCCESS;
     } catch (Exception e) {
       e.printStackTrace();
     }
   } else {
     returnResult = LOGIN;
   }
   return returnResult;
 }
 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 getColumn4DarReport() {
   boolean validateSession = ValidateSession.checkSession();
   if (validateSession) {
     setReportViewProp();
     return SUCCESS;
   } else {
     return ERROR;
   }
 }
 public String beforeEscViewConf() {
   System.out.println("EscalationTypeConfig.beforeEscViewConf()");
   boolean sessionFlag = ValidateSession.checkSession();
   if (sessionFlag) {
     System.out.println("indide esc type");
     return SUCCESS;
   } else {
     return LOGIN;
   }
 }
 public String beforeAuditData() {
   boolean sessionFlag = ValidateSession.checkSession();
   if (sessionFlag) {
     try {
       return SUCCESS;
     } catch (Exception e) {
       e.printStackTrace();
       return ERROR;
     }
   } else {
     return LOGIN;
   }
 }
 public String beforeActionForAudit() {
   boolean sessionFlag = ValidateSession.checkSession();
   if (sessionFlag) {
     try {
       System.out.println(clientId + "inside b4 action::::" + id);
       return SUCCESS;
     } catch (Exception e) {
       e.printStackTrace();
       return ERROR;
     }
   } else {
     return LOGIN;
   }
 }
 public String beforeLeadFactorPie() {
   String returnValue = ERROR;
   if (ValidateSession.checkSession()) {
     try {
       getLeadPieFactorChartData();
       returnValue = SUCCESS;
     } catch (Exception e) {
       e.printStackTrace();
     }
   } else {
     returnValue = LOGIN;
   }
   return returnValue;
 }
 @SuppressWarnings("rawtypes")
 public String getResolverData() {
   String returnResult = ERROR;
   boolean sessionFlag = ValidateSession.checkSession();
   if (sessionFlag) {
     try {
       SessionFactory connectionSpace = (SessionFactory) session.get("connectionSpace");
       HelpdeskUniversalAction HUA = new HelpdeskUniversalAction();
       ComplaintLodgeHelper CLH = new ComplaintLodgeHelper();
       String deptFor = "";
       List empdata = new ArrayList<String>();
       List feedbackList =
           HUA.getMultipleColumns(
               "complaint_status",
               "forDept",
               "",
               "allot_to",
               "level",
               "",
               "id",
               feedid,
               "",
               "",
               connectionSpace);
       if (feedbackList != null && feedbackList.size() > 0) {
         for (Iterator iterator = feedbackList.iterator(); iterator.hasNext(); ) {
           Object[] object = (Object[]) iterator.next();
           deptFor = object[0].toString();
         }
         empdata = CLH.getEmp4Escalation(deptFor, "DREAM_HDM", "", connectionSpace);
         jsonArr = new JSONArray();
         JSONObject formDetailsJson = null;
         for (Object c : empdata) {
           Object[] dataC_new = (Object[]) c;
           formDetailsJson = new JSONObject();
           formDetailsJson.put("ID", dataC_new[0].toString());
           formDetailsJson.put("NAME", dataC_new[1].toString());
           jsonArr.add(formDetailsJson);
         }
       }
       returnResult = SUCCESS;
     } catch (Exception e) {
       e.printStackTrace();
     }
   } else {
     returnResult = LOGIN;
   }
   return returnResult;
 }
 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 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;
 }
  public String escTypeViewConf() {
    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 id,esc_type FROM feedback_escalation_type_config");
        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("esc_type", (object[1]));
            }
            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;
    }
  }
 @SuppressWarnings("rawtypes")
 public String getRCAData() {
   boolean sessionFlag = ValidateSession.checkSession();
   if (sessionFlag) {
     try {
       StringBuilder query = new StringBuilder();
       query.append("SELECT rca.id,rca.rcaBrief FROM rca_master AS rca ");
       query.append(" INNER JOIN complaint_status AS cs  ON cs.offering=rca.category ");
       query.append(" INNER JOIN complaint_status AS cs1  ON cs1.forDept=rca.deptName ");
       query.append(" INNER JOIN complaint_status AS cs2  ON cs2.subCategory=rca.subCategory ");
       query.append(
           " WHERE cs.id='"
               + feedid
               + "' AND rca.moduleName='"
               + moduleName
               + "' GROUP BY rca.id  ");
       System.out.println("QUERY IS AS    ::;  " + query.toString());
       List data = new createTable().executeAllSelectQuery(query.toString(), connectionSpace);
       jsonArr = new JSONArray();
       JSONObject formDetailsJson = null;
       if (data != null && data.size() > 0) {
         for (Iterator iterator = data.iterator(); iterator.hasNext(); ) {
           Object[] object = (Object[]) iterator.next();
           if (object[0] != null && object[1] != null) {
             formDetailsJson = new JSONObject();
             formDetailsJson.put("ID", object[0].toString());
             formDetailsJson.put("NAME", object[1].toString());
             jsonArr.add(formDetailsJson);
           }
         }
       }
       return SUCCESS;
     } catch (Exception e) {
       e.printStackTrace();
       return ERROR;
     }
   } else {
     return LOGIN;
   }
 }
 public String editEscalationViewConf() {
   System.out.println(">>>>>edit>>>>>");
   boolean sessionFlag = ValidateSession.checkSession();
   if (sessionFlag) {
     try {
       if (getOper().equalsIgnoreCase("edit")) {
         System.out.println(">>>>>edit>>>>>");
         Map<String, Object> wherClause = new HashMap<String, Object>();
         Map<String, Object> condtnBlock = new HashMap<String, Object>();
         List<String> requestParameterNames =
             Collections.list((Enumeration<String>) request.getParameterNames());
         Collections.sort(requestParameterNames);
         Iterator it = requestParameterNames.iterator();
         while (it.hasNext()) {
           String Parmname = it.next().toString();
           String paramValue = request.getParameter(Parmname);
           if (paramValue != null
               && !paramValue.equalsIgnoreCase("")
               && Parmname != null
               && !Parmname.equalsIgnoreCase("")
               && !Parmname.equalsIgnoreCase("id")
               && !Parmname.equalsIgnoreCase("oper")) wherClause.put(Parmname, paramValue);
         }
         condtnBlock.put("id", getId());
         cbt.updateTableColomn(
             "feedback_escalation_type_config", wherClause, condtnBlock, connectionSpace);
       } else if (getOper().equalsIgnoreCase("del")) {
         cbt.deleteAllRecordForId(
             "feedback_escalation_type_config", "id", getId(), connectionSpace);
       }
       return SUCCESS;
     } catch (Exception e) {
       e.printStackTrace();
       return ERROR;
     }
   } else {
     return LOGIN;
   }
 }
  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;
  }
  @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 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;
    }
  }
  @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;
    }
  }
  @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 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;
    }
  }
  public boolean addMessage(
      String name,
      String dept,
      String mobone,
      String msg,
      String ticketno,
      String status,
      String statusflag,
      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();
        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("sub_type_id");
        ob1.setDatatype("varchar(80)");
        ob1.setConstraint("default NULL");
        TableColumnName.add(ob1);

        ob1 = new TableColumes();
        ob1.setColumnname("mobile_no");
        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("sub_type_id");
        ob.setDataName(dept);
        insertData.add(ob);

        ob = new InsertDataTable();
        ob.setColName("mobile_no");
        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(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_msg", insertData, connectionSpace);
        insertData.clear();
        flag = true;
      } catch (Exception e) {
        e.printStackTrace();
      }
    } else {
      returnResult = LOGIN;
    }
    return flag;
  }
  @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;
    }
  }
  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;
  }
  // 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;
    }
  }