📄 list.asp
字号:
<!--#include file="../config.asp"-->
<!--#include file="../inc/check_login.asp"-->
<!--#include file="../inc/functions.asp"-->
<%
Application_ID = 5000100 '本功能编号,含义请查看编码表
if not CheckAuth(Session("Employee_ID"),Application_ID) then '验证权限
Server.Transfer "../err/un_authorized.htm"
response.end
end if
%>
<!--**************身份验证部分****************-->
<%
'查询条件
Employee_Name = request("Employee_Name")
Gender = request("Gender")
Age_Min = request("Age_Min")
Age_Max = request("Age_Max")
Branch_ID = request("Branch_ID")
Department_ID = request("Department_ID")
Tel = request("Tel")
Email = request("Email")
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK rel="stylesheet" type="text/css" href="../style.css">
<script language="JavaScript" type="text/javascript" src="../js/functions.js"></script>
</head>
<body>
<form name="frm" action="list.asp" method="post">
<table border=0 cellpadding=0 cellspacing=0 width="100%">
<tr>
<td width="97%">◆<a href="search.asp" target="foot">员工查询</a> ◆<a href="new.asp" target="foot">增加新员工</a></td>
<td width="1%"><nobr>员工姓名:</nobr></td>
<td width="1%"><input type="text" name="Employee_Name" value="<%= Employee_Name %>" size="20" maxlength="20"></td>
<td width="1%"><input type="submit" name="Submit" value="快速查询"></td>
</tr>
</table>
<hr size=1>
<table bgcolor="#FFFFFF" border=0 cellpadding=1 cellspacing=1 width="100%">
<tr bgcolor="#EFEFEF">
<td>用户名</td>
<td>姓名</td>
<td>性别</td>
<td>年龄</td>
<td>分公司</td>
<td>部门</td>
<td>职务</td>
<td>电话</td>
<td><font face="Wingdings">*</font></td>
<td>操作</td>
</tr>
<%
'根据布尔值取得性别汉字
function getGender(tf)
if tf then
getGender = "男"
else
getGender = "女"
end if
end function
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
conn.open connstr
'计算员工总数
sql = "select count(Employee_ID) from Employee where Available = 1"
set rs = conn.execute(sql)
Employee_Total = rs(0)
rs.close
sql = "select Employee.*,Employee_Branch.Branch_Name,Employee_Department.Department_Name from Employee,Employee_Branch,Employee_Department where Employee.Branch_ID = Employee_Branch.Branch_ID and Employee.Department_ID = Employee_Department.Department_ID and Employee.Available = 1"
'用户条件
if IsNot(Employee_Name,"s") then sql = sql & " and Employee.Employee_Name like '%" & Employee_Name & "%'"
if IsNot(Gender,"n") then sql = sql & " and Employee.Gender = " & Gender
if IsNot(Age_Min,"n") then sql = sql & " and datediff(year,Employee.Birthday,getdate()) >= " & Age_Min
if IsNot(Age_Max,"n") then sql = sql & " and datediff(year,Employee.Birthday,getdate()) <= " & Age_Max
if IsNot(Branch_ID,"n") then sql = sql & " and Employee.Branch_ID = " & Branch_ID
if IsNot(Department_ID,"n") then sql = sql & " and Employee.Department_ID = " & Department_ID
if IsNot(Tel,"s") then sql = sql & " and Employee.Tel like '%" & Tel & "%'"
if IsNot(Email,"s") then sql = sql & " and Employee.Email like '%" & Email & "%'"
sql = sql & " order by Employee.Employee_ID DESC"
'response.write sql
rs.open sql,conn,1
if rs.eof then
response.write "<tr><td colspan=18>暂时没有记录</td></tr></table>"
response.end
end if
PageSize = request.Cookies("PageSize")
if not IsNot(PageSize,"n") then PageSize = DefaultPageSize
rs.pagesize = PageSize
PageCount = rs.PageCount
PageNo = request("PageNo")
if PageNo = "" or CInt(PageNo) < 1 then PageNo = 1
if CInt(PageNo) > PageCount then PageNo = PageCount
rs.absolutepage = PageNo
i = 0
while not rs.eof and i < rs.pagesize
f_LoginName = rs("LoginName")
f_Employee_ID = rs("Employee_ID")
ID_Pointer = f_Employee_ID
f_Employee_Name = rs("Employee_Name")
f_Gender = rs("Gender")
f_Birthday = rs("Birthday")
if year(f_Birthday) <> 1900 then
f_Age = datediff("yyyy",f_Birthday,date())
else
f_Age = ""
end if
f_Branch_Name = rs("Branch_Name")
f_Department_Name = rs("Department_Name")
f_Funcs = rs("Funcs")
f_Tel = rs("Tel")
f_Email = rs("Email")
f_Available = rs("Available")
if i mod 2 = 0 then
response.write "<tr>"
else
response.write "<tr bgcolor=#EFEFEF>"
end if
%>
<td><a href="detail.asp?Employee_ID=<%= f_Employee_ID %>" target="foot"><%= f_LoginName %></a> </td>
<td><%= f_Employee_Name %> </td>
<td><%= getGender(f_Gender) %> </td>
<td><%= f_Age %> </td>
<td><%= f_Branch_Name %> </td>
<td><%= f_Department_Name %> </td>
<td><%= f_Funcs %> </td>
<td><%= f_Tel %> </td>
<% If len(f_Email) > 5 then %>
<td><a href="mailto:<%= f_Email %>"><font face="Wingdings">*</font></a> </td>
<% Else %>
<td> </td>
<% End If %>
<td><a href="detail.asp?Employee_ID=<%= f_Employee_ID %>&op=modi" target="foot">修改</a>/<a href="del_yes_no.asp?Employee_ID=<%= f_Employee_ID %>&Available=0" target="foot" onClick="return ConfirmOption('删除员工');">删除</a></td>
</tr>
<%
i = i + 1
rs.movenext
wend
rs.close
set rs = nothing
conn.close
set conn = nothing
%>
<tr bgcolor="#EFEFEF">
<td colspan="6">
<a href="list.asp?PageNo=1&Employee_Name=<%= Employee_Name %>&Gender=<%= Gender %>&Age_Min=<%= Age_Min %>&Age_Max=<%= Age_Max %>&Branch_ID=<%= Branch_ID %>&Department_ID=<%= Department_ID %>&Tel=<%= Tel %>&Email=<%= Email %>"><font face="Webdings">5</font>第一页</a>
<a href="list.asp?PageNo=<%= PageNo - 1 %>&Employee_Name=<%= Employee_Name %>&Gender=<%= Gender %>&Age_Min=<%= Age_Min %>&Age_Max=<%= Age_Max %>&Branch_ID=<%= Branch_ID %>&Department_ID=<%= Department_ID %>&Tel=<%= Tel %>&Email=<%= Email %>"><font face="Webdings">3</font>上一页</a>
<a href="list.asp?PageNo=<%= PageNo + 1 %>&Employee_Name=<%= Employee_Name %>&Gender=<%= Gender %>&Age_Min=<%= Age_Min %>&Age_Max=<%= Age_Max %>&Branch_ID=<%= Branch_ID %>&Department_ID=<%= Department_ID %>&Tel=<%= Tel %>&Email=<%= Email %>"><font face="Webdings">4</font>下一页</a>
<a href="list.asp?PageNo=<%= PageCount %>&Employee_Name=<%= Employee_Name %>&Gender=<%= Gender %>&Age_Min=<%= Age_Min %>&Age_Max=<%= Age_Max %>&Branch_ID=<%= Branch_ID %>&Department_ID=<%= Department_ID %>&Tel=<%= Tel %>&Email=<%= Email %>"><font face="Webdings">6</font>最后一页</a>
</td>
<td colspan=4 align="right">共:<%= Employee_Total %> 名员工,<%= PageSize %>名/页,共:<%= PageCount %> 页</td>
</tr>
</table>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -