<!--#include file="Conn.asp"-->
<!--#include file ="Check_Manager.asp"-->
<!--#include file="Down_Sub.asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="JsInc/Function.asp"-->
<script language="JavaScript" type="text/JavaScript">
function checkBig()
{
  if (document.form1.ClassName.value=="")
  {
    alert("下载类别不能为空！");
    document.form1.ClassName.focus();
    return false;
  }
}
</script>
<html>
<head>
<titel></titel>
<LINK href="admin/admin.css" type=text/css rel=stylesheet>
</head>
<body>
<%
If Request.QueryString("action")="add" Then
Call AddDownClass
If Request.Form("Add")=" 添 加 " Then
titel = Trim(Request.Form("ClassName"))
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open "Select * From [BigClassDown] Where [DownType]='" & titel & "'",Conn,1,3
If Not rs.Eof and Not rs.Bof Then
Response.Write  "<br><li>下载类别“" & titel & "”已经存在！</li>"
Else
rs.AddNew
rs("DownType")=titel
rs.Update
rs.Close
set rs=nothing
JaSys("管理员" & session("ManagerUser") & "<font color=red>添加下载类别"&titel&"</font>成功")
Response.Redirect "Down_ClassManage.asp" 
End if 
End if
End if

If Request.QueryString("action")="down" Then
Call EditDownClass
  If Request.Form("Update")=" 修 改 " Then
  ClassName=Trim(Request("ClassName"))
   FoundErr=False
   If ClassName="" Then
   FoundErr=True
   Response.Write "<br><li>下载类别不能为空！</li>"
   End if
     If FoundErr<>True then
     Set rs=Server.CreateObject("Adodb.RecordSet")
     rs.Open "Select * From [BigClassDown] Where [DownType]='" & ClassName & "'",Conn,1,1
        If not (rs.bof and rs.EOF) then
	Response.Write  "<br><li>下载类别“" & BigClassName & "”已经存在！</li>"
        Else
        Set bb = Conn.Execute("Select * From [BigClassDown] Where ID="&Cint(Request("id")))
        big = bb("DownType")
        Sql = "Update [DownLoad] Set [DownType]='"&ClassName&"' Where [DownType]='"&big&"'"
        Conn.Execute (Sql)
        Sql1 = "Update [BigClassDown] Set [DownType]='"&ClassName&"' Where [DownType]='"&big&"'"
        Conn.Execute (Sql1)
        JaSys("管理员" & session("ManagerUser") & "<font color=red>修改下载类别"&ClassName&"</font>成功")  
    	Response.Redirect "Down_ClassManage.asp"  
	End if
     End if
  End if
End if

If Request.QueryString("action")="del" Then
Call DelDown 
End if

Call CloseConn()
%>
</body>
</html>