/// <summary> /// 保存按钮事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtCheckContent.Text)) { Model.HSSE_Check_CheckItemDetail checkItemDetail = new Model.HSSE_Check_CheckItemDetail { CheckItemSetId = this.CheckItemSetId, CheckContent = this.txtCheckContent.Text.Trim(), SortIndex = Funs.GetNewIntOrZero(this.txtSortIndex.Text.Trim()) }; if (string.IsNullOrEmpty(this.CheckItemDetailId)) { checkItemDetail.CheckItemDetailId = SQLHelper.GetNewID(typeof(Model.HSSE_Check_CheckItemDetail)); BLL.CheckItemDetailService.AddCheckItemDetail(checkItemDetail); BLL.LogService.AddSys_Log(this.CurrUser, checkItemDetail.SortIndex.ToString(), checkItemDetail.CheckItemDetailId, BLL.Const.SpecialCheckTypesMenuId, BLL.Const.BtnAdd); } else { checkItemDetail.CheckItemDetailId = this.CheckItemDetailId; BLL.CheckItemDetailService.UpdateCheckItemDetail(checkItemDetail); BLL.LogService.AddSys_Log(this.CurrUser, checkItemDetail.SortIndex.ToString(), checkItemDetail.CheckItemDetailId, BLL.Const.SpecialCheckTypesMenuId, BLL.Const.BtnModify); } PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else { Alert.ShowInParent("检查项内容不能为空!"); } }
/// <summary> /// 根据主键删除专项检查明细 /// </summary> /// <param name="checkItemDetailId"></param> public static void DeleteCheckItemDetailById(string checkItemDetailId) { Model.HSSE_Check_CheckItemDetail checkItemDetail = db.HSSE_Check_CheckItemDetail.FirstOrDefault(e => e.CheckItemDetailId == checkItemDetailId); if (checkItemDetail != null) { db.HSSE_Check_CheckItemDetail.DeleteOnSubmit(checkItemDetail); db.SubmitChanges(); } }
/// <summary> /// 修改专项检查明细 /// </summary> /// <param name="checkItemDetail"></param> public static void UpdateCheckItemDetail(Model.HSSE_Check_CheckItemDetail checkItemDetail) { Model.HSSE_Check_CheckItemDetail newCheckItemDetail = db.HSSE_Check_CheckItemDetail.FirstOrDefault(e => e.CheckItemDetailId == checkItemDetail.CheckItemDetailId); if (newCheckItemDetail != null) { newCheckItemDetail.CheckContent = checkItemDetail.CheckContent; newCheckItemDetail.SortIndex = checkItemDetail.SortIndex; db.SubmitChanges(); } }
/// <summary> /// 添加专项检查明细 /// </summary> /// <param name="checkItemDetail"></param> public static void AddCheckItemDetail(Model.HSSE_Check_CheckItemDetail checkItemDetail) { Model.HSSE_Check_CheckItemDetail newCheckItemDetail = new Model.HSSE_Check_CheckItemDetail(); newCheckItemDetail.CheckItemDetailId = checkItemDetail.CheckItemDetailId; newCheckItemDetail.CheckItemSetId = checkItemDetail.CheckItemSetId; newCheckItemDetail.CheckContent = checkItemDetail.CheckContent; newCheckItemDetail.SortIndex = checkItemDetail.SortIndex; newCheckItemDetail.IsBuiltIn = checkItemDetail.IsBuiltIn; db.HSSE_Check_CheckItemDetail.InsertOnSubmit(newCheckItemDetail); db.SubmitChanges(); }