<% 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"),"P0702") then Call ReturnError()
	Dim VoteID,VoteDelObj,Types,TempStr
	VoteID = Cstr(Request("VoteID"))
	Types = Cstr(Request("Types"))
	if Types = "Dell" then
	   TempStr = "删除"
	elseif Types = "Open" then
	   TempStr = "开启"
	elseif Types = "Close" then
	   TempStr = "关闭"
	end if
	Set VoteDelObj = Conn.Execute("Select VoteID from Vote where VoteID='"&VoteID&"'")
	If VoteDelObj.eof then
		Response.Write("<script>alert(""参数传递错误"");dialogArguments.location.reload();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 name="VoteDelForm" action="" method="post">
<table width="100%" border="0" cellspacing="5" cellpadding="0">
  <tr> 
    <td width="7%" height="10">&nbsp;</td>
    <td width="17%" rowspan="3"><div align="center"><img src="../Images/Question.gif" width="34" height="33"></div></td>
    <td width="70%">&nbsp;</td>
    <td width="6%" height="10">&nbsp;</td>
  </tr>
  <tr> 
    <td>&nbsp;</td>
    <td>您确定要<%=TempStr%>该投票项目?</td>
    <td>&nbsp;</td>
  </tr>
  <tr> 
    <td height="2">&nbsp;</td>
    <td height="2">&nbsp;</td>
    <td height="2">&nbsp;</td>
  </tr>
  <tr> 
    <td>&nbsp;</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>&nbsp;</td>
  </tr>
  <tr> 
    <td height="10">&nbsp;</td>
    <td height="10" colspan="2">&nbsp;</td>
    <td height="10">&nbsp;</td>
  </tr>
</table>
</form>
</body>
</html>

<%
  If Request.Form("action") = "trues" then
     if Types = "Dell" then
		 Conn.Execute("Delete from VoteOption where VoteID='"&VoteID&"'")
		 Conn.Execute("Delete from Vote where VoteID='"&VoteID&"'")
		 Response.Write("<script>alert(""投票项目删除成功"");dialogArguments.location.reload();window.close();</script>")
		 Response.End
	  end if
	  if Types = "Open" then
	  	 Conn.Execute("Update Vote set State=1 where VoteID='"&VoteID&"'")
		 Response.Write("<script>alert(""投票项目开启成功"");dialogArguments.location.reload();window.close();</script>")
		 Response.End
	  end if
	  if Types = "Close" then
	  	 Conn.Execute("Update Vote set State=0 where VoteID='"&VoteID&"'")
		 Response.Write("<script>alert(""投票项目关闭成功"");dialogArguments.location.reload();window.close();</script>")
		 Response.End
	  end if
  End If
%>