?? employeeinformation.jsp
字號:
<%@ page contentType="text/html; charset=gb2312" language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="cn.edu.buaa.nlsde.db.*"%>
<%request.setCharacterEncoding("GB2312");
String TheMessage = "";
Vector VTDepartments = new Vector();
Vector VTRoles = new Vector();
if (session.getAttribute("VTDepartments") != null) {
VTDepartments = (Vector)session.getAttribute("VTDepartments");
}
if (session.getAttribute("VTRoles") != null) {
VTRoles = (Vector)session.getAttribute("VTRoles");
}
String temp = "";
boolean label = false;
//判斷用戶是否登錄
if (session.getAttribute("ID") == null) {
response.sendRedirect("../login.jsp");
}
//連接系統數據庫
//Connection conn = (new DBConnect()).getODBCConn("EIMS");
Connection conn = (new DBConnect()).getConnPoolConn("eims");
Statement stmt = conn.createStatement();
ResultSet RSEnquiryResult = null;
//判斷用戶是否提交了表單
if (request.getParameter("Send") != null) {
//如果用戶希望查詢全部員工信息
if (request
.getParameter("SendTo")
.equals("AllEmployeeInformation")) {
RSEnquiryResult =
stmt.executeQuery(
"select * from PSLogins order by "
+ request.getParameter("AllOrder"));
TheMessage =
"全體員工信息按" + request.getParameter("AllOrder") + "排序如下";
label = true;
}
//如果用戶希望查詢某個部門員工信息
else if (
request.getParameter("SendTo").equals(
"DepartmentEmployeeInformation")) {
RSEnquiryResult =
stmt.executeQuery(
"select * from PSLogins where Department = '"
+ request.getParameter("DepartmentName")
+ "' order by Position");
TheMessage =
request.getParameter("DepartmentName") + "全部員工信息如下";
label = true;
}
//如果用戶希望進入修改個人信息頁面
else if (
request.getParameter("SendTo").equals(
"ModifyPersonalInformation")) {
response.sendRedirect("modifypersonalinformation.jsp");
}
//如果用戶希望進入系統管理員頁面
else if (
request.getParameter("SendTo").equals("SystemManager")) {
if (session.getAttribute("IsSystemManager").equals("True")) {
session.setAttribute(
"SystemOrder",
request.getParameter("SystemOrder"));
response.sendRedirect("systemmanager.jsp");
}
else {
TheMessage = " 對不起,您不是系統管理員,沒有此項權限";
label = false;
}
}
//如果用戶希望查詢某個員工信息
else if (
request.getParameter("SendTo").equals(
"OneEmployeeInformation")) {
label = true;
if (request.getParameter("CheckName").equals("FromList")) {
RSEnquiryResult =
stmt.executeQuery(
"select * from PSLogins where Name = '"
+ request.getParameter("RoleName")
+ "'");
TheMessage =
"查詢員工" + request.getParameter("RoleName") + "信息結果如下";
}
else {
RSEnquiryResult =
stmt.executeQuery(
"select * from PSLogins where Name = '"
+ request.getParameter("TypeName")
+ "'");
TheMessage =
"查詢員工" + request.getParameter("TypeName") + "信息結果如下";
}
}
//如果用戶希望查詢部門主管信息
else {
RSEnquiryResult =
stmt.executeQuery(
"select * from PSLogins where Position='主管'");
TheMessage = "各部門主管信息如下";
label = true;
}
}
//如果用戶是第一次進入頁面
else {
TheMessage = "請在下面選擇員工信息管理選項";
if (session.getAttribute("VTDepartments") != null) {
VTDepartments = (Vector)session.getAttribute("VTDepartments");
}
else {
ResultSet RSDepartments =
stmt.executeQuery(
"select DepartmentName from Departments");
while (RSDepartments.next()) {
VTDepartments.add(
RSDepartments.getString("DepartmentName"));
}
session.setAttribute("VTDepartments", VTDepartments);
}
if (session.getAttribute("VTRoles") != null) {
VTRoles = (Vector)session.getAttribute("VTRoles");
}
else {
ResultSet RSRoles =
stmt.executeQuery("select Name from PSLogins");
while (RSRoles.next()) {
VTRoles.add(RSRoles.getString("Name"));
}
session.setAttribute("VTRoles", VTRoles);
}
}
%>
<html>
<head>
<title>員工信息管理子系統</title>
</head>
<body>
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2
align=center>
<tr bgcolor=white>
<td valign=middle><img src="../image/jsplogo.jpg" width=796 height=100></td>
</tr>
</table>
<table width="800" border="0" bordercolor="#164DA8" align="center"
cellpadding="0" cellspacing="0">
<tr>
<td height="13"><img src=".././image/banner2.jpg" width="800"
height="12"></td>
</tr>
</table>
<table width=800 border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2
align=center>
<tr>
<td colspan=3>
<div align="center"><font color=white>
公司辦公信息管理系統->員工信息管理子系統 [當前用戶-<%=session.getAttribute("Name")%>] </font></div>
</td>
</tr>
<tr bgcolor=white>
<td><a href="../html/home.jsp"><font color="#104DAD">返回系統主頁</font></a></td>
<td align=center><font color="#104DAD"><%=TheMessage%></FONT></td>
<td align=right><a href="../html/home.jsp"><font color="#104DAD">返回上一級網頁</font></a></td>
</tr>
</table>
<table width="800" border="0" bordercolor="#164DA8" align="center"
cellpadding="0" cellspacing="0">
<tr>
<td height="13"><img src=".././image/banner2.jpg" width="800"
height="12"></td>
</tr>
</table>
<form action="employeeinformation.jsp#List" method=post>
<table width="800" border="0" bordercolor="#164DA8" align="center"
cellpadding="3" cellspacing="0">
<tr>
<td><br>
<table cellpadding=1 cellspacing=2 border=1 bordercolor="#164DA8"
width=800 align=center>
<tr valign="middle" align="center">
<td width=35% bgcolor=#B5C7EF><img src="../image/employee1.jpg"></td>
<td>
<table cellpadding=1 cellspacing=1 border=1 align=center width=100%>
<tr>
<td width=35%><input type="radio" checked name="SendTo"
value="AllEmployeeInformation"> <font color="#164DA8">查詢所有員工信息</font></td>
<td><input type="radio" checked name="AllOrder" value="Name">按姓名排序
<input type="radio" name="AllOrder" value="Department">按部門排序 <input
type="radio" name="AllOrder" value="Birthday">按生日排序</td>
</tr>
<tr>
<td width=30%><input type="radio" name="SendTo"
value="DepartmentEmployeeInformation"> <font color="#164DA8">查詢某個部門員工信息</font></td>
<td><select name="DepartmentName">
<%for (int i = 0; i < VTDepartments.size(); i++) {
temp = (String)VTDepartments.get(i);%>
<option value="<%=temp%>"><%=temp%></option>
<%}%>
</select></td>
</tr>
<tr>
<td><input type="radio" name="SendTo"
value="OneEmployeeInformation"><font color="#164DA8">查詢某個員工信息</font>
</td>
<td>
<table width=100% border=1>
<tr>
<td><input type="radio" Checked name="CheckName"
value="FromList"><font color="#164DA8">從列表中選擇</font></td>
<td><select name="RoleName">
<%for (int i = 0; i < VTRoles.size(); i++) {
temp = (String)VTRoles.get(i);%>
<option value="<%=temp%>"><%=temp%></option>
<%}%>
</select></td>
</tr>
<tr>
<td><input type="radio" name="CheckName" value="Type"><font
color="#164DA8">從輸入的名字查詢</font></td>
<td><input type="text" Checked name="TypeName" value=""></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width=30%><input type="radio" name="SendTo"
value="DepartmentManager"> <font color="#164DA8">查詢部門主管信息</font></td>
<td> </td>
</tr>
<tr>
<td width=30%><input type="radio" name="SendTo"
value="ModifyPersonalInformation"> <font color="#164DA8">修改關于我的信息</font></td>
<td> </td>
</tr>
<tr>
<td width=30%><input type="radio" name="SendTo"
value="SystemManager"> <font color="#164DA8">系統管理員選項</font></td>
<td><input type="radio" name=SystemOrder value="Name" checked>以姓名排序進入
<input type="radio" name=SystemOrder value="Department">以部門排序進入<br>
<input type="radio" name=SystemOrder value="Birthday">以生日排序進入 <input
type="radio" name=SystemOrder value="Position">以職位排序進入</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellpadding=0 cellspacing=0 BORDER=1 width=800 align=center>
<tr VALIGN="top" ALIGN="center">
<td width=100% align=center><input type="submit" name="Send"
value="進入選項"
style="border: 1px solid #3466BB; background-color: #B6CAEB; color: #3466BB">
</td>
</tr>
</table>
<br>
<A name=List></A> <%if (request.getParameter("Send") != null) {
out.println(
"<table width=100% border=0 bgcolor=#164DA8 cellspacing=1 cellpadding=2 align=center>");
out.println(
"<tr><td><font color=white><P ALIGN=CENTER>" + TheMessage);
out.println("</font></td></tr>");
//如果不輸出查詢結果
if (label == false) {
out.println("</table>");
}
//如果要輸出查詢結果
else {
out.println("<tr bgcolor=white ><td align=center>");
out.println(
"<table width=100% bgcolor=#164DA8 border=0 cellspacing=1 cellpadding=2 align=center>");
out.println("<tr><td><font color=white>登錄名</font></td>");
out.println("<td><font color=white>姓名</font></td>");
out.println("<td><font color=white>電子郵件地址</font></td>");
out.println("<td><font color=white>部門</font></td>");
out.println("<td><font color=white>內部分機</font></td>");
out.println("<td><font color=white>家庭電話</font></td>");
out.println("<td><font color=white>移動電話</font></td>");
out.println("<td><font color=white>MSN</font></td>");
out.println("<td><font color=white>生日</font></td></tr>");
while (RSEnquiryResult.next()) {
out.println("<tr bgcolor=white>");
out.println(
"<td>" + RSEnquiryResult.getString(2) + "</td>");
out.println(
"<td>" + RSEnquiryResult.getString(3) + "</td>");
temp = RSEnquiryResult.getString(5);
out.println("<td><a href=mailto:" + temp + ">");
out.println(
"<font face=arial>" + temp + "</font></a></td>");
out.println(
"<td>" + RSEnquiryResult.getString(6) + "</td>");
out.println(
"<td>" + RSEnquiryResult.getString(8) + "</td>");
out.println(
"<td>" + RSEnquiryResult.getString(9) + "</td>");
out.println(
"<td>" + RSEnquiryResult.getString(10) + "</td>");
out.println(
"<td>" + RSEnquiryResult.getString(11) + "</td>");
out.println(
"<td>"
+ RSEnquiryResult.getString(14).substring(0, 10)
+ "</td></tr>");
}
out.println("</table></td></tr></table>");
}
}%></td>
</tr>
</table>
</form>
</body>
</html>
<%DBConnectionManager.getInstance().freeConnection("eims", conn);%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -