📄 searchmgr.inc
字号:
<%
'################################################################################################
'#
'# 文件名 : searchmgr.inc
'#
'#
'# 创建人 : zhouyun
'# 日 期 : 2002-05-13
'#
'# 修改历史 : ****年**月**日 ****** 修改内容:**************************************************
'#
'# 功能描述 : 制度查询管理函数文件
'# 版 本 :
'#
'# Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
'#
'################################################################################################
'***************************************************************************************************
' Name : InfoMaintain
' Function : Insert, Modify, Delete According to the Post Action
' In : No
' Out : No
' Return : No
' Comment : No
'
'---------------------------------------------------------------------------------------------------
Sub InfoMaintain()
'-------------------------------------------------------
'Declares
'-------------------------------------------------------
Dim sNameOld, sNameNew, sAction, sSQL, sError,id,sDeptNew,sTimeNew,sStartNew,sEndNew,sTypeNew
'-------------------------------------------------------
'Get parameters
'--------------------------------------------------------
id = GetParam("id")
sAction = GetParam("formAction")
sAction = LCase(sAction)
'---------------------------------------------------------
' Operate according to sAction
'---------------------------------------------------------
Select Case sAction
Case "addtype"
'--------------------------------
' add ---- insert
'--------------------------------
sNameNew = GetParam("newname")
sDeptNew = GetParam("newdept")
sTimeNew = GetParam("newtime")
sStartNew = GetParam("newstart")
sEndNew = GetParam("newend")
sTypeNew = GetParam("newtype")
sSQL = "insert into T_Rule_Info (name,dept,settime,starttime,endtime,type) values(" & _
ToSQL(sNameNew,"Text") & "," & ToSQL(sDeptNew,"Text") & "," & ToSQL(sTimeNew,"Text") & "," & _
ToSQL(sStartNew,"Text") & "," &ToSQL(sEndNew,"Text") & "," & ToSQL(sTypeNew,"Text") & ")"
Case "updtype"
'------------------------------
' upd --- modify
'------------------------------
sDeptNew = GetParam("newdept")
sTimeNew = GetParam("newtime")
sStartNew = GetParam("newstart")
sEndNew = GetParam("newend")
sNameNew = GetParam("newname")
sTypeNew = GetParam("newtype")
sSQL = "update T_Rule_Info set name=" & ToSQL(sNameNew, "Text") & ", dept=" & ToSQL(sDeptNew,"Text") & ", settime=" & ToSQL(sTimeNew,"Text") & _
", starttime=" & ToSQL(sStartNew,"Text") & ", endtime=" &ToSQL(sEndNew,"Text") & ", type=" & ToSQL(sTypeNew,"Text") & " where sn =" & ToSQL(id, "Number")
Case "deltype"
'-------------------------------
' del --- delete
'-------------------------------
sSQL = "delete from T_Rule_Info where sn =" & ToSQL(id, "Number")
End Select
sError = ExecuteSQL(dbLocal, sSQL)
'-----------------------------------------
' error handling
'-----------------------------------------
if sError <> "" then
if sAction = "addtype" then
Response.Write "<script language=""javascript"">alert('对不起,制度名称已存在,不能重复新增!')</script>"
exit sub
end if
if sAction = "deltype" then
Response.Write "<script language=""javascript"">alert('对不起,制度名称下存在制度,不能删除该名称!')</script>"
exit sub
end if
Response.Write "<script language=""javascript"">alert('对不起,操作中发生错误,请查阅帮助文件!')</script>"
end if
End Sub
'***************************************************************************************************
'***************************************************************************************************
' Name : TableAdd
' Function : Form Table to Implement Insert, Modify, Delete According to the Post Action
' In : No
' Out : No
' Return : Table Add, Modify, Delete
' Comment : No
'
'---------------------------------------------------------------------------------------------------
Function TableAdd()
'---------------------------------------------------
' declares
'---------------------------------------------------
Dim sNameText,sFormName, sTemp,id,sDeptText,sTimeText,sStartText,sEndText,sTypeText
'---------------------------------------------------
' get parameters
'---------------------------------------------------
id = GetParam("id")
'---------------------------------------------------
' construct a table contains all buttons
'---------------------------------------------------
sTemp = "<td width=300><table width=300 cellspacing=0 cellpadding=0 border=0><tr><td width=300 align=center>"
'---------------------------------------------------
' show buttons
'---------------------------------------------------
If IsEmpty(id) Then
' --------------------------------
' add
'---------------------------------
sNameText = ""
sDeptText = ""
sTimeText = Date
sStartText = Date
sEndText = Date
sTypeText = ""
sTemp = sTemp & _
"<span id=btnAdd style=""cursor:hand"" title=""制度信息,点击新增按钮""><img border=0 src=""../images/button/add.gif"" style=""vertical-align:bottom""></span>" & _
" " & _
"<span id=btnClear style=""cursor:hand"" title=""清空""><img border=0 src=""../images/button/clear.gif"" style=""vertical-align:bottom""></span>"
Else
'----------------------------------
' upd and del
'----------------------------------
Dim crs : Set crs = New CRecordset
Dim sSQL : sSQL = "select name,dept,settime,starttime,endtime,type,path from T_Rule_Info where sn=" & ToSQL(id, "Number")
Dim rs : Set rs = crs.open(dbLocal,sSQL)
While Not rs.EOF
sNameText = crs.GetValue("name")
sDeptText = crs.GetValue("dept")
sTimeText = crs.GetValue("settime")
sStartText = crs.GetValue("starttime")
sEndText = crs.GetValue("endtime")
sTypeText = crs.GetValue("type")
rs.movenext
Wend
crs.Close()
sTemp = sTemp & _
"<span id=btnMod style=""cursor:hand"" title=""修改制度名称,点击更新按钮""><img border=0 src=""../images/button/update.gif"" style=""vertical-align:bottom""></span>" & _
" " & _
"<span id=btnDel style=""cursor:hand"" title=""点击删除按钮删除制度名称""><img border=0 src=""../images/button/delete.gif"" style=""vertical-align:bottom""></span>" & _
" " & _
"<span id=btnRes style=""cursor:hand"" title=""重置""><img border=0 src=""../images/button/reset.gif"" style=""vertical-align:bottom""></span>" & _
" " & _
"<span id=btnCancel style=""cursor:hand"" title=""取消""><img border=0 src=""../images/button/cancel.gif"" style=""vertical-align:bottom""></span>"
End If
sTemp = sTemp & "</td></tr></table></td>"
'----------------------------------------------------
' draw add table and return
'----------------------------------------------------
TableAdd = _
TableTitle("制度信息", 300, "", "") & _
"<table cellspacing=0 cellpadding=0 width=300 align=left border=0>" & _
"<form name=frmInfoMgr method=post action=""infomgr.asp"">" & _
"<tr height=60 valign=center>" & _
" <td width=300 align=center colspan=3><br>" & _
" 制度名称:<input type=text name=newname value='" & sNameText & "' maxlength=50><br><BR>" & _
" 制定部门:<input type=text name=newdept value='" & sDeptText & "' maxlength=50><br><BR>" & _
" 制度类别:<select name=newtype maxlength=50>" & SelectOptions(dblocal, "t_rule_types", "type", "type", sTypeText, "") & "</select><BR><BR>" & _
"" & DrawCal("有效起始日期", sStartText, "newstart", "dateimg1") & "<br><BR>" & _
"" & DrawCal("有效终止日期", sEndText, "newend", "dateimg2") & "<br><BR>" & _
"" & DrawCal("制 定 日 期", sTimeText, "newtime", "dateimg3") & "<br><BR>" & _
" <input type=hidden name=id value='" & id & "'>" & _
" <input type=hidden name=formAction>" & _
" </td>" & _
" </tr>" & _
"<tr height=40 align=center>" & _
sTemp & _
"</tr>" & _
"<tr height=10><td colspan=3 width=300> </td></tr>" & _
"</form>" & _
"</table>"
End Function
'***************************************************************************************************
'***************************************************************************************************
' Name : TableHeader
' Function : Table head for Record Table
' In : No
' Out : No
' Return : Table head of table record
' Comment : No
'
'---------------------------------------------------------------------------------------------------
Function TableHeader()
sFileName = "searchmgr.asp"
TableHeader = _
TableTitle("系统制度查询列表", 600, "", "#0040a0") & _
"<table cellspacing=0 cellpadding=0 width=600 align=center class=tablelist>" & _
"<tr>" & _
"<td class=tdHead align=center width=130>" & TableHeaderField(sFileName, "name", "制度名称", sFormParams, iSort, iSorted) & "</td>" & _
"<td class=tdHead align=center width=100>" & TableHeaderField(sFileName, "type", "制度类别", sFormParams, iSort, iSorted) & "</td>" & _
"<td class=tdHead align=center width=90>" & TableHeaderField(sFileName, "starttime", "有效起始期", sFormParams, iSort, iSorted) & "</td>" & _
"<td class=tdHead align=center width=90>" & TableHeaderField(sFileName, "endtime", "有效终止期", sFormParams, iSort, iSorted) & "</td>" & _
"<td class=tdHead align=center width=90>" & TableHeaderField(sFileName, "settime", "制定日期", sFormParams, iSort, iSorted) & "</td>" & _
"</tr>"
End Function
'***************************************************************************************************
' "<td class=tdHead align=center width=100>" & TableHeaderField(sFileName, "dept", "制定部门", sFormParams, iSort, iSorted) & "</td>" & _
'***************************************************************************************************
' Name : TableRecords
' Function : Table List the Records
' In : 9 parameters
' sSQL --- sql statement
' iCols --- columns
' iRecordsPerPage --- records per page
' iTotalRecords --- total records
' iCurrentPage --- current page
' iTotalPages --- total pages
' sFileName --- file name
' sFormParams --- form parameters
' sSortParam --- sort parameters
' Out : No
' Return : Table head of table record
' Comment : No
'
'---------------------------------------------------------------------------------------------------
Function TableRecords(sSQL, iCols, iRecordsPerPage, iTotalRecords, iCurrentPage, iTotalPages, sFileName, sFormParams, sSortParams)
'-------------------------------------------------------------
' declares
'-------------------------------------------------------------
Dim sTemp : sTemp = "" ' 临时字符串变量
Dim j ' 临时循环变量
Dim iCounter : iCounter = 1
Dim iPrevPage, iNextPage
Dim crs : Set crs = New CRecordset
Dim rs : Set rs = crs.open(dbLocal,sSQL)
Dim sRuleName,sRuleSN,sRuleStart,sRuleEnd,sRuleSet,sRuleDept,sRuleType
dim cc,id
cc = "black"
id = GetParam("id")
'--------------------------------------------------------------
' 如果未到记录尾,将记录定位到你翻到的页面的第一个记录,否则显示空行
'---------------------------------------------------------------
if Not rs.EOF then
rs.Move (iCurrentPage - 1) * iRecordsPerPage
end if
'--------------------------------------------------
' write the record list table
'--------------------------------------------------
while not rs.EOF and iCounter <= iRecordsPerPage
sRuleName = crs.GetValue("name")
sRuleSN = crs.GetValue("sn")
sRuleStart = crs.GetValue("starttime")
sRuleEnd = crs.GetValue("endtime")
sRuleSet = crs.GetValue("settime")
sRuleDept = crs.GetValue("dept")
sRuleType = crs.GetValue("type")
If CInt(sRuleSN) = CInt(id) Then
cc = "blue"
Else
cc = "black"
End If
sTemp = sTemp & "<tr valign=center>" & _
"<td class=tdlist align=left width=130 title='" & sRuleName & "' style=""cursor:hand;color:"& cc &""" onclick=""javascript:location.href='../rulemgr/searchmgr.asp?id=" & sRuleSN & "';""><img src=""../images/bg/ar-g.gif"" width=8 height=8> " & ToHtml(Bref(sRuleName,9)) & "</td>" & _
"<td class=tdlist width=100 title='" & sRuleType & "' style="";color:"& cc &""">" & ToHtml(Bref(sRuleType,25)) & " </td>" & _
"<td class=tdlist width=90 title='" & sRuleStart & "' style="";color:"& cc &""">" & sRuleStart & "</td>" & _
"<td class=tdlist width=90 title='" & sRuleEnd & "' style="";color:"& cc &""">" & sRuleEnd & "</td>" & _
"<td class=tdlist width=90 title='" & sRuleSet & "' style="";color:"& cc &""">" & sRuleSet & "</td>" & _
"</tr>"
iCounter = iCounter + 1
rs.movenext
wend
crs.Close()
'------------------------------------------------
' 填补空白行
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -