/// <summary> /// 添加HSSE事故(对人员)记录 /// </summary> /// <param name="accidentPersonRecord"></param> public static void AddAccidentPersonRecord(Model.Accident_AccidentPersonRecord accidentPersonRecord) { Model.SUBHSSEDB db = Funs.DB; Model.Accident_AccidentPersonRecord newAccidentPersonRecord = new Model.Accident_AccidentPersonRecord { AccidentPersonRecordId = accidentPersonRecord.AccidentPersonRecordId, ProjectId = accidentPersonRecord.ProjectId, AccidentTypeId = accidentPersonRecord.AccidentTypeId, WorkAreaId = accidentPersonRecord.WorkAreaId, AccidentDate = accidentPersonRecord.AccidentDate, PersonId = accidentPersonRecord.PersonId, Injury = accidentPersonRecord.Injury, InjuryPart = accidentPersonRecord.InjuryPart, HssePersons = accidentPersonRecord.HssePersons, InjuryResult = accidentPersonRecord.InjuryResult, PreventiveAction = accidentPersonRecord.PreventiveAction, HandleOpinion = accidentPersonRecord.HandleOpinion, FileContent = accidentPersonRecord.FileContent, CompileMan = accidentPersonRecord.CompileMan, CompileDate = accidentPersonRecord.CompileDate, States = accidentPersonRecord.States }; db.Accident_AccidentPersonRecord.InsertOnSubmit(newAccidentPersonRecord); db.SubmitChanges(); }
/// <summary> /// 根据主键删除HSSE事故(对人员)记录 /// </summary> /// <param name="accidentPersonRecordId"></param> public static void DeleteAccidentPersonRecordById(string accidentPersonRecordId) { Model.SUBHSSEDB db = Funs.DB; Model.Accident_AccidentPersonRecord accidentPersonRecord = db.Accident_AccidentPersonRecord.FirstOrDefault(e => e.AccidentPersonRecordId == accidentPersonRecordId); if (accidentPersonRecord != null) { CommonService.DeleteFlowOperateByID(accidentPersonRecordId);//删除流程 db.Accident_AccidentPersonRecord.DeleteOnSubmit(accidentPersonRecord); db.SubmitChanges(); } }
/// <summary> /// 修改HSSE事故(对人员)记录 /// </summary> /// <param name="accidentPersonRecord"></param> public static void UpdateAccidentPersonRecord(Model.Accident_AccidentPersonRecord accidentPersonRecord) { Model.SUBHSSEDB db = Funs.DB; Model.Accident_AccidentPersonRecord newAccidentPersonRecord = db.Accident_AccidentPersonRecord.FirstOrDefault(e => e.AccidentPersonRecordId == accidentPersonRecord.AccidentPersonRecordId); if (newAccidentPersonRecord != null) { //newAccidentPersonRecord.ProjectId = accidentPersonRecord.ProjectId; newAccidentPersonRecord.AccidentTypeId = accidentPersonRecord.AccidentTypeId; newAccidentPersonRecord.WorkAreaId = accidentPersonRecord.WorkAreaId; newAccidentPersonRecord.AccidentDate = accidentPersonRecord.AccidentDate; newAccidentPersonRecord.PersonId = accidentPersonRecord.PersonId; newAccidentPersonRecord.Injury = accidentPersonRecord.Injury; newAccidentPersonRecord.InjuryPart = accidentPersonRecord.InjuryPart; newAccidentPersonRecord.HssePersons = accidentPersonRecord.HssePersons; newAccidentPersonRecord.InjuryResult = accidentPersonRecord.InjuryResult; newAccidentPersonRecord.PreventiveAction = accidentPersonRecord.PreventiveAction; newAccidentPersonRecord.HandleOpinion = accidentPersonRecord.HandleOpinion; newAccidentPersonRecord.FileContent = accidentPersonRecord.FileContent; newAccidentPersonRecord.CompileMan = accidentPersonRecord.CompileMan; newAccidentPersonRecord.CompileDate = accidentPersonRecord.CompileDate; newAccidentPersonRecord.States = accidentPersonRecord.States; 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.AccidentPersonRecordId = Request.Params["AccidentPersonRecordId"]; if (!string.IsNullOrEmpty(this.AccidentPersonRecordId)) { Model.Accident_AccidentPersonRecord accidentPersonRecord = BLL.AccidentPersonRecordService.GetAccidentPersonRecordById(this.AccidentPersonRecordId); if (accidentPersonRecord != null) { this.ProjectId = accidentPersonRecord.ProjectId; if (this.ProjectId != this.CurrUser.LoginProjectId) { this.InitDropDownList(); } if (!string.IsNullOrEmpty(accidentPersonRecord.ProjectId)) { var project = BLL.ProjectService.GetProjectByProjectId(accidentPersonRecord.ProjectId); if (project != null) { this.txtProjectName.Text = project.ProjectName; } } if (!string.IsNullOrEmpty(accidentPersonRecord.AccidentTypeId)) { this.drpAccidentTypeId.SelectedValue = accidentPersonRecord.AccidentTypeId; } if (!string.IsNullOrEmpty(accidentPersonRecord.WorkAreaId)) { this.drpWorkAreaId.SelectedValue = accidentPersonRecord.WorkAreaId; } if (accidentPersonRecord.AccidentDate != null) { this.txtAccidentDate.Text = string.Format("{0:yyyy-MM-dd}", accidentPersonRecord.AccidentDate); } if (!string.IsNullOrEmpty(accidentPersonRecord.PersonId)) { this.drpPersonId.SelectedValue = accidentPersonRecord.PersonId; } if (!string.IsNullOrEmpty(accidentPersonRecord.Injury)) { this.drpInjury.SelectedValue = accidentPersonRecord.Injury; } this.txtInjuryPart.Text = accidentPersonRecord.InjuryPart; this.txtHssePersons.Text = accidentPersonRecord.HssePersons; this.txtInjuryResult.Text = accidentPersonRecord.InjuryResult; this.txtPreventiveAction.Text = accidentPersonRecord.PreventiveAction; this.txtHandleOpinion.Text = accidentPersonRecord.HandleOpinion; this.txtFileContents.Text = HttpUtility.HtmlDecode(accidentPersonRecord.FileContent); } } else { this.txtProjectName.Text = BLL.ProjectService.GetProjectNameByProjectId(this.ProjectId); this.txtAccidentDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); var codeTemplateRule = BLL.ProjectData_CodeTemplateRuleService.GetProjectData_CodeTemplateRuleByMenuIdProjectId(BLL.Const.ProjectAccidentPersonRecordMenuId, this.ProjectId); if (codeTemplateRule != null) { this.txtFileContents.Text = HttpUtility.HtmlDecode(codeTemplateRule.Template); } } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectAccidentPersonRecordMenuId; this.ctlAuditFlow.DataId = this.AccidentPersonRecordId; this.ctlAuditFlow.ProjectId = this.ProjectId; this.ctlAuditFlow.UnitId = this.CurrUser.UnitId; } }
/// <summary> /// 保存数据 /// </summary> /// <param name="type"></param> private void SaveData(string type) { Model.Accident_AccidentPersonRecord accidentPersonRecord = new Model.Accident_AccidentPersonRecord { ProjectId = this.ProjectId }; if (this.drpAccidentTypeId.SelectedValue != BLL.Const._Null) { accidentPersonRecord.AccidentTypeId = this.drpAccidentTypeId.SelectedValue; } if (this.drpWorkAreaId.SelectedValue != BLL.Const._Null) { accidentPersonRecord.WorkAreaId = this.drpWorkAreaId.SelectedValue; } if (!string.IsNullOrEmpty(this.txtAccidentDate.Text.Trim())) { accidentPersonRecord.AccidentDate = Convert.ToDateTime(this.txtAccidentDate.Text.Trim()); } if (this.drpPersonId.SelectedValue != BLL.Const._Null) { accidentPersonRecord.PersonId = this.drpPersonId.SelectedValue; } if (this.drpInjury.SelectedValue != BLL.Const._Null) { accidentPersonRecord.Injury = this.drpInjury.SelectedValue; } accidentPersonRecord.InjuryPart = this.txtInjuryPart.Text.Trim(); accidentPersonRecord.HssePersons = this.txtHssePersons.Text.Trim(); accidentPersonRecord.InjuryResult = this.txtInjuryResult.Text.Trim(); accidentPersonRecord.PreventiveAction = this.txtPreventiveAction.Text.Trim(); accidentPersonRecord.HandleOpinion = this.txtHandleOpinion.Text.Trim(); accidentPersonRecord.FileContent = HttpUtility.HtmlEncode(this.txtFileContents.Text); accidentPersonRecord.CompileMan = this.CurrUser.UserId; accidentPersonRecord.CompileDate = DateTime.Now; accidentPersonRecord.States = BLL.Const.State_0; if (type == BLL.Const.BtnSubmit) { var flowOperate = Funs.DB.Sys_FlowOperate.FirstOrDefault(x => x.DataId == this.AccidentPersonRecordId && x.State == BLL.Const.State_2 && x.IsClosed == true); if (flowOperate != null) { accidentPersonRecord.States = BLL.Const.State_2; } else { accidentPersonRecord.States = this.ctlAuditFlow.NextStep; } } if (!string.IsNullOrEmpty(this.AccidentPersonRecordId)) { accidentPersonRecord.AccidentPersonRecordId = this.AccidentPersonRecordId; BLL.AccidentPersonRecordService.UpdateAccidentPersonRecord(accidentPersonRecord); BLL.LogService.AddSys_Log(this.CurrUser, string.Empty, this.AccidentPersonRecordId, BLL.Const.ProjectAccidentPersonRecordMenuId, Const.BtnModify); } else { this.AccidentPersonRecordId = SQLHelper.GetNewID(typeof(Model.Accident_AccidentPersonRecord)); accidentPersonRecord.AccidentPersonRecordId = this.AccidentPersonRecordId; BLL.AccidentPersonRecordService.AddAccidentPersonRecord(accidentPersonRecord); BLL.LogService.AddSys_Log(this.CurrUser, string.Empty, this.AccidentPersonRecordId, BLL.Const.ProjectAccidentPersonRecordMenuId, Const.BtnAdd); } ////保存流程审核数据 this.ctlAuditFlow.btnSaveData(this.ProjectId, BLL.Const.ProjectAccidentPersonRecordMenuId, this.AccidentPersonRecordId, (type == BLL.Const.BtnSubmit ? true : false), this.drpPersonId.SelectedText, "../Accident/AccidentPersonRecordView.aspx?AccidentPersonRecordId={0}"); }
/// <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.AccidentPersonRecordId = Request.Params["AccidentPersonRecordId"]; if (!string.IsNullOrEmpty(this.AccidentPersonRecordId)) { Model.Accident_AccidentPersonRecord accidentPersonRecord = BLL.AccidentPersonRecordService.GetAccidentPersonRecordById(this.AccidentPersonRecordId); if (accidentPersonRecord != null) { if (!string.IsNullOrEmpty(accidentPersonRecord.ProjectId)) { var project = BLL.ProjectService.GetProjectByProjectId(accidentPersonRecord.ProjectId); if (project != null) { this.txtProjectName.Text = project.ProjectName; } } if (!string.IsNullOrEmpty(accidentPersonRecord.AccidentTypeId)) { var accidentType = BLL.AccidentTypeService.GetAccidentTypeById(accidentPersonRecord.AccidentTypeId); if (accidentType != null) { this.txtAccidentTypeName.Text = accidentType.AccidentTypeName; } } if (!string.IsNullOrEmpty(accidentPersonRecord.WorkAreaId)) { var workArea = BLL.WorkAreaService.GetWorkAreaByWorkAreaId(accidentPersonRecord.WorkAreaId); if (workArea != null) { this.txtWorkAreaName.Text = workArea.WorkAreaName; } } if (accidentPersonRecord.AccidentDate != null) { this.txtAccidentDate.Text = string.Format("{0:yyyy-MM-dd}", accidentPersonRecord.AccidentDate); } if (!string.IsNullOrEmpty(accidentPersonRecord.PersonId)) { var person = BLL.PersonService.GetPersonById(accidentPersonRecord.PersonId); if (person != null) { this.txtPersonName.Text = person.PersonName; } } if (!string.IsNullOrEmpty(accidentPersonRecord.Injury)) { if (accidentPersonRecord.Injury == "1") { this.txtInjury.Text = "死亡"; } else if (accidentPersonRecord.Injury == "2") { this.txtInjury.Text = "重伤"; } else if (accidentPersonRecord.Injury == "3") { this.txtInjury.Text = "轻伤"; } } this.txtInjuryPart.Text = accidentPersonRecord.InjuryPart; this.txtHssePersons.Text = accidentPersonRecord.HssePersons; this.txtInjuryResult.Text = accidentPersonRecord.InjuryResult; this.txtPreventiveAction.Text = accidentPersonRecord.PreventiveAction; this.txtHandleOpinion.Text = accidentPersonRecord.HandleOpinion; this.txtFileContents.Text = HttpUtility.HtmlDecode(accidentPersonRecord.FileContent); } } ///初始化审核菜单 this.ctlAuditFlow.MenuId = BLL.Const.ProjectAccidentPersonRecordMenuId; this.ctlAuditFlow.DataId = this.AccidentPersonRecordId; } }