Exemplo n.º 1
0
    private void RebuildBreadcrumbAndHeadOfHUD()
    {
        string pageName = Resources.Lang.PageName_Operations;
        string pageUrl  = "Operation-Node.aspx";

        if (c.qsId == 0)
        {
            //root
            hud.RebuildBreadcrumb(pageName, false);
            hud.SetHeadText(pageName);
        }
        else
        {
            StringBuilder sbBreadcrumbWoHome = new StringBuilder(100);

            // add root link
            sbBreadcrumbWoHome.Append(hud.GetBreadcrumbLinkItemHtml(pageName, pageName, pageUrl));
            // set url of BackToParent button
            hud.SetButtonAttribute(HudButtonNameEnum.BackToParent, HudButtonAttributeEnum.NavigateUrl, "~/" + pageUrl);

            List <OperationLevelInfo> levelInfos = empAuth.GetOperationLevelInfo(c.qsId);

            if (levelInfos != null)
            {
                int total = levelInfos.Count;

                for (int itemNum = total; itemNum >= 1; itemNum--)
                {
                    OperationLevelInfo opData         = levelInfos[itemNum - 1];
                    string             opSubject      = opData.OpSubject;
                    string             englishSubject = opData.EnglishSubject;
                    int    opId          = opData.OpId;
                    string url           = string.Format("{0}?id={1}", pageUrl, opId);
                    int    levelNum      = opData.LevelNum;
                    string iconImageFile = opData.IconImageFile;

                    if (useEnglishSubject && !string.IsNullOrEmpty(englishSubject))
                    {
                        opSubject = englishSubject;
                    }

                    if (itemNum == 1)
                    {
                        levelNumOfThis = levelNum;
                        sbBreadcrumbWoHome.Append(hud.GetBreadcrumbTextItemHtml(opSubject));
                        // update head of HUD
                        hud.SetHeadText(opSubject);

                        if (!string.IsNullOrEmpty(iconImageFile))
                        {
                            iconImageFile = "~/BPImages/icon/" + iconImageFile;
                            hud.SetHeadIconImageUrl(iconImageFile);
                        }
                    }
                    else
                    {
                        sbBreadcrumbWoHome.Append(hud.GetBreadcrumbLinkItemHtml(opSubject, opSubject, url));

                        if (itemNum == 2)
                        {
                            // set url of BackToParent button
                            hud.SetButtonAttribute(HudButtonNameEnum.BackToParent, HudButtonAttributeEnum.NavigateUrl, "~/" + url);
                        }
                    }
                }
            }

            hud.RebuildBreadcrumb(sbBreadcrumbWoHome.ToString(), true);
        }
    }