public ActionResult ThoroughRemoveForm(string keyValue, string fileType) { if (fileType == "folder") { fileFolderBLL.ThoroughRemoveForm(keyValue); } else { fileInfoBLL.ThoroughRemoveForm(keyValue); } return(Success("删除成功。")); }
/// <summary> /// 删除记录关联的附件及物理文件 /// </summary> /// <param name="recId"></param> public void DeleteFiles(string recId) { if (!string.IsNullOrWhiteSpace(recId)) { FileInfoBLL fileBll = new FileInfoBLL(); var list = fileBll.GetFileList(recId); foreach (var file in list) { fileBll.ThoroughRemoveForm(file.FileId); var filePath = HttpContext.Server.MapPath(file.FilePath); if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } } } }