Beispiel #1
0
    private string GetActiveTab()
    {
        string activeTab = Convert.ToString(Request.QueryString[_activeTabKey]);

        if (!string.IsNullOrEmpty(activeTab))
        {
            if (!IsValidTab(activeTab))
            {
                throw new ArgumentException(Resources.Resources.MsgInvalidTab);
            }
            if (!IsEditMode)
            {
                if (SelectedResourceType == null)
                {
                    activeTab = null;
                }
                else if (activeTab != Constants.MetadataTab)
                {
                    activeTab = Constants.MetadataTab;
                }
            }
            else
            {
                if ((SummaryTab.Visible &&
                     (activeTab.Equals(Constants.MetadataTab, StringComparison.OrdinalIgnoreCase) && !MetadataTab.Visible) ||
                     (activeTab.Equals(Constants.AssociationTab, StringComparison.OrdinalIgnoreCase) && !AssociationsTab.Visible) ||
                     (activeTab.Equals(Constants.CategoriesTab, StringComparison.OrdinalIgnoreCase) && !CategoriesTab.Visible) ||
                     (activeTab.Equals(Constants.TagsTab, StringComparison.OrdinalIgnoreCase) && !TagsTab.Visible) ||
                     (activeTab.Equals(Constants.ChangeHistoryTab, StringComparison.OrdinalIgnoreCase) && !ChangeHistoryTab.Visible) ||
                     (activeTab.Equals(Constants.ResourcePermissionsTab, StringComparison.OrdinalIgnoreCase) && !ResourcePermissionsTab.Visible)))
                {
                    activeTab = Constants.SummaryTab;
                }
            }
        }
        else
        {
            if (IsEditMode)
            {
                activeTab = Constants.SummaryTab;
            }
            else
            {
                if (!string.IsNullOrEmpty(SelectedResourceType))
                {
                    using (ResourceDataAccess dataAccess = new ResourceDataAccess())
                    {
                        int childTypeCount = dataAccess.GetChildResourceTypesCount(SelectedResourceType);
                        if (childTypeCount == 0)
                        {
                            activeTab = Constants.MetadataTab;
                        }
                    }
                }
            }
        }

        return(activeTab);
    }