private void btnSave_Click(object sender, System.EventArgs e)
 {
     if (this.IsValid)
     {
         if (this._forumemoticon == null)
         {
             this._forumemoticon = new ForumEmoticon();
         }
         this.SaveEmoticon();
     }
 }
예제 #2
0
 public void SaveEmoticon(ForumEmoticon emoticon)
 {
     ISession session = this._sessionManager.OpenSession();
     NHibernate.ITransaction tx = session.BeginTransaction();
     try
     {
         session.SaveOrUpdate(emoticon);
         tx.Commit();
         session.Close();
     }
     catch (Exception ex)
     {
         tx.Rollback();
         throw new Exception("Unable to save Emoticon ", ex);
     }
 }
        private void Page_Load(object sender, System.EventArgs e)
        {
            this._module = base.Module as ForumModule;
            this.btnCancel.Attributes.Add("onClick", String.Format("document.location.href='AdminForum.aspx{0}'", base.GetBaseQueryString()));
            if (! this.IsPostBack)
            {
            }

            if (Request.QueryString["EmoticonId"] != null)
            {
                int emoticonId = Int32.Parse(Request.QueryString["EmoticonId"]);
                if (emoticonId > 0)
                {
                    this._forumemoticon = this._module.GetEmoticonById(emoticonId);
                    if (! this.IsPostBack)
                    {
                        BindEmoticon();
                    }
                    this.btnDelete.Visible = true;
                    this.btnDelete.Attributes.Add("onClick", "return confirm('Are you sure?');");
                }
            }
        }