/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.ActionPlanListId = Request.Params["ActionPlanListId"]; if (!string.IsNullOrEmpty(this.ActionPlanListId)) { Model.ActionPlan_ActionPlanList actionPlanList = BLL.ActionPlanListService.GetActionPlanListById(this.ActionPlanListId); if (actionPlanList != null) { ///读取编号 this.txtActionPlanListCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.ActionPlanListId); this.txtActionPlanListName.Text = actionPlanList.ActionPlanListName; this.txtVersionNo.Text = actionPlanList.VersionNo; this.drpProjectType.SelectedValue = actionPlanList.VersionNo; this.drpCompileMan.Text = BLL.UserService.GetUserNameByUserId(actionPlanList.CompileMan); this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", actionPlanList.CompileDate); this.txtActionPlanListContents.Text = HttpUtility.HtmlDecode(actionPlanList.ActionPlanListContents); } } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectActionPlanListMenuId; this.ctlAuditFlow.DataId = this.ActionPlanListId; } }
/// <summary> /// 根据主键删除实施计划 /// </summary> /// <param name="actionPlanListId"></param> public static void DeleteActionPlanListById(string actionPlanListId) { Model.SUBHSSEDB db = Funs.DB; Model.ActionPlan_ActionPlanList actionPlanList = db.ActionPlan_ActionPlanList.FirstOrDefault(e => e.ActionPlanListId == actionPlanListId); if (actionPlanList != null) { ///删除工程师日志收集记录 var flowOperate = from x in db.Sys_FlowOperate where x.DataId == actionPlanList.ActionPlanListId select x; if (flowOperate.Count() > 0) { foreach (var item in flowOperate) { BLL.HSSELogService.CollectHSSELog(actionPlanList.ProjectId, item.OperaterId, item.OperaterTime, "31", "施工HSE实施计划", Const.BtnDelete, 1); } ////删除审核流程表 BLL.CommonService.DeleteFlowOperateByID(actionPlanList.ActionPlanListId); } ///删除附件 BLL.CommonService.DeleteAttachFileById(actionPlanListId); ////删除编码表记录 BLL.CodeRecordsService.DeleteCodeRecordsByDataId(actionPlanList.ActionPlanListId); db.ActionPlan_ActionPlanList.DeleteOnSubmit(actionPlanList); db.SubmitChanges(); } }
/// <summary> /// 加载页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.ProjectId = this.CurrUser.LoginProjectId; this.InitDropDownList(); this.ActionPlanListId = Request.Params["ActionPlanListId"]; if (!string.IsNullOrEmpty(this.ActionPlanListId)) { Model.ActionPlan_ActionPlanList actionPlanList = BLL.ActionPlanListService.GetActionPlanListById(this.ActionPlanListId); if (actionPlanList != null) { this.ProjectId = actionPlanList.ProjectId; if (this.ProjectId != this.CurrUser.LoginProjectId) { this.InitDropDownList(); } ///读取编号 this.txtActionPlanListCode.Text = BLL.CodeRecordsService.ReturnCodeByDataId(this.ActionPlanListId); this.txtActionPlanListName.Text = actionPlanList.ActionPlanListName; this.txtVersionNo.Text = actionPlanList.VersionNo; this.drpProjectType.SelectedValue = actionPlanList.VersionNo; if (!string.IsNullOrEmpty(actionPlanList.CompileMan)) { this.drpCompileMan.SelectedValue = actionPlanList.CompileMan; } if (actionPlanList.CompileDate != null) { this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", actionPlanList.CompileDate); } this.txtActionPlanListContents.Text = HttpUtility.HtmlDecode(actionPlanList.ActionPlanListContents); } } else { this.drpCompileMan.SelectedValue = this.CurrUser.UserId; this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); var codeTemplateRule = BLL.ProjectData_CodeTemplateRuleService.GetProjectData_CodeTemplateRuleByMenuIdProjectId(BLL.Const.ProjectActionPlanListMenuId, this.ProjectId); if (codeTemplateRule != null) { this.txtActionPlanListContents.Text = HttpUtility.HtmlDecode(codeTemplateRule.Template); } ////自动生成编码 this.txtActionPlanListCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ProjectActionPlanListMenuId, this.ProjectId, this.CurrUser.UnitId); this.txtActionPlanListName.Text = this.SimpleForm1.Title; } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectActionPlanListMenuId; this.ctlAuditFlow.DataId = this.ActionPlanListId; this.ctlAuditFlow.ProjectId = this.ProjectId; this.ctlAuditFlow.UnitId = this.CurrUser.UnitId; } }
/// <summary> /// 修改实施计划 /// </summary> /// <param name="actionPlanList"></param> public static void UpdateActionPlanList(Model.ActionPlan_ActionPlanList actionPlanList) { Model.SUBHSSEDB db = Funs.DB; Model.ActionPlan_ActionPlanList newActionPlanList = db.ActionPlan_ActionPlanList.FirstOrDefault(e => e.ActionPlanListId == actionPlanList.ActionPlanListId); if (newActionPlanList != null) { //newActionPlanList.ProjectId = actionPlanList.ProjectId; newActionPlanList.ActionPlanListCode = actionPlanList.ActionPlanListCode; newActionPlanList.ActionPlanListName = actionPlanList.ActionPlanListName; newActionPlanList.VersionNo = actionPlanList.VersionNo; newActionPlanList.ProjectType = actionPlanList.ProjectType; newActionPlanList.ActionPlanListContents = actionPlanList.ActionPlanListContents; newActionPlanList.CompileMan = actionPlanList.CompileMan; newActionPlanList.CompileDate = actionPlanList.CompileDate; newActionPlanList.States = actionPlanList.States; db.SubmitChanges(); } }
/// <summary> /// 保存数据 /// </summary> /// <param name="type"></param> private void SaveData(string type) { Model.ActionPlan_ActionPlanList actionPlanList = new Model.ActionPlan_ActionPlanList { ProjectId = this.ProjectId, ActionPlanListCode = this.txtActionPlanListCode.Text.Trim(), ActionPlanListName = this.txtActionPlanListName.Text.Trim(), VersionNo = this.txtVersionNo.Text.Trim(), ProjectType = this.drpProjectType.SelectedValue, ActionPlanListContents = HttpUtility.HtmlEncode(this.txtActionPlanListContents.Text) }; if (this.drpCompileMan.SelectedValue != BLL.Const._Null) { actionPlanList.CompileMan = this.drpCompileMan.SelectedValue; } if (!string.IsNullOrEmpty(this.txtCompileDate.Text.Trim())) { actionPlanList.CompileDate = Convert.ToDateTime(this.txtCompileDate.Text.Trim()); } actionPlanList.States = BLL.Const.State_0; if (type == BLL.Const.BtnSubmit) { actionPlanList.States = this.ctlAuditFlow.NextStep; } if (!string.IsNullOrEmpty(this.ActionPlanListId)) { actionPlanList.ActionPlanListId = this.ActionPlanListId; BLL.ActionPlanListService.UpdateActionPlanList(actionPlanList); BLL.LogService.AddSys_Log(this.CurrUser, this.txtActionPlanListCode.Text, this.ActionPlanListId, BLL.Const.ProjectActionPlanListMenuId, Const.BtnModify); } else { this.ActionPlanListId = SQLHelper.GetNewID(typeof(Model.ActionPlan_ActionPlanList)); actionPlanList.ActionPlanListId = this.ActionPlanListId; BLL.ActionPlanListService.AddActionPlanList(actionPlanList); BLL.LogService.AddSys_Log(this.CurrUser, this.txtActionPlanListCode.Text, this.ActionPlanListId, BLL.Const.ProjectActionPlanListMenuId, Const.BtnAdd); } ////保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectActionPlanListMenuId, this.ActionPlanListId, (type == BLL.Const.BtnSubmit ? true : false), actionPlanList.ActionPlanListName, "../ActionPlan/ActionPlanListView.aspx?ActionPlanListId={0}"); }
/// <summary> /// 添加实施计划 /// </summary> /// <param name="actionPlanList"></param> public static void AddActionPlanList(Model.ActionPlan_ActionPlanList actionPlanList) { Model.SUBHSSEDB db = Funs.DB; Model.ActionPlan_ActionPlanList newActionPlanList = new Model.ActionPlan_ActionPlanList { ActionPlanListId = actionPlanList.ActionPlanListId, ProjectId = actionPlanList.ProjectId, ActionPlanListCode = actionPlanList.ActionPlanListCode, ActionPlanListName = actionPlanList.ActionPlanListName, VersionNo = actionPlanList.VersionNo, ProjectType = actionPlanList.ProjectType, ActionPlanListContents = actionPlanList.ActionPlanListContents, CompileMan = actionPlanList.CompileMan, CompileDate = actionPlanList.CompileDate, States = actionPlanList.States }; db.ActionPlan_ActionPlanList.InsertOnSubmit(newActionPlanList); db.SubmitChanges(); ////增加一条编码记录 BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectActionPlanListMenuId, newActionPlanList.ProjectId, null, newActionPlanList.ActionPlanListId, newActionPlanList.CompileDate); }