<% data_path="../../" 'ACC连接数据库路径，对SQL无效 %>
<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
 <!--#include file="../checkrole.asp"-->
<%
  call checkuser("cp")

if issession=0 then
gsid=Replace_Text(request.Cookies("Yxmemberid"))
else
gsid=session("id")
end if
  Response.Buffer = true
  Response.ExpiresAbsolute=now()-1
  Response.Expires=0
  Response.CacheControl="no-cache"
  
cmd=Replace_Text(request("cmd"))

if cmd="add" then
bigclassname=Replace_Text(request.form("bigclassname"))
if bigclassname="" then
response.write"<SCRIPT language=JavaScript>alert('输入的内容不能为空！');"
response.write"this.location.href='addclass.asp';</SCRIPT>"
response.end
end if
set rs=server.createobject("adodb.recordset")
sql="select * from Websen_productclass where gsid="&gsid&" and bigclassname='"&bigclassname&"'"
rs.open sql,conn,1,3
if not (rs.eof and rs.bof) then
response.write"<SCRIPT language=JavaScript>alert('对不起，已存在此产品系列！');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end 
else
rs.addnew
rs("gsid")=gsid
rs("bigclassname")=bigclassname
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing

Content="<center>恭喜您，该产品系列名称已经添加成功<br><br><input name='' type='button' value='返回上一页' onclick='javascript:history.go(-1)'></center>"

Call Operation(Content,1)
end if
end if

if cmd="del" then
	
if Chkrequest(request("bigclassid")) then
	bigclassid=request("bigclassid")
else
	
response.write"<SCRIPT language=JavaScript>alert('提交的参数非法，请返回！');"
response.write"this.location.href='addclass.asp';</SCRIPT>"
response.end 
end if

conn.execute("delete from Websen_productclass where bigclassid="&bigclassid&" and gsid="&gsid&"")
conn.execute("delete from Websen_productclass_1 where bigclassid="&bigclassid&" and gsid="&gsid&"")
Set Rs=Server.CreateObject("adodb.RecordSet")
	SqlFile="Select * From Websen_productshow where bigclassid="&bigclassid&" and gsid="&gsid&""
	Rs.Open SqlFile,Conn,1,3

if not(rs.eof and rs.bof) then
	do WHile Not Rs.Eof
			 ttid=rs("id")
		 sortid=rs("sortid")
		 typeid=rs("typeid")
		 typeid_2=rs("typeid_2")
		 
		FileName=HOPE_InstallDir&"productshow/offerdetail/"&sortid&"-"&typeid&"-"&typeid_2&"-"&ttid&".html"
		Call FileDel(FileName) 
		
	Rs.MoveNext
		if Rs.eof then exit do 
	loop
	conn.execute("delete from Websen_productshow where bigclassid="&bigclassid&" and gsid="&gsid&"")
end if
rs.close
set rs=nothing
conn.close
set conn=nothing

	Content="<center>恭喜您，该产品系列已经删除成功<br><br><input name='' type='button' value='返回上一页' onclick='javascript:history.go(-1)'></center>"

Call Operation(Content,1)
end if 




if cmd="up" then
if Chkrequest(request("bigclassid")) then
bigclassid=request("bigclassid")
else
response.write"<SCRIPT language=JavaScript>alert('提交的参数非法，请返回！');"
response.write"this.location.href='addclass.asp';</SCRIPT>"
response.end 
end if
bigclassname=Replace_Text(request.form("bigclassname"))
if bigclassname="" then
response.write"<SCRIPT language=JavaScript>alert('输入的内容不能为空！');"
response.write"this.location.href='addclass.asp';</SCRIPT>"
response.end
end if
set rs1=server.createobject("adodb.recordset")
sql1="select * from Websen_productclass where gsid="&gsid&" and bigclassname='"&bigclassname&"' and bigclassid<>"&bigclassid&""
rs1.open sql1,conn,1,3
if not rs1.eof then
response.write"<SCRIPT language=JavaScript>alert('对不起，和已存在产品系列同名！');"
response.write"this.location.href='addclass.asp';</SCRIPT>"
response.end 
else
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from Websen_productclass where bigclassid="&bigclassid&" and gsid="&gsid&""
rs.open sql,conn,1,3
rs("bigclassname")=bigclassname
rs.update
rs.close
set rs=nothing
rs1.close
set rs1=nothing
conn.close
set conn=nothing
	Content="<center>恭喜您，该产品系列名称已经修改成功<br><br><input name='' type='button' value='返回上一页' onclick='javascript:history.go(-1)'></center>"

Call Operation(Content,1)

end if
end if
%>