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


C# TabController.Where方法代码示例

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


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

示例1: GetTabsToLocalize

        public List<TabInfo> GetTabsToLocalize(int portalId, string code)
        {
            var results = new List<TabInfo>();
            var portalTabs = new TabController().GetTabsByPortal(portalId);
            foreach (var kvp in portalTabs.Where(kvp => kvp.Value.CultureCode == PortalSettings.DefaultLanguage && !kvp.Value.IsDeleted))
            {
                if (kvp.Value.LocalizedTabs.Count == 0)
                {
                    results.Add(kvp.Value);
                }
                else
                {
                    bool tabLocalizedInCulture = kvp.Value.LocalizedTabs.Any(localizedTab => localizedTab.Value.CultureCode == code);
                    if (!tabLocalizedInCulture)
                    {
                        results.Add(kvp.Value);
                    }
                }
            }
            return results;

        }
开发者ID:KashbinRepository,项目名称:Core,代码行数:22,代码来源:LocalizePages.ascx.cs

示例2: PurgeInvalidRedirections

        /// <summary>
        /// Deletes all redirection rules that were set for pages that have been soft or hard deleted.
        /// </summary>
        /// <param name="portalId"></param>
        public void PurgeInvalidRedirections(int portalId)
        {
            var allTabs = new TabController().GetTabsByPortal(portalId);
            var redirects = GetRedirectionsByPortal(portalId);

            //remove rules for deleted source tabs
            foreach (var r in redirects.Where(r => r.SourceTabId != Null.NullInteger && allTabs.Where(t => t.Key == r.SourceTabId).Count() < 1))
            {
                Delete(portalId, r.Id);
            }
            
            //remove rules for deleted target tabs
            redirects = GetRedirectionsByPortal(portalId); //fresh get of rules in case some were deleted above                       
            foreach (var r in redirects.Where(r => r.TargetType == TargetType.Tab && allTabs.Where(t => t.Key == int.Parse(r.TargetValue.ToString())).Count() < 1))
            {
                Delete(portalId, r.Id);
            }

            //remove rules for deleted target portals
            redirects = GetRedirectionsByPortal(portalId); //fresh get of rules in case some were deleted above                       
            var allPortals = new PortalController().GetPortals();            
            foreach (var r in redirects.Where(r => r.TargetType == TargetType.Portal))
            {
                bool found = false;
                foreach (PortalInfo portal in allPortals)
                {
                    if (portal.PortalID == int.Parse(r.TargetValue.ToString()))
                    {
                        found = true;
                        break;
                    }
                }
                if (!found)                               
                    Delete(portalId, r.Id);
            }
        }
开发者ID:kp-xcess,项目名称:Dnn.Platform,代码行数:40,代码来源:RedirectionController.cs

示例3: BindSettingControls

        private void BindSettingControls()
        {
			// Toggle fields if a redirect already exists for the Portal Home Page
			var defaultRedirect = HomePageRedirectExists();

            // Populate Pages dropdowns            
            var tabs = new TabController().GetTabsByPortal(ModuleContext.PortalId).AsList().Where(IsVisible);
            cboSourcePage.DataTextField = "IndentedTabName";
            cboSourcePage.DataValueField = "TabID";
            cboSourcePage.DataSource = tabs;
            cboSourcePage.DataBind();
            cboTargetPage.DataTextField = "IndentedTabName";
            cboTargetPage.DataValueField = "TabID";

			//if set a default redirect then hide home page in target page list.
			if(!defaultRedirect)
			{
				cboTargetPage.DataSource = tabs.Where(t => t.TabID != ModuleContext.PortalSettings.HomeTabId);
			}
			else
			{
				cboTargetPage.DataSource = tabs;
			}

            cboTargetPage.DataBind();

            // Populating Portals dropdown
            var portalController = new PortalController();
        	var portals = portalController.GetPortals().Cast<PortalInfo>().Where(p => p.PortalID != ModuleContext.PortalId).ToList();
            if (portals.Count > 0)
            {
                cboPortal.DataSource = portals;
                cboPortal.DataTextField = "PortalName";
                cboPortal.DataValueField = "PortalID";
                cboPortal.DataBind();
            }
            else
            {
                optRedirectTarget.Items[0].Enabled = false;
                optRedirectTarget.Items[0].Selected = false;
                optRedirectTarget.Items[1].Selected = true;
            }

            cboSourcePage.Visible = defaultRedirect;
            lblHomePage.Visible = !defaultRedirect;
            lblRedirectName.Visible = defaultRedirect;
            txtRedirectName.Visible = defaultRedirect;
        }
开发者ID:biganth,项目名称:Curt,代码行数:48,代码来源:SimpleSettingsView.ascx.cs


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