Exemplo n.º 1
0
        protected void btnDel_Click(object sender, EventArgs e)
        {
            Repeater list = (Repeater)ControlsList1.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.UUMS.Domain.Controls domainControls = new ZhuJi.UUMS.Domain.Controls();

                domainControls.Id = int.Parse(id);

                ZhuJi.UUMS.IDAL.IControls controls = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Controls)) as ZhuJi.UUMS.IDAL.IControls;
                controls.Delete(domainControls);

                Response.Redirect(Request.Url.ToString(), true);
            }
            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.UUMS.Domain.Controls domainControls = new ZhuJi.UUMS.Domain.Controls();

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

                ZhuJi.UUMS.IDAL.IControls controls = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Controls)) as ZhuJi.UUMS.IDAL.IControls;
                controls.Delete(domainControls);
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }
            Response.Redirect(Request.Url.ToString(), true);
        }
        /// <summary>
        /// 点击编辑按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    ZhuJi.UUMS.Domain.Controls domainControls = new ZhuJi.UUMS.Domain.Controls();
                    UIMapping.BindControlsToObject(domainControls, this);

                    ZhuJi.UUMS.IDAL.IControls controls = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Controls)) as ZhuJi.UUMS.IDAL.IControls;
                    controls.Update(domainControls);
                }
                catch (Exception ex)
                {
                    ShowMessage(ex);
                }
            }
        }
        /// <summary>
        /// 初始化编辑表单
        /// </summary>
        private void Edit()
        {
            btnAdd.Visible  = true;
            btnAdd.Text     = "另存为新记录";
            btnEdit.Visible = true;
            btnDel.Visible  = true;

            try
            {
                ZhuJi.UUMS.IDAL.IControls  controls       = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Controls)) as ZhuJi.UUMS.IDAL.IControls;
                ZhuJi.UUMS.Domain.Controls domainControls = controls.GetObject(_identity);
                UIMapping.BindObjectToControls(domainControls, this);
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 初始化查询列表
 /// </summary>
 public void List()
 {
     try
     {
         ZhuJi.UUMS.IDAL.IControls controls = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.Controls)) as ZhuJi.UUMS.IDAL.IControls;
         rptList.DataSource = controls.GetObjects(base.Where, base.OrderNo, base.PageNo, base.PageSize);
         rptList.DataBind();
         if (base.IsShowPager)
         {
             simplePager.Visible     = true;
             simplePager.CurrentPage = base.PageNo;
             simplePager.PageSize    = base.PageSize;
             simplePager.PageUrl     = Request.Url.ToString();
             simplePager.RecordCount = controls.GetRowCount;
             simplePager.DataBind();
         }
     }
     catch (Exception ex)
     {
         ShowMessage(ex);
     }
 }