/// <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> /// 保存ReceiveFileManager /// </summary> /// <param name="newItem">来文信息</param> /// <returns></returns> public static void SaveReceiveFileManager(Model.ReceiveFileManagerItem newItem) { Model.SUBHSSEDB db = Funs.DB; string menuId = string.Empty; Model.InformationProject_ReceiveFileManager newReceiveFile = new Model.InformationProject_ReceiveFileManager { FileType = newItem.FileType, ReceiveFileManagerId = newItem.ReceiveFileManagerId, ProjectId = newItem.ProjectId, ReceiveFileCode = newItem.ReceiveFileCode, ReceiveFileName = newItem.ReceiveFileName, Version = newItem.Version, FileCode = newItem.FileCode, FilePageNum = newItem.FilePageNum, GetFileDate = Funs.GetNewDateTime(newItem.GetFileDate), MainContent = System.Web.HttpUtility.HtmlEncode(newItem.MainContent), UnitIds = newItem.UnitIds, States = Const.State_2, }; if (!string.IsNullOrEmpty(newItem.FileUnitId)) { newReceiveFile.FileUnitId = newItem.FileUnitId; } if (!string.IsNullOrEmpty(newItem.SendPersonId)) { newReceiveFile.SendPersonId = newItem.SendPersonId; } if (newItem.States != "1") { newReceiveFile.States = Const.State_0; } var updateFile = Funs.DB.InformationProject_ReceiveFileManager.FirstOrDefault(x => x.ReceiveFileManagerId == newItem.ReceiveFileManagerId); if (updateFile == null) { newItem.ReceiveFileManagerId = newReceiveFile.ReceiveFileManagerId = SQLHelper.GetNewID(); newReceiveFile.ReceiveFileCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ReceiveFileManagerMenuId, newReceiveFile.ProjectId, null); ReceiveFileManagerService.AddReceiveFileManager(newReceiveFile); } else { ReceiveFileManagerService.UpdateReceiveFileManager(newReceiveFile); } if (newItem.States == "1") { CommonService.btnSaveData(newItem.ProjectId, Const.ReceiveFileManagerMenuId, newReceiveFile.ReceiveFileManagerId, newReceiveFile.SendPersonId, true, newReceiveFile.ReceiveFileName, "../ReceiveFileManager/ReceiveFileManagerView.aspx?ReceiveFileManagerId={0}"); } ////保存附件 if (!string.IsNullOrEmpty(newItem.FileAttachUrl)) { UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.FileAttachUrl, 10, null), newItem.FileAttachUrl, Const.ReceiveFileManagerMenuId, newItem.ReceiveFileManagerId); } else { CommonService.DeleteAttachFileById(Const.ReceiveFileManagerMenuId, newItem.ReceiveFileManagerId); } }
/// <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(); } }
public BaseActivity() { UserService = new UserService(db); CheckInService = new CheckInService(db); ArticleService = new ArticleService(db); UserRoleService = new UserRoleService(db); UploadFileService = new UploadFileService(db); LeaveProcessService = new LeaveProcessService(db); ProjectProcessService = new ProjectProcessService(db); InboxService = new InboxService(db); }
/// <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> /// 保存Solution_ConstructSolution /// </summary> /// <param name="newItem">施工方案</param> /// <returns></returns> public static void SaveConstructSolution(Model.ConstructSolutionItem newItem) { Model.SUBHSSEDB db = Funs.DB; Model.Solution_ConstructSolution newConstructSolution = new Model.Solution_ConstructSolution { ConstructSolutionId = newItem.ConstructSolutionId, ProjectId = newItem.ProjectId, ConstructSolutionCode = newItem.ConstructSolutionCode, ConstructSolutionName = newItem.ConstructSolutionName, VersionNo = newItem.VersionNo, UnitId = newItem.UnitId, InvestigateType = newItem.InvestigateType, SolutinType = newItem.SolutinTypeId, FileContents = System.Web.HttpUtility.HtmlEncode(newItem.FileContents), CompileMan = newItem.CompileManId, CompileManName = UserService.GetUserNameByUserId(newItem.CompileManId), States = Const.State_2, }; if (newItem.States != "1") { newConstructSolution.States = Const.State_0; } var updateConstructSolution = Funs.DB.Solution_ConstructSolution.FirstOrDefault(x => x.ConstructSolutionId == newItem.ConstructSolutionId); if (updateConstructSolution == null) { newConstructSolution.CompileDate = DateTime.Now; newConstructSolution.ConstructSolutionId = SQLHelper.GetNewID(); newConstructSolution.ConstructSolutionCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectConstructSolutionMenuId, newConstructSolution.ProjectId, newConstructSolution.UnitId); ConstructSolutionService.AddConstructSolution(newConstructSolution); } else { ConstructSolutionService.UpdateConstructSolution(newConstructSolution); } if (newConstructSolution.States == "1") { CommonService.btnSaveData(newConstructSolution.ProjectId, Const.ProjectConstructSolutionMenuId, newConstructSolution.ConstructSolutionId, newConstructSolution.CompileMan, true, newConstructSolution.CompileManName, "../Solution/ConstructSolutionView.aspx?ConstructSolutionId={0}"); } if (!string.IsNullOrEmpty(newItem.AttachUrl)) { ////保存附件 UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl, 10, null), newItem.AttachUrl, Const.ProjectConstructSolutionMenuId, newConstructSolution.ConstructSolutionId); } else { CommonService.DeleteAttachFileById(newConstructSolution.ConstructSolutionId); } }
public BaseController() { UserService = new UserService(db); InboxService = new InboxService(db); ArticleService = new ArticleService(db); UserRoleService = new UserRoleService(db); UploadFileService = new UploadFileService(db); LeaveProcessService = new LeaveProcessService(db); ProjectProcessService = new ProjectProcessService(db); CheckInService = new CheckInService(db); var user = UserService.GetUserByCookie(); ViewBag.IsLogin = user != null; ViewBag.User = user; }
/// <summary> /// 保存QualityAudit_EquipmentQuality /// </summary> /// <param name="newItem">机具设备资质</param> /// <returns></returns> public static void SaveEquipmentQuality(Model.EquipmentQualityItem newItem) { Model.SUBHSSEDB db = Funs.DB; Model.QualityAudit_EquipmentQuality newEquipmentQuality = new Model.QualityAudit_EquipmentQuality { EquipmentQualityId = newItem.EquipmentQualityId, ProjectId = newItem.ProjectId, EquipmentQualityCode = newItem.EquipmentQualityCode, UnitId = newItem.UnitId, SpecialEquipmentId = newItem.SpecialEquipmentId, EquipmentQualityName = newItem.EquipmentQualityName, SizeModel = newItem.SizeModel, FactoryCode = newItem.FactoryCode, CertificateCode = newItem.CertificateCode, CheckDate = Funs.GetNewDateTime(newItem.CheckDate), LimitDate = Funs.GetNewDateTimeOrNow(newItem.LimitDate), InDate = Funs.GetNewDateTime(newItem.InDate), OutDate = Funs.GetNewDateTime(newItem.OutDate), ApprovalPerson = newItem.ApprovalPerson, CarNum = newItem.CarNum, Remark = newItem.Remark, CompileMan = newItem.CompileManId, }; var updateEquipmentQuality = Funs.DB.QualityAudit_EquipmentQuality.FirstOrDefault(x => x.EquipmentQualityId == newItem.EquipmentQualityId); if (updateEquipmentQuality == null) { newEquipmentQuality.CompileDate = DateTime.Now; newEquipmentQuality.EquipmentQualityId = SQLHelper.GetNewID(); newEquipmentQuality.EquipmentQualityCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.EquipmentQualityMenuId, newEquipmentQuality.ProjectId, newEquipmentQuality.UnitId); EquipmentQualityService.AddEquipmentQuality(newEquipmentQuality); } else { EquipmentQualityService.UpdateEquipmentQuality(newEquipmentQuality); } if (!string.IsNullOrEmpty(newItem.AttachUrl)) { ////保存附件 UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl, 10, null), newItem.AttachUrl, Const.EquipmentQualityMenuId, newEquipmentQuality.EquipmentQualityId); } else { CommonService.DeleteAttachFileById(newEquipmentQuality.EquipmentQualityId); } }
/// <summary> /// 保存来文-回复文件 /// </summary> /// <param name="receiveFileManagerId">主键</param> /// <param name="attachUrl">回执单路径</param> public static void SaveReplyFileAttachUrl(string receiveFileManagerId, string replyFileAttachUrl) { var getFile = Funs.DB.InformationProject_ReceiveFileManager.FirstOrDefault(x => x.ReceiveFileManagerId == receiveFileManagerId); if (getFile != null) { ////保存附件 if (!string.IsNullOrEmpty(replyFileAttachUrl)) { UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(replyFileAttachUrl, 10, null), replyFileAttachUrl, Const.ReceiveFileManagerMenuId, getFile.ReceiveFileManagerId + "#1"); } else { CommonService.DeleteAttachFileById(Const.ReceiveFileManagerMenuId, getFile.ReceiveFileManagerId + "#1"); } } }
/// <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="pauseNoticeId">主键</param> /// <param name="attachUrl">路径</param> public static void SavePauseNoticeUrl(string pauseNoticeId, string attachUrl) { var getPauseNotice = Funs.DB.Check_PauseNotice.FirstOrDefault(x => x.PauseNoticeId == pauseNoticeId); if (getPauseNotice != null) { string menuId = Const.ProjectPauseNoticeMenuId; ////保存附件 if (!string.IsNullOrEmpty(attachUrl)) { UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(attachUrl, 10, null), attachUrl, menuId, getPauseNotice.PauseNoticeId); } else { CommonService.DeleteAttachFileById(menuId, getPauseNotice.PauseNoticeId); } } }
public static void SaveAttachUrl(string menuId, string dataId, string url, string isInsert) { ////保存附件 if (!string.IsNullOrEmpty(url)) { if (isInsert == "1") { var att = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == dataId); if (att != null) { url = att.AttachUrl + "," + url; } } UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(url, 10, null), url, menuId, dataId); } else { CommonService.DeleteAttachFileById(dataId); } }
/// <summary> /// 保存附件方法 /// </summary> public static void SaveAttachUrl(Model.ToDoItem toDoItem) { ////保存附件 if (!string.IsNullOrEmpty(toDoItem.UrlStr)) { if (toDoItem.IsInsert == "1") { var att = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == toDoItem.DataId); if (att != null) { toDoItem.UrlStr = att.AttachUrl + "," + toDoItem.UrlStr; } } UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(toDoItem.UrlStr, 10, null), toDoItem.UrlStr, toDoItem.MenuId, toDoItem.DataId); } else { CommonService.DeleteAttachFileById(toDoItem.DataId); } }
/// <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> /// <param name="attachUrl">回执单路径</param> public static void SavePunishNoticeReceiptUrl(string punishNoticeId, string attachUrl, string type) { var getPunishNotice = Funs.DB.Check_PunishNotice.FirstOrDefault(x => x.PunishNoticeId == punishNoticeId); if (getPunishNotice != null) { string menuId = Const.ProjectPunishNoticeMenuId; if (type == "0") { menuId = Const.ProjectPunishNoticeStatisticsMenuId; } ////保存附件 if (!string.IsNullOrEmpty(attachUrl)) { UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(attachUrl, 10, null), attachUrl, menuId, getPunishNotice.PunishNoticeId); } else { CommonService.DeleteAttachFileById(menuId, getPunishNotice.PunishNoticeId); } } }
/// <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(); } }
/// <summary> /// 保存专项检查明细项 /// </summary> /// <param name="newDetail"></param> public static void SaveCheckSpecialDetail(Model.CheckSpecialDetailItem newDetail) { if (!string.IsNullOrEmpty(newDetail.CheckSpecialId)) { Model.Check_CheckSpecialDetail newCheckSpecialDetail = new Model.Check_CheckSpecialDetail { CheckSpecialId = newDetail.CheckSpecialId, CheckItem = newDetail.CheckItemSetId, CheckItemType = newDetail.CheckItemSetName, Unqualified = newDetail.Unqualified, UnitId = newDetail.UnitId, HandleStep = newDetail.HandleStep, CompleteStatus = newDetail.CompleteStatus, RectifyNoticeId = newDetail.RectifyNoticeId, LimitedDate = Funs.GetNewDateTime(newDetail.LimitedDate), CompletedDate = Funs.GetNewDateTime(newDetail.CompletedDate), Suggestions = newDetail.Suggestions, WorkArea = newDetail.WorkArea, CheckArea = newDetail.WorkAreaId, CheckContent = newDetail.CheckContent, }; var getUnit = UnitService.GetUnitByUnitId(newDetail.UnitId); if (getUnit != null) { newCheckSpecialDetail.UnitId = newDetail.UnitId; } var updateDetail = Funs.DB.Check_CheckSpecialDetail.FirstOrDefault(x => x.CheckSpecialDetailId == newDetail.CheckSpecialDetailId); if (updateDetail == null) { newCheckSpecialDetail.CheckSpecialDetailId = SQLHelper.GetNewID(); Funs.DB.Check_CheckSpecialDetail.InsertOnSubmit(newCheckSpecialDetail); Funs.DB.SubmitChanges(); } else { newCheckSpecialDetail.CheckSpecialDetailId = updateDetail.CheckSpecialDetailId; updateDetail.CheckItem = newCheckSpecialDetail.CheckItem; updateDetail.CheckItemType = newCheckSpecialDetail.CheckItemType; updateDetail.Unqualified = newCheckSpecialDetail.Unqualified; updateDetail.UnitId = newCheckSpecialDetail.UnitId; updateDetail.HandleStep = newCheckSpecialDetail.HandleStep; updateDetail.CompleteStatus = newCheckSpecialDetail.CompleteStatus; updateDetail.RectifyNoticeId = newCheckSpecialDetail.RectifyNoticeId; updateDetail.LimitedDate = newCheckSpecialDetail.LimitedDate; updateDetail.CompletedDate = newCheckSpecialDetail.CompletedDate; updateDetail.Suggestions = newCheckSpecialDetail.Suggestions; updateDetail.WorkArea = newCheckSpecialDetail.WorkArea; updateDetail.CheckContent = newCheckSpecialDetail.CheckContent; Funs.DB.SubmitChanges(); } ////保存附件 if (!string.IsNullOrEmpty(newDetail.AttachUrl1)) { UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newDetail.AttachUrl1, 10, null), newDetail.AttachUrl1, Const.ProjectCheckSpecialMenuId, newCheckSpecialDetail.CheckSpecialDetailId); } else { CommonService.DeleteAttachFileById(Const.ProjectCheckSpecialMenuId, newCheckSpecialDetail.CheckSpecialDetailId); } } }
/// <summary> /// 保存Check_PauseNotice /// </summary> /// <param name="newItem">工程暂停令</param> /// <returns></returns> public static void SavePauseNotice(Model.PauseNoticeItem newItem) { using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString)) { Model.Check_PauseNotice newPauseNotice = new Model.Check_PauseNotice { PauseNoticeId = newItem.PauseNoticeId, PauseNoticeCode = newItem.PauseNoticeCode, ProjectId = newItem.ProjectId, UnitId = newItem.UnitId, ProjectPlace = newItem.ProjectPlace, WrongContent = newItem.WrongContent, PauseTime = Funs.GetNewDateTime(newItem.PauseTime), PauseContent = newItem.PauseContent, OneContent = newItem.OneContent, SecondContent = newItem.SecondContent, ThirdContent = newItem.ThirdContent, States = Const.State_0, PauseStates = newItem.PauseStates, }; var getUpdate = db.Check_PauseNotice.FirstOrDefault(x => x.PauseNoticeId == newItem.PauseNoticeId); if (getUpdate == null) { newPauseNotice.CompileDate = DateTime.Now; newPauseNotice.PauseNoticeId = SQLHelper.GetNewID(); newPauseNotice.PauseNoticeCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectPauseNoticeMenuId, newPauseNotice.ProjectId, newPauseNotice.UnitId); db.Check_PauseNotice.InsertOnSubmit(newPauseNotice); db.SubmitChanges(); CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectPauseNoticeMenuId, newPauseNotice.ProjectId, newPauseNotice.UnitId, newPauseNotice.PauseNoticeId, newPauseNotice.CompileDate); //// 回写巡检记录表 if (!string.IsNullOrEmpty(newItem.HazardRegisterId)) { List <string> listIds = Funs.GetStrListByStr(newItem.HazardRegisterId, ','); foreach (var item in listIds) { var getHazardRegister = Funs.DB.HSSE_Hazard_HazardRegister.FirstOrDefault(x => x.HazardRegisterId == item); if (getHazardRegister != null) { getHazardRegister.States = "3"; getHazardRegister.HandleIdea += "已下发工程暂停令:" + newPauseNotice.PauseNoticeCode; getHazardRegister.ResultId = newPauseNotice.PauseNoticeId; getHazardRegister.ResultType = "3"; Funs.SubmitChanges(); } } } //// 回写专项检查明细表 if (!string.IsNullOrEmpty(newItem.CheckSpecialDetailId)) { List <string> listIds = Funs.GetStrListByStr(newItem.CheckSpecialDetailId, ','); foreach (var item in listIds) { var getCheckSpecialDetail = db.Check_CheckSpecialDetail.FirstOrDefault(x => x.CheckSpecialDetailId == item); if (getCheckSpecialDetail != null) { getCheckSpecialDetail.DataType = "3"; getCheckSpecialDetail.DataId = newPauseNotice.PauseNoticeId; db.SubmitChanges(); } } } } else { newPauseNotice.PauseNoticeId = getUpdate.PauseNoticeId; getUpdate.PauseStates = newItem.PauseStates; if (newPauseNotice.PauseStates == "0" || newPauseNotice.PauseStates == "1") ////编制人 修改或提交 { getUpdate.UnitId = newPauseNotice.UnitId; getUpdate.ProjectPlace = newPauseNotice.ProjectPlace; getUpdate.WrongContent = newPauseNotice.WrongContent; getUpdate.PauseTime = newPauseNotice.PauseTime; getUpdate.PauseContent = newPauseNotice.PauseContent; getUpdate.OneContent = newPauseNotice.OneContent; getUpdate.SecondContent = newPauseNotice.SecondContent; getUpdate.ThirdContent = newPauseNotice.ThirdContent; if (newPauseNotice.PauseStates == "1" && !string.IsNullOrEmpty(newItem.SignManId)) { getUpdate.SignManId = newItem.SignManId; } else { newPauseNotice.PauseStates = getUpdate.PauseStates = "0"; } } else if (newPauseNotice.PauseStates == "2") ////【签发】总包安全经理 { /// 不同意 打回 同意抄送专业工程师、施工经理、相关施工分包单位并提交【批准】总包项目经理 if (newItem.IsAgree == false) { newPauseNotice.PauseStates = getUpdate.PauseStates = "0"; } else { if (!string.IsNullOrEmpty(newItem.ProfessionalEngineerId)) { getUpdate.ProfessionalEngineerId = newItem.ProfessionalEngineerId; } if (!string.IsNullOrEmpty(newItem.ConstructionManagerId)) { getUpdate.ConstructionManagerId = newItem.ConstructionManagerId; } if (!string.IsNullOrEmpty(newItem.UnitHeadManId)) { getUpdate.UnitHeadManId = newItem.UnitHeadManId; } if (!string.IsNullOrEmpty(newItem.SupervisorManId)) { getUpdate.SupervisorManId = newItem.SupervisorManId; } if (!string.IsNullOrEmpty(newItem.OwnerId)) { getUpdate.OwnerId = newItem.OwnerId; } if (!string.IsNullOrEmpty(newItem.ApproveManId)) { getUpdate.ApproveManId = newItem.ApproveManId; getUpdate.SignDate = DateTime.Now; } else { newPauseNotice.PauseStates = getUpdate.States = "1"; } } } else if (newPauseNotice.PauseStates == "3") ////【批准】总包项目经理 { /// 不同意 打回 同意下发【回执】施工分包单位 if (newItem.IsAgree == false || string.IsNullOrEmpty(newItem.DutyPersonId)) { newPauseNotice.PauseStates = getUpdate.PauseStates = "1"; } else { getUpdate.DutyPersonId = newItem.DutyPersonId; getUpdate.ApproveDate = DateTime.Now; getUpdate.IsConfirm = true; } } else if (newPauseNotice.PauseStates == "4") ////【批准】总包项目经理 { getUpdate.DutyPersonDate = DateTime.Now; getUpdate.States = Const.State_2; } db.SubmitChanges(); } if (newItem.PauseStates == Const.State_0 || newItem.PauseStates == Const.State_1) { //// 通知单附件 UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.PauseNoticeAttachUrl, 10, null), newItem.PauseNoticeAttachUrl, Const.ProjectPauseNoticeMenuId, newPauseNotice.PauseNoticeId); } if (getUpdate != null && getUpdate.States == Const.State_2) { CommonService.btnSaveData(newPauseNotice.ProjectId, Const.ProjectPauseNoticeMenuId, newPauseNotice.PauseNoticeId, newPauseNotice.CompileManId, true, newPauseNotice.PauseContent, "../Check/PauseNoticeView.aspx?PauseNoticeId={0}"); var getcheck = from x in db.Check_CheckSpecialDetail where x.DataId == getUpdate.PauseNoticeId select x; if (getcheck.Count() > 0) { foreach (var item in getcheck) { item.CompleteStatus = true; item.CompletedDate = DateTime.Now; db.SubmitChanges(); } } } } }
/// <summary> /// 保存Check_CheckSpecial /// </summary> /// <param name="newItem">处罚通知单</param> /// <returns></returns> public static string SaveCheckSpecial(Model.CheckSpecialItem newItem) { using (Model.SUBHSSEDB db = new Model.SUBHSSEDB(Funs.ConnString)) { string message = string.Empty; Model.Check_CheckSpecial newCheckSpecial = new Model.Check_CheckSpecial { CheckSpecialId = newItem.CheckSpecialId, CheckSpecialCode = newItem.CheckSpecialCode, CheckItemSetId = newItem.CheckItemSetId, CheckType = newItem.CheckType, ProjectId = newItem.ProjectId, CheckPerson = newItem.CheckPersonId, CheckTime = Funs.GetNewDateTime(newItem.CheckTime), DaySummary = System.Web.HttpUtility.HtmlEncode(newItem.DaySummary), PartInUnits = newItem.PartInUnitIds, PartInPersonIds = newItem.PartInPersonIds, PartInPersons = UserService.getUserNamesUserIds(newItem.PartInPersonIds), PartInPersonNames = newItem.PartInPersonNames2, CompileMan = newItem.CompileManId, States = Const.State_2, }; if (newItem.States != "1") { newCheckSpecial.States = Const.State_0; } var updateCheckSpecial = db.Check_CheckSpecial.FirstOrDefault(x => x.CheckSpecialId == newItem.CheckSpecialId); if (updateCheckSpecial == null) { newCheckSpecial.CheckSpecialId = SQLHelper.GetNewID(); newCheckSpecial.CheckSpecialCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectCheckSpecialMenuId, newCheckSpecial.ProjectId, string.Empty); db.Check_CheckSpecial.InsertOnSubmit(newCheckSpecial); db.SubmitChanges(); ////增加一条编码记录 BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectCheckSpecialMenuId, newCheckSpecial.ProjectId, null, newCheckSpecial.CheckSpecialId, newCheckSpecial.CheckTime); } else { Check_CheckSpecialService.UpdateCheckSpecial(newCheckSpecial); //// 删除专项检查明细项 Check_CheckSpecialDetailService.DeleteCheckSpecialDetails(newCheckSpecial.CheckSpecialId); } if (newCheckSpecial.States == "1") { CommonService.btnSaveData(newCheckSpecial.ProjectId, Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId, newCheckSpecial.CompileMan, true, newCheckSpecial.CheckSpecialCode, "../Check/CheckSpecialView.aspx?CheckSpecialId={0}"); } ////保存附件 if (!string.IsNullOrEmpty(newItem.AttachUrl1)) { UploadFileService.SaveAttachUrl(UploadFileService.GetSourceByAttachUrl(newItem.AttachUrl1, 10, null), newItem.AttachUrl1, Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId); } else { CommonService.DeleteAttachFileById(Const.ProjectCheckSpecialMenuId, newCheckSpecial.CheckSpecialId); } ///// 新增检查项 if (newItem.CheckSpecialDetailItems != null && newItem.CheckSpecialDetailItems.Count() > 0) { foreach (var item in newItem.CheckSpecialDetailItems) { item.CheckSpecialId = newCheckSpecial.CheckSpecialId; SaveCheckSpecialDetail(item); } //// 单据完成后 系统自动按照单位 整改要求生成隐患整改单 if (newCheckSpecial.States == Const.State_2) { SaveNewRectifyNotices(newItem); message = "已生成整改单,请在隐患整改单待提交中签发!"; } } return(message); } }