/// <summary> /// 保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string strRowID = hfFormID.Text; Model.Base_PostTitle newPostTitle = new Model.Base_PostTitle { PostTitleCode = this.txtPostTitleCode.Text.Trim(), PostTitleName = this.txtPostTitleName.Text.Trim(), Remark = txtRemark.Text.Trim() }; if (string.IsNullOrEmpty(strRowID)) { newPostTitle.PostTitleId = SQLHelper.GetNewID(typeof(Model.Base_PostTitle)); BLL.PostTitleService.AddPostTitle(newPostTitle); BLL.LogService.AddSys_Log(this.CurrUser, newPostTitle.PostTitleCode, newPostTitle.PostTitleId, BLL.Const.PostTitleMenuId, BLL.Const.BtnAdd); } else { newPostTitle.PostTitleId = strRowID; BLL.PostTitleService.UpdatePostTitle(newPostTitle); BLL.LogService.AddSys_Log(this.CurrUser, newPostTitle.PostTitleCode, newPostTitle.PostTitleId, BLL.Const.PostTitleMenuId, BLL.Const.BtnModify); } this.SimpleForm1.Reset(); // 重新绑定表格,并点击当前编辑或者新增的行 BindGrid(); PageContext.RegisterStartupScript(String.Format("F('{0}').selectRow('{1}');", Grid1.ClientID, newPostTitle.PostTitleId)); }
/// <summary> /// 根据职称主键删除对应职称信息 /// </summary> /// <param name="postTitleId"></param> public static void DeletePostTitleById(string postTitleId) { Model.SUBHSSEDB db = Funs.DB; Model.Base_PostTitle postTitle = db.Base_PostTitle.FirstOrDefault(e => e.PostTitleId == postTitleId); { db.Base_PostTitle.DeleteOnSubmit(postTitle); db.SubmitChanges(); } }
/// <summary> /// 修改职称信息 /// </summary> /// <param name="teamGroup"></param> public static void UpdatePostTitle(Model.Base_PostTitle postTitle) { Model.SUBHSSEDB db = Funs.DB; Model.Base_PostTitle newPostTitle = db.Base_PostTitle.FirstOrDefault(e => e.PostTitleId == postTitle.PostTitleId); if (newPostTitle != null) { newPostTitle.PostTitleCode = postTitle.PostTitleCode; newPostTitle.PostTitleName = postTitle.PostTitleName; newPostTitle.Remark = postTitle.Remark; db.SubmitChanges(); } }
/// <summary> /// 添加职称信息 /// </summary> /// <param name="?"></param> public static void AddPostTitle(Model.Base_PostTitle postTitle) { Model.SUBHSSEDB db = Funs.DB; Model.Base_PostTitle newPostTitle = new Model.Base_PostTitle { PostTitleId = postTitle.PostTitleId, PostTitleCode = postTitle.PostTitleCode, PostTitleName = postTitle.PostTitleName, Remark = postTitle.Remark }; db.Base_PostTitle.InsertOnSubmit(newPostTitle); db.SubmitChanges(); }