Esempio n. 1
0
        public ViewResult Detail(TaxonomyBranchPrimaryKey taxonomyBranchPrimaryKey)
        {
            var taxonomyBranch         = taxonomyBranchPrimaryKey.EntityObject;
            var taxonomyBranchProjects = taxonomyBranch.GetAssociatedProjects(CurrentPerson).ToList();

            var projectMapCustomization = new ProjectMapCustomization(ProjectLocationFilterType.TaxonomyBranch, new List <int> {
                taxonomyBranch.TaxonomyBranchID
            }, ProjectColorByType.ProjectStage);
            var projectLocationsLayerGeoJson = new LayerGeoJson($"{FieldDefinition.ProjectLocation.GetFieldDefinitionLabel()}", Project.MappedPointsToGeoJsonFeatureCollection(taxonomyBranchProjects, true, true), "red", 1, LayerInitialVisibility.Show);
            var projectLocationsMapInitJson  = new ProjectLocationsMapInitJson(projectLocationsLayerGeoJson, projectMapCustomization, "TaxonomyBranchProjectMap");
            var projectLocationsMapViewData  = new ProjectLocationsMapViewData(projectLocationsMapInitJson.MapDivID, ProjectColorByType.ProjectStage.DisplayName, MultiTenantHelpers.GetTopLevelTaxonomyTiers(), CurrentPerson.CanViewProposals);

            var associatePerformanceMeasureTaxonomyLevel = MultiTenantHelpers.GetAssociatePerformanceMeasureTaxonomyLevel();
            var canHaveAssociatedPerformanceMeasures     = associatePerformanceMeasureTaxonomyLevel == TaxonomyLevel.Branch;
            var taxonomyTierPerformanceMeasures          = taxonomyBranch.GetTaxonomyTierPerformanceMeasures();
            var relatedPerformanceMeasuresViewData       = new RelatedPerformanceMeasuresViewData(associatePerformanceMeasureTaxonomyLevel, true, taxonomyTierPerformanceMeasures, canHaveAssociatedPerformanceMeasures);
            List <PerformanceMeasureChartViewData> performanceMeasureChartViewDatas = null;

            if (canHaveAssociatedPerformanceMeasures)
            {
                performanceMeasureChartViewDatas = taxonomyTierPerformanceMeasures.Select(x => new PerformanceMeasureChartViewData(x.Key, CurrentPerson, false, new List <Project>())).ToList();
            }

            var taxonomyLevel = MultiTenantHelpers.GetTaxonomyLevel();
            var viewData      = new DetailViewData(CurrentPerson, taxonomyBranch, projectLocationsMapInitJson, projectLocationsMapViewData, canHaveAssociatedPerformanceMeasures, relatedPerformanceMeasuresViewData, performanceMeasureChartViewDatas, taxonomyLevel);

            return(RazorView <Summary, DetailViewData>(viewData));
        }
        public ViewResult Detail(TaxonomyBranchPrimaryKey taxonomyBranchPrimaryKey)
        {
            var taxonomyBranch         = taxonomyBranchPrimaryKey.EntityObject;
            var taxonomyBranchProjects = taxonomyBranch.GetAssociatedProjects(CurrentFirmaSession).ToList();

            var projectMapCustomization = new ProjectMapCustomization(ProjectLocationFilterType.TaxonomyBranch, new List <int> {
                taxonomyBranch.TaxonomyBranchID
            }, ProjectColorByType.ProjectStage);
            var projectLocationsLayerGeoJson = new LayerGeoJson(
                $"{FieldDefinitionEnum.ProjectLocation.ToType().GetFieldDefinitionLabel()}",
                taxonomyBranchProjects.MappedPointsToGeoJsonFeatureCollection(false, true, true),
                "red", 1, LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            var projectLocationsMapInitJson = new ProjectLocationsMapInitJson(projectLocationsLayerGeoJson, projectMapCustomization,
                                                                              "TaxonomyBranchProjectMap", false);

            // Add Organization Type boundaries according to configuration
            projectLocationsMapInitJson.Layers.AddRange(HttpRequestStorage.DatabaseEntities.Organizations.GetConfiguredBoundaryLayersGeoJson());

            var projectLocationsMapViewData = new ProjectLocationsMapViewData(projectLocationsMapInitJson.MapDivID, ProjectColorByType.ProjectStage.GetDisplayNameFieldDefinition(), MultiTenantHelpers.GetTopLevelTaxonomyTiers(), CurrentFirmaSession.CanViewProposals());

            var associatePerformanceMeasureTaxonomyLevel = MultiTenantHelpers.GetAssociatePerformanceMeasureTaxonomyLevel();
            var canHaveAssociatedPerformanceMeasures     = associatePerformanceMeasureTaxonomyLevel == TaxonomyLevel.Branch;
            var taxonomyTierPerformanceMeasures          = taxonomyBranch.GetTaxonomyTierPerformanceMeasures();
            var relatedPerformanceMeasuresViewData       = new RelatedPerformanceMeasuresViewData(associatePerformanceMeasureTaxonomyLevel, true, taxonomyTierPerformanceMeasures, canHaveAssociatedPerformanceMeasures);
            List <PerformanceMeasureChartViewData> performanceMeasureChartViewDatas = null;

            if (canHaveAssociatedPerformanceMeasures)
            {
                performanceMeasureChartViewDatas = taxonomyTierPerformanceMeasures.Select(x => new PerformanceMeasureChartViewData(x.Key, CurrentFirmaSession, false, new List <Project>())).ToList();
            }

            var taxonomyLevel = MultiTenantHelpers.GetTaxonomyLevel();
            var projectCustomDefaultGridConfigurations = HttpRequestStorage.DatabaseEntities.ProjectCustomGridConfigurations.Where(x => x.IsEnabled && x.ProjectCustomGridTypeID == ProjectCustomGridType.Default.ProjectCustomGridTypeID).OrderBy(x => x.SortOrder).ToList();
            var viewData = new DetailViewData(CurrentFirmaSession, taxonomyBranch, projectLocationsMapInitJson, projectLocationsMapViewData, canHaveAssociatedPerformanceMeasures, relatedPerformanceMeasuresViewData, performanceMeasureChartViewDatas, taxonomyLevel, projectCustomDefaultGridConfigurations);

            return(RazorView <Summary, DetailViewData>(viewData));
        }