📄 list.asp
字号:
<!-- #include file="db.inc" -->
<!-- #include file="datahandle.inc" -->
<!-- #include file="recordlist.inc" -->
<!-- #include file="security.inc" -->
<!-- #include file="common.inc" -->
<!-- #include file="test2.inc" -->
<%
'********************************************************************
' 名称:list.asp
' 目的:list personal cards
'********************************************************************
dim dbConn
dim strsql, restrict
sFileName = "list.asp"
CheckSecurity(sFileName)
dim emp_id, emp_serial
emp_id = GetUserId
emp_serial = GetEmpSerial
dim command, serial
command = GetParam("command")
serial = GetParam("serial")
'--------------------------------------------------------------------------------------
' 获取查询参数信息
'--------------------------------------------------------------------------------------
dim group, name, company_name, position_id
card_group = GetParam("card_group")
name = GetParam("name")
company_name= GetParam("company_name")
position_id = GetParam("position_id")
if IsEmpty(position_id) then position_id = "-1"
if IsEmpty(card_group) then card_group = "-1"
if IsEmpty(name) then name = ""
if IsEmpty(company_name) then company_name = ""
'----------------------------------
Select Case command
Case "delete"
strsql = " delete from t_personalcard where serial = " &serial
Case "list"
' the default
Case Empty
' the default
End Select
'---------------------
'Debug
Debug()
DebugStr (strsql)
' do delete
if command = "delete" then
cn.Execute(strsql)
end if
'----------------------
'do default action
strsql = "select serial, emp_serial, name, company_name, position_id, company_phone, fax, email" & _
" from t_personalcard "
strWhere1 = " where emp_serial = " & emp_serial
strWhere2 = " where ispublic = 1 and emp_serial <> " & emp_serial
'----------------------
' 其它限制条件
if card_group = "" then card_group = "-1"
if card_group <> "-1" then restrict = restrict & " and card_group = " & card_group
if name <> "" then restrict = restrict & " and name like '%" &name &"%'"
if company_name <> "" then restrict = restrict & " and company_name like '%" &company_name &"%'"
if position_id <> "-1" then restrict = restrict & " and position_id = " &position_id
Dim sFormParams : sFormParams = ""
' 查询参数
sFormParams = "card_group=" & card_group & _
"&name=" & name & _
"&company_name=" & company_name & _
"&position_id=" & position_id & "&"
'-------------------------------------------------------------------------------------
' order by
'-------------------------------------------------------------------------------------
strOrderby = " order by name"
iSort = GetParam("Sorting")
iSorted = GetParam("Sorted")
if IsEmpty(iSort) then
iSort = ""
elseif iSort<>"name" and iSort<>"company_name" and iSort<>"position_id" and iSort<>"phone" and iSort<>"fax" and iSort<>"email" then
iSort = ""
else
if iSort = iSorted then ' 这一列是上次排序的列,则将iSorted的值置空""(降序排列),否则置iSort的值(升序排列)
sDirection = " desc"
sSortParams = "Sorting=" & iSort & "&Sorted=" & iSorted & "&"
iSorted = ""
else
sDirection = " asc"
sSortParams = "Sorting=" & iSort & "&Sorted=" & "&"
iSorted = iSort
end if
end if
if iSort <> "" then
strOrderby = " order by " & iSort & sDirection
end if
'--------------------------------------
' 定义分页变量
'--------------------------------------
Dim iTotalRecords : iTotalRecords = 0 ' 分页
Dim iRecordsPerPage : iRecordsPerPage = 10
Dim iTotalPages : iTotalPages = 0
Dim iCurrentPage
'--------------------------------------
' 获取总的记录数,以便分页
'--------------------------------------
sSQL = strsql & strWhere1 & restrict & strOrderby
response.write sSQL & "<br>"
iTotalRecords = TotalRecords(dbLocal, sSQL)
if iTotalRecords = 0 then
Response.write "( 没有任何记录 )<br>"
Response.end
end if
'--------------------------------------
' 计算总页数,当前页码
'--------------------------------------
if iTotalRecords mod iRecordsPerPage = 0 then
iTotalPages = int(iTotalRecords / iRecordsPerPage)
else
iTotalPages = int(iTotalRecords / iRecordsPerPage) + 1
end if
iCurrentPage = GetParam("Page")
if IsEmpty(iCurrentPage) then
iCurrentPage = 1
end if
if Not isNumeric(iCurrentPage) then
iCurrentPage = 1
end if
iCurrentPage = CInt(iCurrentPage) ' 转化成整数再与iTotalPages比较,否则就是比较出来的结果是不正确的
if iCurrentPage > iTotalPages then
iCurrentPage = iTotalPages
end if
'-------------------------------------
' display the result
%>
<html>
<head>
<style type="text/css">
<!-- @import url(../common.css); -->
</style>
</head>
<Script Language="VBScript">
Sub OnSearch()
formSearch.name.value = Trim(formSearch.name.value)
formSearch.company_name.value = Trim(formSearch.company_name.value)
End Sub
</Script>
<body>
<center>
<%
'-------------------------------------------------------------------------------------
' 名片查询
'-------------------------------------------------------------------------------------
%>
<form name=formSearch action='list.asp' method=post>
<table cellspacing=0 cellpadding=0 border=0 align=center>
<!-- 按卡片类查询 --><!-- 按名字查询 --><!-- 按公司查询 --><!-- 按职务查询 -->
<tr>
<td class=noborder> 分类列表: </td>
<td class=noborder> 按名字查询: </td>
<td class=noborder> 按公司查询: </td>
<td class=noborder> 按职务查询: </td>
<td class=noborder> </td></tr>
<tr><td class=noborder>
<select name='card_group'>
<option value=-1 selected>全部
<%
Response.Write SelectOptions(dbLocal, "T_PersonalCardGroup", "group_id", "group_desp",card_group,"emp_serial=" & emp_serial)
%>
</select></td>
<td class=noborder> <input type=text name='name' class=RimInput value="<%=name%>"></td>
<td class=noborder> <input type=text name='company_name' class=RimInput value="<%=company_name%>"></td>
<td class=noborder>
<select name='position_id'>
<option value=-1 selected>全部
<%Response.Write SelectOptions(dbLocal, "T_Position", "Position_id", "Position_desc", position_id, "") %>
</select></td>
<td class=noborder> <input type=submit name=command value='查询' class='FlatBtn' OnClick="OnSearch()"></td></tr>
</table>
</form>
<%
'-------------------------------------------------------------------------------------
' 名片列表
'-------------------------------------------------------------------------------------
Response.Write TableHeader()
sSQL = strsql & strWhere1 & restrict & strOrderby
Response.write "<tr><td colspan=9 align=left style=""font-size:9pt;color:blue;background-color:#ffffcc;border:solid;border-width:1px;border-color:white gray gray white""> 以下是我的名片... </td></tr>"
Response.Write TableRecords( sSQL, 9, 10, iTotalRecords, iCurrentPage, iTotalPages, "list.asp", sFormParams, sSortParams)
sSQL = strsql & strWhere2 & restrict & strOrderby
Response.write "<tr><td colspan=9 align=left style=""font-size:9pt;color:blue;background-color:#ffffcc;border:solid;border-width:1px;border-color:white gray gray white""> 以下是其他人的共享名片... </td></tr>"
Response.Write TableRecords( sSQL, 9, 10, iTotalRecords, iCurrentPage, iTotalPages,"list.asp", sFormParams, sSortParams )
Response.Write TableTailer()
%>
<p>
<a href="detail.asp?command=new"><img src="../images/add.gif" border=0> 添加新名片</a>
<a href="group.asp"><img src="../images/list.gif" border=0> 名片类别管理</a>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -