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 beforeEmployeeCreate() {
    try {
      if (userName == null || userName.equalsIgnoreCase("")) return LOGIN;

      CommonOperInterface cbt = new CommonConFactory().createInterface();
      if (getEmpModuleFalgForDeptSubDept() != null) {
        // set the employee basic , prsnl , qualification or bank detail accordin based on the
        // selected level of configuration
        StringBuilder empuery = new StringBuilder("");
        empuery.append("select table_name from mapped_employee_basic_configuration");
        List empData = cbt.executeAllSelectQuery(empuery.toString(), connectionSpace);

        if (empData != null) {
          for (Iterator it = empData.iterator(); it.hasNext(); ) {
            Object obdata = (Object) it.next();

            if (obdata != null) {
              if (obdata.toString().equalsIgnoreCase("employee_basic_configuration")) {
                empForAddBasic = 1;
              } else if (obdata.toString().equalsIgnoreCase("employee_personal_configuration")) {
                empForAddPrsl = 1;
              } else if (obdata
                  .toString()
                  .equalsIgnoreCase("employee_work_exprience_configuration")) {
                empForAddWorkQua = 1;
              } else if (obdata
                  .toString()
                  .equalsIgnoreCase("employee_work_exprience_configuration")) {
                empForAddWorkExpirence = 1;
              } else if (obdata
                  .toString()
                  .equalsIgnoreCase("employee_bank_details_configuration")) {
                empForAddBaank = 1;
              }
            }
          }
        }
        setViewPageProps();
      }
    } catch (Exception e) {
      addActionError("Ooops There Is Some Problem In Sub-Department Creation!");
      e.printStackTrace();
      return ERROR;
    }
    return SUCCESS;
  }
  public void setContactAddPageDataFields() {
    try {
      CommonOperInterface cbt = new CommonConFactory().createInterface();
      List<GridDataPropertyView> gridFields =
          Configuration.getConfigurationData(
              "mapped_common_contact_configuration",
              accountID,
              connectionSpace,
              "",
              0,
              "table_name",
              "common_contact_configuration");
      if (gridFields != null) {
        contactDD = new ArrayList<ConfigurationUtilBean>();
        for (GridDataPropertyView gdp : gridFields) {
          ConfigurationUtilBean objdata = new ConfigurationUtilBean();
          if (gdp.getColType().trim().equalsIgnoreCase("D")) {
            objdata.setKey(gdp.getColomnName());
            objdata.setValue(gdp.getHeadingName());
            objdata.setColType(gdp.getColType());
            objdata.setValidationType(gdp.getValidationType());
            if (gdp.getMandatroy() == null) objdata.setMandatory(false);
            else if (gdp.getMandatroy().equalsIgnoreCase("0")) objdata.setMandatory(false);
            else if (gdp.getMandatroy().equalsIgnoreCase("1")) objdata.setMandatory(true);
            contactDD.add(objdata);

            if (gdp.getColomnName().equalsIgnoreCase("regLevel")) {
              officeMap = new HashMap<Integer, String>();
              List data =
                  cbt.executeAllSelectQuery(
                      " select levelName from mapped_orgleinfo_level ", connectionSpace);

              if (data != null && data.size() > 0 && data.get(0) != null) {
                String arr[] = data.get(0).toString().split("#");
                for (int i = 0; i < arr.length; i++) {
                  officeMap.put(i + 1, arr[i].toString());
                }
              }
            }
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 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 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;
    }
  }
  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 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;
  }
  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;
  }
  public boolean addScheduledMessage(
      String name,
      String dept,
      String mobone,
      String msg,
      String ticketno,
      String status,
      String statusflag,
      String module,
      String smsDate,
      String smsTime,
      SessionFactory connectionSpace) {
    boolean flag = false;
    @SuppressWarnings("unused")
    String returnResult = ERROR;
    boolean sessionFlag = true;
    if (sessionFlag) {
      try {
        @SuppressWarnings("unchecked")
        String userName = "******";
        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(userName);
        insertData.add(ob);

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

        ob = new InsertDataTable();
        ob.setColName("time");
        ob.setDataName(smsTime);
        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;
  }
  // add sms on server and client...
  public boolean addScheduledMessageClientServer(
      String name,
      String dept,
      String mobone,
      String msg,
      String ticketno,
      String status,
      String statusflag,
      String module,
      String smsDate,
      String smsTime,
      SessionFactory connectionSpace) {
    boolean flag = false;
    @SuppressWarnings("unused")
    String returnResult = ERROR;
    boolean statusserver = false;
    boolean sessionFlag = true;
    if (sessionFlag) {
      try {
        @SuppressWarnings("unchecked")
        String userName = "******";
        // CommonOperInterface cot = new CommonConFactory().createInterface();
        CommonOperInterface cbt = 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);

        cbt.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(userName);
        insertData.add(ob);


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

        ob=new InsertDataTable();
        ob.setColName("time");
        ob.setDataName(smsTime);
        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();*/

        /** 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("name");
        Tablecolumevalue.add(name);
        Tablecolumename.add("dept");
        Tablecolumevalue.add(dept);
        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(userName);
        Tablecolumename.add("date");
        Tablecolumevalue.add(smsDate);
        Tablecolumename.add("time");
        Tablecolumevalue.add(smsTime);
        Tablecolumename.add("update_date");
        Tablecolumevalue.add("0000-00-00");
        Tablecolumename.add("update_time");
        Tablecolumevalue.add("00-00-00");
        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(" ;");
        //	obj.setCreateTableQuery(createTableQuery.toString());

        // insert into local database.
        int maxId = cbt.insertIntoTable(createTableQuery.toString(), connectionSpace);
        // insert into Server database.
        //    statusserver= objstatus.insertIntoTable(obj).get_return();
        if (statusserver) {
          flag = true;
        } else {
          flag = false;
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    } else {
      returnResult = LOGIN;
    }
    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;
  }
  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 void setContactDataFieldsToAdd(String mappedTable, String configTable) {
    try {
      CommonOperInterface cbt = new CommonConFactory().createInterface();
      List<GridDataPropertyView> gridFields =
          Configuration.getConfigurationData(
              mappedTable, accountID, connectionSpace, "", 0, "table_name", configTable);

      if (gridFields != null) {
        deptMap = new HashMap<Integer, String>();
        contactFormDDBox = new ArrayList<ConfigurationUtilBean>();
        contactTextBox = new ArrayList<ConfigurationUtilBean>();
        industryMap = new HashMap<Integer, String>();
        contactFileBox = new ArrayList<ConfigurationUtilBean>();
        contactDateTimeBox = new ArrayList<ConfigurationUtilBean>();
        for (GridDataPropertyView gdp : gridFields) {
          ConfigurationUtilBean objdata = new ConfigurationUtilBean();
          if (gdp.getColType().trim().equalsIgnoreCase("T")
              && !gdp.getColomnName().equalsIgnoreCase("userName")
              && !gdp.getColomnName().equalsIgnoreCase("createdDate")
              && !gdp.getColomnName().equalsIgnoreCase("createdAt")
              && !gdp.getColomnName().equalsIgnoreCase("userAccountId")
              && !gdp.getColomnName().equalsIgnoreCase("flag")) {
            objdata.setKey(gdp.getColomnName());
            objdata.setValue(gdp.getHeadingName());
            objdata.setColType(gdp.getColType());
            objdata.setValidationType(gdp.getValidationType());
            if (gdp.getMandatroy() == null) objdata.setMandatory(false);
            else if (gdp.getMandatroy().equalsIgnoreCase("0")) objdata.setMandatory(false);
            else if (gdp.getMandatroy().equalsIgnoreCase("1")) objdata.setMandatory(true);
            contactTextBox.add(objdata);
          } else if (gdp.getColType().trim().equalsIgnoreCase("F")
              && !gdp.getColomnName().equalsIgnoreCase("userName")
              && !gdp.getColomnName().equalsIgnoreCase("createdDate")
              && !gdp.getColomnName().equalsIgnoreCase("createdAt")) {
            objdata.setKey(gdp.getColomnName());
            objdata.setValue(gdp.getHeadingName());
            objdata.setColType(gdp.getColType());
            objdata.setValidationType(gdp.getValidationType());
            if (gdp.getMandatroy() == null) objdata.setMandatory(false);
            else if (gdp.getMandatroy().equalsIgnoreCase("0")) objdata.setMandatory(false);
            else if (gdp.getMandatroy().equalsIgnoreCase("1")) objdata.setMandatory(true);
            contactFileBox.add(objdata);

          } else if (gdp.getColType().trim().equalsIgnoreCase("date")) {
            objdata.setKey(gdp.getColomnName());
            objdata.setValue(gdp.getHeadingName());
            objdata.setColType(gdp.getColType());
            objdata.setValidationType(gdp.getValidationType());
            if (gdp.getMandatroy() == null) objdata.setMandatory(false);
            else if (gdp.getMandatroy().equalsIgnoreCase("0")) objdata.setMandatory(false);
            else if (gdp.getMandatroy().equalsIgnoreCase("1")) objdata.setMandatory(true);
            contactDateTimeBox.add(objdata);
          } else if (gdp.getColType().trim().equalsIgnoreCase("D")) {
            objdata.setKey(gdp.getColomnName());
            objdata.setValue(gdp.getHeadingName());
            objdata.setColType(gdp.getColType());
            objdata.setValidationType(gdp.getValidationType());
            if (gdp.getMandatroy() == null) objdata.setMandatory(false);
            else if (gdp.getMandatroy().equalsIgnoreCase("0")) objdata.setMandatory(false);
            else if (gdp.getMandatroy().equalsIgnoreCase("1")) objdata.setMandatory(true);
            contactFormDDBox.add(objdata);

            if (gdp.getColomnName().equalsIgnoreCase("industry")) {
              List data =
                  cbt.executeAllSelectQuery(
                      "select id,industry from industrydatalevel1", connectionSpace);
              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) {
                    industryMap.put(Integer.parseInt(object[0].toString()), object[1].toString());
                  }
                }
              }
            } /*else if (getRegLevel() != null) {
              	List data = cbt.executeAllSelectQuery(
              			"select id,deptName from department where mappedOrgnztnId='"
              					+ getRegLevel() + "'",
              			connectionSpace);
              	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) {
              				deptMap.put(Integer.parseInt(object[0]
              						.toString()), object[1]
              						.toString());
              			}
              		}
              	}
              }*/
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Пример #14
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;
    }
  }
Пример #15
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 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("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 String viewRatingDataGrid() {
    System.out.println("iii2    ");
    CommonOperInterface cbt = new CommonConFactory().createInterface();
    LeadSupportBean clientBean;
    finalDataList = new ArrayList<LeadSupportBean>();

    try {
      System.out.println("iii3    ");
      if (starRating.equalsIgnoreCase("rat1")) {
        starRating = "1";
      } else if (starRating.equalsIgnoreCase("rat2")) {
        starRating = "2";
      } else if (starRating.equalsIgnoreCase("rat3")) {
        starRating = "3";
      } else if (starRating.equalsIgnoreCase("rat4")) {
        starRating = "4";
      } else if (starRating.equalsIgnoreCase("rat5")) {
        starRating = "5";
      }

      if (clientType.equalsIgnoreCase("Prospective")) {
        clientType = "0";
      } else if (clientType.equalsIgnoreCase("Existing")) {
        clientType = "1";
      } else if (clientType.equalsIgnoreCase("Lost")) {
        clientType = "2";
      }
      StringBuilder query = new StringBuilder("");
      query.append(
          "select cbd.leadName, cbd.leadAddress,cbd.webAddress,loc.name,indus.industry,subindus.subIndustry,cbd.id ");
      query.append("from leadgeneration as cbd ");
      query.append("left join location as loc on cbd.name=loc.id ");
      query.append("left join industrydatalevel1 as indus on cdb.industry = indus.id ");
      query.append(
          "left join subindustrydatalevel2 as subindus on indus.industry = subindus.industry ");
      query.append("where cbd.isConverted = '");
      query.append(clientType);
      query.append("' and cbd.starRating='");
      query.append(starRating);
      query.append("'");

      System.out.println("query:::::" + query.toString());
      List template = cbt.executeAllSelectQuery(query.toString(), connectionSpace);
      for (Iterator iterator = template.iterator(); iterator.hasNext(); ) {
        clientBean = new LeadSupportBean();
        Object[] object = (Object[]) iterator.next();

        if (object[0] != null) {
          clientBean.setLeadname(object[0].toString());
          System.out.println("object[0].toString() " + object[0].toString());
        }
        if (object[1] != null) {
          clientBean.setAddress(object[1].toString());
          System.out.println("object[1].toString() " + object[1].toString());
        }
        if (object[2] != null) {
          clientBean.setWebaddress(object[2].toString());
          System.out.println("object[2].toString() " + object[2].toString());
        }
        if (object[3] != null) {
          clientBean.setLocation(object[3].toString());
          System.out.println("object[3].toString() " + object[3].toString());
        }
        if (object[4] != null) {
          clientBean.setIndustry(object[4].toString());
          System.out.println("object[4].toString() " + object[4].toString());
        }
        if (object[5] != null) {
          clientBean.setSubindustry(object[5].toString());
          System.out.println("object[5].toString() " + object[5].toString());
        }

        if (object[6] != null) {
          clientBean.setId(object[6].toString());
          System.out.println("object[6].toString() " + object[6].toString());
        }

        finalDataList.add(clientBean);
        System.out.println("ratingfDataList  " + finalDataList.size());

        System.out.println("iii5    ");
      }
      setRatingfDataList(finalDataList);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return SUCCESS;
  }