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

📄 prod0.asp

📁 网上购物系统 asp+sql server 2005
💻 ASP
📖 第 1 页 / 共 2 页
字号:
conn.execute "delete from s_class where LarCode='"&request("LarCode")&"'" 
'同步删除该分类下的所有商品
if tree_del_yesorno="1" then
conn.execute "delete from s_produc where LarCode='"&request("LarCode")&"'" 
else
conn.execute "update s_produc set MidCode='未归类',Larcode='未归类' where larCode='"&request("larCode")&"'" 
end if


conn.close
response.write "<script language='javascript'>"
if tree_del_yesorno="1" then
response.write "alert('操作成功,所选一级分类已被删除\n\n注意:该分类下的所有商品已被同时删除。');"
else
response.write "alert('操作成功,所选一级分类已被删除\n\n注意:该分类下的所有商品已被设为未归类商品。');"
end if
response.write "location.href='prod0.asp';"	
response.write "</script>"
response.end
end sub

sub editclassok()
'编辑商品分类处理
if request("MidCode")<>"" then
 sql="select * from s_class where MidCode='"&request("MidCode")&"' and  larCode='"&request("larCode")&"'"
 text="MidCode"
elseif request("LarCode")<>"" then
 sql="select * from s_class where LarCode='"&request("LarCode")&"'"
 text="LarCode"
end if

'修改二级分类名称
if request("MidCode")<>"" then

'重名处理,检查相同的一级分类下面,是否已经有这个名称的二级分类存在
set rs=conn.execute("select * from s_class where MidCode='"&request("MidCode")&"' and  larCode='"&request("larCode")&"'")
if request("old")=request("midcode") then mGoBack "出错了,新旧名称相同,未作修改"
if not ( rs.eof and rs.bof ) then mGoBack "出错了,已经有这个名称的二级分类,请使用其它名称。"
set rs=nothing
'更新类别名称
conn.execute("update s_class set MidCode='"&trim(request("MidCode"))&"' where Midcode='"&request("old")&"' and LarCode='"&request("larcode")&"'")
'同步更新商品资料中的类别
conn.execute("update s_produc set MidCode='"&trim(request("MidCode"))&"' where Midcode='"&request("old")&"' and LarCode='"&request("larcode")&"'")
'修改一级分类名称
elseif request("LarCode")<>"" then

set rs=conn.execute("select * from s_class where larCode='"&request("larCode")&"'")
if request("old")=request("larcode") then mGoBack "出错了,新旧名称相同,未作修改"
'重名处理,检查是否已经有同名的一级分类存在
if not ( rs.eof and rs.bof ) then mGoBack "出错了,已经有这个名称的一级分类,请使用其它名称。"
set rs=nothing

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

end if
conn.close
mGoTo "prod0.asp","操作成功,商品类别由“"&request("old")&"”更新为“"&request(text)&"”"
end sub

sub editclass()
'编辑商品分类显示
if request("MidCode")<>"" then
 sql="select * from s_class where MidCode='"&request("MidCode")&"' and  larCode='"&request("larCode")&"'"
 text="MidCode"
elseif request("LarCode")<>"" then
 sql="select * from s_class where LarCode='"&request("LarCode")&"'"
 text="LarCode"
end if
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=editclassOk' 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=editclassOk' 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 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 s_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;
<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;<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

sub output()
'更新分类
    Set Fso = CreateObject("Scripting.FileSystemObject")
	set bclass=Fso.CreateTextFile(Server.MapPath("../include/class.asp"),true)
	set rs=conn.execute("select * from s_class order by LarSeq asc, MidSeq asc")
	if rs.eof and rs.bof then 
		bclass.writeline "暂无商品分类"
	else
		Do While Not rs.eof
		if rs("LarCode")<>old then
			bclass.writeline "lar:"&rs("LarCode")
		end if
			bclass.writeline rs("MidCode")
			old=rs("LarCode")
		rs.movenext
		if rs.eof then exit do
		Loop
	end if
	set rs=nothing

	bclass.close
    set fso=nothing

	mGoTo "prod0.asp","操作成功,商品类别已更新,首页将显示更新后的商品分类。"
end sub

sub views()
if request("midcode")<>"" then
sql="select * from s_produc where ProdId is not null and larcode='"&request("larcode")&"' and midcode='"&request("midcode")&"'"
else
sql="select * from s_produc where ProdId is not null and larcode='"&request("larcode")&"'"
end if
session("sql")=sql
Response.Redirect("prod1.asp")
end sub
%>

⌨️ 快捷键说明

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