移交尾项管理文件导出后,没有删除冗余文件问题处理
This commit is contained in:
parent
f1a1329927
commit
407ba6c76d
|
@ -13,6 +13,8 @@ using System.Data.SqlClient;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text;
|
||||||
using System.Web.Services.Description;
|
using System.Web.Services.Description;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
|
||||||
|
|
||||||
|
@ -530,6 +532,8 @@ namespace FineUIPro.Web.Transfer
|
||||||
ShowNotify("没有要导出的数据!!!", MessageBoxIcon.Warning);
|
ShowNotify("没有要导出的数据!!!", MessageBoxIcon.Warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
newUrl = uploadfilepath.Replace("导出模板", "导出数据").Replace(".xlsx", DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx");
|
newUrl = uploadfilepath.Replace("导出模板", "导出数据").Replace(".xlsx", DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx");
|
||||||
File.Copy(uploadfilepath, newUrl);
|
File.Copy(uploadfilepath, newUrl);
|
||||||
NPOI.SS.UserModel.IWorkbook workbook;
|
NPOI.SS.UserModel.IWorkbook workbook;
|
||||||
|
@ -714,5 +718,20 @@ namespace FineUIPro.Web.Transfer
|
||||||
Response.Close();
|
Response.Close();
|
||||||
File.Delete(newUrl);
|
File.Delete(newUrl);
|
||||||
}
|
}
|
||||||
|
catch (WebException ex)
|
||||||
|
{
|
||||||
|
if (File.Exists(newUrl))
|
||||||
|
{
|
||||||
|
File.Delete(newUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (File.Exists(newUrl))
|
||||||
|
{
|
||||||
|
File.Delete(newUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue