{
string absolutePath = SetFullPath();
printpdf pdf = new printpdf();
IQueryable<视图或表名> aa= db.视图或表名.AsNoTracking();
pdf.PrintDetailReWrite(aa, 起始日期, 结束日期, xxxxx, reportCriteria,timeZone);
download(pdf.fileName, ".pdf", type);
FileInfo file = new FileInfo(absolutePath + pdf.fileName + ".pdf");
file.Delete();
}
private static string SetFullPath()
{
string absolutePath1 = ConfigurationManager.AppSettings["PDFTestFolder"];
if (string.IsNullOrEmpty(absolutePath1))
{
absolutePath1 = "C:\\test\\download\\";
}
return absolutePath1;
}
private void download(string serverFileName, string fileType, int reportType)
{
string fileName = "";
switch (reportType)
{
case 1:
fileName += "文件名前半部分";
break;
}
fileName += DateTime.UtcNow.ToString("yyyyMMddHHmmss") + fileType;
string filePath = absolutePath + serverFileName + fileType;
FileStream fs = new FileStream(filePath, FileMode.Open);
byte[] bytes = new byte[(int)fs.Length];
fs.Read(bytes, 0, bytes.Length);
fs.Close();
Response.ContentType =