예제 #1
0
        /// <summary>
        /// 初始化添加/编辑表单
        /// </summary>
        public void Initialize()
        {
            btnAdd.Visible  = false;
            btnEdit.Visible = false;
            btnDel.Visible  = false;
            try
            {
                ZhuJi.UUMS.IDAL.IMethodExplain          methodExplain     = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.MethodExplain)) as ZhuJi.UUMS.IDAL.IMethodExplain;
                IList <ZhuJi.UUMS.Domain.MethodExplain> listMethodExplain = methodExplain.GetObjects();
                foreach (ZhuJi.UUMS.Domain.MethodExplain domainMethodExplain in listMethodExplain)
                {
                    ExplainId.Items.Add(new ListItem(domainMethodExplain.Title.ToString(), domainMethodExplain.Id.ToString()));
                }
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }

            switch (_command)
            {
            case "ADD":
                Add();
                break;

            case "EDIT":
                Edit();
                break;
            }
        }
 /// <summary>
 /// 初始化查询列表
 /// </summary>
 public void BindGrid()
 {
     try
     {
         ZhuJi.UUMS.IDAL.IMethodExplain methodExplain = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.MethodExplain)) as ZhuJi.UUMS.IDAL.IMethodExplain;
         gvList.DataSource = methodExplain.GetObjects(base.Where, base.OrderNo);
         gvList.DataBind();
     }
     catch (Exception ex)
     {
         ShowMessage(ex);
     }
 }
        protected void gvList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                ZhuJi.UUMS.Domain.MethodExplain domainMethodExplain = new ZhuJi.UUMS.Domain.MethodExplain();

                domainMethodExplain.Id = int.Parse(gvList.Rows[e.RowIndex].Cells[0].Text);

                ZhuJi.UUMS.IDAL.IMethodExplain methodExplain = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.MethodExplain)) as ZhuJi.UUMS.IDAL.IMethodExplain;
                methodExplain.Delete(domainMethodExplain);

                gvList.EditIndex = -1;
                BindGrid();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void gvList_RowInserting(object sender, EventArgs e)
        {
            try
            {
                ZhuJi.UUMS.Domain.MethodExplain domainMethodExplain = new ZhuJi.UUMS.Domain.MethodExplain();
                TextBox txtTitle   = (TextBox)gvList.FooterRow.FindControl("txtTitle");
                TextBox txtOrderBy = (TextBox)gvList.FooterRow.FindControl("txtOrderBy");

                domainMethodExplain.Title   = txtTitle.Text.Trim();
                domainMethodExplain.OrderBy = int.Parse(txtOrderBy.Text.Trim());

                ZhuJi.UUMS.IDAL.IMethodExplain methodExplain = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.UUMS.NHibernateDAL.MethodExplain)) as ZhuJi.UUMS.IDAL.IMethodExplain;
                methodExplain.Insert(domainMethodExplain);

                gvList.EditIndex = -1;
                BindGrid();
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }
        }