/// <summary> /// 保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { string strRowID = hfFormID.Text; Model.Base_LicenseType licenseType = new Model.Base_LicenseType { LicenseTypeCode = this.txtLicenseTypeCode.Text.Trim(), LicenseTypeName = this.txtLicenseTypeName.Text.Trim(), Remark = txtRemark.Text.Trim(), LicenseContents = HttpUtility.HtmlEncode(this.txtLicenseContents.Text) }; if (string.IsNullOrEmpty(strRowID)) { licenseType.LicenseTypeId = SQLHelper.GetNewID(typeof(Model.Base_LicenseType)); BLL.LicenseTypeService.AddLicenseType(licenseType); BLL.LogService.AddSys_Log(this.CurrUser, licenseType.LicenseTypeCode, licenseType.LicenseTypeId, BLL.Const.LicenseTypeMenuId, BLL.Const.BtnAdd); } else { licenseType.LicenseTypeId = strRowID; BLL.LicenseTypeService.UpdateLicenseType(licenseType); BLL.LogService.AddSys_Log(this.CurrUser, licenseType.LicenseTypeCode, licenseType.LicenseTypeId, BLL.Const.LicenseTypeMenuId, BLL.Const.BtnModify); } this.SimpleForm1.Reset(); // 重新绑定表格,并点击当前编辑或者新增的行 BindGrid(); //PageContext.RegisterStartupScript(String.Format("F('{0}').selectRow('{1}');", Grid1.ClientID, licenseType.LicenseTypeId)); }
/// <summary> /// 根据主键删除许可证类型 /// </summary> /// <param name="licenseTypeId"></param> public static void DeleteLicenseTypeById(string licenseTypeId) { Model.SUBHSSEDB db = Funs.DB; Model.Base_LicenseType licenseType = db.Base_LicenseType.FirstOrDefault(e => e.LicenseTypeId == licenseTypeId); if (licenseType != null) { db.Base_LicenseType.DeleteOnSubmit(licenseType); db.SubmitChanges(); } }
/// <summary> /// 修改许可证类型 /// </summary> /// <param name="licenseType"></param> public static void UpdateLicenseType(Model.Base_LicenseType licenseType) { Model.SUBHSSEDB db = Funs.DB; Model.Base_LicenseType newLicenseType = db.Base_LicenseType.FirstOrDefault(e => e.LicenseTypeId == licenseType.LicenseTypeId); if (newLicenseType != null) { newLicenseType.LicenseTypeCode = licenseType.LicenseTypeCode; newLicenseType.LicenseTypeName = licenseType.LicenseTypeName; newLicenseType.Remark = licenseType.Remark; newLicenseType.LicenseContents = licenseType.LicenseContents; db.SubmitChanges(); } }
/// <summary> /// 添加许可证类型 /// </summary> /// <param name="licenseType"></param> public static void AddLicenseType(Model.Base_LicenseType licenseType) { Model.SUBHSSEDB db = Funs.DB; Model.Base_LicenseType newLicenseType = new Model.Base_LicenseType { LicenseTypeId = licenseType.LicenseTypeId, LicenseTypeCode = licenseType.LicenseTypeCode, LicenseTypeName = licenseType.LicenseTypeName, Remark = licenseType.Remark, LicenseContents = licenseType.LicenseContents }; db.Base_LicenseType.InsertOnSubmit(newLicenseType); db.SubmitChanges(); }