<% Option Explicit %>
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.asp" -->
<%
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P0804") then Call ReturnError()
    dim UserGroupID,UGDellObj
	    if Request("ID")<>"" then
		   UserGroupID = Request("ID")
		   Set UGDellObj = Conn.Execute("select ID from MemGroup where GroupID='"&UserGroupID&"'")
		   if UGDellObj.eof then
			 Response.Write("<script>alert(""参数传递错误"");window.close();</script>")
			 response.end
		   end if
		else
		 Response.Write("<script>alert(""参数传递错误"");window.close();</script>")
		 response.end
		end if 
%>
<html>
<head>
<link href="../Inc/ModeWindow.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>会员组删除</title>
</head>

<body leftmargin="0" topmargin="0">
<form action="" name="JSDellForm" method="post">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
  <tr> 
    <td width="7%" height="10"></td>
    <td width="19%" rowspan="3"><div align="center"><img src="../Images/Question.gif" width="39" height="37"></div></td>
    <td width="68%"></td>
    <td width="6%" height="10"></td>
  </tr>
  <tr> 
    <td>&nbsp;</td>
    <td>您确定要删除此会员组<br>并删除此会员组下的所有会员?</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td height="2"></td>
    <td height="2"></td>
    <td height="2"></td>
  </tr>
  <tr> 
    <td></td>
    <td colspan="2"><div align="center"> 
        <input type="submit" name="Submit" value=" 确 定 ">
        <input type="hidden" name="action" value="trues">
        <input type="button" name="Submit2" value=" 取 消 " onClick="window.close();">
      </div></td>
    <td></td>
  </tr>
  <tr> 
    <td height="10"></td>
    <td height="10" colspan="2"></td>
    <td height="10"></td>
  </tr>
</table>
</form>
</body>
</html>
<%
  if request.Form("action")="trues" then
  	 Dim MessageObj
	 Set MessageObj = Conn.Execute("Select MemName from Members where GroupID='"&UserGroupID&"' order by RegTime asc")
     Do While Not MessageObj.eof
	 	Conn.Execute("Delete from Message where MeRead='"&MessageObj("MemName")&"'")
	 	MessageObj.MoveNext
	 Loop
	 MessageObj.Close
	 Set MessageObj = Nothing
	 Conn.Execute("delete from Members where GroupID='"&UserGroupID&"'")
	 Conn.Execute("delete from MemGroup where GroupID='"&UserGroupID&"'")
	response.write("<script>dialogArguments.location.reload();window.close();</script>")
	response.end
  end if
%>