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

📄 prod0.asp

📁 网上购物系统 asp+sql server 2005
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!--#include file="../include/dbopenbd.asp"-->
<!--#include file="checkadmin.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
</head>
<BODY background="../images/admin/back.gif">
<%
action = request("action")
if action="" then
call showclass()
end if

if action="editclass" then
'编辑类别名字显示
call editclass()
end if

if action="editclassOk" then
'编辑类别名字处理
call editclassok()
end if

if action="delMidclass" then
'删除二级分类
MidCode=request("MidCode")
LarCode=request("LarCode")
call delmidclass()
end if

if action="delLarclass" then
'删除一级分类
LarCode=request("LarCode")
call dellarclass()
end if

if action="addMidclass" then
'增加二级分类显示
call addmidclass()
end if

if action="addMidclassOk" then
'增加二级分类处理
call addmidclassok()
end if

if action="addLarclass" then
'增加一级分类显示
call addlarclass()
end if

if action="addLarclassOk" then
'增加一级分类处理
call addlarclassok()
end if

if action="output" then
'更新分类
call output()
end if

if action="view" then
'浏览商品
call views()
end if

sub addmidclassok()
'增加二级分类处理
LarCode=trim(request("LarCode"))
newclass=trim(request("newclass"))
If trim(newclass)="" or instr(newclass,"&")>0 or instr(newclass,"%")>0 or instr(newclass,"'")>0 or instr(newclass,"&quot;")>0 then
mGoBack "出错了,资料填写不完整或不符合要求,请检查后重新提交。"
end if
set rs=conn.execute("select * from s_class where MidCode='"&newclass&"' and LarCode='"&LarCode&"'")
if not (rs.eof and rs.bof) then
mGoBack "出错了,已经有一个同名二级分类存在,请使用其它名称吧。"
end if
set rs=nothing
sql="select * from s_class where LarCode='"&LarCode&"' order by MidSeq"
set rs=conn.execute(sql)
while Not rs.eof
counter=rs("MidSeq")+1
larseq=rs("LarSeq")
rs.movenext
wend
set rsadd=server.createobject("adodb.recordset")
rsadd.open "s_class",conn,1,3
rsadd.addnew
rsadd("LarSeq")=larseq
rsadd("LarCode")=LarCode
rsadd("MidSeq")=counter
rsadd("MidCode")=newclass
rsadd.update
rsadd.close
set rsadd=nothing
rs.close
set rs=nothing
mGoTo "prod0.asp","操作成功,已添加了二级分类“"&trim(request("newclass"))&"”。"
end sub

sub addmidclass()
'增加二级分类显示
LarCode=trim(request("LarCode"))
%>
<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>
<tr><td width=20% height=25 align=center>一级分类名称</td><td><%=LarCode%></td></tr>
<tr><td width=20% height=25 align=center valign=top">现有二级分类名称</td><td>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from s_class where LarCode='"&LarCode&"' order by MidSeq asc"
rs.open sql,conn,1,1
if not (rs.eof and rs.bof) then
do while not rs.eof
response.write rs("midcode")&"<br>"
rs.movenext
loop
end if
%>
</td></tr>
<form action='prod0.asp?action=addMidclassOk' method=post name=addmidclass>
<tr><td width=20% height=25 align=center>新增二级分类名称</td><td><INPUT TYPE='text' NAME='newclass' size=20 maxlength=20 value=''>[请勿输入<font color=red>% &quot; ' &amp; + = \</font>等禁用字符]</td></tr>
<tr><td colspan=2><INPUT TYPE='hidden' name=add value='ok'><INPUT TYPE='hidden' name=LarCode value='<%=LarCode%>'><INPUT TYPE='submit' value='保存设置'>
</td></tr>
</form>
</table>
<%
rs.close
set rs=nothing
end sub

sub addlarclassok()
'增加一级分类处理
If trim(request("newclass"))="" or instr(request("newclass"),"&")>0 or instr(request("newclass"),"%")>0 or instr(request("newclass"),"'")>0 or instr(request("newclass"),"&quot;")>0 then
mGoBack "出错了,资料填写不完整或不符合要求,请检查后重新提交。"
end if
set rs=conn.execute("select * from s_class where LarCode='"&trim(request("newclass"))&"'")
if not (rs.eof and rs.bof) then mGoBack "出错了,已经有一个同名分类存在,请使用其它名称。"
set rs=nothing
set rs=conn.execute("select * from s_class order by larseq desc")
if not (rs.eof and rs.bof) then
count=clng(rs("larseq"))+1
else
count=1
end if
set rs=nothing
set rsadd=Server.CreateObject("ADODB.Recordset")
sql="SELECT * FROM s_class"
rsadd.open sql,conn,3,3
rsadd.addnew
rsadd("LarSeq")=count
rsadd("MidSeq")=1
'增加大类同时增加同名小类一个
rsadd("LarCode")=trim(request.form("newclass"))
rsadd("MidCode")=trim(request.form("newclass"))
rsadd.update
rsadd.close
set rsadd=nothing
mGoTo "prod0.asp","操作成功,已添加一级分类“"&trim(request.form("newclass"))&"”,及一个同名的二级分类。"
end sub

sub addlarclass()
'增加一级分类显示
%>
<table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px" bordercolor="#333333" cellspacing="0" cellpadding="2">
<form action='prod0.asp?action=addLarclassOk' method=post name=addlarclass>
<tr><td colspan=2 class=td height=18>添加一级分类</td></tr>
<tr><td width=20% height=25 align=center>一级分类名称</td><td><INPUT TYPE='text' NAME='newclass' size=20 maxlength=20 value=''>[请勿输入<font color=red>% &quot; ' &amp; + = \</font>等禁用字符]</td></tr>
<tr><td colspan=2><INPUT TYPE='hidden' name=add value='ok'><INPUT TYPE='submit' value='保存设置'>
</td></tr>
</form>
</table>
<%
end sub


sub delmidclass()
'删除二级分类
conn.execute "delete from s_class where MidCode='"&request("MidCode")&"' and  larCode='"&request("larCode")&"'" 
'同步删除该分类下的所有商品
if tree_del_yesorno="1" then
conn.execute "delete from s_produc where MidCode='"&request("MidCode")&"' and  larCode='"&request("larCode")&"'" 
else
conn.execute "update s_produc set MidCode='未归类',Larcode='未归类' where MidCode='"&request("MidCode")&"' and  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>"
end sub

sub delLarclass()
'删除一级分类

⌨️ 快捷键说明

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