private void Page_Load(object sender, System.EventArgs e) { this._module = base.Module as ShopModule; this.btnCancel.Attributes.Add("onClick", String.Format("document.location.href='AdminShop.aspx{0}'", base.GetBaseQueryString())); if (! this.IsPostBack) { } if (Request.QueryString["TagId"] != null) { int tagId = Int32.Parse(Request.QueryString["TagId"]); if (tagId > 0) { this._shoptag = this._module.GetTagById(tagId); if (! this.IsPostBack) { BindTag(); } this.btnDelete.Visible = true; this.btnDelete.Attributes.Add("onClick", "return confirm('Are you sure?');"); } } }
public void DeleteTag(ShopTag tag) { ISession session = this._sessionManager.OpenSession(); NHibernate.ITransaction tx = session.BeginTransaction(); try { session.Delete(tag); tx.Commit(); session.Close(); } catch (Exception ex) { tx.Rollback(); throw new Exception("Unable to delete Tag" + "<br>" + ex.Message + "<br>" + ex.InnerException, ex); } }
private void btnSave_Click(object sender, System.EventArgs e) { if (this.IsValid) { if (this._shoptag == null) { this._shoptag = new ShopTag(); } this.SaveTag(); } }