protected void btnDel_Click(object sender, EventArgs e)
        {
            Repeater list = (Repeater)SiteList1.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.Portal.Domain.Site domainSite = new ZhuJi.Portal.Domain.Site();

                domainSite.Id = int.Parse(id);

               ZhuJi.Portal.IDAL.ISite site = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Site)) as ZhuJi.Portal.IDAL.ISite;
                site.Delete(domainSite);

                Response.Redirect(Request.Url.ToString(), true);
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }
        }
Exemple #2
0
        protected void btnDel_Click(object sender, EventArgs e)
        {
            Repeater list = (Repeater)SiteList1.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.Portal.Domain.Site domainSite = new ZhuJi.Portal.Domain.Site();

                domainSite.Id = int.Parse(id);

                ZhuJi.Portal.IDAL.ISite site = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Site)) as ZhuJi.Portal.IDAL.ISite;
                site.Delete(domainSite);

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

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

                ZhuJi.Portal.IDAL.ISite site = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Site)) as ZhuJi.Portal.IDAL.ISite;
                site.Delete(domainSite);
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }
            Response.Redirect(Request.Url.ToString(), true);
        }
Exemple #4
0
        /// <summary>
        /// 初始化编辑表单
        /// </summary>
        private void Edit()
        {
            btnAdd.Visible  = true;
            btnAdd.Text     = "另存为新记录";
            btnEdit.Visible = true;
            btnDel.Visible  = true;

            try
            {
                ZhuJi.Portal.IDAL.ISite  site       = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Site)) as ZhuJi.Portal.IDAL.ISite;
                ZhuJi.Portal.Domain.Site domainSite = site.GetObject(_identity);
                UIMapping.BindObjectToControls(domainSite, this);
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }
        }
Exemple #5
0
        /// <summary>
        /// 点击编辑按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    ZhuJi.Portal.Domain.Site domainSite = new ZhuJi.Portal.Domain.Site();
                    UIMapping.BindControlsToObject(domainSite, this);

                    ZhuJi.Portal.IDAL.ISite site = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Site)) as ZhuJi.Portal.IDAL.ISite;
                    site.Update(domainSite);
                }
                catch (Exception ex)
                {
                    ShowMessage(ex);
                }
            }
        }
        /// <summary>
        /// 点击添加按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    ZhuJi.Portal.Domain.Site domainSite = new ZhuJi.Portal.Domain.Site();
                    UIMapping.BindControlsToObject(domainSite, this);

                   ZhuJi.Portal.IDAL.ISite site = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Site)) as ZhuJi.Portal.IDAL.ISite;
                    site.Insert(domainSite);

                    _identity = domainSite.Id;
                    Edit();
                }
                catch (Exception ex)
                {
                    ShowMessage(ex);
                }
            }
        }
        /// <summary>
        /// 点击删除按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDel_Click(object sender, EventArgs e)
        {
            try
            {
                ZhuJi.Portal.Domain.Site domainSite = new ZhuJi.Portal.Domain.Site();

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

               ZhuJi.Portal.IDAL.ISite site = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Site)) as ZhuJi.Portal.IDAL.ISite;
                site.Delete(domainSite);
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }
            Response.Redirect(Request.Url.ToString(), true);
        }