⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 booktype.inc

📁 物业管理和办公自动化系统
💻 INC
字号:
<%
'#############################################################################################
'#
'#	文件名	 : booktype.inc
'#	Copyright(c) 2001-2002 上海阿尔卡特网络支援系统有限公司
'#
'#	创建人	 : BinZha
'#  日 期	 : 2002-07-19
'#
'#	修改历史  : ****年**月**日 ****** 修改内容:**********************************************
'#
'#	功能描述	 : 图书分类管理函数文件
'#  版   本	 :
'#
'#############################################################################################

Function ListTableHeader()
	ListTableHeader = _
		"<table cellspacing=0 cellpadding=0 width=300 align=center class=tablelist>" & _
		"<tr><td colspan=" & iCols & " bgcolor=""#0040a0"" align=center style=""color:white;font-weight:600"" height=20 >图书类别列表</td></tr>" & _
		"<tr><td class=tdHead width=300>&nbsp;<img src=""../images/bg/ar-y.gif"" width=8 height=8>&nbsp;" & TableHeaderField(sFileName, "title", "类别名称", sFormParams, iSort, iSorted) & "</td>" & _
		"</tr>"
End Function

Function ListTableTailer()
	ListTableTailer = "</table>"
End Function

Function ListTableRecords(sSQL, iCols, iRecordsPerPage, iTotalRecords, iCurrentPage, iTotalPages, sFileName, sFormParams, sSortParams)
	dim sTemp				: sTemp = ""	' 临时字符串变量
	dim j					' 临时循环变量
'	response.write sSQL : response.end
	'------------------------------------
	' 分页所需的变量定义
	'------------------------------------
	Dim iCounter			: iCounter = 1
	Dim iPrevPage, iNextPage
	
	'------------------------------------
	' 获取数据库连接
	'------------------------------------
	dim crs					: set crs = New CRecordset
	dim rs					: set rs = crs.open(dbLocal,sSQL)
	dim iTypeId, sTypeTitle
	dim sColor	

	' 如果未到记录尾,将记录定位到你翻到的页面的第一个记录,否则显示空行
	if Not rs.EOF then	
		rs.Move (iCurrentPage - 1) * iRecordsPerPage
	end if
	while not rs.EOF and iCounter <= iRecordsPerPage
		iTypeId				= crs.GetValue("id")
		sTypeTitle			= crs.GetValue("title")

		if sTypeTitle = sType then		'' 如果是选中的纪录,显示不同的颜色,这里指定红色
				sColor = "red"
		else
				sColor = "black"
		end if
		sTemp = sTemp & "<tr bgcolor=white>" & _
				"<td class=tdlist title=""" & sTypeTitle & """ style=""cursor:hand;color:" & sColor & """ onclick=""javascript:location.href='booktype.asp?id=" & iTypeId & "';"">&nbsp;<img src=""../images/bg/ar-g.gif"" width=8 height=8>&nbsp;" & Bref(sTypeTitle,18) & "&nbsp;</td>" & _
				"</tr>"
		iCounter = iCounter + 1
		rs.movenext
	wend
	crs.Close()

	' 填补空白行
	sTemp = sTemp & WhiteRows(iCols, iCounter, iRecordsPerPage)

	' 首页、前页、后页、尾页等分页信息
	sTemp = sTemp & "<tr bgcolor=white><td class=tdlist colspan=" & iCols & " align=right>" & _
				Paginate(sFileName, sFormParams, sSortParams, iCurrentPage, iTotalPages) & _
				"&nbsp;</td></tr>"

	ListTableRecords = sTemp
End Function


Function FormTable()
	dim sTitle, sActionLinks
	if IsEmpty(iGroupId) then
		sTitle = "新增图书类别"			'' 显示新增、取消的链接
		sActionLinks = _
				"<tr bgcolor=white height=30>" & vbLF & _
				"	<td colspan=8 align=center>" & vbLF & _
				"		<img border=0 src=""../images/button/add.gif"" onclick=""btnAdd_OnClick()"" style=""cursor:hand"">" & vbLF & _
				"		&nbsp;&nbsp;&nbsp;&nbsp;" & vbLF & _
				"		<img border=0 src=""../images/button/clear.gif"" onclick=""btnClear_OnClick()"" style=""cursor:hand"">" & vbLF & _
				"	</td>" & vbLF & _
				"</tr>" & vbLF
	else
		sTitle = "重命名图书类别"			'' 显示修改、删除、取消的链接
		sActionLinks = _
				"<tr bgcolor=white height=30>" & vbLF & _
				"	<td colspan=8 align=center>" & vbLF & _
				"		<img border=0 src=""../images/button/update.gif"" onclick=""btnUpdate_OnClick()"" style=""cursor:hand"">" & vbLF & _
				"		&nbsp;&nbsp;&nbsp;&nbsp;" & vbLF & _
				"		<img border=0 src=""../images/button/delete.gif"" onclick=""btnDelete_OnClick()"" style=""cursor:hand"">" & vbLF & _
				"		&nbsp;&nbsp;&nbsp;&nbsp;" & vbLF & _
				"		<img border=0 src=""../images/button/cancel.gif"" onclick=""btnCancel_OnClick()"" style=""cursor:hand"">" & vbLF & _
				"	</td>" & vbLF & _
				"</tr>" & vbLF
	end if

	FormTable = _
		"<table cellspacing=1 cellpadding=0 bgcolor=white border=0 width=300 height=""100%"">" & vbLF & _
		"<form method=post name=frmGroupMgr action=""booktype.asp"">" & vbLF & _
		"<input type=""hidden"" name=""FormAction"">" & vbLF & _
		"<input type=""hidden"" name=""id"" value=""" & iGroupId & """>" & vbLF & _
		"<tr height=20>" & vbLF & _
		"		<td colspan=2 background=""../images/bg/bnbg.gif"" style=""color:white;font-weight:600"" align=center>" & sTitle & "</td></tr>" & vbLF & _
		"<tr height=20><td></td></tr>" & vbLF & _
		"<tr bgcolor=""#FFFFFF"" height=60>" & vbLF & _
		"		<td width=80 align=right>类别名称:</td>" & _
		"		<td><input type=""text"" name=""type"" value=""" & sType & """ size=31 maxlength=10></td></tr>" & vbLF & _
		sActionLinks & vbLF & _
		"<tr height=166><td></td></tr>" & vbLF & _
		"</form>" & _
		"</table>" & vbLF & _
		""
End Function

Function TableLink()
	TableLink = _
		"<table width=600 cellspacing=0 cellpadding=0 border=0 align=center>" & _
		"<tr height=10>" & _ 
		"	<td width=600><img src=""../images/bg/line.gif"" width=600 height=3></td>" & _
		"</tr>" & _
		"<tr height=20>" & _
		"	<td width=600>&nbsp;" & _
		"		<img src=""../images/goto.gif"">&nbsp;<a href=""booktype.asp"">新增图书类别</a>" & _
		"		&nbsp;" & _
		"		<img src=""../images/goto.gif"">&nbsp;<a href=""booklist.asp"">图书列表</a></td>" & _
		"</tr>" & _
		"</table>"
End Function


sub AddType()
	dim sSQL, iRows
	sType = Trim(sType)

	'' 类别名称不能为空
	if sType = "" then
		Response.Write _
				"<script language=""javascript"">" & vbLF & _
				"		alert(""对不起,请输入图书类别名称"");" & vbLF & _
				"</script>" & vbLF
		exit sub
	end if

	'' 检查是否存在重复的类别名称
	iRows = DLookUp(dbLocal, "t_library_type", "count(*)", "title =" & ToSQL(sType, "Text"))
	if iRows > 0 then
		Response.Write _
				"<script language=""javascript"">" & vbLF & _
				"		alert(""对不起,已经存在名称为“" & sType & "”的类别,类别名称不能重复!"");" & vbLF & _
				"</script>" & vbLF
		exit sub
	end if
	sSQL = "insert into t_library_type(title) values(" & ToSQL(sType, "Text") & ")"
	call ExecuteSQL(dbLocal, sSQL)
	iGroupId = empty		'' 重新置成新增状态
	sType = ""
end sub

sub UpdateType()
	dim sSQL, iRows
	sType = Trim(sType)

	'' 类别名称不能为空
	if sType = "" then
		Response.Write _
				"<script language=""javascript"">" & vbLF & _
				"		alert(""对不起,请输入图书类别名称"");" & vbLF & _
				"</script>" & vbLF
		exit sub
	end if

	'' 检查是否存在重复的类别名称
	iRows = DLookUp(dbLocal, "t_library_type", "count(*)", "title=" & ToSQL(sType, "Text") & " and id<>" & ToSQL(iGroupId,"Number"))
	if iRows > 0 then
		Response.Write _
				"<script language=""javascript"">" & vbLF & _
				"		alert(""对不起,类别名称不能重复!"");" & vbLF & _
				"</script>" & vbLF
		exit sub
	end if
	sSQL = "update t_library_type set Title = " & ToSQL(sType, "Text") & " where id = " & ToSQL(iGroupId, "Number")
	call ExecuteSQL(dbLocal, sSQL)
	iGroupId = empty
	sType = ""
end sub

sub DeleteType()
	dim sSQL, iRows

	'' 检查是否存在重复的类别名称
	iRows = DLookUp(dbLocal, "t_library", "count(*)", "typeid =" & ToSQL(iGroupId, "Number"))
	if iRows > 0 then
		Response.Write _
				"<script language=""javascript"">" & vbLF & _
				"		alert(""对不起,您必须先删除所有属于“" & sType & "”类别的图书信息后才能删除该类别!"");" & vbLF & _
				"</script>" & vbLF
		exit sub
	end if
	sSQL = "delete from t_library_type where id = " & ToSQL(iGroupId, "Number")
	call ExecuteSQL(dbLocal, sSQL)
	iGroupId = empty		'' 重新置成新增状态
	sType = ""
end sub
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -