productsort.asp

来自「1. 硬件环境:MS WINDOWS NT PACK 4 OR LATER /W」· ASP 代码 · 共 410 行 · 第 1/2 页

ASP
410
字号
		sortid="0"
		else
			sortname=Rsl("SortCnName")
			sortid=Rsl("SortID")
		end if
	Response.write "<tr><td width=492 align=right height=1>所属类别</td><td width=492 height=1 align=leFt><select size=1 name=DadID><option value=0>TOP类</option> <option value="&sortid&" selected>"&sortname&"</option>"
	listsort "1"
	Response.write"</select></td></tr>"
	Response.write "<input name=editid type=hidden value="&editid&">"
	rs.close
	end if
	%>
	
	<tr>
	<td width="492" align="right" height="1">指定管理用户(多用户请用","隔开)</td>
	<td width="492" height="1" align="left">
	<input type="text" name="SortMan" size="20"  maxlength="250" value=<%=SortMan%>> (包含其下所有子类<input name="ason" type="checkbox" value="Yes">)
	</td>
	</tr>
	
	</table>
	<table width="100%" border="0" cellspacing="0" cellpadding="3">
	<tr>
	<td>
	<p align="center">
	<input type="submit" name="Submit" value=" 确 定 "> <input type="BUTTON" value=" 取 消 " Onclick=Javascript:location.href='ProductSort.asp';>
	</td>
	</tr>
	</table>
	</form>
<%end sub

sub dels(id,dadid)%>
	<form method="GET"  action="?menu=dels" ><table width="100%" border="0" cellspacing="1" cellpadding="4" height="114">
	<tr align="left"> 
	<td colspan="2" height="16" align="center" width="975">删除类别<input name=menu type="hidden" value=dels><input name=id type="hidden" value=<%=id%>><input name=dadid type="hidden" value=<%=dadid%>></td>
	</tr>
	<tr> 
	<td width="492" align="right" height="19">仅删除该类:</td>
	<td width="492" height="19" align="left"> <input type="radio" value="V2" checked name="R1">
	</td>
	</tr>
	<tr> 
	<td width="492" align="right" height="19">删除该类及其所有子类和产品信息:</td>
	<td width="492" height="19" align="left"> <input type="radio" value="V3" name="R1"> <font color=#ff0000> 注意!(删除后信息将不可恢复!)</font></td>
	</tr><tr><td width="984" align="right" height="1" colspan="2"><p align="center"><input type="submit" value="确定" > <input type=button value="取消" Onclick=javascript:location.href='ProductSort.asp';></td>
	</tr>
	</table>
	</form>
	<%Response.end
end sub

sub spreads
	dim Sonsort,Product
	Set rs = Server.CreateObject("ADODB.Recordset")
	Response.write "<ol>"
	rs.open "Product_Sort",conn,1
	do while not rs.eof
		Sonsort=conn.execute("Select count(SortID)from Product_Sort where SortDad="&rs("SortID"))(0)
		Product=conn.execute("Select count(ProductID)from Product_Info where ProductSort="&rs("SortID"))(0)
	if rs("SortDad")<>0 and conn.execute("Select count(SortID)from Product_Sort where SortID="&rs("SortDad"))(0)=0 then
	Response.write "<li type=I ><b><font title="&rs("SortCnName")&"类包含"&Sonsort&"个子类,"&Product&"个产品>"&rs("SortCnName")&" ----</font></b></li><a href=?menu=addsort&DadID="&rs("SortID")&"><font color=#4880B8>[新增子类]</font></a>  <a href=?menu=edit&editID="&rs("SortID")&"><font color=#4880B8>[编辑]</font></a> <a href=AddProduct.asp?menu=sort&sortid="&rs("SortID")&"&sortname="&rs("SortCnName")&"><font color=#4880B8>[增加产品]</font></a> <a href=Management.asp?menu=ment&id="&rs("SortID")&"&sortname="&rs("SortCnName")&"><font color=#4880B8> [管理产品] </font></a> <a href=?menu=delsort&id="&rs("SortID")&"&dadid="&rs("SortDad")&"><font color=#4880B8>[删除该类]</font></a>"
	if rs("SortSon")<>0 then sort rs("SortID"),2
	end if
	rs.movenext
	loop
	Rs.Close
	Set Rs = Nothing
	Response.write "</ol>"
end sub

sub sort(id,selec)
	dim Sonsort,Product
	if selec<>"1" then
	Response.write "<ol>"
	end if
		Set rs1 = Server.CreateObject("ADODB.Recordset")
		sql="Select * From Product_Sort where SortDad="&id&" order by SortNum"
		rs1.open sql,conn,1
		do while not rs1.eof 
		Sonsort=conn.execute("Select count(SortID)from Product_Sort where SortDad="&rs1("SortID"))(0)
		Product=conn.execute("Select count(ProductID)from Product_Info where ProductSort="&rs1("SortID"))(0)
		if selec="1" then
		Response.write " <option value="&rs1("SortID")&">&nbsp;&nbsp;&nbsp;&nbsp;"&rs1("SortCnName")&"</option>"
		else
		Response.write "<li><b><font title="&rs1("SortCnName")&"类包含"&Sonsort&"个子类,"&Product&"个产品>"&rs1("SortCnName")&" ----</font></b></li> <a href=?menu=addsort&DadID="&rs1("SortID")&"><font color=#4880B8>[新增子类]</font></a>   <a href=?menu=edit&editID="&rs1("SortID")&"><font color=#4880B8>[编辑]</font></a>  <a href=AddProduct.asp?menu=sort&sortid="&rs1("SortID")&"&sortname="&rs1("SortCnName")&"><font color=#4880B8>[增加产品]</font></a> <a href=Management.asp?menu=ment&id="&rs1("SortID")&"&sortname="&rs("SortCnName")&"><font color=#4880B8> [管理产品] </font></a> <a href=?menu=delsort&id="&rs1("SortID")&"&dadid="&rs1("SortDad")&"><font color=#4880B8>[删除该类]</font></a>"
		end if
		Uid=rs1("SortID")
		if rs1("SortSon")<>0 then sort Uid,selec
		rs1.movenext
		loop
	if selec<>"1" then
	Response.write "</ol>"
	end if
end sub

sub listsort(selec)
	dim Sonsort,Product
	if selec<>"1" then	
	Response.write "<ol>"
	end if
	sql="select * From Product_Sort where SortDad=0 order by SortNum"
	Set Rs = Conn.Execute(Sql)
	do while not rs.eof
	
		Sonsort=conn.execute("Select count(SortID)from Product_Sort where SortDad="&rs("SortID"))(0)
		Product=conn.execute("Select count(ProductID)from Product_Info where ProductSort="&rs("SortID"))(0)
		if selec="1" then
		Response.write " <option value="&rs("SortID")&">&nbsp;"&rs("SortCnName")&"</option>"
		else
		Response.write "<li ><b><font title="&rs("SortCnName")&"类包含"&Sonsort&"个子类,"&Product&"个产品>"&rs("SortCnName")&" ----</font></b></li> <a href=?menu=addsort&DadID="&rs("SortID")&"><font color=#4880B8>[新增子类]</font></a>  <a href=?menu=edit&editID="&rs("SortID")&"><font color=#4880B8>[编辑]</font></a> <a href=AddProduct.asp?menu=sort&sortid="&rs("SortID")&"&sortname="&rs("SortCnName")&"><font color=#4880B8>[增加产品]</font></a> <a href=Management.asp?menu=ment&id="&rs("SortID")&"&sortname="&rs("SortCnName")&"><font color=#4880B8> [管理产品] </font></a><a href=?menu=delsort&id="&rs("SortID")&"&dadid="&rs("SortDad")&"><font color=#4880B8>[删除该类]</font></a>"
		end if
		if rs("SortSon")<>0 then sort rs("SortID"),selec
		rs.movenext
	loop
	if selec<>"1" then
	Response.write "</ol>"
	end if
end sub

sub delsort(id)
	dim delid,SortSon
	Set rs = Server.CreateObject("ADODB.Recordset")
	sql="select * From Product_Sort where SortID="&id
	rs.open sql,conn,1,3
		conn.execute("delete From Product_Info where ProductSort="&rs("SortID"))
		conn.execute("update Product_Sort set SortSon=SortSon-1 where SortID="&rs("SortDad"))
		delid=rs("SortID")
		SortSon=rs("SortSon")
		rs.delete
		if SortSon > 0 then delsoft1 delid
	error 3,"删除完成!","ProductSort.asp"
end sub


sub delsoft1(id)
	dim delid,SortSon	
		Set rs1 = Server.CreateObject("ADODB.Recordset")
		sql="select * From Product_Sort where SortDad="&id
		rs1.open sql,conn,1,3
		do while not rs1.eof
		conn.execute("delete * From Product_Info where ProductSort="&rs1("SortID"))
		conn.execute("update Product_Sort set SortSon=SortSon-1 where SortID="&rs1("SortDad"))
		delid=rs1("SortID")
		SortSon=rs1("SortSon")
		rs1.delete
		if SortSon > 0 then delsoft1 delid
		rs1.movenext
		loop
end sub

sub FsOWrite
	dim Sonsort,Product
	fs.writeline "<ol>"
	sql="select * From Product_Sort where SortDad=0 order by SortNum"
	Set rs = Conn.Execute(sql)
	do while not rs.eof
		Sonsort=conn.execute("Select count(SortID)from Product_Sort where SortDad="&rs("SortID"))(0)
		Product=conn.execute("Select count(ProductID)from Product_Info where ProductSort="&rs("SortID"))(0)
		fs.writeline  "<li><a href=?Menu=List&SortId="&rs("SortID")&">"&rs("SortCnName")&"</a> ---- [包含"&Sonsort&"个子类,"&Product&"个产品]</li> "
		if rs("SortSon")<>0 then Writesort rs("SortID"),selec
		rs.movenext
	loop
	 fs.writeline "</ol>"
	Rs.Close
end sub

sub Writesort(id,selec)
	dim Sonsort,Product
	fs.writeline "<ol>"
		sql="Select * From Product_Sort where SortDad="&id&" order by SortNum"
		Set rs1 = Conn.Execute(sql)
		do while not rs1.eof 
		Sonsort=conn.execute("Select count(SortID)from Product_Sort where SortDad="&rs1("SortID"))(0)
		Product=conn.execute("Select count(ProductID)from Product_Info where ProductSort="&rs1("SortID"))(0)
		fs.writeline  "<li><a href=?Menu=List&SortId="&rs1("SortID")&">"&rs1("SortCnName")&"</a> ---- [包含"&Sonsort&"个子类,"&Product&"个产品]</li> "
		Uid=rs1("SortID")
		if rs1("SortSon")<>0 then Writesort Uid,selec
		rs1.movenext
		loop
		fs.writeline  "</ol>"
		Rs1.Close
end sub

Sub AsLev(Sortda,SortMan)
	Set rs1 = Server.CreateObject("ADODB.Recordset")
	Sql="Select SortID,SortMan,SortSon From Product_Sort where SortDad="&Sortda
	Rs1.Open Sql,Conn,1,3
	do while not rs1.eof
	if Rs1("SortMan") = "" Then
	Rs1("SortMan")=","&SortMan&","
	Else
	Rs1("SortMan")=Rs1("SortMan")&SortMan&","
	End if
	SortSon=Rs1("SortSon")
	SortID=Rs1("SortID")
	Rs1.movenext
	if SortSon<>0 Then AsLev SortID,SortMan
	loop
	Rs1.Close
	Set Rs1 = Nothing
End Sub
%>

⌨️ 快捷键说明

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