Ejemplo n.º 1
0
  public CoreList count(String dept_name) throws SQLException {
    CoreList ch = new CoreList();
    ch.clear();
    PreparedStatement pst = null;
    ResultSet rs = null;
    DBConn conn = new DBConn();

    con = conn.getConnection();
    try {

      pst =
          con.prepareStatement(
              "select count(*) from employee_reg where dept_name='" + dept_name + "'");
      System.out.println("chai");
      rs = pst.executeQuery();
      while (rs.next()) {
        EmployeeRegForm psf = new EmployeeRegForm();
        psf.setCount(rs.getInt(1));

        ch.add(psf);
      }
    } catch (Exception e) {
      con.close();
      System.out.println("Connection Closed");
      e.printStackTrace();
    }
    return ch;
  }
Ejemplo n.º 2
0
  public CoreList View_DeptName(int ps_id) throws SQLException {
    CoreList ch = new CoreList();
    ch.clear();
    PreparedStatement pst = null;
    ResultSet rs = null;
    DBConn conn = new DBConn();

    con = conn.getConnection();
    try {

      pst = con.prepareStatement("select dept_name from employee_reg where ps_id=?");
      pst.setInt(1, ps_id);
      rs = pst.executeQuery();
      while (rs.next()) {
        System.out.println("chai=============================" + ps_id);
        EmployeeRegForm psf = new EmployeeRegForm();
        psf.setDept_name(rs.getString(1));
        ch.add(psf);
      }
    } catch (Exception e) {
      con.close();
      System.out.println("Connection Closed");
      e.printStackTrace();

    } finally {
      releaseResources(con, pst);
    }
    return ch;
  }
Ejemplo n.º 3
0
  public CoreList View_Employee(String emp_id) throws SQLException {
    CoreList ch = new CoreList();
    ch.clear();
    PreparedStatement pst = null;
    ResultSet rs = null;
    DBConn conn = new DBConn();
    System.out.println(emp_id);
    con = conn.getConnection();
    try {

      pst = con.prepareStatement("select * from employee_reg where emp_id='" + emp_id + "'");
      System.out.println("chai");
      rs = pst.executeQuery();
      while (rs.next()) {
        EmployeeRegForm psf = new EmployeeRegForm();
        psf.setPs_id(rs.getInt(1));
        psf.setDept_name(rs.getString(2));
        System.out.println(rs.getString(2));
        psf.setEmp_id(rs.getString(3));
        psf.setEmp_firstname(rs.getString(4));
        psf.setEmp_lastname(rs.getString(5));
        psf.setSex(rs.getString(6));
        psf.setJoin_date(rs.getString(7));
        psf.setDesignation(rs.getString(8));

        ch.add(psf);
      }
    } catch (Exception e) {
      con.close();
      System.out.println("Connection Closed");
      e.printStackTrace();

    } finally {
      releaseResources(con, pst);
    }
    return ch;
  }