/// <summary> /// 保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string strRowID = hfFormID.Text; Model.Base_PersonSpecialty newPersonSpecialty = new Model.Base_PersonSpecialty { PersonSpecialtyCode = this.txtPersonSpecialtyCode.Text.Trim(), PersonSpecialtyName = this.txtPersonSpecialtyName.Text.Trim(), Remark = txtRemark.Text.Trim() }; if (string.IsNullOrEmpty(strRowID)) { newPersonSpecialty.PersonSpecialtyId = SQLHelper.GetNewID(typeof(Model.Base_PersonSpecialty)); BLL.PersonSpecialtyService.AddPersonSpecialty(newPersonSpecialty); BLL.LogService.AddSys_Log(this.CurrUser, newPersonSpecialty.PersonSpecialtyCode, newPersonSpecialty.PersonSpecialtyId, BLL.Const.PersonSpecialtyMenuId, BLL.Const.BtnAdd); } else { newPersonSpecialty.PersonSpecialtyId = strRowID; BLL.PersonSpecialtyService.UpdatePersonSpecialty(newPersonSpecialty); BLL.LogService.AddSys_Log(this.CurrUser, newPersonSpecialty.PersonSpecialtyCode, newPersonSpecialty.PersonSpecialtyId, BLL.Const.PersonSpecialtyMenuId, BLL.Const.BtnModify); } this.SimpleForm1.Reset(); // 重新绑定表格,并点击当前编辑或者新增的行 BindGrid(); PageContext.RegisterStartupScript(String.Format("F('{0}').selectRow('{1}');", Grid1.ClientID, newPersonSpecialty.PersonSpecialtyId)); }
/// <summary> /// 根据主键删除信息 /// </summary> /// <param name="personSpecialtyId"></param> public static void DeletePersonSpecialtyById(string personSpecialtyId) { Model.SUBHSSEDB db = Funs.DB; Model.Base_PersonSpecialty personSpecialty = db.Base_PersonSpecialty.FirstOrDefault(e => e.PersonSpecialtyId == personSpecialtyId); { db.Base_PersonSpecialty.DeleteOnSubmit(personSpecialty); db.SubmitChanges(); } }
/// <summary> /// 修改 /// </summary> /// <param name="teamGroup"></param> public static void UpdatePersonSpecialty(Model.Base_PersonSpecialty personSpecialty) { Model.SUBHSSEDB db = Funs.DB; Model.Base_PersonSpecialty newPersonSpecialty = db.Base_PersonSpecialty.FirstOrDefault(e => e.PersonSpecialtyId == personSpecialty.PersonSpecialtyId); if (newPersonSpecialty != null) { newPersonSpecialty.PersonSpecialtyCode = personSpecialty.PersonSpecialtyCode; newPersonSpecialty.PersonSpecialtyName = personSpecialty.PersonSpecialtyName; newPersonSpecialty.Remark = personSpecialty.Remark; db.SubmitChanges(); } }
/// <summary> /// 添加 /// </summary> /// <param name="?"></param> public static void AddPersonSpecialty(Model.Base_PersonSpecialty personSpecialty) { Model.SUBHSSEDB db = Funs.DB; Model.Base_PersonSpecialty newPersonSpecialty = new Model.Base_PersonSpecialty { PersonSpecialtyId = personSpecialty.PersonSpecialtyId, PersonSpecialtyCode = personSpecialty.PersonSpecialtyCode, PersonSpecialtyName = personSpecialty.PersonSpecialtyName, Remark = personSpecialty.Remark }; db.Base_PersonSpecialty.InsertOnSubmit(newPersonSpecialty); db.SubmitChanges(); }