예제 #1
0
  public votblOrganization getAllOrganizations(int iFKCompanyID, int iOrganisationID) {
    Vector v = new Vector();
    Connection con = null;
    Statement st = null;
    ResultSet rs = null;
    votblOrganization vo = new votblOrganization();

    String sql = "";
    if (iOrganisationID != 0) {
      sql = "SELECT * FROM tblConsultingCompany a, tblOrganization b";
      sql =
          sql
              + " WHERE a.CompanyID = b.FKCompanyID AND a.CompanyID = "
              + iFKCompanyID
              + " AND b.PKOrganization ="
              + iOrganisationID;
    } else {
      sql = "SELECT * FROM tblConsultingCompany WHERE CompanyID = " + iFKCompanyID;
    }

    try {

      con = ConnectionBean.getConnection();
      st = con.createStatement();
      rs = st.executeQuery(sql);

      if (rs.next()) {
        // 27 May 2008 by Hemilda - cause iOrganisationID == 0 the query only retrieve
        // tblConsultingCompany column
        if (iOrganisationID != 0) {
          vo.setEmailNom(rs.getString("EmailNom"));
          vo.setEmailNomRemind(rs.getString("EmailNomRemind"));
          vo.setEmailPart(rs.getString("EmailPart"));
          vo.setEmailPartRemind(rs.getString("EmailPartRemind"));
          vo.setExtraModule(rs.getInt("ExtraModule"));
          vo.setFKCompanyID(rs.getInt("FKCompanyID"));
          vo.setNameSequence(rs.getInt("NameSequence"));
          vo.setOrganizationCode(rs.getString("OrganizationCode"));
          vo.setOrganizationLogo(rs.getString("OrganizationLogo"));
          vo.setOrganizationName(rs.getString("OrganizationName"));
          vo.setPKOrganization(rs.getInt("PKOrganization"));
        }
        vo.setCompanyName(rs.getString("CompanyName"));
      }

    } catch (SQLException SE) {
      System.err.println("Organization.java - getAllOrganizations - " + SE.getMessage());
    } finally {

      ConnectionBean.closeRset(rs); // Close ResultSet
      ConnectionBean.closeStmt(st); // Close statement
      ConnectionBean.close(con); // Close connection
    }
    return vo;
  }
예제 #2
0
  /**
   * Get Organization
   *
   * @param iFKCompanyID
   * @return
   * @author James
   */
  public votblOrganization getOrganization(int iOrgID) {
    votblOrganization vo = new votblOrganization();
    Connection con = null;
    Statement st = null;
    ResultSet rs = null;

    String command = "SELECT * FROM tblOrganization WHERE PKOrganization= " + iOrgID;
    try {

      con = ConnectionBean.getConnection();
      System.out.println("con:" + con);
      st = con.createStatement();
      rs = st.executeQuery(command);

      if (rs.next()) {
        vo.setEmailNom(rs.getString("EmailNom"));
        vo.setEmailNomRemind(rs.getString("EmailNomRemind"));
        vo.setEmailPart(rs.getString("EmailPart"));
        vo.setEmailPartRemind(rs.getString("EmailPartRemind"));
        vo.setExtraModule(rs.getInt("ExtraModule"));
        vo.setFKCompanyID(rs.getInt("FKCompanyID"));
        vo.setNameSequence(rs.getInt("NameSequence"));
        vo.setOrganizationCode(rs.getString("OrganizationCode"));
        vo.setOrganizationLogo(rs.getString("OrganizationLogo"));
        vo.setOrganizationName(rs.getString("OrganizationName"));
        vo.setPKOrganization(rs.getInt("PKOrganization"));

        // Added by DeZ, 18/06/08, to add function to enable/disable Nominate Rater
        vo.setNomRater(rs.getBoolean("NominationModule"));
      }

    } catch (SQLException SE) {
      System.err.println("Organization.java - getOrganization - " + SE.getMessage());
    } finally {

      ConnectionBean.closeRset(rs); // Close ResultSet
      ConnectionBean.closeStmt(st); // Close statement
      ConnectionBean.close(con); // Close connection
    }

    return vo;
  }
예제 #3
0
  public Vector getAllOrganizations(int iFKCompanyID) {
    Vector v = new Vector();
    Connection con = null;
    Statement st = null;
    ResultSet rs = null;

    /*
     * Change(s) : Changed the SQL statement to get the company name as well
     * Reason(s) : Able to set the selected company name when company selection is changed in OrganizationList.jsp
     * Updated By: Gwen Oh
     * Updated On: 26 Sep 2011
     */
    // String sSQL="SELECT * FROM tblOrganization WHERE FKCompanyID= "+ iFKCompanyID;
    String sSQL =
        "SELECT tblOrganization.*, tblConsultingCompany.CompanyName FROM "
            + "tblOrganization INNER JOIN tblConsultingCompany ON tblOrganization.FKCompanyID = tblConsultingCompany.CompanyID "
            + "WHERE tblOrganization.FKCompanyID="
            + iFKCompanyID;
    try {
      /*
       * Re-edited by Eric Lu 15-May-08
       *
       * Added sort and toggle functionality for getting organizations
       */
      sSQL = sSQL + " ORDER BY ";

      if (SortType_org == 1) sSQL = sSQL + "OrganizationName";
      else if (SortType_org == 2) sSQL = sSQL + "OrganizationCode";
      else if (SortType_org == 3) sSQL = sSQL + "NameSequence";

      if (Toggle_org[SortType_org - 1] == 1) sSQL = sSQL + " DESC";

      con = ConnectionBean.getConnection();
      st = con.createStatement();
      rs = st.executeQuery(sSQL);

      while (rs.next()) {
        votblOrganization vo = new votblOrganization();
        vo.setEmailNom(rs.getString("EmailNom"));
        vo.setEmailNomRemind(rs.getString("EmailNomRemind"));
        vo.setEmailPart(rs.getString("EmailPart"));
        vo.setEmailPartRemind(rs.getString("EmailPartRemind"));
        vo.setExtraModule(rs.getInt("ExtraModule"));
        vo.setFKCompanyID(rs.getInt("FKCompanyID"));
        vo.setNameSequence(rs.getInt("NameSequence"));
        vo.setOrganizationCode(rs.getString("OrganizationCode"));
        vo.setOrganizationLogo(rs.getString("OrganizationLogo"));
        vo.setOrganizationName(rs.getString("OrganizationName"));
        vo.setPKOrganization(rs.getInt("PKOrganization"));
        // Gwen Oh - 26/09/2011: Set the company name
        vo.setCompanyName(rs.getString("CompanyName"));

        v.add(vo);
      }

    } catch (SQLException SE) {
      System.err.println("Organization.java - getAllOrganizations - " + SE.getMessage());
    } finally {

      ConnectionBean.closeRset(rs); // Close ResultSet
      ConnectionBean.closeStmt(st); // Close statement
      ConnectionBean.close(con); // Close connection
    }

    return v;
  }