Beispiel #1
0
        private SiteMapNode CreateSiteMapNode(ZhuJi.Portal.Domain.Channel domainChannel)
        {
            int id = domainChannel.Id;

            if (_nodes.ContainsKey(id))
            {
                throw new ProviderException("不能有重复ID");
            }

            string title       = domainChannel.Title;
            string url         = domainChannel.SiteInfo.Url + string.Format(domainChannel.Url.ToString(), domainChannel.Id.ToString());
            string description = domainChannel.Remarks;
            string target      = domainChannel.Target;

            // 新建一个SiteMapNode
            SiteMapNode node;

            if (target.Length == 0)
            {
                node = new SiteMapNode(this, id.ToString(), url, title, description);
            }
            else
            {
                NameValueCollection attributes = new NameValueCollection();
                attributes.Add("target", target);

                node = new SiteMapNode(this, id.ToString(), url, title, description, null, attributes, null, null);
            }

            // 把这个SiteMapNode添加进节点字典表里
            _nodes.Add(id, node);

            // 返回这个SiteMapNode
            return(node);
        }
 private void ShowControl(int id)
 {
     ZhuJi.Portal.IDAL.IChannel  channel       = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Channel)) as ZhuJi.Portal.IDAL.IChannel;
     ZhuJi.Portal.Domain.Channel domainChannel = channel.GetObject(id);
     if (domainChannel != null)
     {
         Control control = this.LoadControl(domainChannel.ContentItemInfo.Operate);
         phContent.Controls.Add(control);
     }
 }
Beispiel #3
0
        private SiteMapNode GetParentNode(ZhuJi.Portal.Domain.Channel domainChannel)
        {
            int pid = domainChannel.Parent;

            if (!_nodes.ContainsKey(pid))
            {
                throw new ProviderException("有重复节点ID");
            }

            // 返回父节点的SiteMapNode
            return(_nodes[pid]);
        }
Beispiel #4
0
        /// <summary>
        /// 点击删除按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDel_Click(object sender, EventArgs e)
        {
            try
            {
                ZhuJi.Portal.Domain.Channel domainChannel = new ZhuJi.Portal.Domain.Channel();

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

                ZhuJi.Portal.IDAL.IChannel channel = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Channel)) as ZhuJi.Portal.IDAL.IChannel;
                channel.Delete(domainChannel);
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }
            Response.Redirect(Request.Url.ToString(), true);
        }
Beispiel #5
0
 /// <summary>
 /// 初始化编辑表单
 /// </summary>
 private void Edit()
 {
     btnAdd.Visible  = true;
     btnAdd.Text     = "另存为新记录";
     btnEdit.Visible = true;
     btnDel.Visible  = true;
     try
     {
         ZhuJi.Portal.IDAL.IChannel  channel       = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Channel)) as ZhuJi.Portal.IDAL.IChannel;
         ZhuJi.Portal.Domain.Channel domainChannel = channel.GetObject(_identity);
         UIMapping.BindObjectToControls(domainChannel, this);
     }
     catch (Exception ex)
     {
         ShowMessage(ex);
     }
 }
Beispiel #6
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.Channel domainChannel = new ZhuJi.Portal.Domain.Channel();
                    UIMapping.BindControlsToObject(domainChannel, this);

                    ZhuJi.Portal.IDAL.IChannel channel = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Channel)) as ZhuJi.Portal.IDAL.IChannel;
                    channel.Update(int.Parse(rblCurrentNode.SelectedValue), domainChannel);
                }
                catch (Exception ex)
                {
                    ShowMessage(ex);
                }
            }
        }
        /// <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.Channel domainChannel = new ZhuJi.Portal.Domain.Channel();
                    UIMapping.BindControlsToObject(domainChannel, this);

                    ZhuJi.Portal.IDAL.IChannel channel = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Channel)) as ZhuJi.Portal.IDAL.IChannel;
                    channel.Update(int.Parse(rblCurrentNode.SelectedValue), domainChannel);
                }
                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.Channel domainChannel = new ZhuJi.Portal.Domain.Channel();

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

                ZhuJi.Portal.IDAL.IChannel channel = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Channel)) as ZhuJi.Portal.IDAL.IChannel;
                channel.Delete(domainChannel);
            }
            catch (Exception ex)
            {
                ShowMessage(ex);
            }
            Response.Redirect(Request.Url.ToString(), true);
        }
 /// <summary>
 /// 获取栏目信息
 /// </summary>
 /// <param name="id"></param>
 private void GetChannel(int id)
 {
     ZhuJi.Portal.IDAL.IChannel channel = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Channel)) as ZhuJi.Portal.IDAL.IChannel;
     domainChannel = channel.GetObject(id);
 }
 /// <summary>
 /// ��ȡ��Ŀ��Ϣ
 /// </summary>
 /// <param name="id"></param>
 private void GetChannel(int id)
 {
     ZhuJi.Portal.IDAL.IChannel channel = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Channel)) as ZhuJi.Portal.IDAL.IChannel;
     domainChannel = channel.GetObject(id);
 }