当前位置: 首页>>代码示例>>C#>>正文


C# TabController.GetTabByName方法代码示例

本文整理汇总了C#中DotNetNuke.Entities.Tabs.TabController.GetTabByName方法的典型用法代码示例。如果您正苦于以下问题:C# TabController.GetTabByName方法的具体用法?C# TabController.GetTabByName怎么用?C# TabController.GetTabByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotNetNuke.Entities.Tabs.TabController的用法示例。


在下文中一共展示了TabController.GetTabByName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpgradeModule

        /// <summary>
        /// Upgrades the module.
        /// </summary>
        /// <param name="Version">The version.</param>
        /// <returns>System.String.</returns>
        public string UpgradeModule(string Version)
        {
            TabController tabs = new TabController();
            foreach (PortalInfo p in new PortalController().GetPortals())
            {
                TabInfo tabInfo = tabs.GetTabByName("Vanity Urls", p.PortalID);
                if (tabInfo == null)
                {

                    tabInfo = new TabInfo();
                    tabInfo.TabID = -1;
                    tabInfo.ParentId = tabs.GetTabByName("Admin", p.PortalID).TabID;
                    tabInfo.PortalID = p.PortalID;
                    tabInfo.TabName = "Vanity Urls";
                    try
                    {
                        int tabId = tabs.AddTab(tabInfo);
                        AddModuleToPage(p.PortalID, tabId);
                        return "Vanity Urls page added";
                    }
                    catch (Exception ex)
                    {
                        DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                    }
                }
            }

            return "";
        }
开发者ID:jsheely,项目名称:DotNetNuke-VanityUrls,代码行数:34,代码来源:DNNController.cs

示例2: MustHaveTestPageAdded

 public void MustHaveTestPageAdded()
 {
     //Create a tabInfo obj, then use TabController AddTab Method?
     TabInfo newPage = new TabInfo();
     newPage.TabName = "Test Page";
     newPage.PortalID = 0;
     newPage.SkinSrc = "[G]Skins/DarkKnight/Home-Mega-Menu.ascx";
     newPage.ContainerSrc = "[G]Containers/DarkKnight/SubTitle_Grey.ascx";
     TabController tabController = new TabController();
     var tab = tabController.GetTabByName("Test Page", 0);
     if (tab == null)
     {
         try
         {
             tabController.AddTab(newPage);
         }
         catch (Exception exc)
         {
             Assert.IsTrue(false, "Add Tab result: " + exc.Message);
         }
         //tabController.AddTab(newPage);
         newPage = tabController.GetTabByName("Test Page", 0);
         TabPermissionInfo tabPermission = new TabPermissionInfo();
         tabPermission.PermissionID = 3;
         tabPermission.TabID = newPage.TabID;
         tabPermission.AllowAccess = true;
         tabPermission.RoleID = 0;
         newPage.TabPermissions.Add(tabPermission);
         try
         {
             tabController.UpdateTab(newPage);
         }
         catch (Exception exc)
         {
             Assert.IsTrue(false, "Update Tab result: " + exc.Message);
         }
         newPage = tabController.GetTabByName("Test Page", 0);
         tabPermission.RoleID = 0;
         tabPermission.PermissionID = 4;
         tabPermission.TabID = newPage.TabID;
         tabPermission.AllowAccess = true;
         newPage.TabPermissions.Add(tabPermission);
         try
         {
             tabController.UpdateTab(newPage);
         }
         catch (Exception exc)
         {
             Assert.IsTrue(false, "Update Tab Permissions result: " + exc.Message);
         }
         Thread.Sleep(1500);
     }
 }
开发者ID:biganth,项目名称:Curt,代码行数:53,代码来源:BasePageSteps.cs

示例3: AddCoursePage

        public TabInfo AddCoursePage(string tabName, string tabTitle)
        {
            PortalSettings portalSettings = new PortalSettings();
            int portalId = portalSettings.PortalId;

            TabController tabController = new TabController();
            TabInfo getTab = tabController.GetTabByName(tabName, portalId);
            if (getTab != null)
                throw new Exception("Cannot create Page. Page with this PageName already exists");

            TabInfo newTab = new TabInfo();
            newTab.PortalID = portalId;
            newTab.TabName = tabName;
            newTab.Title = tabTitle;
            newTab.SkinSrc = "[G]Skins/20047-UnlimitedColorPack-033/CoursePage.ascx";
            newTab.ContainerSrc = portalSettings.DefaultPortalContainer;
            CommonTabSettings(newTab);
            AddViewPermissions(newTab);

            int tabId = tabController.AddTab(newTab, true);
            DotNetNuke.Common.Utilities.DataCache.ClearModuleCache(tabId);

            AddTabURL(newTab); //Makes the URL of Page /4 or /C4

            // add modules to new page

            AddModuleToPage(newTab, ModuleType.DisplayCourse);

            AddModuleToPage(newTab, ModuleType.Rating);

            AddModuleToPage(newTab, ModuleType.Comments);

            return newTab;
        }
开发者ID:Jochumzen,项目名称:DisplayPluggOld,代码行数:34,代码来源:DNN.cs

示例4: TestFixtureSetUp

        public override void TestFixtureSetUp()
        {
            base.TestFixtureSetUp();

            var tc = new TabController();
            var tab = tc.GetTabByName(_aboutUsPageName, PortalId);
            _tabId = tab.TabID;

            //Add Portal Aliases
            var aliasController = new PortalAliasController();
            TestUtil.ReadStream(String.Format("{0}", "Aliases"), (line, header) =>
                        {
                            string[] fields = line.Split(',');
                            var alias = aliasController.GetPortalAlias(fields[0], PortalId);
                            if (alias == null)
                            {
                                alias = new PortalAliasInfo
                                                {
                                                    HTTPAlias = fields[0],
                                                    PortalID = PortalId
                                                };
                                TestablePortalAliasController.Instance.AddPortalAlias(alias);
                            }
                        });
            TestUtil.ReadStream(String.Format("{0}", "Users"), (line, header) =>
                        {
                            string[] fields = line.Split(',');

                            TestUtil.AddUser(PortalId, fields[0].Trim(), fields[1].Trim(), fields[2].Trim());
                        });
        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:31,代码来源:FriendlyUrlTests.cs

示例5: MustNotHavePage

        private void MustNotHavePage(string pageName)
        {
            var controller = new TabController();
            TabInfo page = controller.GetTabByName(pageName, 0);

            if (page != null)
            {
                controller.DeleteTab(page.TabID, page.PortalID);
            }
        }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:10,代码来源:BasePageSteps.cs

示例6: PageDesignersMustNotExist

 public void PageDesignersMustNotExist()
 {
     var tabController = new TabController();
     var tab = tabController.GetTabByName("Designers", 0);
     if (tab != null)
     {
         tabController.DeleteTab(tab.TabID, 0);
         Config.Touch();
     }
 }
开发者ID:biganth,项目名称:Curt,代码行数:10,代码来源:PageSteps.cs

示例7: getUrlPreview

        public string getUrlPreview(string id)
        {
            TabController tCtlr = new TabController();
            TabInfo tInfoP = tCtlr.GetTabByName("Contingent Entry", PortalId);
            int tID = 392;
            if (tInfoP != null)
            {
                int tpID = tInfoP.TabID;
                TabInfo tInfo = tCtlr.GetTabByName("Input", PortalId, tpID);

                if (tInfo != null)
                {
                    tID = tInfo.TabID;
                }
            }

            //return "Default.aspx?tabid=383" + "&ID=" + id;
            //return "Default.aspx?tabid=392" + "&ID=" + id;
            return "Default.aspx?tabid=" + tID + "&ID=" + id;
        }
开发者ID:nguyenppt,项目名称:1pubcreditnew,代码行数:20,代码来源:CollateralContingentEntry_PL.ascx.cs

示例8: GivenThereIsAPageCalled

        public void GivenThereIsAPageCalled(string pageName, Table permissions)
        {
            var reset = false;
            var tabController = new TabController();
            var tab = tabController.GetTabByName(pageName, PortalId);
            if (tab == null)
            {
                tab = new TabInfo
                {
                    TabName = pageName,
                    PortalID = 0
                };
                tab.TabID = tabController.AddTab(tab);
                foreach (var row in permissions.Rows)
                {
                    var roleId = -1;
                    var roleController = new RoleController();
                    if (row[0] == "All Users")
                    {
                        roleId = -1;
                    }
                    else
                    {
                        var role = roleController.GetRoleByName(PortalId, row[0]);
                        if (role == null)
                        {
                            if (roleController.GetRoleByName(Null.NullInteger, row[0]) == null)
                            {
                                role = new RoleInfo { RoleName = row[0], RoleGroupID = Null.NullInteger };
                                roleId = roleController.AddRole(role);
                            }
                        }
                    }
                    var permissionController = new PermissionController();
                    var permission = permissionController.GetPermissionByCodeAndKey("SYSTEM_TAB", row[1]);
                    var tabPermission = new TabPermissionInfo
                    {
                        PermissionID = 3,
                        TabID = tab.TabID,
                        AllowAccess = true,
                        RoleID = roleId
                    };
                    tab.TabPermissions.Add(tabPermission);
                }

                tabController.UpdateTab(tab);
                reset = true;
            }
            Page = tab;
            if (reset)
            {
                Config.Touch();
            }
        }
开发者ID:biganth,项目名称:Curt,代码行数:54,代码来源:PageSteps.cs

示例9: AdvancedUrlRewriter_ForwardExternalUrls

        public void AdvancedUrlRewriter_ForwardExternalUrls(Dictionary<string, string> testFields)
        {
            var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]);

            settings.PortalId = PortalId;

            var tc = new TabController();
            var tab = tc.GetTabByName(_testPage, PortalId);
            tab.Url = testFields["ExternalUrl"];
            tc.UpdateTab(tab);

            ExecuteTest(settings, testFields, true);
        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:13,代码来源:UrlRewriteTests.cs

示例10: AdvancedUrlRewriter_DeletedTabHandling

        public void AdvancedUrlRewriter_DeletedTabHandling(Dictionary<string, string> testFields)
        {
            var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]);

            settings.PortalId = PortalId;

            var tc = new TabController();
            var tab = tc.GetTabByName(_testPage, PortalId);
            if (Convert.ToBoolean(testFields["HardDeleted"]))
            {
                DeleteTab(_testPage);
                CacheController.FlushPageIndexFromCache();
            }
            else
            {
                tab.IsDeleted = Convert.ToBoolean(testFields["SoftDeleted"]);
                tab.DisableLink = Convert.ToBoolean(testFields["Disabled"]);
                if (Convert.ToBoolean(testFields["Expired"]))
                {
                    tab.EndDate = DateTime.Now - TimeSpan.FromDays(1);
                }
                UpdateTab(tab);
            }

            string deletedTabHandling = testFields.GetValue("DeletedTabHandling");

            if (!String.IsNullOrEmpty(deletedTabHandling))
            {
                switch (deletedTabHandling)
                {
                    case "Do404Error":
                        settings.DeletedTabHandlingType = DeletedTabHandlingType.Do404Error;
                        break;
                    default:
                        settings.DeletedTabHandlingType = DeletedTabHandlingType.Do301RedirectToPortalHome;
                        break;
                }
            }

            SetDefaultAlias(testFields);

            ExecuteTest(settings, testFields, true);
        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:43,代码来源:UrlRewriteTests.cs

示例11: ExecuteTest

        private void ExecuteTest(FriendlyUrlSettings settings, Dictionary<string, string> testFields, bool setDefaultAlias)
        {
            var tabName = testFields["Page Name"];
            var tc = new TabController();
            var tab = tc.GetTabByName(tabName, PortalId);

            if (setDefaultAlias)
            {
                SetDefaultAlias(testFields);
            }

            ExecuteTestForTab(tab, settings, testFields);
        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:13,代码来源:UrlRewriteTests.cs

示例12: DeleteTab

        private void DeleteTab(string tabName)
        {
            var tc = new TabController();
            var tab = tc.GetTabByName(tabName, PortalId);

            if (tab != null)
            {
                tc.DeleteTab(tab.TabID, PortalId);
            }
        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:10,代码来源:UrlRewriteTests.cs

示例13: RemoveModule

        private static int RemoveModule(string desktopModuleName, string tabName, int parentId, bool removeTab)
        {
            DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "RemoveModule:" + desktopModuleName);
            var tabController = new TabController();
            var moduleController = new ModuleController();
            TabInfo tab = tabController.GetTabByName(tabName, Null.NullInteger, parentId);
            int moduleDefId = 0;
            int count = 0;

            //Get the Modules on the Tab
            if (tab != null)
            {
                foreach (KeyValuePair<int, ModuleInfo> kvp in moduleController.GetTabModules(tab.TabID))
                {
                    var module = kvp.Value;
                    if (module.DesktopModule.FriendlyName == desktopModuleName)
                    {
                        //Delete the Module from the Modules list
                        moduleController.DeleteTabModule(module.TabID, module.ModuleID, false);
                        moduleDefId = module.ModuleDefID;
                    }
                    else
                    {
                        count += 1;
                    }
                }

                //If Tab has no modules optionally remove tab
                if (count == 0 && removeTab)
                {
                    tabController.DeleteTab(tab.TabID, tab.PortalID);
                }
            }

            return moduleDefId;
        }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:36,代码来源:Upgrade.cs

示例14: GetShowOnlyCurrent

        private void GetShowOnlyCurrent(TabController objTabController, ref int StartingItemId, ref int iRootGroupId)
        {
            StartingItemId = 0;
            iRootGroupId = 0;
            //check if we have a value to work with
            if (string.IsNullOrEmpty(ShowOnlyCurrent))
            {
                return;
            }

            //check if user specified an ID
            if ((char.IsDigit(ShowOnlyCurrent.ToCharArray()[0])))
            {
                int output;
                if(int.TryParse(ShowOnlyCurrent, out output))
                {
                    StartingItemId = output;
                }
            }

            //check if user specified a page name
            if ((ShowOnlyCurrent.StartsWith("PageItem:")))
            {
                TabInfo temptab = objTabController.GetTabByName(ShowOnlyCurrent.Substring(("PageItem:").Length), PortalSettings.PortalId);
                if ((temptab != null))
                {
                    StartingItemId = temptab.TabID;
                }
            }

            //RootItem
            if (("RootItem" == ShowOnlyCurrent))
            {
                iRootGroupId = PortalSettings.ActiveTab.TabID;
                while (((objTabController.GetTab(iRootGroupId, PortalSettings.PortalId, true)).ParentId != -1))
                {
                    iRootGroupId = (objTabController.GetTab(iRootGroupId, PortalSettings.PortalId, true)).ParentId;
                }
            }
        }
开发者ID:hackoose,项目名称:cfi-team05,代码行数:40,代码来源:LeftMenu.ascx.cs

示例15: UpdateTabSetting

 private void UpdateTabSetting(string tabName, string settingName, string settingValue)
 {
     var tc = new TabController();
     var tab = tc.GetTabByName(tabName, PortalId);
     tab.TabSettings[settingName] = settingValue;
     tc.UpdateTab(tab);
 }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:7,代码来源:UrlRewriteTests.cs


注:本文中的DotNetNuke.Entities.Tabs.TabController.GetTabByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。