<!--#include file="Conn.asp"-->
<!--#include file ="Check_Manager.asp"-->
<!--#include file="Product_Sub.asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="JsInc/Function.asp"-->
<script language="JavaScript" type="text/JavaScript">
function checkBig()
{
  if (document.form1.BigClassName.value=="")
  {
    alert("大类名称不能为空！");
    document.form1.BigClassName.focus();
    return false;
  }
}
</script>
<script language="JavaScript" type="text/JavaScript">
function checkSmall()
{
  if (document.form1.SmallClassName.value=="")
  {
    alert("小类名称不能为空！");
    document.form1.SmallClassName.focus();
    return false;
  }
}
</script>
<html>
<head>
<titel></titel>
<LINK href="admin/admin.css" type=text/css rel=stylesheet>
</head>
<body>
<%
If Request.QueryString("action")="update" Then
Set pp = Conn.Execute("Select * From [DownLoad] Where ID="&Request("id"))
If pp.Bof and pp.Eof Then
Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('没有该文件!');" & Chr(13)
		Response.write "window.document.location.href='Down_Manage.asp';"&Chr(13)
		Response.write "</script>" & Chr(13)
Response.End
Else
If Request.Form("upda")="修改" Then
titel = Trim(Request.Form("Title"))
content = Trim(Request.Form("Content"))
content = Replace(content,"'","''")
downtype = Trim(Request.Form("ClassName"))
UpdateTime = Trim(Request.Form("UpdateTime"))
photourl = Trim(Request.Form("photourl"))
downUrl = Trim(Request.Form("downUrl"))

Sql1 = "Update [DownLoad] Set "
Sql1 = Sql1 & " [Titel]='"&titel&"',[Content]='"&content&"',[DownType]='"&downtype&"' "
Sql1 = Sql1 & " ,[PhotoUrl]='"&photourl&"',[DownUrl]='"&downurl&"' Where ID="&Request("id")
Conn.Execute (Sql1)
        If UpdateTime<>"" and IsDate(UpdateTime)=true then
		UpdateTime=CDate(UpdateTime)
	Else
		UpdateTime=date()
	End if
SqlStr2 = "Update [DownLoad] Set [InfoTime]='"&UpdateTime&"' Where ID="&Request("id")
Conn.Execute (SqlStr2)
JaSys("管理员" & session("ManagerUser") & "<font color=red>修改下载信息ID"&Request("id")&"</font>成功")
Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('更新成功!');" & Chr(13)
		Response.write "window.document.location.href='Down_Manage.asp';"&Chr(13)
		Response.write "</script>" & Chr(13)
Response.End
End if
End if
End if

If Request.QueryString("action")="deldown" Then
Dim ArticleID,Action,sqlDel,rsDel,FoundErr,ObjInstalled
AllID=Trim(Request.Form("AllID"))
ArticleID=Trim(Request("ArticleID"))
Action=Trim(Request("action"))
id=Request("id")
FoundErr=False
ObjInstalled=IsObjInstalled("Scripting.FileSystemObject")
If Request.QueryString("del")="one" then
Set del=Conn.Execute("Delete * From [DownLoad] Where ID=" & CLng(id))
JaSys("管理员" & session("ManagerUser") & "<font color=red>删除下载信息ID"&id&"</font>成功")
	Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('删除成功!');" & Chr(13)
		Response.write "window.document.location.href='Down_Manage.asp';"&Chr(13)
		Response.write "</script>" & Chr(13)
        Response.End
End if

If ArticleID="" or Action<>"deldown" then
	FoundErr=True
	Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('参数不足!');" & Chr(13)
		Response.write "window.document.location.href='Down_Manage.asp';"&Chr(13)
		Response.write "</script>" & Chr(13)
        Response.End
End if
If FoundErr=False then
	If instr(ArticleID,",")>0 Then
		dim idarr,i
		idArr=split(ArticleID,",")
		for i = 0 to ubound(idArr)
	        If Request.Form(idArr(i))=turn Then
		Set de=Conn.Execute("Delete * From [DownLoad] Where ID=" & CLng(idArr(i))) 
                End if
		next
                JaSys("管理员" & session("ManagerUser") & "<font color=red>删除多个下载信息ID"&ArticleID&"</font>成功")
	Else
		Set de=Conn.Execute("Delete * From DownLoad Where ID=" & CLng(id))
                JaSys("管理员" & session("ManagerUser") & "<font color=red>删除下载信息ID"&id&"</font>成功")
	End if
End if

If FoundErr=False then
	call CloseConn()
	response.Redirect "Down_Manage.asp"
Else
	call CloseConn()
End if
End if
%>
</body>
</html>