예제 #1
0
        private bool VerifyPortalTab(int PortalId, int TabId)
        {
            TabInfo       objTab           = null;
            TabInfo       objSplashTab     = null;
            TabInfo       objHomeTab       = null;
            bool          isVerified       = false;
            TabController objTabController = new TabController();
            TabCollection portalTabs       = objTabController.GetTabsByPortal(PortalId);
            TabCollection hostTabs         = objTabController.GetTabsByPortal(Null.NullInteger);

            if (TabId != Null.NullInteger)
            {
                if (portalTabs.TryGetValue(TabId, out objTab))
                {
                    if (!objTab.IsDeleted)
                    {
                        this.ActiveTab = objTab.Clone();
                        isVerified     = true;
                    }
                }
            }
            if (!isVerified && TabId != Null.NullInteger)
            {
                if (hostTabs.TryGetValue(TabId, out objTab))
                {
                    if (!objTab.IsDeleted)
                    {
                        this.ActiveTab = objTab.Clone();
                        isVerified     = true;
                    }
                }
            }
            if (!isVerified && this.SplashTabId > 0)
            {
                objSplashTab   = objTabController.GetTab(this.SplashTabId, PortalId, false);
                this.ActiveTab = objSplashTab.Clone();
                isVerified     = true;
            }
            if (!isVerified && this.HomeTabId > 0)
            {
                objHomeTab     = objTabController.GetTab(this.HomeTabId, PortalId, false);
                this.ActiveTab = objHomeTab.Clone();
                isVerified     = true;
            }
            if (!isVerified)
            {
                foreach (TabInfo tab in portalTabs.AsList())
                {
                    if (!tab.IsDeleted && tab.IsVisible)
                    {
                        this.ActiveTab = tab.Clone();
                        isVerified     = true;
                        break;
                    }
                }
            }
            if (Null.IsNull(this.ActiveTab.StartDate))
            {
                this.ActiveTab.StartDate = System.DateTime.MinValue;
            }
            if (Null.IsNull(this.ActiveTab.EndDate))
            {
                this.ActiveTab.EndDate = System.DateTime.MaxValue;
            }
            return(isVerified);
        }