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

📄 prod0.asp

📁 是一套很好的数码购物系统
💻 ASP
📖 第 1 页 / 共 2 页
字号:
set rs=nothing

'更新类别名称
conn.execute("update buyok_class set LarCode='"&trim(request("LarCode"))&"' where LarCode='"&request("old")&"'")
'同步更新商品资料中的类别
conn.execute("update buyok_produc set LarCode='"&trim(request("LarCode"))&"' where LarCode='"&request("old")&"'")

end if
conn.close

response.write "<script language='javascript'>"
response.write "alert('操作成功,商品类别由“"&request("old")&"”更新为“"&request(text)&"”');"
response.write "location.href='prod0.asp';"
response.write "</script>"
response.end
else
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if text="MidCode" then
%>
<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px" bordercolor="#333333" cellspacing="0" cellpadding="2">
<form name=editform action='prod0.asp?action=editclass' method=post>
<tr><td colspan=2 class=td height=18>编辑二级分类名称</td></tr>
<tr><td width=20% height=25 align=center>一级分类名称</td><td> <%=request("larCode")%> </td></tr>
<tr><td width=20% height=25 align=center>二级分类名称</td><td><INPUT TYPE='text' NAME=MidCode size=20 maxlength=20 value='<%=rs("MidCode")%>'>[请勿输入<font color=red>% &quot; ' &amp; + = \</font>等禁用字符]</td></tr>
<tr><td colspan=2><INPUT TYPE='hidden' name=old value='<%=rs("MidCode")%>'><INPUT TYPE='hidden' name="larcode" value='<%=rs("larcode")%>'><INPUT TYPE='hidden' name=edit value=ok><INPUT TYPE='submit' name=submit value='保存修改'>
</td></tr>
</form>
</table>
<%
end if
if text="LarCode" then
%>
<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px" bordercolor="#333333" cellspacing="0" cellpadding="2">
<form name=editform action='prod0.asp?action=editclass' method=post>
<tr><td colspan=2 class=td height=18>编辑一级分类名称</td></tr>
<tr><td width=20% height=25 align=center>一级分类名称</td><td><INPUT TYPE='text' NAME=LarCode size=20 maxlength=20 value='<%=rs("LarCode")%>'>[请勿输入<font color=red>% &quot; ' &amp; + = \</font>等禁用字符]</td></tr>
<tr><td colspan=2><INPUT TYPE='hidden' name=old value='<%=rs("LarCode")%>'><INPUT TYPE='hidden' name=edit value=ok><INPUT TYPE='submit' name=submit value='提交'>
</td></tr>
</form>
</table>
<%
end if
rs.close
set rs=nothing
end if
end sub


sub showclass()
'分类管理首页
%>
<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px" bordercolor="#333333" cellspacing="0" cellpadding="2">
<tr><td colspan=2 class=td height=18>商品分类管理</td></tr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from buyok_class order by LarSeq asc, MidSeq asc"
rs.open sql,conn,1,3
dim old
if rs.eof and rs.bof then 
response.Redirect "prod0.asp?action=addLarclass"
else
Do While Not rs.eof
if rs("LarCode")<>old then    '判断另一个一级分类,old的值在二级分类列表后赋值
%>
<tr><td width=50% height=30>&nbsp;<img border=0 src=../images/admin/small_left.gif>&nbsp;<font color=red><b><%=rs("LarCode")%></b></font>
<a alt="在<font color=red> <%=rs("LarCode")%> </font>下添加二级分类" href='prod0.asp?action=addMidclass&LarCode=<%=rs("LarCode")%>'>(添加二级分类)</a></td>
<td> <u alt="编辑 <font color=red><%=rs("LarCode")%></font> 的名称" style="cursor:hand" onclick="{location.href='prod0.asp?action=editclass&LarCode=<%=rs("LarCode")%>';}">编辑</u>&nbsp;&nbsp;<a href='prod0.asp?action=larup&larcode=<%=rs("LarCode")%>'><img border=0 src=../images/admin/small_up1.gif alt='一级向上移动'></a>&nbsp;&nbsp;<a href='prod0.asp?action=lardown&larcode=<%=rs("LarCode")%>'><img border=0 src=../images/admin/small_down1.gif alt='一级分类向下移动'></a>&nbsp;&nbsp;<u 
<%if tree_del_yesorno="1" then%>
alt="删除 <font color=red><%=rs("LarCode")%></font> 分类<br>注意:此操作将同时删除该分类下的全部商品<br>提示:您可到 <font color=red>参数设置</font> 中去看看……" 
<%else%>
alt="删除 <font color=red><%=rs("LarCode")%></font> 分类<br>注意:删除分类后,所属商品将转为未归类商品<br>提示:您可到 <font color=red>参数设置</font> 去看看……" 
<%end if%>
style="cursor:hand" value="删除" onclick="{if(confirm('注意:该操作不可恢复!\n\n确实删除所选一级分类吗?')){location.href='prod0.asp?action=delLarclass&LarCode=<%=rs("LarCode")%>';}}">删除</u>   &nbsp; <a href='prod0.asp?action=view&larcode=<%=rs("LarCode")%>' alt="浏览<font color=red> <%=rs("LarCode")%> </font>分类下的全部商品">浏览</a>
<%if addlar<>"no" then response.write "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=prod0.asp?action=addLarclass><font color=blue><b>添加一级分类</b></font></a>"%></td></tr>
<%
addlar="no"
end if
%>
<tr><td width=50% height=25>&nbsp;&nbsp;&nbsp;&nbsp;<font color=#0066cc>
<b><%=rs("MidCode")%></b></font></td>
<td><u alt="修改 <font color=red><%=rs("MidCode")%></font> 的名称" style="cursor:hand" onclick="{location.href='prod0.asp?action=editclass&MidCode=<%=rs("MidCode")%>&larcode=<%=rs("LarCode")%>';}">修改</u>&nbsp;&nbsp;<a href='prod0.asp?action=midup&MidCode=<%=rs("MidCode")%>&larcode=<%=rs("LarCode")%>'><img border=0 src=../images/admin/small_up2.gif alt='二级分类向上移动'></a>&nbsp;&nbsp;<a href='prod0.asp?action=middown&MidCode=<%=rs("MidCode")%>&larcode=<%=rs("LarCode")%>'><img border=0 src=../images/admin/small_down2.gif alt='二级分类向下移动'></a>&nbsp;&nbsp;<u 
<%if tree_del_yesorno="1" then%>
alt="删除 <font color=red><%=rs("MidCode")%></font> 分类<br>注意:此操作将同时删除该分类下的全部商品<br>提示:您可到 <font color=red>参数设置</font> 中去看看……" 
<%else%>
alt="删除 <font color=red><%=rs("MidCode")%></font> 分类<br>注意:删除分类后,所属商品将转为未归类商品<br>提示:您可到 <font color=red>参数设置</font> 去看看……" 
<%end if%>
style="cursor:hand" onclick="{if(confirm('注意:该操作不可恢复!\n\n确实删除所选二级分类吗?')){location.href='prod0.asp?action=delMidclass&MidCode=<%=rs("MidCode")%>&larcode=<%=rs("LarCode")%>';}}">删除</u> &nbsp; <a href='prod0.asp?action=view&MidCode=<%=rs("MidCode")%>&larcode=<%=rs("LarCode")%>' alt="浏览<font color=red> <%=rs("MidCode")%> </font>分类下的全部商品">浏览</a>
</td></tr>
<%
old=rs("LarCode")
rs.movenext
if rs.eof then exit do
Loop
end if
response.write "<tr><td colspan=2><input type='button' onClick=""javascript:location.href='prod0.asp?action=output';"" value='更新分类' alt='修改分类后,请更新分类'></td></tr>"
rs.close
set rs=nothing
end sub

'二级分类向上提升
if action="midup" then
LarCode=request("LarCode")
MidCode=request("MidCode")
dim i,mid(100)
i=0
set rs=server.createobject("adodb.recordset")
sql="select * from buyok_class where larcode='"&larcode&"' order by MidSeq asc"
rs.open sql,conn,1,3
do while not rs.eof
i=i+1
if rs("midcode")=midcode then G=i
if rs.eof then exit do
rs.movenext
loop
rs.movefirst
i=0
do while not rs.eof
i=i+1
if i=g-1 then
rs("midseq")=i+1
elseif i>1 and i=g then
rs("midseq")=i-1
else
rs("midseq")=i
end if
rs.update
if rs.eof then exit do
rs.movenext
loop
response.Redirect "prod0.asp"
rs.close
set rs=nothing
end if

'二级分类向下降
if action="middown" then
LarCode=request("LarCode")
MidCode=request("MidCode")
i=0
set rs=server.createobject("adodb.recordset")
sql="select * from buyok_class where larcode='"&larcode&"' order by MidSeq asc"
rs.open sql,conn,1,3
do while not rs.eof
i=i+1
if rs("midcode")=midcode then G=i
if rs.eof then exit do
rs.movenext
loop
rs.movefirst
i=0
do while not rs.eof
i=i+1
if i=g then
rs("midseq")=i+1
elseif i=g+1 then
rs("midseq")=i-1
else
rs("midseq")=i
end if
rs.update
if rs.eof then exit do
rs.movenext
loop
response.Redirect "prod0.asp"
rs.close
set rs=nothing
end if

'一级分类向上提升
if action="larup" then
LarCode=request("LarCode")
i=0
set rs=server.createobject("adodb.recordset")
sql="select * from buyok_class order by LarSeq asc, MidSeq asc"
rs.open sql,conn,1,3
old=""
do while not rs.eof
if rs("larcode")<>old then i=i+1
if rs("larcode")=larcode then
G=i
exit do
end if
if rs.eof then exit do
old=rs("larcode")
rs.movenext
loop
rs.movefirst
i=0
old=""
do while not rs.eof
if rs("larcode")<>old then i=i+1
if i=g-1 then
rs("larseq")=i+1
elseif i>1 and i=g then
rs("larseq")=i-1
else
rs("larseq")=i
end if
rs.update
if rs.eof then exit do
old=rs("larcode")
rs.movenext
loop
response.Redirect "prod0.asp"
rs.close
set rs=nothing
end if

'一级分类向下降
if action="lardown" then
LarCode=request("LarCode")
i=0
set rs=server.createobject("adodb.recordset")
sql="select * from buyok_class order by LarSeq asc, MidSeq asc"
rs.open sql,conn,1,3
old=""
do while not rs.eof
if rs("larcode")<>old then i=i+1
if rs("larcode")=larcode then
G=i
exit do
end if
if rs.eof then exit do
old=rs("larcode")
rs.movenext
loop
rs.movefirst
i=0
old=""
do while not rs.eof
if rs("larcode")<>old then i=i+1
if i=g then
rs("larseq")=i+1
elseif i=g+1 then
rs("larseq")=i-1
else
rs("larseq")=i
end if
rs.update
if rs.eof then exit do
old=rs("larcode")
rs.movenext
loop
response.Redirect "prod0.asp"
rs.close
set rs=nothing
end if

'更新分类
if action="output" then

    Set Fso = CreateObject("Scripting.FileSystemObject")
	set buyok_class=Fso.CreateTextFile(Server.MapPath("../include/buyok_class.asp"),true)


	set rs=conn.execute("select * from buyok_class order by LarSeq asc, MidSeq asc")
	if rs.eof and rs.bof then 
		buyok_class.writeline "暂无商品分类"
	else
		Do While Not rs.eof
		if rs("LarCode")<>old then
			buyok_class.writeline "lar:"&rs("LarCode")
		end if
			buyok_class.writeline rs("MidCode")
			old=rs("LarCode")
		rs.movenext
		if rs.eof then exit do
		Loop
	end if
	set rs=nothing

	buyok_class.close
    set fso=nothing

response.write "<script language='javascript'>"
response.write "alert('操作成功,商品类别已更新,首页将显示更新后的商品分类。');"
response.write "location.href='prod0.asp';"
response.write "</script>"
response.end
end if

if action="view" then
if request("midcode")<>"" then
sql="select * from buyok_produc where ProdId is not null and larcode='"&request("larcode")&"' and midcode='"&request("midcode")&"'"
else
sql="select * from buyok_produc where ProdId is not null and larcode='"&request("larcode")&"'"
end if
response.cookies("buyok")("sql")=sql
Response.Redirect("prod1.asp")
end if
%>

⌨️ 快捷键说明

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