private List<CloseTicketEntity> getOpenTaskPracticeCountIdBaseOnTheTech(
      String techId, String taskNo, String value) {

    StringBuilder sql =
        new StringBuilder(
            "SELECT ppd.id AS taskid, ppd.`clientid` AS clientid FROM projectplandetails  ppd LEFT JOIN project p ON p.`projectid`=ppd.`projectid` LEFT JOIN users u ON u.uid = p.telcallsid   ");
    sql.append(
        " LEFT JOIN users u1 ON u1.uid = ppd.resourceid AND u1.`UserType`=2 WHERE ppd.delflag = 0 AND ppd.status <>-1   AND ppd.status <> 1 AND ppd.`clientid` <> 0 AND  ppd.resourceid = ?  ");
    if (taskNo != null & taskNo.length() > 0)
      sql.append(" and ppd.id LIKE '").append(value).append("%'");
    Connection connection = null;
    PreparedStatement ps = null;
    ResultSet rs = null;
    CloseTicketEntity obj = null;

    List<CloseTicketEntity> list = new ArrayList<CloseTicketEntity>();
    try {
      connection = DBManager.getConnection(OneClickConstants.EMGR_DS);
      ps = connection.prepareStatement(sql.toString());
      ps.setString(1, techId);
      rs = ps.executeQuery();
      while (rs.next()) {
        obj = new CloseTicketEntity();
        ;
        obj.setTicketId(Helper.chkNull(rs.getString("taskid")));
        obj.setPusername(Helper.chkNull(rs.getString("clientid")));
        list.add(obj);
      }
    } catch (Exception e) {
      logger.error("Error While getting task id count ", e);
    } finally {
      try {
        if (connection != null) {
          connection.close();
        }
        if (rs != null) {
          rs.close();
        }
        if (ps != null) {
          ps.close();
        }
      } catch (Exception e) {
        logger.error("Error while Connection closeing... ");
      }
    }
    return list;
  }
  private List<CloseTicketEntity> getOpenTicketPracticeIdBaseOnTheTech(
      String techId, String TicketNom, String value) {

    StringBuilder sql =
        new StringBuilder(
            "SELECT t.ticketid as ticketid,t.clientid AS PracticeID FROM tickets t LEFT JOIN  users u ON u.uid= t.clientid WHERE t.assignedto = ? ");
    if (TicketNom != null && TicketNom.length() > 0)
      sql.append(" and ticketid like '").append(value).append("%' ");
    sql.append(" AND t.createdDateTime  AND t.status NOT IN (2,10,15,20) ");
    Connection connection = null;
    PreparedStatement ps = null;
    ResultSet rs = null;
    CloseTicketEntity obj = null;

    List<CloseTicketEntity> list = new ArrayList<CloseTicketEntity>();
    try {
      connection = DBManager.getConnection(OneClickConstants.EMGR_DS);
      ps = connection.prepareStatement(sql.toString());
      ps.setString(1, techId);
      rs = ps.executeQuery();
      while (rs.next()) {
        obj = new CloseTicketEntity();
        ;
        obj.setTicketId(Helper.chkNull(rs.getString("ticketid")));
        obj.setPusername(Helper.chkNull(rs.getString("PracticeID")));
        list.add(obj);
      }
    } catch (Exception e) {
      logger.error("Error While getting practice user name from emanager database ", e);
    } finally {
      try {
        if (connection != null) {
          connection.close();
        }
        if (rs != null) {
          rs.close();
        }
        if (ps != null) {
          ps.close();
        }
      } catch (Exception e) {
        logger.error("Error while Connection closeing... ");
      }
    }
    return list;
  }