/// <summary> /// 保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string strRowID = hfFormID.Text; Model.Base_LawsRegulationsType lawsRegulationsType = new Model.Base_LawsRegulationsType { Code = txtCode.Text.Trim(), Name = txtName.Text.Trim(), Remark = txtRemark.Text.Trim() }; if (string.IsNullOrEmpty(strRowID)) { lawsRegulationsType.Id = SQLHelper.GetNewID(typeof(Model.Base_LawsRegulationsType)); BLL.LawsRegulationsTypeService.AddLawsRegulationsType(lawsRegulationsType); BLL.LogService.AddSys_Log(this.CurrUser, lawsRegulationsType.Code, lawsRegulationsType.Id, BLL.Const.LawsRegulationsTypeMenuId, BLL.Const.BtnAdd); } else { lawsRegulationsType.Id = strRowID; BLL.LawsRegulationsTypeService.UpdateLawsRegulationsType(lawsRegulationsType); BLL.LogService.AddSys_Log(this.CurrUser, lawsRegulationsType.Code, lawsRegulationsType.Id, BLL.Const.LawsRegulationsTypeMenuId, BLL.Const.BtnModify); } //this.hfFormID.Text = string.Empty; //this.txtCode.Text = string.Empty; //this.txtName.Text = string.Empty; //this.txtRemark.Text = string.Empty; this.SimpleForm1.Reset(); // 重新绑定表格,并点击当前编辑或者新增的行 BindGrid(); PageContext.RegisterStartupScript(String.Format("F('{0}').selectRow('{1}');", Grid1.ClientID, lawsRegulationsType.Id)); }
/// <summary> /// 根据主键删除法律法规信息 /// </summary> /// <param name="id"></param> public static void DeleteLawsRegulationsTypeById(string id) { Model.SUBHSSEDB db = Funs.DB; Model.Base_LawsRegulationsType lawsRegulationsType = db.Base_LawsRegulationsType.FirstOrDefault(e => e.Id == id); if (lawsRegulationsType != null) { db.Base_LawsRegulationsType.DeleteOnSubmit(lawsRegulationsType); db.SubmitChanges(); } }
/// <summary> /// 修改法律法规类型 /// </summary> /// <param name="lawsRegulationsType"></param> public static void UpdateLawsRegulationsType(Model.Base_LawsRegulationsType lawsRegulationsType) { Model.SUBHSSEDB db = Funs.DB; Model.Base_LawsRegulationsType newLawsRegulationsType = db.Base_LawsRegulationsType.FirstOrDefault(e => e.Id == lawsRegulationsType.Id); if (newLawsRegulationsType != null) { newLawsRegulationsType.Code = lawsRegulationsType.Code; newLawsRegulationsType.Name = lawsRegulationsType.Name; newLawsRegulationsType.Remark = lawsRegulationsType.Remark; db.SubmitChanges(); } }
/// <summary> /// 添加法律法规类型 /// </summary> /// <param name="lawsRegulationsType"></param> public static void AddLawsRegulationsType(Model.Base_LawsRegulationsType lawsRegulationsType) { Model.SUBHSSEDB db = Funs.DB; Model.Base_LawsRegulationsType newLawsRegulationsType = new Model.Base_LawsRegulationsType { Id = lawsRegulationsType.Id, Code = lawsRegulationsType.Code, Name = lawsRegulationsType.Name, Remark = lawsRegulationsType.Remark }; db.Base_LawsRegulationsType.InsertOnSubmit(newLawsRegulationsType); db.SubmitChanges(); }