/// <summary> /// 保存数据 /// </summary> /// <param name="p"></param> private void SaveData(bool isClose) { Model.Accident_NoFourLetoff noFourLetOff = new Model.Accident_NoFourLetoff { ProjectId = this.CurrUser.LoginProjectId, AccidentHandleId = this.AccidentHandleId, AccidentDate = Funs.GetNewDateTime(this.txtAccidentDate.Text.Trim()), FileContents = HttpUtility.HtmlEncode(this.txtFileContents.Text) }; if (this.drpRegistUnitId.SelectedValue != BLL.Const._Null) { noFourLetOff.RegistUnitId = this.drpRegistUnitId.SelectedValue; } if (this.drpHeadManId.SelectedValue != BLL.Const._Null) { noFourLetOff.HeadMan = this.drpHeadManId.SelectedValue; } noFourLetOff.RegistDate = Funs.GetNewDateTime(this.txtRegistDate.Text.Trim()); if (!string.IsNullOrEmpty(this.NoFourLetoffId)) { noFourLetOff.NoFourLetoffId = this.NoFourLetoffId; BLL.NoFourLetoffService.UpdateNoFourLetoff(noFourLetOff); BLL.LogService.AddSys_Log(this.CurrUser, this.txtAccidentHandleCode.Text, this.AccidentHandleId, BLL.Const.ProjectAccidentHandleMenuId, Const.BtnModify); } else { this.NoFourLetoffId = SQLHelper.GetNewID(typeof(Model.Accident_NoFourLetoff)); noFourLetOff.NoFourLetoffId = this.NoFourLetoffId; BLL.NoFourLetoffService.AddNoFourLetoff(noFourLetOff); BLL.LogService.AddSys_Log(this.CurrUser, this.txtAccidentHandleCode.Text, this.AccidentHandleId, BLL.Const.ProjectAccidentHandleMenuId, Const.BtnAdd); } PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); }
/// <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(); BLL.UnitService.InitUnitDropDownList(this.drpRegistUnitId, this.CurrUser.LoginProjectId, true); BLL.UserService.InitUserDropDownList(this.drpHeadManId, this.CurrUser.LoginProjectId, true); this.AccidentHandleId = Request.Params["AccidentHandleId"]; if (!string.IsNullOrEmpty(this.AccidentHandleId)) { Model.Accident_AccidentHandle accidentHandle = BLL.AccidentHandleService.GetAccidentHandleById(AccidentHandleId); if (accidentHandle != null) { this.txtAccidentDate.Text = string.Format("{0:yyyy-MM-dd}", accidentHandle.AccidentDate); this.txtAccidentHandleCode.Text = accidentHandle.AccidentHandleCode; this.txtUnitName.Text = BLL.UnitService.GetUnitNameByUnitId(accidentHandle.UnitId); Model.Accident_NoFourLetoff noFourLetoff = BLL.NoFourLetoffService.GetNoFourLetoffByAccidentHandleId(this.AccidentHandleId); if (noFourLetoff != null) { this.NoFourLetoffId = noFourLetoff.NoFourLetoffId; if (noFourLetoff.AccidentDate != null) { this.txtAccidentDate.Text = string.Format("{0:yyyy-MM-dd}", noFourLetoff.AccidentDate); } this.txtFileContents.Text = HttpUtility.HtmlDecode(noFourLetoff.FileContents); if (!string.IsNullOrEmpty(noFourLetoff.RegistUnitId)) { this.drpRegistUnitId.SelectedValue = noFourLetoff.RegistUnitId; } if (!string.IsNullOrEmpty(noFourLetoff.HeadMan)) { this.drpHeadManId.SelectedValue = noFourLetoff.HeadMan; } if (noFourLetoff.RegistDate != null) { this.txtRegistDate.Text = string.Format("{0:yyyy-MM-dd}", noFourLetoff.RegistDate); } } else { this.txtRegistDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); this.drpHeadManId.SelectedValue = this.CurrUser.UserId; this.drpRegistUnitId.SelectedValue = this.CurrUser.UnitId; var codeTemplateRule = BLL.ProjectData_CodeTemplateRuleService.GetProjectData_CodeTemplateRuleByMenuIdProjectId(BLL.Const.ProjectAccidentHandleMenuId, this.CurrUser.LoginProjectId); if (codeTemplateRule != null) { this.txtFileContents.Text = HttpUtility.HtmlDecode(codeTemplateRule.Template); } } } } } }
/// <summary> /// 根据主键删除四不放过 /// </summary> /// <param name="noFourLetoffId"></param> public static void DeleteNoFourLetoffByNoFourLetoffId(string noFourLetoffId) { Model.SUBHSSEDB db = Funs.DB; Model.Accident_NoFourLetoff noFourLetoff = db.Accident_NoFourLetoff.FirstOrDefault(e => e.NoFourLetoffId == noFourLetoffId); if (noFourLetoff != null) { CommonService.DeleteAttachFileById(noFourLetoffId); ////删除审核流程表 BLL.CommonService.DeleteFlowOperateByID(noFourLetoff.NoFourLetoffId); db.Accident_NoFourLetoff.DeleteOnSubmit(noFourLetoff); db.SubmitChanges(); } }
/// <summary> /// 修改四不放过 /// </summary> /// <param name="noFourLetoff"></param> public static void UpdateNoFourLetoff(Model.Accident_NoFourLetoff noFourLetoff) { Model.SUBHSSEDB db = Funs.DB; Model.Accident_NoFourLetoff newNoFourLetoff = db.Accident_NoFourLetoff.FirstOrDefault(e => e.NoFourLetoffId == noFourLetoff.NoFourLetoffId); if (newNoFourLetoff != null) { newNoFourLetoff.ProjectId = noFourLetoff.ProjectId; newNoFourLetoff.AccidentHandleId = noFourLetoff.AccidentHandleId; newNoFourLetoff.NoFourLetoffCode = noFourLetoff.NoFourLetoffCode; newNoFourLetoff.UnitId = noFourLetoff.UnitId; newNoFourLetoff.AccidentDate = noFourLetoff.AccidentDate; newNoFourLetoff.FileContents = noFourLetoff.FileContents; newNoFourLetoff.RegistUnitId = noFourLetoff.RegistUnitId; newNoFourLetoff.HeadMan = noFourLetoff.HeadMan; newNoFourLetoff.RegistDate = noFourLetoff.RegistDate; db.SubmitChanges(); } }
/// <summary> /// 添加四不放过 /// </summary> /// <param name="noFourLetoff"></param> public static void AddNoFourLetoff(Model.Accident_NoFourLetoff noFourLetoff) { Model.SUBHSSEDB db = Funs.DB; Model.Accident_NoFourLetoff newNoFourLetoff = new Model.Accident_NoFourLetoff { NoFourLetoffId = noFourLetoff.NoFourLetoffId, ProjectId = noFourLetoff.ProjectId, AccidentHandleId = noFourLetoff.AccidentHandleId, NoFourLetoffCode = noFourLetoff.NoFourLetoffCode, UnitId = noFourLetoff.UnitId, AccidentDate = noFourLetoff.AccidentDate, FileContents = noFourLetoff.FileContents, RegistUnitId = noFourLetoff.RegistUnitId, HeadMan = noFourLetoff.HeadMan, RegistDate = noFourLetoff.RegistDate }; db.Accident_NoFourLetoff.InsertOnSubmit(newNoFourLetoff); db.SubmitChanges(); }