示例#1
0
        protected void btnDel_Click(object sender, EventArgs e)
        {
            Repeater list = (Repeater)SkinList1.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.Skin domainSkin = new ZhuJi.Portal.Domain.Skin();

                domainSkin.Id = int.Parse(id);

                ZhuJi.Portal.IDAL.ISkin skin = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Skin)) as ZhuJi.Portal.IDAL.ISkin;
                skin.Delete(domainSkin);

                Response.Redirect(Request.Url.ToString(), true);
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }
        }
示例#2
0
        /// <summary>
        /// 初始化添加/编辑表单
        /// </summary>
        public void Initialize()
        {
            btnAdd.Visible  = false;
            btnEdit.Visible = false;
            btnDel.Visible  = false;
            try
            {
                ZhuJi.Portal.IDAL.IChannel          channel = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Channel)) as ZhuJi.Portal.IDAL.IChannel;
                IList <ZhuJi.Portal.Domain.Channel> list    = channel.TreeNodes();
                Parent.Items.Clear();
                foreach (ZhuJi.Portal.Domain.Channel domainChannel in list)
                {
                    Parent.Items.Add(new ListItem(domainChannel.Title.PadLeft(domainChannel.Title.Length + domainChannel.Depth, SYMBOLS), domainChannel.Id.ToString()));
                }
                Parent.Items.Insert(0, new ListItem("根目录", "0"));

                ZhuJi.Portal.IDAL.ISite          site     = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Site)) as ZhuJi.Portal.IDAL.ISite;
                IList <ZhuJi.Portal.Domain.Site> listSite = site.GetObjects("", "tmp.OrderBy");
                foreach (ZhuJi.Portal.Domain.Site domainSite in listSite)
                {
                    SiteId.Items.Add(new ListItem(domainSite.Title.ToString(), domainSite.Id.ToString()));
                }

                ZhuJi.Portal.IDAL.IContentItem          contentItem     = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.ContentItem)) as ZhuJi.Portal.IDAL.IContentItem;
                IList <ZhuJi.Portal.Domain.ContentItem> listContentItem = contentItem.GetObjects("", "tmp.OrderBy");
                foreach (ZhuJi.Portal.Domain.ContentItem domainContentItem in listContentItem)
                {
                    ContentItemId.Items.Add(new ListItem(domainContentItem.Name.ToString(), domainContentItem.Id.ToString()));
                }

                ZhuJi.Portal.IDAL.ISkin          skin     = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Skin)) as ZhuJi.Portal.IDAL.ISkin;
                IList <ZhuJi.Portal.Domain.Skin> listSkin = skin.GetObjects("", "tmp.OrderBy");
                foreach (ZhuJi.Portal.Domain.Skin domainSkin in listSkin)
                {
                    SkinId.Items.Add(new ListItem(domainSkin.Name.ToString(), domainSkin.Id.ToString()));
                }
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }

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

            case "EDIT":
                Edit();
                break;
            }
        }
示例#3
0
 /// <summary>
 /// 初始化编辑表单
 /// </summary>
 private void Edit()
 {
     btnAdd.Visible  = true;
     btnAdd.Text     = "另存为新记录";
     btnEdit.Visible = true;
     btnDel.Visible  = true;
     try
     {
         ZhuJi.Portal.IDAL.ISkin  skin       = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Skin)) as ZhuJi.Portal.IDAL.ISkin;
         ZhuJi.Portal.Domain.Skin domainSkin = skin.GetObject(_identity);
         UIMapping.BindObjectToControls(domainSkin, this);
     }
     catch (Exception ex)
     {
         ShowMessage(ex);
     }
 }
示例#4
0
        /// <summary>
        /// 点击删除按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDel_Click(object sender, EventArgs e)
        {
            try
            {
                ZhuJi.Portal.Domain.Skin domainSkin = new ZhuJi.Portal.Domain.Skin();

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

                ZhuJi.Portal.IDAL.ISkin skin = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Skin)) as ZhuJi.Portal.IDAL.ISkin;
                skin.Delete(domainSkin);
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }
            Response.Redirect(Request.Url.ToString(), true);
        }
示例#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.Skin domainSkin = new ZhuJi.Portal.Domain.Skin();
                    UIMapping.BindControlsToObject(domainSkin, this);

                    ZhuJi.Portal.IDAL.ISkin skin = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Skin)) as ZhuJi.Portal.IDAL.ISkin;
                    skin.Update(domainSkin);
                }
                catch (Exception ex)
                {
                    ShowMessage(ex);
                }
            }
        }
 /// <summary>
 /// 初始化查询列表
 /// </summary>
 public void List()
 {
     try
     {
         ZhuJi.Portal.IDAL.ISkin skin = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Skin)) as ZhuJi.Portal.IDAL.ISkin;
         rptList.DataSource = skin.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 = skin.GetRowCount;
             simplePager.DataBind();
         }
     }
     catch (Exception ex)
     {
         ShowMessage(ex);
     }
 }