public void GuiLeiFilseList(HttpContext context) { string re = "1"; string id = context.Request.QueryString["id"]; string SessionID = context.Request.QueryString["SessionID"]; string FileType = context.Request.QueryString["FileType"]; if (!string.IsNullOrEmpty(FileType)) { FileType = HttpUtility.UrlDecode(FileType); } List <Sys_ModelFile> list = null; if (HttpContext.Current.Session[SessionID] != null) { list = HttpContext.Current.Session[SessionID] as List <Sys_ModelFile>; //List<Sys_ModelFile> list2 = list.FindAll(p => id.Contains(p.FileID)); for (int i = 0; i < list.Count; i++) { //for (int j = 0; j < list.Count;j++ ) //{ // if(list2[i].FileID){} //} string fileid = list[i].FileID; if (id.Contains(fileid)) { list[i].File_Type = FileType; } } HttpContext.Current.Session[SessionID] = list; List <Sys_ModelFile> lisst = HttpContext.Current.Session[SessionID] as List <Sys_ModelFile>; } Sys_ModelFileBLL bllfile = new Sys_ModelFileBLL(); //string picid = "'" + id.Replace(",", "','") + "'"; //List<Sys_ModelFile> fileList = bllfile.FindWhere(" FileID in (" + picid + ")"); string[] picid = id.Split(','); List <Sys_ModelFile> fileList = bllfile.GetList(p => picid.Contains(p.FileID)).ToList(); for (int i = 0; i < fileList.Count; i++) { fileList[i].File_Type = FileType; } string b = ""; bool bl = bllfile.Update(fileList); if (!bl) { re = "2"; } context.Response.Write(re); }
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); }