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

📄 ccard_g.inc

📁 物业管理和办公自动化系统
💻 INC
字号:
<%
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, "group_desp", "类别名称", 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 iCardGroupId, sCardGroupDesp
	dim sColor	

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

		if sCardGroupDesp = sGroupDesp then		'' 如果是选中的纪录,显示不同的颜色,这里指定红色
				sColor = "red"
		else
				sColor = "black"
		end if
		sTemp = sTemp & "<tr bgcolor=white>" & _
				"<td class=tdlist title=""" & sCardGroupDesp & """ style=""cursor:hand;color:" & sColor & """ onclick=""javascript:location.href='ccard_g.asp?group_id=" & iCardGroupId & "';"">&nbsp;<img src=""../images/bg/ar-g.gif"" width=8 height=8>&nbsp;" & Bref(sCardGroupDesp,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(pGroupId) 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=""ccard_g.asp"">" & vbLF & _
		"<input type=""hidden"" name=""FormAction"">" & vbLF & _
		"<input type=""hidden"" name=""group_id"" value=""" & pGroupId & """>" & 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=""group_desp"" value=""" & sGroupDesp & """ 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=""ccard_g.asp"">新增单位名录类别</a>" & _
		"		&nbsp;" & _
		"		<img src=""../images/goto.gif"">&nbsp;<a href=""ccard_e.asp"">新建单位名录</a>" & _
		"		&nbsp;" & _
		"		<img src=""../images/goto.gif"">&nbsp;<a href=""ccard_l.asp"">单位名录查询</a>" & _
		"		&nbsp;" & _
		"		<img src=""../images/goto.gif"">&nbsp;<a href=""pcard_l.asp"">我的个人通讯录</a></td>" & _
		"</tr>" & _
		"</table>"
End Function


sub AddGroup()
	dim sSQL, iRows
	sGroupDesp = Trim(sGroupDesp)

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

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

sub UpdateGroup()
	dim sSQL, iRows
	sGroupDesp = Trim(sGroupDesp)

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

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

sub DeleteGroup()
	dim sSQL, iRows

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

⌨️ 快捷键说明

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