Пример #1
0
/*====================================================*/

        protected override void Render(HtmlTextWriter aTxTWr)
        {
            int aIndex;

            if (this.Page.Request.QueryString["PageFrame"] == "Print")
            {
                return;
            }

            mCrumbTrail = ((cWebUser)((cModulePage)Page).ModuleUser).CrumbTrail;
            //AutoVDateType: None, Root, Relative
            if (AutoVDateType == "Root")
            {
                mCrumbTrail.Validate_Root(Key, "", LinkTitle, this.Page.Request.Url.AbsoluteUri);
            }
            else if (AutoVDateType == "Relative")
            {
                mCrumbTrail.Validate(Key, "", LinkTitle, this.Page.Request.Url.AbsoluteUri);
            }
            else if (AutoVDateType == "Last")
            {
                mCrumbTrail.Validate_Last(Key, "", LinkTitle, this.Page.Request.Url.AbsoluteUri);
            }

            if (CrumbTrail == null)
            {
                aTxTWr.Write("CrumbTrail is null");
                return;
            }

            for (aIndex = 0; aIndex < CrumbTrail.Count; aIndex++)
            {
                if (aIndex != 0)
                {
                    aTxTWr.Write("&nbsp;|&nbsp;");
                }

                if (aIndex == CrumbTrail.Count - 1)
                {
                    CrumbTrail.Crumb_From_Index(aIndex).Anchor = false;
                }
                else
                {
                    CrumbTrail.Crumb_From_Index(aIndex).Anchor = true;
                }

                if (AutoVDateType != "Root")
                {
                    aTxTWr.Write(((cModulePage)Page).ConfigurableText(CrumbTrail.Crumb_From_Index(aIndex).OutputHtml));
                }
            }
        }
Пример #2
0
        /// <summary>
        /// This method creates the crumbtrail for a given item
        /// </summary>
        /// <param name="reader">The DnaDataReader that contains the crumbtrail result set.</param>
        static public CrumbTrails GetCrumbtrailForItem(IDnaDataReader reader)
        {
            CrumbTrails crumbTrialList = new CrumbTrails();
            bool startOfTrail = true;
            CrumbTrail crumbTrail = null;
            while (reader.Read())
            {
                // Check to see if we're at the top level
                int treeLevel = reader.GetInt32("TreeLevel");
                if (treeLevel == 0)
                {
                    startOfTrail = true;
                }

                // Check to see if we're starting a new trail
                if (startOfTrail)
                {
                    if (crumbTrail != null)
                    {//add the previous to the list
                        crumbTrialList.CrumbTrail.Add(crumbTrail);
                    }
                    //start new
                    crumbTrail = new CrumbTrail();
                    startOfTrail = false;
                }

                CrumbTrailAncestor ancestor = new CrumbTrailAncestor();
                ancestor.Name = reader.GetString("DisplayName");
                ancestor.NodeId = reader.GetInt32("NodeID");
                ancestor.TreeLevel = treeLevel;
                ancestor.NodeType = reader.GetInt32("Type");
                if (reader.Exists("RedirectNodeID") && !reader.IsDBNull("RedirectNodeID"))
                {
                    ancestor.RedirectNode = new CrumbTrialAncestorRedirect();
                    ancestor.RedirectNode.id = reader.GetInt32("RedirectNodeID");
                    ancestor.RedirectNode.value = reader.GetString("RedirectNodeName");
                }
                crumbTrail.Ancestor.Add(ancestor);
            }
            if (crumbTrail != null)
            {//add the previous to the list
                crumbTrialList.CrumbTrail.Add(crumbTrail);
            }
            return crumbTrialList;
        }