public void DelFiles() { Sys_ModelFileBLL filebll = new Sys_ModelFileBLL(); string id = HttpContext.Current.Request["id"]; List <string> listId = new List <string>(); listId = id.Split(',').ToList(); foreach (var item in listId) { bool file = filebll.Delete(p => p.File_OperationID == item); } }
private string DeleteSoftware(string id) { Sys_Software software = sfbll.Find(s => s.SoftwareID == id); // 并不真实删除表中数据,仅仅更新字段,并保留删除信息 software.Software_IsExists = 1; software.Software_DeleteTime = DateTime.Now; software.Software_DeleteUserID = CurrUserInfo().UserID; string msg = string.Empty; bool bol = sfbll.Update(software, out msg); // 得到ModelFile表中对象。 var file = bll.Find(m => m.File_OperationID == id); FileDeleHandler fdh = new FileDeleHandler(); // 删除Download中的文件 string Result = fdh.PublicDele(file.FileID, "ww", file.File_Type); bll.Delete(file); return(Result); }
public void DelFilseList(HttpContext context) { string re = "1"; string id = context.Request.QueryString["id"]; string SessionID = context.Request.QueryString["SessionID"]; string FileType = context.Request.QueryString["FileType"]; if (FileType == Constant.fileType1) //如果是第一部 真删除 { List <Sys_ModelFile> list = null; if (HttpContext.Current.Session[SessionID] != null) { list = HttpContext.Current.Session[SessionID] as List <Sys_ModelFile>; List <Sys_ModelFile> modelList = list.FindAll(p => id.Contains(p.FileID)); if (modelList.Count > 0) { for (int i = 0; i < modelList.Count; i++) { File.Delete(HttpContext.Current.Server.MapPath(modelList[i].File_Path)); if (modelList[i] != null) { list.Remove(modelList[i]); } } HttpContext.Current.Session[SessionID] = list; } } Sys_ModelFileBLL bllfile = new Sys_ModelFileBLL(); string[] picid = id.Split(','); //string picid = "'" + id.Replace(",", "','") + "'"; //List<Sys_ModelFile> fileList = bllfile.FindWhere(" FileID in (" + picid + ")"); //bool b = bllfile.DeleteWhere(" FileID in (" + picid + ")"); List <Sys_ModelFile> fileList = bllfile.GetList(p => picid.Contains(p.FileID)).ToList(); bool b = bllfile.Delete((p => picid.Contains(p.FileID))); if (b) { for (int i = 0; i < fileList.Count; i++) { try { File.Delete(HttpContext.Current.Server.MapPath(fileList[i].File_Path)); } catch { } re = "1"; } } } else { List <Sys_ModelFile> list = null; if (HttpContext.Current.Session[SessionID] != null) { list = HttpContext.Current.Session[SessionID] as List <Sys_ModelFile>; for (int i = 0; i < list.Count; i++) { string fileid = list[i].FileID; if (id.Contains(fileid)) { list[i].File_Type = Constant.fileType7; } } HttpContext.Current.Session[SessionID] = list; } Sys_ModelFileBLL bllfile = new Sys_ModelFileBLL(); string[] picid = id.Split(','); List <Sys_ModelFile> fileList = bllfile.GetList(p => picid.Contains(p.FileID)).ToList(); //string picid = "'" + id.Replace(",", "','") + "'"; //List<Sys_ModelFile> fileList = bllfile.FindWhere(" FileID in (" + picid + ")"); for (int i = 0; i < fileList.Count; i++) { fileList[i].File_Type = Constant.fileType7; } bool bl = bllfile.Update(fileList); if (!bl) { re = "2"; } } context.Response.Write(re); }
public void DelFile(string id) { Sys_ModelFileBLL filebll = new Sys_ModelFileBLL(); bool file = filebll.Delete(p => p.File_OperationID == id); }