/// <summary> /// 根据主键删除采购供货厂家管理 /// </summary> /// <param name="inUnitId"></param> public static void DeleteInUnitById(string inUnitId) { Model.SUBHSSEDB db = Funs.DB; Model.QualityAudit_InUnit inUnit = db.QualityAudit_InUnit.FirstOrDefault(e => e.InUnitId == inUnitId); if (inUnit != null) { CodeRecordsService.DeleteCodeRecordsByDataId(inUnitId); if (!string.IsNullOrEmpty(inUnit.TrainRecordsUrl)) { UploadFileService.DeleteFile(Funs.RootPath, inUnit.TrainRecordsUrl); } if (!string.IsNullOrEmpty(inUnit.PlanUrl)) { UploadFileService.DeleteFile(Funs.RootPath, inUnit.PlanUrl); } if (!string.IsNullOrEmpty(inUnit.TemporaryPersonUrl)) { UploadFileService.DeleteFile(Funs.RootPath, inUnit.TemporaryPersonUrl); } if (!string.IsNullOrEmpty(inUnit.InPersonTrainUrl)) { UploadFileService.DeleteFile(Funs.RootPath, inUnit.InPersonTrainUrl); } if (!string.IsNullOrEmpty(inUnit.HSEAgreementUrl)) { UploadFileService.DeleteFile(Funs.RootPath, inUnit.HSEAgreementUrl); } db.QualityAudit_InUnit.DeleteOnSubmit(inUnit); db.SubmitChanges(); } }
/// <summary> /// 根据主键删除隐患整改通知单 /// </summary> /// <param name="rectifyNoticesId"></param> public static void DeleteRectifyNoticesById(string rectifyNoticesId) { Model.SUBHSSEDB db = Funs.DB; Model.Check_RectifyNotices rectifyNotices = db.Check_RectifyNotices.FirstOrDefault(e => e.RectifyNoticesId == rectifyNoticesId); if (rectifyNotices != null) { CodeRecordsService.DeleteCodeRecordsByDataId(rectifyNoticesId); UploadFileService.DeleteFile(Funs.RootPath, rectifyNotices.AttachUrl); CommonService.DeleteAttachFileById(rectifyNoticesId); var getCheck_RectifyNoticesItem = from x in db.Check_RectifyNoticesItem where x.RectifyNoticesId == rectifyNoticesId select x; if (getCheck_RectifyNoticesItem.Count() > 0) { db.Check_RectifyNoticesItem.DeleteAllOnSubmit(getCheck_RectifyNoticesItem); db.SubmitChanges(); } var getRectifyNoticesFlowOperate = from x in db.Check_RectifyNoticesFlowOperate where x.RectifyNoticesId == rectifyNoticesId select x; if (getRectifyNoticesFlowOperate.Count() > 0) { db.Check_RectifyNoticesFlowOperate.DeleteAllOnSubmit(getRectifyNoticesFlowOperate); db.SubmitChanges(); } db.Check_RectifyNotices.DeleteOnSubmit(rectifyNotices); db.SubmitChanges(); } }
/// <summary> /// 根据主键删除项目绩效评价 /// </summary> /// <param name="perfomanceRecordId"></param> public static void DeletePerfomanceRecordById(string perfomanceRecordId) { Model.SUBHSSEDB db = Funs.DB; Model.ProjectSupervision_ProjectEvaluation perfomanceRecord = db.ProjectSupervision_ProjectEvaluation.FirstOrDefault(e => e.PerfomanceRecordId == perfomanceRecordId); if (perfomanceRecord != null) { UploadFileService.DeleteFile(Funs.RootPath, perfomanceRecord.AttachUrl);//删除附件 db.ProjectSupervision_ProjectEvaluation.DeleteOnSubmit(perfomanceRecord); db.SubmitChanges(); } }
/// <summary> /// 根据主键删除分包方绩效评价 /// </summary> /// <param name="perfomanceRecordId"></param> public static void DeletePerfomanceRecordById(string perfomanceRecordId) { Model.SUBHSSEDB db = Funs.DB; Model.Perfomance_PerfomanceRecord perfomanceRecord = db.Perfomance_PerfomanceRecord.FirstOrDefault(e => e.PerfomanceRecordId == perfomanceRecordId); if (perfomanceRecord != null) { CodeRecordsService.DeleteCodeRecordsByDataId(perfomanceRecordId); //删除编号 CommonService.DeleteFlowOperateByID(perfomanceRecordId); //删除流程 UploadFileService.DeleteFile(Funs.RootPath, perfomanceRecord.AttachUrl); //删除附件 db.Perfomance_PerfomanceRecord.DeleteOnSubmit(perfomanceRecord); db.SubmitChanges(); } }
/// <summary> ///根据主键删除附件 /// </summary> /// <param name="lawRegulationId"></param> public static void DeleteAttachFileById(string id) { using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString)) { Model.AttachFile attachFile = db.AttachFile.FirstOrDefault(e => e.ToKeyId == id); if (attachFile != null) { if (!string.IsNullOrEmpty(attachFile.AttachUrl)) { UploadFileService.DeleteFile(Funs.RootPath, attachFile.AttachUrl); } db.AttachFile.DeleteOnSubmit(attachFile); db.SubmitChanges(); } } }
/// <summary> /// 根据主键删除分包商资质 /// </summary> /// <param name="subUnitQualityId"></param> public static void DeleteSubUnitQualityById(string subUnitQualityId) { Model.SUBHSSEDB db = Funs.DB; Model.QualityAudit_SubUnitQuality subUnitQuality = db.QualityAudit_SubUnitQuality.FirstOrDefault(e => e.SubUnitQualityId == subUnitQualityId); if (subUnitQuality != null) { if (!string.IsNullOrEmpty(subUnitQuality.BL_ScanUrl)) { UploadFileService.DeleteFile(Funs.RootPath, subUnitQuality.BL_ScanUrl); } if (!string.IsNullOrEmpty(subUnitQuality.O_ScanUrl)) { UploadFileService.DeleteFile(Funs.RootPath, subUnitQuality.O_ScanUrl); } if (!string.IsNullOrEmpty(subUnitQuality.C_ScanUrl)) { UploadFileService.DeleteFile(Funs.RootPath, subUnitQuality.C_ScanUrl); } if (!string.IsNullOrEmpty(subUnitQuality.QL_ScanUrl)) { UploadFileService.DeleteFile(Funs.RootPath, subUnitQuality.QL_ScanUrl); } if (!string.IsNullOrEmpty(subUnitQuality.H_ScanUrl)) { UploadFileService.DeleteFile(Funs.RootPath, subUnitQuality.H_ScanUrl); } if (!string.IsNullOrEmpty(subUnitQuality.H_ScanUrl2)) { UploadFileService.DeleteFile(Funs.RootPath, subUnitQuality.H_ScanUrl2); } if (!string.IsNullOrEmpty(subUnitQuality.SL_ScanUrl)) { UploadFileService.DeleteFile(Funs.RootPath, subUnitQuality.SL_ScanUrl); } CodeRecordsService.DeleteCodeRecordsByDataId(subUnitQualityId); db.QualityAudit_SubUnitQuality.DeleteOnSubmit(subUnitQuality); db.SubmitChanges(); } }
/// <summary> /// 根据主键删除处罚通知单 /// </summary> /// <param name="punishNoticeId"></param> public static void DeletePunishNoticeById(string punishNoticeId) { Model.SUBHSSEDB db = Funs.DB; Model.Check_PunishNotice punishNotice = db.Check_PunishNotice.FirstOrDefault(e => e.PunishNoticeId == punishNoticeId); if (punishNotice != null) { CodeRecordsService.DeleteCodeRecordsByDataId(punishNoticeId); UploadFileService.DeleteFile(Funs.RootPath, punishNotice.AttachUrl); ///删除工程师日志收集记录 var flowOperate = from x in db.Sys_FlowOperate where x.DataId == punishNotice.PunishNoticeId select x; if (flowOperate.Count() > 0) { foreach (var item in flowOperate) { BLL.HSSELogService.CollectHSSELog(punishNotice.ProjectId, item.OperaterId, item.OperaterTime, "211", "处罚通知单", Const.BtnDelete, 1); } ////删除流程表 BLL.CommonService.DeleteFlowOperateByID(punishNotice.PunishNoticeId); } db.Check_PunishNotice.DeleteOnSubmit(punishNotice); db.SubmitChanges(); } }