<% Option Explicit %>
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Const.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"),"P0802") then Call ReturnError()
Dim Result
Dim ID,GroupName,Comment,AdminGroupObj,Sql
ID = Request("ID")
Result = Request.Form("Result")
if ID <> "" then
	Sql = "Select * from AdminGroup where ID=" & ID
	Set AdminGroupObj = Server.CreateObject("ADODB.RecordSet")
	AdminGroupObj.Open Sql,Conn,3,3
	if Not AdminGroupObj.Eof then
		if Result = "Submit" then
			AdminGroupObj("GroupName") = Request.Form("GroupName")
			AdminGroupObj("Comment") = Request.Form("Comment")
			AdminGroupObj.UpDate
			if Err.Number = 0 then
%>
<script language="JavaScript">
	alert('修改成功');
	dialogArguments.location.reload();
	window.close();
</script>
<%
			else
%>
<script language="JavaScript">
	alert('修改失败');
	dialogArguments.location.reload();
	window.close();
</script>
<%
			end if
		end if
		GroupName = AdminGroupObj("GroupName")
		Comment = AdminGroupObj("Comment")
	else
%>
<script language="JavaScript">
	alert('参数传递错误');
	dialogArguments.location.reload();
	window.close();
</script>
<%
	end if
	Set AdminGroupObj = Nothing
else
	GroupName = ""
	Comment = ""
	if Result = "Submit" then
		if Request.Form("GroupName") <> "" then
			Sql = "Insert into AdminGroup(GroupName,Comment) values ('" & Request.Form("GroupName") & "','" & Request.Form("Comment") & "')"
			Conn.Execute(Sql)
			if Err.Number = 0 then
%>
<script language="JavaScript">
	alert('添加成功');
	dialogArguments.location.reload();
	window.close();
</script>
<%
			else
%>
<script language="JavaScript">
	alert('添加失败');
	dialogArguments.location.reload();
	window.close();
</script>
<%
			end if
		else
%>
<script language="JavaScript">
	alert('请填写组名');
</script>
<%
			GroupName = Request.Form("GroupName")
			Comment = Request.Form("Comment")
		end if
	end if
end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>添加和修改系统管理员组</title>
</head>
<link href="../Inc/ModeWindow.css" rel="stylesheet">
<body topmargin="0" leftmargin="0">
<div align="center">
<table width="96%" border="0" align="center" cellpadding="0" cellspacing="5">
  <form action="" method="post" id="AdminGroupForm" name="AdminGroupForm">	  
	  <tr>
	    <td height="10">&nbsp;</td>
	    <td height="10">&nbsp;</td>
      </tr>
	  <tr>
		<td width="21%"> 
          <div align="center">组 名 称</div></td>
        <td width="79%">
		 <input value="<% =GroupName %>" name="GroupName" style="width:95%;" type="text"  size="36" maxlength="40"><font color="red">&nbsp;</font>
		</td>
      </tr>
      <tr> 
        <td valign="middle"> 
          <div align="center">简要说明</div></td>
        <td> 
          <textarea style="width:95%;" name="Comment" cols="34" rows="4" id="textarea"><% = Comment %></textarea></td>
      </tr>
      <tr> 
        <td colspan="2">
		 <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="10">&nbsp;</td>
            </tr>
            <tr> 
              <td><div align="center"> 
                <input type="submit" name="Submit" value=" 确 定 "><input name="Result" type="hidden" id="Result" value="Submit">
                <input type="hidden" value="<% = ID %>" name="OrdinaryID"><input name="Submitre" type="reset" value=" 重 填 ">
                  <input type="reset" name="Submitcancel" onClick="dialogArguments.location.reload();window.close();" value=" 取 消 ">
                </div></td>
            </tr>
         </table>
        </td>
	 </tr>
  </form>
</table>		
</div>
</body>
</html>
<%
Set Conn = Nothing
%>