<% Option Explicit %>
<!--#include file="Function.asp" -->
<!--#include file="../../Inc/Function.asp" -->
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="RefreshFunction.asp" -->
<!--#include file="SelectFunction.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"),"P0405") then Call ReturnError1()
Dim Types,SearchSql,RsSearchObj,PromptInfo,NewsNo,NewsTotalNum
NewsNo = Request("NewsNo")
if NewsNo = "" then
	NewsNo = 1
else
	NewsNo = CInt(NewsNo)
end if
SearchSql = Request("SearchSql")
if SearchSql = "" then
	Types = Request("Types")
	if Types = "DatesType" then
		SearchSql = "Select * from DownLoad where AuditTF=1 and AddTime >= #" & Request.Form("FromDate") & "# And AddTime <= #" & Request.Form("TentDate") & "# order by AddTime Desc" 
	elseif Types = "NewType" then
		SearchSql = "Select Top " & Request.Form("NewNum") & " * from DownLoad where AuditTF=1 order by AddTime Desc"
	elseif Types = "AllType" then
		SearchSql = "Select * from DownLoad where AuditTF=1 order by AddTime Desc"
	elseif Types = "ClassType" then
		if Request.Form("NumClass") <> "0" then
			if (Request.Form("NumClass") <> "") And (Request.Form("ClassID") <> "") then
				SearchSql = "Select Top " & Request.Form("NumClass") & " * from DownLoad where AuditTF=1 and ClassID='" & Request.Form("ClassID") & "' order by AddTime Desc"
			else
				SearchSql = ""
			end if
		else
			PromptInfo = "没有刷新下载&nbsp;&nbsp;<a href=""RefreshDownLoad.asp"">返回</a>"
			Call PromptFunction
		end if
	else
		SearchSql = ""
	end if
end if
if SearchSql <> "" then
	Set RsSearchObj = Server.CreateObject("ADODB.RecordSet")
	RsSearchObj.Open SearchSql,Conn,1,1
	NewsTotalNum = RsSearchObj.RecordCount
	if RsSearchObj.Eof then
		PromptInfo = "没有要刷新的下载&nbsp;&nbsp;<font color=""red""><a href=""RefreshDownLoad.asp"">返回</a></font>"
		Set RsSearchObj = Nothing
		Call PromptFunction
	else
		RsSearchObj.Move NewsNo - 1
		if Not RsSearchObj.Eof then
			RefreshDownLoad RsSearchObj
			NewsNo = NewsNo + 1
			Response.Write("<meta http-equiv=""refresh"" content=""0;url=RefreshDownLoadSave.asp?NewsNo=" & NewsNo & "&SearchSql=" & SearchSql & """>") 'Replace(SearchSql,"#","*")
			PromptInfo = "共有<font color=red><b>" & NewsTotalNum & "</b></font>条下载需要刷新<br><br>正在刷新第<font color=red><b>" & NewsNo - 1 & "</b></font>条下载"
			PromptInfo = PromptInfo & "按确定键返回！<br><br><input name=""imageField"" type=""image"" src=""../Images/back.gif"" width=""75"" height=""21"" border=""0"">"
		else
			PromptInfo = "刷新下载成功<font color=red><b>" & NewsTotalNum & "</b></font>条下载<br><br><input name=""imageField"" type=""image"" src=""../Images/back.gif"" width=""75"" height=""21"" border=""0"">"
		end if
		Set RsSearchObj = Nothing
		Call PromptFunction
	end if
	Set RsSearchObj = Nothing
else
	PromptInfo = "参数传递错误"
	Call PromptFunction
end if

Sub PromptFunction()
	Set Conn = Nothing
%>
<!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 rel="stylesheet" href="../../CSS/css.css">
<body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <form method=post action=RefreshDownLoad.asp>
    <tr> 
      <td height="150"> <div align="center"> 
          <% = PromptInfo %>
        </div></td>
    </tr>
  </form>
</table>
</body>
</html>
<%
End Sub
%>