Exemple #1
0
        protected void btnDel_Click(object sender, EventArgs e)
        {
            Repeater list = (Repeater)VoteSubjectList1.FindControl("rptList");
            string   id   = UIControlHelper.GetCheckBoxByRepeater(list, "chkId");

            if (id.Length == 0)
            {
                MessageHelper.ShowAndBack(Page, MessageHelper.GetMessage("NOCHECK"));
                return;
            }
            if (id.Split(',').Length > 1)
            {
                MessageHelper.ShowAndBack(Page, MessageHelper.GetMessage("MORECHECK"));
                return;
            }
            try
            {
                ZhuJi.Modules.VoteModule.Domain.VoteSubject domainVoteSubject = new ZhuJi.Modules.VoteModule.Domain.VoteSubject();

                domainVoteSubject.Id = int.Parse(id);

                ZhuJi.Modules.VoteModule.IDAL.IVoteSubject voteSubject = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Modules.VoteModule.NHibernateDAL.VoteSubject)) as ZhuJi.Modules.VoteModule.IDAL.IVoteSubject;
                voteSubject.Delete(domainVoteSubject);

                Response.Redirect(Request.Url.ToString(), true);
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }
        }
Exemple #2
0
        /// <summary>
        /// 点击删除按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDel_Click(object sender, EventArgs e)
        {
            try
            {
                ZhuJi.Modules.VoteModule.Domain.VoteSubject domainVoteSubject = new ZhuJi.Modules.VoteModule.Domain.VoteSubject();

                domainVoteSubject.Id = int.Parse(Id.Text);

                ZhuJi.Modules.VoteModule.IDAL.IVoteSubject voteSubject = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Modules.VoteModule.NHibernateDAL.VoteSubject)) as ZhuJi.Modules.VoteModule.IDAL.IVoteSubject;
                voteSubject.Delete(domainVoteSubject);
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }
            Response.Redirect(Request.Url.ToString(), true);
        }