/// <summary> /// 添加施工方案/审查 /// </summary> /// <param name="constructSolution"></param> public static void AddConstructSolution(Model.Solution_ConstructSolution constructSolution) { Model.SUBHSSEDB db = Funs.DB; Model.Solution_ConstructSolution newConstructSolution = new Model.Solution_ConstructSolution { ConstructSolutionId = constructSolution.ConstructSolutionId, ProjectId = constructSolution.ProjectId, ConstructSolutionCode = constructSolution.ConstructSolutionCode, ConstructSolutionName = constructSolution.ConstructSolutionName, VersionNo = constructSolution.VersionNo, UnitId = constructSolution.UnitId, InvestigateType = constructSolution.InvestigateType, SolutinType = constructSolution.SolutinType, FileContents = constructSolution.FileContents, Remark = constructSolution.Remark, CompileMan = constructSolution.CompileMan, CompileManName = constructSolution.CompileManName, CompileDate = constructSolution.CompileDate, States = constructSolution.States }; db.Solution_ConstructSolution.InsertOnSubmit(newConstructSolution); db.SubmitChanges(); if (constructSolution.ConstructSolutionCode == BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectConstructSolutionMenuId, constructSolution.ProjectId, null)) { CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectConstructSolutionMenuId, constructSolution.ProjectId, null, constructSolution.ConstructSolutionId, constructSolution.CompileDate); } }
/// <summary> /// 修改施工方案/审查 /// </summary> /// <param name="constructSolution"></param> public static void UpdateConstructSolution(Model.Solution_ConstructSolution constructSolution) { Model.SUBHSSEDB db = Funs.DB; Model.Solution_ConstructSolution newConstructSolution = db.Solution_ConstructSolution.FirstOrDefault(e => e.ConstructSolutionId == constructSolution.ConstructSolutionId); if (newConstructSolution != null) { newConstructSolution.ConstructSolutionName = constructSolution.ConstructSolutionName; newConstructSolution.VersionNo = constructSolution.VersionNo; newConstructSolution.UnitId = constructSolution.UnitId; newConstructSolution.InvestigateType = constructSolution.InvestigateType; newConstructSolution.SolutinType = constructSolution.SolutinType; newConstructSolution.FileContents = constructSolution.FileContents; newConstructSolution.Remark = constructSolution.Remark; newConstructSolution.States = constructSolution.States; if (!string.IsNullOrEmpty(constructSolution.QRCodeAttachUrl)) { newConstructSolution.QRCodeAttachUrl = constructSolution.QRCodeAttachUrl; } db.SubmitChanges(); if (constructSolution.ConstructSolutionCode != CodeRecordsService.ReturnCodeByDataId(constructSolution.ConstructSolutionId)) { CodeRecordsService.DeleteCodeRecordsByDataId(constructSolution.ConstructSolutionId);//删除编号 } } }
/// <summary> /// 根据主键删除施工方案/审查 /// </summary> /// <param name="constructSolutionId"></param> public static void DeleteConstructSolutionById(string constructSolutionId) { Model.SUBHSSEDB db = Funs.DB; Model.Solution_ConstructSolution constructSolution = db.Solution_ConstructSolution.FirstOrDefault(e => e.ConstructSolutionId == constructSolutionId); if (constructSolution != null) { ///删除工程师日志收集记录 var flowOperate = from x in db.Sys_FlowOperate where x.DataId == constructSolution.ConstructSolutionId select x; if (flowOperate.Count() > 0) { foreach (var item in flowOperate) { BLL.HSSELogService.CollectHSSELog(constructSolution.ProjectId, item.OperaterId, item.OperaterTime, "32", constructSolution.ConstructSolutionName, Const.BtnDelete, 1); } ////删除审核流程表 CommonService.DeleteFlowOperateByID(constructSolutionId); } CodeRecordsService.DeleteCodeRecordsByDataId(constructSolutionId); //删除编号 CommonService.DeleteAttachFileById(constructSolutionId); //删除附件 db.Solution_ConstructSolution.DeleteOnSubmit(constructSolution); 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); } }