%--
/***************************************************************************************
* @author - Aruni N Perera
* @version - 1.0
* Date Written - 17/12/2004
* Last Modified Date - 11/01/2005
* Purpose of this file -
**************************************************************************************/
--%>
<%@ page language="java" import ="java.util.*,java.sql.*,oracle.jdbc.driver.*,oracle.jdbc.pool.*" %>
<%
Connection conn = null;
Statement stmt = null;
ResultSet results = null;
String strDBURL = (String)application.getInitParameter("URL");
String strDBUser = (String)application.getInitParameter("SlasiUser");
String strDBPassword = (String)application.getInitParameter("SlasiPwd");
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection(""+strDBURL+"",""+strDBUser+"",""+strDBPassword+"");
}catch(SQLException e){
System.out.println(e.getMessage());
}catch(NullPointerException ne){
System.out.println(ne.getMessage());
}
String strUserId = (String)session.getAttribute("userID");
String strCompanyId = null;
String strCompStat = null;
String strMemLevel = null;
if (strUserId == null) {
%>
<%
} else {
//----- Find the Comapny ID
try {
String strQryCompId = "SELECT NVL(company_id,'0') company_id FROM member_registration WHERE user_id = '"+strUserId.toLowerCase()+"'";
/*"SELECT NVL(MR.company_id,'0') company_id, NVL(mem_level,'0') mem_level, NVL(mem_status,'0') mem_status "+
"FROM member_registration MR, company_details CD "+
"WHERE user_id = '"+strUserId.toLowerCase()+"'"+
"AND MR.company_id = CD.company_id";*/
stmt = conn.createStatement();
results = stmt.executeQuery(strQryCompId);
if (results.next())
{
strCompanyId = results.getString("company_id");
}
} catch(SQLException e) {
System.out.println("Error @ FIND COMP_DET - " + e.getMessage());
} // catch
if (strCompanyId.equals("0"))
{
%>
<%
} else {
//----- Find the STATUS of the Comapny
try {
String strQryCompStat = "SELECT mem_status, mem_level FROM company_details WHERE company_id = "+strCompanyId+" ";
results = stmt.executeQuery(strQryCompStat);
if (results.next())
{
strCompStat = results.getString("mem_status");
strMemLevel = results.getString("mem_level");
}
} catch(SQLException e) {
System.out.println("Error @ FIND COMP_STAT&LEVEL - " + e.getMessage());
} // catch
if (strMemLevel.equals("X"))
{
%>
<%
} else {
%>
<%
}
}
}
%>