/// <summary> /// 保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string strRowID = hfFormID.Text; Model.Base_ExpertType expertType = new Model.Base_ExpertType { ExpertTypeCode = this.txtExpertTypeCode.Text.Trim(), ExpertTypeName = this.txtExpertTypeName.Text.Trim(), Remark = txtRemark.Text.Trim() }; if (string.IsNullOrEmpty(strRowID)) { expertType.ExpertTypeId = SQLHelper.GetNewID(typeof(Model.Base_ExpertType)); BLL.ExpertTypeService.AddExpertType(expertType); BLL.LogService.AddSys_Log(this.CurrUser, expertType.ExpertTypeCode, expertType.ExpertTypeId, BLL.Const.ExpertTypeMenuId, BLL.Const.BtnAdd); } else { expertType.ExpertTypeId = strRowID; BLL.ExpertTypeService.UpdateExpertType(expertType); BLL.LogService.AddSys_Log(this.CurrUser, expertType.ExpertTypeCode, expertType.ExpertTypeId, BLL.Const.ExpertTypeMenuId, BLL.Const.BtnModify); } this.SimpleForm1.Reset(); // 重新绑定表格,并点击当前编辑或者新增的行 BindGrid(); PageContext.RegisterStartupScript(String.Format("F('{0}').selectRow('{1}');", Grid1.ClientID, expertType.ExpertTypeId)); }
/// <summary> /// 根据主键删除信息 /// </summary> /// <param name="expertTypeId"></param> public static void DeleteExpertTypeById(string expertTypeId) { Model.SUBHSSEDB db = Funs.DB; Model.Base_ExpertType expertType = db.Base_ExpertType.FirstOrDefault(e => e.ExpertTypeId == expertTypeId); { db.Base_ExpertType.DeleteOnSubmit(expertType); db.SubmitChanges(); } }
/// <summary> /// 修改 /// </summary> /// <param name="teamGroup"></param> public static void UpdateExpertType(Model.Base_ExpertType expertType) { Model.SUBHSSEDB db = Funs.DB; Model.Base_ExpertType newExpertType = db.Base_ExpertType.FirstOrDefault(e => e.ExpertTypeId == expertType.ExpertTypeId); if (newExpertType != null) { newExpertType.ExpertTypeCode = expertType.ExpertTypeCode; newExpertType.ExpertTypeName = expertType.ExpertTypeName; newExpertType.Remark = expertType.Remark; db.SubmitChanges(); } }
/// <summary> /// 添加 /// </summary> /// <param name="?"></param> public static void AddExpertType(Model.Base_ExpertType expertType) { Model.SUBHSSEDB db = Funs.DB; Model.Base_ExpertType newExpertType = new Model.Base_ExpertType { ExpertTypeId = expertType.ExpertTypeId, ExpertTypeCode = expertType.ExpertTypeCode, ExpertTypeName = expertType.ExpertTypeName, Remark = expertType.Remark }; db.Base_ExpertType.InsertOnSubmit(newExpertType); db.SubmitChanges(); }