public object RemoveObsRecord([FromBody] JObject json) { try { string res = json.Value <string>("json"); dynamic dy = JsonConvert.DeserializeObject <ExpandoObject>(res); string userId = dy.userid; string obsId = dy.data.obsid; //附件 var filelist = fileinfobll.GetFiles(obsId); if (filelist.Rows.Count > 0) { for (int i = 0; i < filelist.Rows.Count; i++) { fileinfobll.RemoveForm(filelist.Rows[i]["fileid"].ToString()); } } //观察记录 observerecordbll.RemoveForm(obsId); return(new { Code = 0, Count = 0, Info = "操作成功" }); } catch (Exception ex) { return(new { Code = -1, Count = 0, Info = ex.Message }); } }
public ActionResult RemoveForm(string keyValue, string fileType) { if (fileType == "folder") { fileFolderBLL.RemoveForm(keyValue); } else { fileInfoBLL.RemoveForm(keyValue); } return(Success("删除成功。")); }
public void DeleteFileByRec(string recId) { if (!string.IsNullOrWhiteSpace(recId)) { var list = fileinfobll.GetFileList(recId); foreach (var file in list) { fileinfobll.RemoveForm(file.FileId); var filePath = ctx.Server.MapPath(file.FilePath); if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } } } }
public void DeleteFileByRec(string recId) { if (!string.IsNullOrWhiteSpace(recId)) { var list = fileInfoBLL.GetFileList(recId); foreach (var file in list) { fileInfoBLL.RemoveForm(file.FileId); var filePath = dataitemdetailbll.GetItemValue("imgPath") + file.FilePath.Replace("~", ""); if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } } } }
public ActionResult CopyForm(string keyValue, string recid) { try { IList <FileInfoEntity> filelist = fileinfobll.GetFileList(recid); IList <FileInfoEntity> filelist1 = fileinfobll.GetFileList(keyValue); foreach (var item in filelist1) { fileinfobll.RemoveForm(item.FileId); } string dir = string.Format("~/Resource/{0}/{1}", "ht/images", DateTime.Now.ToString("yyyyMMdd")); foreach (var item in filelist) { if (!Directory.Exists(Server.MapPath(dir))) { Directory.CreateDirectory(Server.MapPath(dir)); } if (System.IO.File.Exists(Server.MapPath(item.FilePath))) { string newFileName = Guid.NewGuid().ToString() + item.FileExtensions; string newFilePath = dir + "/" + newFileName; System.IO.File.Copy(Server.MapPath(item.FilePath), Server.MapPath(newFilePath)); item.FilePath = newFilePath; } item.RecId = keyValue; item.FileId = Guid.NewGuid().ToString(); fileinfobll.SaveForm("", item); } return(Success("操作成功。")); } catch (Exception ex) { return(Error(ex.ToString())); } }
public ActionResult GetAptituInfoByOutProject(string outProjectId, string keyValue) { var zzData = aptitudeinvestigateinfobll.GetListByOutprojectId(outProjectId); if (zzData != null) { var data = new { BUSCODE = zzData.BUSCODE, BUSCERTIFICATE = zzData.BUSCERTIFICATE, BUSVALIDSTARTTIME = zzData.BUSVALIDSTARTTIME, BUSVALIDENDTIME = zzData.BUSVALIDENDTIME, SPLCODE = zzData.SPLCODE, SPLCERTIFICATE = zzData.SPLCERTIFICATE, SPLVALIDSTARTTIME = zzData.SPLVALIDSTARTTIME, SPLVALIDENDTIME = zzData.SPLVALIDENDTIME, UnitSuper = zzData.UnitSuper, UnitSuperPhone = zzData.UnitSuperPhone, ProjectManager = zzData.ProjectManager, ProjectManagerTel = zzData.ProjectManagerTel, SafetyModerator = zzData.SafetyModerator, SafetyModeratorTel = zzData.SafetyModeratorTel, //CQCODE = zzData.CQCODE, //CQORG = zzData.CQORG, //CQRANGE = zzData.CQRANGE, //CQLEVEL = zzData.CQLEVEL, //CQVALIDSTARTTIME = zzData.CQVALIDSTARTTIME, //CQVALIDENDTIME = zzData.CQVALIDENDTIME, ID = zzData.ID }; //编辑时同步上次通过审核的单位资质附件 //如果前面同步过其它的附件先删除后在同步 //保证与最近一次通过审核的资质审查信息一致 for (int i = 1; i <= 8; i++) { var id = zzData.ID + "0" + i; var file1 = filebll.GetFiles(id); if (file1.Rows.Count > 0) { var key = keyValue + "0" + i; var fileEdit1 = filebll.GetFiles(key); if (fileEdit1.Rows.Count > 0) { foreach (DataRow item in fileEdit1.Rows) { filebll.RemoveForm(item["FileId"].ToString()); } } foreach (DataRow item in file1.Rows) { FileInfoEntity itemFile = new FileInfoEntity(); //itemFile.FileId = Guid.NewGuid().ToString(); itemFile.FileName = item["FileName"].ToString(); itemFile.FilePath = item["filepath"].ToString(); itemFile.FileSize = item["filesize"].ToString(); itemFile.RecId = (keyValue + "0" + i).ToString(); filebll.SaveForm(itemFile.FileId, itemFile); } } } //查询资质证件信息并给当前新增的赋值 List<QualificationEntity> quaOldList = aptitudeinvestigateinfobll.GetZzzjList().Where(x => x.InfoId == keyValue).ToList(); if (quaOldList.Count > 0) { for (int i = 0; i < quaOldList.Count; i++) { aptitudeinvestigateinfobll.RemoveZzzjForm(quaOldList[i].ID); } } List<QualificationEntity> quaList = aptitudeinvestigateinfobll.GetZzzjList().Where(x => x.InfoId == zzData.ID).ToList(); for (int i = 0; i < quaList.Count; i++) { var file1 =new FileInfoBLL().GetFiles(quaList[i].ID); quaList[i].ID = ""; quaList[i].InfoId = keyValue; aptitudeinvestigateinfobll.SaveZzzjForm("", quaList[i]); if (file1.Rows.Count > 0) { var key = quaList[i].ID; foreach (DataRow item in file1.Rows) { FileInfoEntity itemFile = new FileInfoEntity(); itemFile.FileName = item["FileName"].ToString(); itemFile.FilePath = item["filepath"].ToString(); itemFile.FileSize = item["filesize"].ToString(); itemFile.RecId = key; new FileInfoBLL().SaveForm(itemFile.FileId, itemFile); } } } return ToJsonResult(data); } else { return ToJsonResult(null); } }