日期:2011-09-17 浏览次数:20471 次
Asp.net中带进度条的批量静态页生成
namespace WDFROG.BLL
...{
public delegate void CreateHtmlHandler(string fileName,string msg,int percent );
public class News
...{
private const string C_ERR_MSG = "You have no rights!";
private const string C_CHK_NAME = "NewsManage";
private static string C_DIR = ConfigurationManager.AppSettings["NewsHtml"];
public event CreateHtmlHandler CompleteAFile;
public static int Create(string AdminName,NewsInfo news)
...{
IPermissionChecker chk = PermissionCheckerFactory.GetChecker(AdminName, C_CHK_NAME);
chk.Check(C_ERR_MSG);
news.HtmlFile =FileOperator.GetRandFileName(".html");
int ret= NewsDAL.Create(news);
CreateHtmlFile(news);
return ret;
}
public static int DeleteByIdList(string AdminName,string IdList)
...{
IPermissionChecker chk = PermissionCheckerFactory.GetChecker(AdminName, C_CHK_NAME);
chk.Check(C_ERR_MSG);
DataTable dt = SelectHtmlFileByIdList(IdList).Tables[0];
string fileName = "";
foreach (DataRow dr in dt.Rows)
...{
if (!(dr[0] is DBNull))
...{
fileName = dr[0].ToString();
if(string.IsNullOrEmpty(fileName))
...{
fileName = FileOperator.MapPath(C_DIR + fileName);
File.Delete(fileName);
}
}
}
return NewsDAL.DeleteByIdList(IdList);
}
public static int DeleteByNewsID(string AdminName, int N