日期:2014-05-17 浏览次数:21380 次
//全局唯一入口
private static ReportEntrance instance=new ReportEntrance ();
public static ReportEntrance GetInstance()
{
return instance;
}
//线程挂起时间
private int interval = int.Parse(ConfigurationManager.AppSettings["interval"]) * 60 * 1000;
//定义线程
private Thread ReportThread;
//构造函数,线程开始
private ReportEntrance()
{
try
{
this.ReportThread = new Thread(new ThreadStart(ReportThreadProc));
this.ReportThread.Name = "Report Thread";
this.ReportThread.Start();
}
catch(Exception ex)
{
throw ex;
}
}
//报表生成方法
private void ReportThreadProc()
{
while (true)
{
RunLogger.Info(string.Empty);
Console.WriteLine("Begin Create Report---StartTime:"+DateTime.Now);
RunLogger.Info("开始生成报表");
CreatReport();/////////操作内容;有异常时会console.write();
RunLogger.Info("报表生成结束");
Console.WriteLine("Create Finish---EndTime:" + DateTime.Now);
Console.WriteLine(string.Empty);
&nbs