Exemplo n.º 1
0
        public static Dictionary <string, List <ProjectMapLegendElement> > BuildLegendFormatDictionary(List <TaxonomyTier> topLevelTaxonomyTiers, bool showProposals)
        {
            var legendFormats = new Dictionary <string, List <ProjectMapLegendElement> >
            {
                {
                    ProjectColorByType.ProjectStage.ProjectColorByTypeNameWithIdentifier,
                    ProjectMapCustomization.GetProjectStagesForMap(showProposals)
                    .Where(x => x.ShouldShowOnMap()).OrderBy(x => x.SortOrder).Select(x => new ProjectMapLegendElement(x.ProjectStageID, x.ProjectStageColor, x.ProjectStageDisplayName)).ToList()
                }
            };

            if (MultiTenantHelpers.IsTaxonomyLevelTrunk())
            {
                legendFormats[ProjectColorByType.TaxonomyTrunk.ProjectColorByTypeNameWithIdentifier] =
                    topLevelTaxonomyTiers
                    .OrderBy(x => x.SortOrder).ThenBy(x => x.DisplayName, StringComparer.InvariantCultureIgnoreCase)
                    .Select(x => new ProjectMapLegendElement(x.TaxonomyTierID, x.ThemeColor, x.DisplayName))
                    .ToList();
                legendFormats[ProjectColorByType.TaxonomyBranch.ProjectColorByTypeNameWithIdentifier] =
                    topLevelTaxonomyTiers.SelectMany(x => x.TaxonomyTrunk.TaxonomyBranches)
                    .OrderBy(x => x.TaxonomyTrunk.GetSortOrder()).ThenBy(x => x.GetDisplayName(), StringComparer.InvariantCultureIgnoreCase)
                    .ThenBy(x => x.GetSortOrder()).ThenBy(x => x.GetDisplayName(), StringComparer.InvariantCultureIgnoreCase)
                    .Select(x => new ProjectMapLegendElement(x.TaxonomyBranchID, x.ThemeColor, x.GetDisplayName()))
                    .ToList();
                legendFormats[ProjectColorByType.TaxonomyLeaf.ProjectColorByTypeNameWithIdentifier] =
                    topLevelTaxonomyTiers.SelectMany(x => x.TaxonomyTrunk.TaxonomyBranches)
                    .SelectMany(x => x.TaxonomyLeafs)
                    .OrderBy(x => x.TaxonomyBranch.TaxonomyTrunk.GetSortOrder()).ThenBy(x => x.TaxonomyBranch.TaxonomyTrunk.GetDisplayName(), StringComparer.InvariantCultureIgnoreCase)
                    .ThenBy(x => x.TaxonomyBranch.GetSortOrder()).ThenBy(x => x.TaxonomyBranch.GetDisplayName(), StringComparer.InvariantCultureIgnoreCase)
                    .ThenBy(x => x.GetSortOrder()).ThenBy(x => x.GetDisplayName(), StringComparer.InvariantCultureIgnoreCase)
                    .Select(x => new ProjectMapLegendElement(x.TaxonomyLeafID, x.ThemeColor, x.GetDisplayName()))
                    .ToList();
            }
            if (MultiTenantHelpers.IsTaxonomyLevelBranch())
            {
                legendFormats[ProjectColorByType.TaxonomyBranch.ProjectColorByTypeNameWithIdentifier] =
                    topLevelTaxonomyTiers.OrderBy(x => x.SortOrder).ThenBy(x => x.DisplayName, StringComparer.InvariantCultureIgnoreCase)
                    .Select(x => new ProjectMapLegendElement(x.TaxonomyTierID, x.ThemeColor, x.DisplayName))
                    .ToList();
                legendFormats[ProjectColorByType.TaxonomyLeaf.ProjectColorByTypeNameWithIdentifier] =
                    topLevelTaxonomyTiers.SelectMany(x => x.TaxonomyBranch.TaxonomyLeafs)
                    .OrderBy(x => x.TaxonomyBranch.GetSortOrder()).ThenBy(x => x.TaxonomyBranch.GetDisplayName(), StringComparer.InvariantCultureIgnoreCase)
                    .ThenBy(x => x.GetSortOrder()).ThenBy(x => x.GetDisplayName(), StringComparer.InvariantCultureIgnoreCase)
                    .Select(x => new ProjectMapLegendElement(x.TaxonomyLeafID, x.ThemeColor, x.GetDisplayName()))
                    .ToList();
            }
            if (MultiTenantHelpers.IsTaxonomyLevelLeaf())
            {
                legendFormats[ProjectColorByType.TaxonomyLeaf.ProjectColorByTypeNameWithIdentifier] =
                    topLevelTaxonomyTiers
                    .OrderBy(x => x.SortOrder).ThenBy(x => x.DisplayName, StringComparer.InvariantCultureIgnoreCase)
                    .Select(x => new ProjectMapLegendElement(x.TaxonomyTierID, x.ThemeColor, x.DisplayName))
                    .ToList();
            }

            return(legendFormats);
        }
Exemplo n.º 2
0
        public static Dictionary <string, List <ProjectMapLegendElement> > BuildLegendFormatDictionary(List <ITaxonomyTier> topLevelTaxonomyTiers, bool showProposals)
        {
            var legendFormats = new Dictionary <string, List <ProjectMapLegendElement> >
            {
                {
                    ProjectColorByType.ProjectStage.ProjectColorByTypeNameWithIdentifier,
                    ProjectMapCustomization.GetProjectStagesForMap(showProposals).Where(x => x.ShouldShowOnMap()).OrderBy(x => x.SortOrder).Select(x => new ProjectMapLegendElement(x.ProjectStageID, x.ProjectStageColor, x.ProjectStageDisplayName)).ToList()
                },
                {
                    MultiTenantHelpers.IsTaxonomyLevelTrunk() ? ProjectColorByType.TaxonomyTrunk.ProjectColorByTypeNameWithIdentifier : ProjectColorByType.TaxonomyBranch.ProjectColorByTypeNameWithIdentifier,
                topLevelTaxonomyTiers.Select(x => new ProjectMapLegendElement(x.TaxonomyTierID, x.ThemeColor, x.DisplayName)).ToList()
                }
            };

            return(legendFormats);
        }