<%@ codepage ="936" %>
  <% 
	data_path="../../" 'ACC连接数据库路径，对SQL无效
	numid="71"
	dir="../err.asp" 
  %>
  <!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
<!--#include file="../../inc/FileSystem.asp"-->
 <!--#include file="../rolecheck.asp"-->
 <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../css/style.css" rel=stylesheet type=text/css>
<script>
function conficheck()
{
var i=confirm("该操作用途：用于对添加相关信息提供参考的行业类别资料，该操作消耗较大的资源，运行时间稍长，请慎用！");
if(i)
{
return true;
}
else
{
return false;
 }
 }
 function checkmodi_1()
 {
 var str1=document.FORMmodi_1.class_1_name.value;
 var str2=document.FORMmodi_1.orderid_1.value;
 if(str1.replace(/^\s+|\s+$/g,'')=="")
 {
 alert("请输入类别名称！");
 return false;
 }
 if(str2.replace(/^\s+|\s+$/g,'')=="")
 {
 alert("请输入排序id号！");
 return false;
 }
 }
 </script>
</head>
<%
dim body
call main()
set rs=nothing
conn.close
set conn=nothing
sub main()
%>
<table width="98%" border="0" cellspacing="0" cellpadding="0"  align=center class="tableBorder"> 
  <tr> 
     <th height=25 colspan="2" class="tableHeaderText">网站行业类别管理 </th> 
  </tr> 
  <tr> 
     <td colspan="2"  ><font   color="#666666">温馨提示：① 类别直接与发布的信息相关联，删除类别可能会影响到会员发布的供求商机信息、产品信息、公司库信息。②点击类别名称进入相应下级分类，点击相应的分类操作属性进行相应操作。③如果改变了网站行业分类，一定要重新<a href="makeallclass.asp" onClick="return conficheck();"><font color="red">【<b>生成行业分类JS文件</b>】</font></a>。④如：要添加三级分类——>先点击大类进入二级类——>点击二级类进入三级类——>添加三级类别</font>
[<a href="sort.asp">返回大类</a>]   </td> 
  </tr> 
</table>
 <%
if request("action") ="add_class_1" then 
call add_class_1()
elseif request("action")="add_class_1_ok" then
call add_class_1_ok()

elseif request("action")="add_class_2" then
call add_class_2()
elseif request("action")="add_class_2_ok" then
call add_class_2_ok()

elseif request("action")="add_class_3" then
call add_class_3()
elseif request("action")="add_class_3_ok" then
call add_class_3_ok()

elseif request("action")="edit_class_1" then
call edit_class_1()
elseif request("action")="edit_class_2" then
call edit_class_2()
elseif request("action")="edit_class_3" then
call edit_class_3()

elseif request("action")="savedit_1" then
call savedit_1()
elseif request("action")="savedit_2" then
call savedit_2()
elseif request("action")="savedit_3" then
call savedit_3()

elseif request("action")="del_class_1" then
	call del_class_1()

elseif request("action")="del_class_2" then
	call del_class_2()
elseif request("action")="del_class_3" then
	call del_class_3()

else
	call linkinfo()
end if
%>
<%
end sub
sub add_class_1()
%>
<TABLE width=100% border="0" align="center" cellPadding=3 cellSpacing=1 class="tableBorder">
    <FORM name=FORM1 onSubmit="return FORM1_onsubmit()" action=admin_class_ok.asp?action=add_class_1_ok method=post>
<TR> 
      <Th colSpan=2 height="25" class="tableHeaderText">添加行业一级类别</Th> 
    </TR>
<TR>
<TD width=36% height=25 align=right class="forumRowHighlight">行业一级类别名称<b>:</b></TD>
<TD width=64% height=41 class="forumRowHighlight"><input maxlength=16 size=25 name=class_name>  &nbsp;排序号:
  <input type="text" name="orderid"  value="0" maxlength="5" onKeyUp="value=value.replace(/[^\d]/g,'') " size=5   tonbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"> </TD></TR>
<TR>
<TD colSpan=2 height="27" align=center class="forumRowHighlight">
<INPUT type=submit value='确 定 添 加' name=Submit2></TD>
</TR>
</FORM>
</TABLE>
<SCRIPT language=javascript>
function FORM1_onsubmit()
{
if(document.FORM1.class_name.value.length<1)
{
alert("您必须输入大类名称!");
document.FORM1.class_name.focus();
return false;
}
if(document.FORM1.orderid.value.length<1)
{
alert("您必须输入排序值!");
document.FORM1.orderid.focus();
return false;
}

}
</SCRIPT>
<%
end sub
sub add_class_2()
%>
<TABLE width=100% border="0" align="center" cellPadding=3 cellSpacing=1 class="tableBorder">
    <FORM name=FORM1 onSubmit="return FORM1_onsubmit()" action=admin_class_ok.asp?action=add_class_2_ok method=post>
<TR> 
      <Th colSpan=2 height="25" class="tableHeaderText">添加行业二级类别</Th> 
    </TR>
<TD width=40% height=25 class="forumRowHighlight" align=center><b>所属行业一级分类</b></TD>
<TD width=60% height=25 class="forumRowHighlight"><select name="class_1_id"> 
<%
sqlsort="select * from Websen_class_1 where sortid="&request("sortid")&""
set rssort=conn.execute(sqlsort) 
response.write"<OPTION value='"&rssort("sortid")&"' selected>"&rssort("sort")&"</OPTION>"
%> 
<%
set rsc=conn.execute("select * from Websen_class_1")
do while Not rsc.eof
response.write "<option value='"&rsc("sortid")&"'>"&rsc("sort")&"</option>"&chr(13)+chr(10)
rsc.movenext
loop
rsc.close
%>
</select></TD>
</TR>
<TR>
<TD width=40% height=25 class="forumRowHighlight" align=center><b>行业二级分类名称</b></TD>
<TD width=60% height=40 class="forumRowHighlight"><input name="class_2_name" type="text" size="25" maxlength="16"></TD>
</TR>
<TR>
<TD colSpan=2 height="27" align="center" class="forumRowHighlight"> <INPUT type=submit size=3 value='确 定 添 加' name=Submit2></TD>
</TR>
</form>
</TABLE> 　
<SCRIPT language=javascript>
function FORM1_onsubmit()
{
if(document.FORM1.class_2_name.value.length<1)
{
alert("您必须输入二级分类名称!");
document.FORM1.class_2_name.focus();
return false;
}
}
</SCRIPT>
<%
end sub
sub add_class_2_ok()
set rs=server.createobject("adodb.recordset")
sqltext="select * from Websen_class_2 where typename='"&Replace_Text(request.form("class_2_name"))&"' and sortid=" & Replace_Text(request.form("class_1_id"))&""
rs.open sqltext,conn,1,1
'查找数据库，检查二级分类是否已经存在
if rs.recordcount >= 1 then 
if rs("typename")=Lcase(Replace_Text(request.form("class_2_name"))) then
response.write "<script language='javascript'>"
response.write "alert('此二级分类已经存在，请选用其它名称!');"
response.write"javascript:history.back(-1)</SCRIPT>"
response.end
rs.close
end if
else
set rs=server.createobject("adodb.recordset")
sqltext="select * from Websen_class_2"
rs.open sqltext,conn,3,3
'添加一个二级分类到数据库
rs.addnew
rs("typename")=Replace_Text(request.form("class_2_name"))
rs("sortid")=Replace_Text(request.form("class_1_id"))
rs("top")=0
rs.update
response.redirect "type.asp?sortid="&request.form("class_1_id")&""
end if
end sub
sub add_class_3()
%>
<script language = "JavaScript"> 
sall=new Array();
<%
Dim i
i=0
set rsc2=conn.execute("select * from Websen_class_2")
do while Not rsc2.eof
%>
sall[<%=i%>]=new Array("<%=rsc2("typename")%>","<%=rsc2("sortid")%>","<%=rsc2("typeid")%>");
<%
i=i+1
rsc2.movenext
loop
rsc2.close
%>
function changeselect(selvalue)  
   { 
      document.FORM1.class_2_typeid.length=0;  
      var selvalue=selvalue;
      var i;
      for(i=0;i<sall.length;i++) 
	{
	    if(sall[i][1]==selvalue) 
      		{
  	var newOption1=new Option(sall[i][0],sall[i][2]);
	document.all.class_2_typeid.add(newOption1);
		}
	}
}
</script>
<TABLE width=100% border="0" align="center" cellPadding=3 cellSpacing=1 class="tableBorder">
    <FORM name=FORM1 onSubmit="return FORM1_onsubmit()" action=admin_class_ok.asp?action=add_class_3_ok method=post>
<TR> 
      <Th colSpan=2 height="25" class="tableHeaderText">添加行业三级类别</Th> 
    </TR>
<TD width=40% height=25 class="forumRowHighlight" align=center><b>所属行业一级及二级分类</b></TD>
<TD width=60% height=25 class="forumRowHighlight"><select name="class_1_id" onChange="changeselect(document.FORM1.class_1_id.options[document.FORM1.class_1_id.selectedIndex].value)" size="1"> 
<%
sqlsort="select * from Websen_class_1 where sortid="&request("sortid")&""
set rssort=conn.execute(sqlsort) 
response.write"<OPTION value='"&rssort("sortid")&"' selected>"&rssort("sort")&"</OPTION>"
%> 
<%
set rsc=conn.execute("select * from Websen_class_1")
do while Not rsc.eof
response.write "<option value='"&rsc("sortid")&"'>"&rsc("sort")&"</option>"&chr(13)+chr(10)
rsc.movenext
loop
rsc.close
%>
</select> 
<select name="class_2_typeid"> 
<%
sqltype="select * from Websen_class_2 where typeid="&request("typeid")&""
set rstype=conn.execute(sqltype) 
response.write"<OPTION selected value="&rstype("typeid")&">"&rstype("typename")&"</OPTION>"
%> 
</select></TD>
</TR>
<TR>
<TD width=40% height=25 class="forumRowHighlight" align=center><b>行业三级分类名称</b></TD>
<TD width=60% height=40 class="forumRowHighlight"><input name="class_3_name" type="text" size="25" maxlength="16"></TD>
</TR>
<TR>
<TD colSpan=2 height="27" align="center" class="forumRowHighlight"> <INPUT type=submit size=3 value='确 定 添 加' name=Submit2></TD>
</TR>
</form>
</TABLE> 　
<SCRIPT language=javascript>
function FORM1_onsubmit()
{
if(document.FORM1.class_3_name.value.length<1)
{
alert("您必须输入三级分类名称!");
document.FORM1.class_3_name.focus();
return false;
}
}
</SCRIPT>
<%
end sub
sub add_class_3_ok()
set rs=server.createobject("adodb.recordset")
sqltext="select * from Websen_class_3 where typename_2='"&request.form("class_3_name")&"' and sortid=" & request.form("class_1_id")&" and typeid=" & request.form("class_2_typeid")&""
rs.open sqltext,conn,1,1
'查找数据库，检查二级分类是否已经存在
if rs.recordcount >= 1 then 
if rs("typename_2")=Lcase(request.form("class_3_name")) then
response.write "<script language='javascript'>"
response.write "alert('此三级分类已经存在，请选用其它名称!');"
response.write"javascript:history.back(-1)</SCRIPT>"
response.end
rs.close
end if
else
set rs=server.createobject("adodb.recordset")
sqltext="select * from Websen_class_3"
rs.open sqltext,conn,3,3
'添加一个三级分类到数据库
rs.addnew
rs("typename_2")=Replace_Text(request.form("class_3_name"))
rs("sortid")=request.form("class_1_id")
rs("typeid")=Replace_Text(request.form("class_2_typeid"))
rs.update
response.redirect "type_2.asp?typeid="&request.form("class_2_typeid")&""
end if
end sub
sub edit_class_1()
set rs=server.createobject("adodb.recordset")
sqltext="select * from Websen_class_1 where sortid="+Cstr(request("id"))
rs.open sqltext,conn,1,1
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder">
<form name=FORMmodi_1 action="Admin_Class_Ok.asp?action=savedit_1" method=post onSubmit="return checkmodi_1();">
<input type=hidden name=id value="<%=Cstr(request("id"))%>"> 	
<TR> 
<Th colSpan=2 height="25" class="tableHeaderText">行业一级类别修改</Th> 
    </TR>
<TD width=35% height=25 class="forumRowHighlight" align=right> 行业一级类别名称 </TD>
<td width="65%" class="forumRowHighlight" height="40"> 
<input type="text" name="class_1_name" size='25' maxlength="16" value=<%=rs("sort")%>>
&nbsp;排序号:
  <input type="text" name="orderid_1"  value="<%=rs("orderid")%>" maxlength="5" onKeyUp="value=value.replace(/[^\d]/g,'') " size=5   tonbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"> 
</td>
</tr>
<tr> 
<td height="30" colspan="2" class="forumRowHighlight" align="center"> 
<input type="submit" name="Submit" value="确 定 修 改">
</td>
</tr>
</form>
</table>
<SCRIPT language=javascript>
function FORM1_onsubmit()
{
if(document.FORM1.class_name.value.length<1)
{
alert("您必须输入大类名称!");
document.FORM1.class_name.focus();
return false;
}
}
</SCRIPT>
<%
rs.close
set rs=nothing
end sub
sub edit_class_2()
set rs=server.createobject("adodb.recordset")
sqltext="select * from Websen_class_2 where typeid="+Cstr(request("id"))
rs.open sqltext,conn,1,1
set rs2=server.createobject("adodb.recordset")
sqltext2="select * from Websen_class_1 where sortid="+Cstr(rs("sortid"))
rs2.open sqltext2,conn,1,1
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder">
    <form name=form1 action=Admin_Class_Ok.asp?action=savedit_2 method=post>
<input type=hidden name=id value=<%=Cstr(request("id"))%>>
<input type=hidden name=sortid value=<%=Cstr(request("sortid"))%>>
<TR> 
      <Th colSpan=2 height="25" class="tableHeaderText">行业二级类别修改</Th> 
    </TR>
<tr> 
<td width="40%" class="forumRowHighlight" align=center><b>所属一级分类</b></td>
<td width="60%" class="forumRowHighlight"><select name="forum_setting" id="forum_setting" disabled=true>
	<option value="0"><%=rs2("sort")%> 
	</select></td>
</tr>
<tr> 
<td width="40%" height="40" align=center class="forumRowHighlight"><b>二级分类名称</b></td>
<td width="60%" bgcolor="#E0EEF5"> 
<input name="class_2_name" type="text" value=<%=rs("typename")%> size='25' maxlength="16"></td>
</tr>
<tr> 
<td height="30" colspan="2" class="forumRowHighlight" align="center">
<input type="submit" name="Submit" value="确 定 修 改">
</td>
</tr>
</form>
</table>
<SCRIPT language=javascript>
function FORM1_onsubmit()
{
if(document.FORM1.class_2_name.value.length<1)
{
alert("您必须输入二级分类名称!");
document.FORM1.class_2_name.focus();
return false;
}
}
</SCRIPT>
<%
rs.close
rs2.close
set rs=nothing
set rs2=nothing
end sub
sub edit_class_3()
set rs=server.createobject("adodb.recordset")
sqltext="select * from Websen_class_3 where typeid_2="+Cstr(request("id"))
rs.open sqltext,conn,1,1
set rs2=server.createobject("adodb.recordset")
sqltext2="select * from Websen_class_2 where typeid="+Cstr(rs("typeid"))
rs2.open sqltext2,conn,1,1
set rs3=server.createobject("adodb.recordset")
sqltext3="select * from Websen_class_1 where sortid="+Cstr(rs2("sortid"))
rs3.open sqltext3,conn,1,1
%>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableBorder">
    <form name=form1 action=Admin_Class_Ok.asp?action=savedit_3 method=post>
<input type=hidden name=id value=<%=Cstr(request("id"))%>>
<input type=hidden name=typeid value=<%=Cstr(request("typeid"))%>>
<TR> 
      <Th colSpan=2 height="25" class="tableHeaderText">行业三级类别修改</Th> 
    </TR>
<tr> 
<td width="40%" class="forumRowHighlight" align=center><b>所属一级及二级分类</b></td>
<td width="60%" class="forumRowHighlight"><select name="sort" id="sort" disabled=true>
	<option value="0"><%=rs3("sort")%> 
	</select> <select name="typename" id="typename" disabled=true>
	<option value="0"><%=rs2("typename")%> 
	</select></td>
</tr>
<tr> 
<td width="40%" height="40" align=center class="forumRowHighlight"><b>三级分类名称</b></td>
<td width="60%" bgcolor="#E0EEF5"> 
<input name="class_3_name" type="text" value=<%=rs("typename_2")%> size='25' maxlength="16"></td>
</tr>
<tr> 
<td height="30" colspan="2" class="forumRowHighlight" align="center">
<input type="submit" name="Submit" value="确 定 修 改">
</td>
</tr>
</form>
</table>
<SCRIPT language=javascript>
function FORM1_onsubmit()
{
if(document.FORM1.class_2_name.value.length<1)
{
alert("您必须输入三级分类名称!");
document.FORM1.class_2_name.focus();
return false;
}
}
</SCRIPT>
<%
rs.close
rs2.close
rs3.close
set rs=nothing
set rs2=nothing
set rs3=nothing
end sub
sub savedit_1()
set rs= server.createobject ("adodb.recordset")
sql ="select * from Websen_class_1 where sortid="+Cstr(request("id"))
rs.Open sql,conn,1,3
if rs.eof and rs.bof then
body=body+"<br>"+"错误，数据库操作错误，没有找到此条信息。"
else
rs("sort")=Replace_Text(Request.Form ("class_1_name"))
orderid_1=Replace_Text(request.Form("orderid_1"))
if not isnumeric(orderid_1) then
orderid_1=0
end if
rs("orderid")=orderid_1
rs.Update
end if 
response.redirect "sort.asp"
end sub
sub savedit_2()
set rs= server.createobject ("adodb.recordset")
sql ="select * from Websen_class_2 where typeid="+Cstr(request("id"))
rs.Open sql,conn,1,3
if rs.eof and rs.bof then
body=body+"<br>"+"错误，数据库操作错误，没有找到此条信息"
else
rs("typename")=Replace_Text(Request.Form ("class_2_name"))
rs.Update
end if 
response.redirect "type.asp?sortid="&request("sortid")&""
end sub
sub savedit_3()
set rs= server.createobject ("adodb.recordset")
sql ="select * from Websen_class_3 where typeid_2="+Cstr(request("id"))
rs.Open sql,conn,1,3
if rs.eof and rs.bof then
body=body+"<br>"+"错误，数据库操作错误，没有找到此条信息"
else
rs("typename_2")=Replace_Text(Request.Form ("class_3_name"))
rs.Update
end if 
response.redirect "type_2.asp?typeid="&request("typeid")&""
end sub
sub del_class_1()
	
	Call Class_type1(Cstr(request("id")))
conn.execute("delete from [Websen_class_1] where sortid="+Cstr(request("id")))
conn.execute("delete from [Websen_class_2] where sortid="+Cstr(request("id")))
conn.execute("delete from [Websen_class_3] where sortid="+Cstr(request("id")))

response.Write "<script>window.location.href='sort.asp'</script>"

end sub
sub del_class_2()
	
	Call Class_type2(Cstr(request("id")))
	
conn.execute("delete from [Websen_class_2] where typeid="+Cstr(request("id")))
conn.execute("delete from [Websen_class_3] where typeid="+Cstr(request("id")))

response.Write "<script>window.location.href='type.asp?sortid="&request("sortid")&"'</script>"

end sub
sub del_class_3()


	Call Class_type3(Cstr(request("id")))
conn.execute("delete from [Websen_class_3] where typeid_2="+Cstr(request("id")))

response.Write "<script>window.location.href='type_2.asp?typeid="&request("typeid")&"'</script>"
end sub


sub add_class_1_ok()
set rs=server.createobject("adodb.recordset")
sqltext="select * from Websen_class_1 where sort='"&Replace_Text(request.form("class_name"))&"'"
rs.open sqltext,conn,1,1
'查找数据库，检查大类是否已经存在
if rs.recordcount >= 1 then 
if rs("sort")=Replace_Text(request.form("class_name")) then
response.write "<script language='javascript'>"
response.write "alert('此类别已经存在，请选用其它名称！');"
response.write"javascript:history.back(-1)</SCRIPT>"
response.end
end if
else
set rs=server.createobject("adodb.recordset")
sqltext="select * from Websen_class_1"
rs.open sqltext,conn,3,3
rs.addnew
rs("sort")=Replace_Text(request.form("class_name"))
orderid=Replace_Text(request.Form("orderid"))
if not isnumeric(orderid) then
orderid=0
end if 
rs("orderid")=orderid
rs.update
response.redirect "sort.asp"
end if
end sub



Sub Class_type1(One_ID) '删除一级分类
	Set  RsType=Server.Createobject("Adodb.recordset")
		SqlType="select * from Websen_class_1 Where SortID="&One_ID&""
		RsType.Open SqlType,Conn,1,3
		if Not RsType.Eof Then 
			sortid=RsType("SortID")
		end if
		 RsType.CLose
		 Set RsType=NOthing
		 

		 
		CoList=HOPE_InstallDir&"corporation/trade/"&sortid&".html"'公司
		ProList=HOPE_InstallDir&"productshow/trade/"&sortid&".html"'产品
		sellerList=HOPE_InstallDir&"seller/trade/"&sortid&".html"'求购
		tradeinfoList=HOPE_InstallDir&"tradeinfo/trade/"&sortid&".html"'供应
	
		Call FileDel(ProList)'删除该分类下的产品列表				
		Call FileDel(sellerList)'删除该分类下的我要销售列表				
		Call FileDel(tradeinfoList)'删除该分类下的我要采购列表				
		Call FileDel(CoList)'删除该分类下的公司列表				
		
	Set Rstype_1=Server.CreateObject("Adodb.Recordset")
		SqlType_1="select * from Websen_class_2 Where SortId="&One_ID&""	
		RsType_1.Open SqlType_1,conn,1,1
		IF Not RsType_1.Eof Then 

			do while Not  RsType_1.Eof 
				   Call Class_type2(RsType_1("TypeID"))
				RsType_1.MOveNext
					if RsType_1.Eof Then exit do
			loop
			
		end if
		 RsType_1.Close
		 SEt RsType_1=NOthing
End Sub

Sub Class_type2(Two_ID) '删除二级分类相关信息
	Set  RsType=Server.Createobject("Adodb.recordset")
		SqlType="select * from Websen_class_2 Where TypeID="&Two_ID&""
		RsType.Open SqlType,Conn,1,3
		
		 ttid=RsType("typeID")
		 sttid=RsType("sortID")
		 RsType.CLose
		 Set RsType=NOthing

		'删除各个分类的列表
		CoList=HOPE_InstallDir&"corporation/trade/"&sttid&"-"&ttid&".html"'公司
		ProList=HOPE_InstallDir&"productshow/trade/"&sttid&"-"&ttid&".html"'产品
		sellerList=HOPE_InstallDir&"seller/trade/"&sttid&"-"&ttid&".html"'求购
		tradeinfoList=HOPE_InstallDir&"tradeinfo/trade/"&sttid&"-"&ttid&".html"'供应
		
		Call FileDel(ProList)'删除该分类下的产品列表				
		Call FileDel(sellerList)'删除该分类下的我要销售列表				
		Call FileDel(tradeinfoList)'删除该分类下的我要采购列表				
		Call FileDel(CoList)'删除该分类下的公司列表				
		
	Set  RsType_3=Server.Createobject("Adodb.recordset")
		SqlType_3="select * from Websen_class_3 Where typeid="&Two_ID&""
		RsType_3.Open SqlType_3,Conn,1,3
		if Not RsType_3.Eof  then 
			do while Not RsType_3.Eof 
					TwoId=RsType_3("typeid_2")
				  	 Call Class_type3(TwoId) 
				RsType_3.MoveNExt
				if RsType_3.Eof Then exit do
			loop
			
		end if
		
		RsType_3.Close
		Set RsType_3=NOthing
End Sub










Sub Class_type3(ID) '删除三级分类相关文件

	Set  RsType=Server.Createobject("Adodb.recordset")
		SqlType="select * from Websen_class_3 Where typeid_2="&ID&""
		RsType.Open SqlType,Conn,1,3
			      ttid=RsType("typeid_2")
				 tytid=RsType("typeID")
				 sttid=RsType("sortID")
		RsType.Close
		Set RsType=Nothing
		
		'删除各个分类的列表
		ProList=HOPE_InstallDir&"productshow/offerlist/"&sttid&"-"&tytid&"-"&ttid&".html"
		CoList=HOPE_InstallDir&"corporation/offerlist/"&sttid&"-"&tytid&"-"&ttid&".html"
		sellerList=HOPE_InstallDir&"seller/offerlist/"&sttid&"-"&tytid&"-"&ttid&".html"
		tradeinfoList=HOPE_InstallDir&"tradeinfo/offerlist/"&sttid&"-"&tytid&"-"&ttid&".html"
		
		Call FileDel(ProList)'删除该分类下的产品列表				
		Call FileDel(sellerList)'删除该分类下的我要销售列表				
		Call FileDel(tradeinfoList)'删除该分类下的我要采购列表				
		Call FileDel(CoList)'删除该分类下的公司列表				
		
		'=================================删除该分类下的产品信息=================================
		
	Set RsPro=Conn.Execute("Select ID, GsID,sortid,typeid,typeid_2,cpmc From Websen_productshow Where typeid_2="&id&"")
		if NOt RsPro.Eof then 
			do while Not RsPro.Eof
					ttid=rs("id")
					sortid=rs("sortid")
					typeid=rs("typeid")
					typeid_2=rs("typeid_2")
					showname=rs("cpmc")
					 ProFile=HOPE_InstallDir&"productshow/offerdetail/"&sortid&"-"&typeid&"-"&typeid_2&"-"&ttid&".html"
					Call FileDel(ProFile)
				RsPro.MoveNExt
					if RsPro.Eof Then exit do
			Loop
		end if
			RsPro.Close
			Set RsPro=Nothing		
		'=================================删除该分类下的供求信息=================================
		
		SqltridInfo="select Info_ID, sortid,typeid,typeid_2,showname,dateandtime,period,type  from Websen_Info where  typeid_2="&id&""
	Set RsInfo=Conn.Execute(SqltridInfo)
		 IF Not RsInfo.Eof Then 
						do while Not RsInfo.Eof
							 ttid=RsInfo("Info_ID")
							 sortid=RsInfo("sortid")
							 typeid=RsInfo("typeid")
							 typeid_2=RsInfo("typeid_2")
							 showname=RsInfo("showname")
							 dateandtime=RsInfo("dateandtime")
							 period=RsInfo("period")
								FileTrideinfo=HOPE_InstallDir&"tradeinfo/offerdetail/"&sortid&"-"&typeid&"-"&typeid_2&"-"&ttid&".html"
								Call FileDel(FileTrideinfo) '删除供应信息
								
								FileTrideinfo=HOPE_InstallDir&"seller/offerdetail/"&sortid&"-"&typeid&"-"&typeid_2&"-"&ttid&".html"
								Call FileDel(FileTrideinfo)'删除供应信息
							
							RsInfo.MOVeNExt
								if RsInfo.Eof Then exit do
						loop
					  End if
					RsInfo.CLose
					Set RsInfo=nothing
					
					
					
'=================================删除会员生成文件与会员生成的相关文件=================================	
	Set RsCo=Server.CreateObject("adodb.recordset")
	RsCo.Open ("Select typeid_2,Typeid,Sortid,ID,[User],Flag From Websen_corporation Where typeid_2="&id&""),conn,1,3
		if 	Not RsCo.Eof Then 
			do while Not RsCo.Eof
				if RsCo("Flag")=1 then 
					action=5 'VIP会员
				end if
				 user=RsCo("user")
				 userID=RsCo("ID")

					PtPath=HOPE_InstallDir&"Ptcom/"&user&".html"
					Call FileDel(PtPath)  '检查当前会员是否生成过展示,并且删除该文件
					
				FileName=HOPE_InstallDir&"vipcom/"&user&"/"
					Call FSO_Del(FileName) '检查当前会员是否生成过VIP会员模板,并且删除该会员模板下的所有文件

					'【公共:删除生成的产品信息信息文件:/productshow/,】
						Set RsPro=Conn.Execute("Select ID, GsID,sortid,typeid,typeid_2,cpmc From Websen_productshow Where GsID="&userID&"")
							IF NOt RsPro.Eof Then 
								do while Not RsPro.Eof
									ttid=rs("id")
									sortid=rs("sortid")
									typeid=rs("typeid")
									typeid_2=rs("typeid_2")
									showname=rs("cpmc")
									ProFile=HOPE_InstallDir&"productshow/offerdetail/"&sortid&"-"&typeid&"-"&typeid_2&"-"&ttid&".html"
									Call FileDel(ProFile)
								RsPro.MOveNExt
									if RsPro.Eof then exit do
								loop
							End if
							RsPro.CloSe
							Set RsPro=nothing
				
					'【公共:删除生成的展会信息文件:service/expo/detail,】
							Set RsExpo=Conn.Execute("Select id,gsid,picture From Websen_expo Where gsid="&userID&"") 
							if NOt RsExpo.Eof Then 
								do while Not RsExpo.Eof
									ttid=RsExpo("id")
									picture=RsExpo("picture")
								
									ExpoFile=HOPE_InstallDir&"service/expo/detail/"&ttid&".html"
									Call FileDel(ExpoFile)'删除文件
									ExpoPic=HOPE_InstallDir&"UploadFile/"&picture&"/"
									if picture<>"nopicture.gif" then
									Call FileDel(ExpoPic)'删除图片
									end if
									RsExpo.MOveNExt
										if RsExpo.Eof Then exit do
								loop
							End if
							
							RsExpo.Close
							Set RsExpo=Nothing
							
					'【公共:删除生成的供求信息文件Websen_Info】
					SqltridInfo="select Info_ID, sortid,typeid,typeid_2,showname,dateandtime,period,type  from Websen_Info where  gsid="&userID&""
					Set RstridInfo=Conn.Execute(SqltridInfo)
					
					  IF Not RstridInfo.Eof Then 
						do while Not RstridInfo.Eof
							 ttid=RstridInfo("Info_ID")
							 sortid=RstridInfo("sortid")
							 typeid=RstridInfo("typeid")
							 typeid_2=RstridInfo("typeid_2")
							 showname=RstridInfo("showname")
							 dateandtime=RstridInfo("dateandtime")
							 period=RstridInfo("period")
						 
								FileTrideinfo=HOPE_InstallDir&"tradeinfo/offerdetail/"&sortid&"-"&typeid&"-"&typeid_2&"-"&ttid&".html"
								Call FileDel(FileTrideinfo) '删除供应信息
								
								FileTrideinfo=HOPE_InstallDir&"seller/offerdetail/"&sortid&"-"&typeid&"-"&typeid_2&"-"&ttid&".html"
								Call FileDel(FileTrideinfo)'删除供应信息
							
							RstridInfo.MOVeNExt
								if RstridInfo.Eof Then exit do
						loop
					  End if
					RstridInfo.CLose
					Set RstridInfo=nothing
					
					Call  deleteannounce(userID) '删除该会员的相关资料
					
				RsCo.MoveNExt
					IF RsCo.Eof Then Exit do
			 loop 
		end if
			RsCo.Close
			Set RsCo=NOthing
	Conn.execute("Delete  From Websen_productshow Where typeid_2="&id&"") '删除产品
	Conn.execute("Delete  From Websen_Info Where typeid_2="&id&"") '删除供求		
End Sub


sub deleteannounce(id)

set DelRs=conn.execute("select * from Websen_corporation where id="&cstr(id)&"")
theuser=DelRs("user")

conn.execute("delete from [Websen_memberRelation] where [user]='"&theuser&"' or secuser='"&theuser&"'")    '从会员关系表中删除这个公司的信息
if action=5 then
	conn.execute("delete from [Websen_bizre] where gsid="&cstr(id)&"")
		'删除企业证书  
	conn.execute("delete from [Websen_expo] where gsid="&cstr(id)&"")
		'删除展会信息
	conn.execute("delete from [Websen_book] where bookid="&cstr(id)&" or gsid="&cstr(id)&"")  
	  '从客户反馈表中删除这个公司的信息(网盛通公司专有)
	conn.execute("delete from [Websen_trustadv] where bprid="&cstr(id)&" or pjrid="&cstr(id)&"")   
		'从网盛通会员评论表中删除这个公司的信息(网盛通公司专有)
	conn.execute("delete from [Websen_work] where gsid="&cstr(id)&"")   
		'从招聘表中删除这个公司的信息(网盛通公司专有)
	conn.execute("delete from [Websen_productclass] where gsid="&cstr(id)&"")  
	    '从产品分类中删除这个公司的信息(网盛通公司专有)
	conn.execute("delete from [Websen_productclass_1] where gsid="&cstr(id)&"")  
	    '从产品二级分类中删除这个公司的信息(网盛通公司专有)
	conn.execute("delete from [Websen_productshow] where gsid="&cstr(id)&"")  
	    '从产品信息中删除这个公司的信息(网盛通公司专有)
end if
	'Response.write id
	'Response.end
conn.execute("delete from [Websen_wt] where gsid="&cstr(id)&"")  
  '从委托代理表中删除这个公司的信息
conn.execute("delete from [Websen_emailorder] where gsid="&cstr(id)&"")  
  '从邮件订阅表中删除这个公司的信息
conn.execute("delete from [Websen_getprice] where mycid="&cstr(id)&" or sendcid="&cstr(id)&"")   
 '从发信中删除这个公司的信息
conn.execute("delete from [Websen_getprice1] where mycid="&cstr(id)&" or sendcid="&cstr(id)&"")   
 '从询价表1中删除这个公司的信息
conn.execute("delete from [Websen_Info] where gsid="&cstr(id)&"")   
 '从供求信息中删除这个公司的信息
conn.execute("delete from [Websen_files] where userid="&cstr(id)&"")   
 '删除这个公司的上传图片信息
conn.execute("delete from [Websen_corporation] where id="&cstr(id)&"")  
 '最后，从公司库中删除
if err.Number<>0 then
err.clear
response.write "删 除 失 败 !<br>"
end if
End sub
%>
<br>
 