Exemple #1
0
        public JsonNetJArrayResult FilteredProjectsWithLocationAreas(ProjectMapCustomization projectMapCustomization)
        {
            if (projectMapCustomization.FilterPropertyValues == null ||
                !projectMapCustomization.FilterPropertyValues.Any())
            {
                return(new JsonNetJArrayResult(new List <object>()));
            }
            var projectLocationFilterTypeFromFilterPropertyName = projectMapCustomization
                                                                  .GetProjectLocationFilterTypeFromFilterPropertyName();
            var filterFunction =
                projectLocationFilterTypeFromFilterPropertyName.GetFilterFunction(projectMapCustomization
                                                                                  .FilterPropertyValues);
            var allProjectsForMap = ProjectMapCustomization.ProjectsForMap(CurrentFirmaSession.CanViewProposals(), CurrentFirmaSession);
            var filteredProjects  = allProjectsForMap.Where(filterFunction.Compile())
                                    .ToList();

            var filteredProjectsWithLocationAreas = filteredProjects.Where(x => !x.HasProjectLocationPoint(false)).ToList();

            // Add projects where locations are private
            filteredProjectsWithLocationAreas.AddRange(ProjectMapCustomization.GetProjectsWithPrivateLocations());

            var taxonomyLevel = MultiTenantHelpers.GetTaxonomyLevel();
            var taxonomyTiersAsFancyTreeNodes = taxonomyLevel
                                                .GetTaxonomyTiers(HttpRequestStorage.DatabaseEntities).OrderBy(x => x.SortOrder)
                                                .ThenBy(x => x.DisplayName, StringComparer.InvariantCultureIgnoreCase)
                                                .Select(x => x.ToFancyTreeNode(CurrentFirmaSession))
                                                .ToList();
            var projectsIDsThatDoNotHaveSimpleLocation = filteredProjectsWithLocationAreas
                                                         .Select(project => project.ProjectID.ToString()).ToList();

            switch (taxonomyLevel.ToEnum)
            {
            case TaxonomyLevelEnum.Leaf:
                PruneProjectsFromTaxonomyLeaves(taxonomyTiersAsFancyTreeNodes, projectsIDsThatDoNotHaveSimpleLocation);
                break;

            case TaxonomyLevelEnum.Branch:
                PruneTaxonomyBranchesWithNoProjects(taxonomyTiersAsFancyTreeNodes, projectsIDsThatDoNotHaveSimpleLocation);
                break;

            case TaxonomyLevelEnum.Trunk:
                foreach (var taxonomyTrunkNode in taxonomyTiersAsFancyTreeNodes)
                {
                    var taxonomyBranchNodes = taxonomyTrunkNode.Children.ToList();
                    PruneTaxonomyBranchesWithNoProjects(taxonomyBranchNodes, projectsIDsThatDoNotHaveSimpleLocation);
                    taxonomyTrunkNode.Children = taxonomyBranchNodes;
                }
                taxonomyTiersAsFancyTreeNodes.RemoveAll(x => !x.Children.Any());
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(new JsonNetJArrayResult(taxonomyTiersAsFancyTreeNodes));
        }
        public ViewResult Detail(ClassificationPrimaryKey classificationPrimaryKey)
        {
            var classification                = classificationPrimaryKey.EntityObject;
            var mapDivID                      = $"classification_{classification.ClassificationID}_Map";
            var associatedProjects            = classification.GetAssociatedProjects(CurrentFirmaSession);
            var currentPersonCanViewProposals = CurrentFirmaSession.CanViewProposals();

            var projectMapCustomization      = ProjectMapCustomization.CreateDefaultCustomization(associatedProjects, currentPersonCanViewProposals);
            var projectLocationsLayerGeoJson = new LayerGeoJson($"{FieldDefinitionEnum.ProjectLocation.ToType().GetFieldDefinitionLabelPluralized()}",
                                                                associatedProjects.MappedPointsToGeoJsonFeatureCollection(false, true, false), "red", 1, LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            var projectLocationsMapInitJson = new ProjectLocationsMapInitJson(projectLocationsLayerGeoJson,
                                                                              projectMapCustomization, mapDivID, false)
            {
                AllowFullScreen = true,
            };

            // Add Organization Type boundaries according to configuration
            projectLocationsMapInitJson.Layers.AddRange(HttpRequestStorage.DatabaseEntities.Organizations.GetConfiguredBoundaryLayersGeoJson().
                                                        Where(x => x.LayerInitialVisibility == LayerInitialVisibility.LayerInitialVisibilityEnum.Show));
            var filteredProjectList = associatedProjects.Where(x1 => x1.HasProjectLocationPointViewableByUser(CurrentFirmaSession)).
                                      Where(x => x.ProjectStage.ShouldShowOnMap()).ToList();

            // filteredProjectList only contains project location points the user has permission to see
            projectLocationsMapInitJson.BoundingBox =
                new BoundingBox(filteredProjectList.Select(x => x.GetProjectLocationPoint(true)).ToList());
            var projectLocationsMapViewData = new ProjectLocationsMapViewData(projectLocationsMapInitJson.MapDivID,
                                                                              ProjectColorByType.ProjectStage.GetDisplayNameFieldDefinition(), MultiTenantHelpers.GetTopLevelTaxonomyTiers(), currentPersonCanViewProposals);

            var projectFundingSourceExpenditures = associatedProjects.SelectMany(x => x.ProjectFundingSourceExpenditures);
            var organizationTypes = HttpRequestStorage.DatabaseEntities.OrganizationTypes.ToList();

            const string chartTitle       = "Reported Expenditures By Organization Type";
            var          chartContainerID = chartTitle.Replace(" ", "");
            var          googleChart      = projectFundingSourceExpenditures.ToGoogleChart(x => x.FundingSource.Organization.OrganizationType.OrganizationTypeName,
                                                                                           organizationTypes.Select(x => x.OrganizationTypeName).ToList(),
                                                                                           x => x.FundingSource.Organization.OrganizationType.OrganizationTypeName,
                                                                                           chartContainerID,
                                                                                           chartTitle,
                                                                                           organizationTypes.ToDictionary(x => x.OrganizationTypeName, x => x.LegendColor));

            var viewGoogleChartViewData = new ViewGoogleChartViewData(googleChart, chartTitle, 405, true);

            var performanceMeasures = associatedProjects
                                      .SelectMany(x => x.PerformanceMeasureActuals)
                                      .Select(x => x.PerformanceMeasure).Distinct(new HavePrimaryKeyComparer <PerformanceMeasure>())
                                      .OrderBy(x => x.PerformanceMeasureDisplayName)
                                      .ToList();

            var projectCustomDefaultGridConfigurations = HttpRequestStorage.DatabaseEntities.ProjectCustomGridConfigurations.Where(x => x.IsEnabled && x.ProjectCustomGridTypeID == ProjectCustomGridType.Default.ProjectCustomGridTypeID).OrderBy(x => x.SortOrder).ToList();
            var viewData = new DetailViewData(CurrentFirmaSession, classification, projectLocationsMapViewData, projectLocationsMapInitJson, viewGoogleChartViewData, performanceMeasures, projectCustomDefaultGridConfigurations);

            return(RazorView <Detail, DetailViewData>(viewData));
        }
        public ViewResult Detail(TaxonomyTrunkPrimaryKey taxonomyTrunkPrimaryKey)
        {
            var taxonomyTrunk         = taxonomyTrunkPrimaryKey.EntityObject;
            var taxonomyTrunkProjects = taxonomyTrunk.GetAssociatedProjects(CurrentFirmaSession).ToList();

            var projectMapCustomization = new ProjectMapCustomization(ProjectLocationFilterType.TaxonomyTrunk,
                                                                      new List <int> {
                taxonomyTrunk.TaxonomyTrunkID
            }, ProjectColorByType.ProjectStage);
            var projectLocationsLayerGeoJson =
                new LayerGeoJson($"{FieldDefinitionEnum.ProjectLocation.ToType().GetFieldDefinitionLabel()}",
                                 taxonomyTrunkProjects.MappedPointsToGeoJsonFeatureCollection(false, true, true), "red", 1,
                                 LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            var projectLocationsMapInitJson = new ProjectLocationsMapInitJson(projectLocationsLayerGeoJson,
                                                                              projectMapCustomization, "TaxonomyTrunkProjectMap", false);

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

            var associatePerformanceMeasureTaxonomyLevel =
                MultiTenantHelpers.GetAssociatePerformanceMeasureTaxonomyLevel();
            var canHaveAssociatedPerformanceMeasures = associatePerformanceMeasureTaxonomyLevel == TaxonomyLevel.Trunk;
            var taxonomyTierPerformanceMeasures      = taxonomyTrunk.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, taxonomyTrunk, projectLocationsMapInitJson,
                                              projectLocationsMapViewData, canHaveAssociatedPerformanceMeasures, relatedPerformanceMeasuresViewData,
                                              performanceMeasureChartViewDatas, taxonomyLevel, projectCustomDefaultGridConfigurations);

            return(RazorView <Detail, DetailViewData>(viewData));
        }
Exemple #4
0
        public ViewResult Index(GeospatialAreaTypePrimaryKey geospatialAreaTypePrimaryKey)
        {
            var geospatialAreaType = geospatialAreaTypePrimaryKey.EntityObject;
            var layerGeoJsons      = new List <LayerGeoJson>
            {
                geospatialAreaType.GetGeospatialAreaWmsLayerGeoJson("#59ACFF", 0.2m, LayerInitialVisibility.LayerInitialVisibilityEnum.Show)
            };
            var currentPersonCanViewProposals = CurrentFirmaSession.CanViewProposals();
            var projectsToShow = ProjectMapCustomization.ProjectsForMap(currentPersonCanViewProposals, CurrentFirmaSession);
            var projectLocationsLayerGeoJson =
                new LayerGeoJson($"Mapped {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}",
                                 projectsToShow.MappedPointsToGeoJsonFeatureCollection(false, true, true), "#80b2ff", 1,
                                 LayerInitialVisibility.LayerInitialVisibilityEnum.Show);

            layerGeoJsons.Add(projectLocationsLayerGeoJson);

            var mapInitJson = new MapInitJson("geospatialAreaIndex", 10, layerGeoJsons, MapInitJson.GetExternalMapLayers(),
                                              BoundingBox.MakeNewDefaultBoundingBox());

            var viewData = new IndexViewData(CurrentFirmaSession, geospatialAreaType, mapInitJson);

            return(RazorView <Index, IndexViewData>(viewData));
        }
        public ViewResult Index()
        {
            var firmaPageByPageTypeHomePage = FirmaPageTypeEnum.HomePage.GetFirmaPage();

            var firmaPageByPageTypeHomePageAdditionalInfo = FirmaPageTypeEnum.HomeAdditionalInfo.GetFirmaPage();

            var firmaPageByPageTypeHomePageMapInfo = FirmaPageTypeEnum.HomeMapInfo.GetFirmaPage();

            var firmaHomePageImages = HttpRequestStorage.DatabaseEntities.FirmaHomePageImages.ToList().OrderBy(x => x.SortOrder).ToList();

            var currentPersonCanViewProposals = CurrentFirmaSession.CanViewProposals();
            var projectsToShow = ProjectMapCustomization.ProjectsForMap(currentPersonCanViewProposals);

            var projectMapCustomization      = ProjectMapCustomization.CreateDefaultCustomization(projectsToShow, currentPersonCanViewProposals);
            var projectLocationsLayerGeoJson = new LayerGeoJson(
                $"{FieldDefinitionEnum.ProjectLocation.ToType().GetFieldDefinitionLabelPluralized()}",
                projectsToShow.MappedPointsToGeoJsonFeatureCollection(false, false, true),
                "red", 1, LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            var projectLocationsMapInitJson = new ProjectLocationsMapInitJson(projectLocationsLayerGeoJson,
                                                                              projectMapCustomization, "ProjectLocationsMap", false)
            {
                AllowFullScreen = false,
                // Add Organization Type boundaries according to configuration
                Layers = HttpRequestStorage.DatabaseEntities.Organizations.GetConfiguredBoundaryLayersGeoJson().
                         Where(x => x.LayerInitialVisibility == LayerInitialVisibility.LayerInitialVisibilityEnum.Show).ToList()
            };
            var projectLocationsMapViewData = new ProjectLocationsMapViewData(
                projectLocationsMapInitJson.MapDivID, ProjectColorByType.ProjectStage.GetDisplayNameFieldDefinition(),
                MultiTenantHelpers.GetTopLevelTaxonomyTiers(), currentPersonCanViewProposals
                );
            var activeFeaturedProjects   = HttpRequestStorage.DatabaseEntities.Projects.Where(x => x.IsFeatured).ToList().GetActiveProjects();
            var featuredProjectsViewData = new FeaturedProjectsViewData(this.CurrentFirmaSession, activeFeaturedProjects);

            var viewData = new IndexViewData(CurrentFirmaSession, firmaPageByPageTypeHomePage, firmaPageByPageTypeHomePageAdditionalInfo, firmaPageByPageTypeHomePageMapInfo, featuredProjectsViewData, projectLocationsMapViewData, projectLocationsMapInitJson, firmaHomePageImages);

            return(RazorView <Index, IndexViewData>(viewData));
        }
Exemple #6
0
        public ViewResult Detail(TaxonomyLeafPrimaryKey taxonomyLeafPrimaryKey)
        {
            var taxonomyLeaf = taxonomyLeafPrimaryKey.EntityObject;
            var currentPersonCanViewProposals = CurrentFirmaSession.CanViewProposals();

            var primaryTaxonomyLeafProjects = taxonomyLeaf.GetProjects().ToList()
                                              .GetActiveProjectsAndProposals(currentPersonCanViewProposals)
                                              .Where(x => x.ProjectStage.ShouldShowOnMap())
                                              .ToList();
            var secondaryTaxonomyLeafProjects = primaryTaxonomyLeafProjects.Union(
                taxonomyLeaf.SecondaryProjectTaxonomyLeafs.Select(x => x.Project)
                .ToList()
                .GetActiveProjectsAndProposals(currentPersonCanViewProposals)
                .Where(x => x.ProjectStage.ShouldShowOnMap()))
                                                .ToList();

            // This page supports two maps for cases where secondary taxonomy leafs are supported
            var primaryProjectMapCustomization = new ProjectMapCustomization(ProjectLocationFilterType.TaxonomyLeaf,
                                                                             new List <int> {
                taxonomyLeaf.TaxonomyLeafID
            }, ProjectColorByType.ProjectStage);
            var secondaryProjectMapCustomization = new ProjectMapCustomization(ProjectLocationFilterType.TaxonomyLeaf,
                                                                               secondaryTaxonomyLeafProjects.Select(x => x.GetTaxonomyLeaf().TaxonomyLeafID).Union(new List <int> {
                taxonomyLeaf.TaxonomyLeafID
            }).ToList(),
                                                                               ProjectColorByType.ProjectStage);
            var primaryProjectLocationsLayerGeoJson =
                new LayerGeoJson($"{FieldDefinitionEnum.ProjectLocation.ToType().GetFieldDefinitionLabel()}",
                                 primaryTaxonomyLeafProjects.MappedPointsToGeoJsonFeatureCollection(false, true, false), "red", 1,
                                 LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            var secondaryProjectLocationsLayerGeoJson =
                new LayerGeoJson($"{FieldDefinitionEnum.ProjectLocation.ToType().GetFieldDefinitionLabel()}",
                                 secondaryTaxonomyLeafProjects.MappedPointsToGeoJsonFeatureCollection(false, true, false), "red", 1,
                                 LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            // Add Organization Type boundaries according to configuration
            var configuredOrganizationBoundariesMapInitJson = HttpRequestStorage.DatabaseEntities.Organizations.GetConfiguredBoundaryLayersGeoJson();

            var primaryProjectLocationsMapInitJson = new ProjectLocationsMapInitJson(primaryProjectLocationsLayerGeoJson,
                                                                                     primaryProjectMapCustomization, "TaxonomyLeafProjectMap", false);

            primaryProjectLocationsMapInitJson.Layers.AddRange(configuredOrganizationBoundariesMapInitJson);

            var secondaryProjectLocationsMapInitJson = new ProjectLocationsMapInitJson(secondaryProjectLocationsLayerGeoJson,
                                                                                       secondaryProjectMapCustomization, "SecondaryTaxonomyLeafProjectMap", false);

            secondaryProjectLocationsMapInitJson.Layers.AddRange(configuredOrganizationBoundariesMapInitJson);

            var primaryProjectLocationsMapViewData = new ProjectLocationsMapViewData(primaryProjectLocationsMapInitJson.MapDivID,
                                                                                     ProjectColorByType.ProjectStage.GetDisplayNameFieldDefinition(), MultiTenantHelpers.GetTopLevelTaxonomyTiers(),
                                                                                     CurrentFirmaSession.CanViewProposals());
            var secondaryProjectLocationsMapViewData = new ProjectLocationsMapViewData(secondaryProjectLocationsMapInitJson.MapDivID,
                                                                                       ProjectColorByType.ProjectStage.GetDisplayNameFieldDefinition(), MultiTenantHelpers.GetTopLevelTaxonomyTiers(),
                                                                                       CurrentFirmaSession.CanViewProposals());

            var associatePerformanceMeasureTaxonomyLevel =
                MultiTenantHelpers.GetAssociatePerformanceMeasureTaxonomyLevel();
            var canHaveAssociatedPerformanceMeasures = associatePerformanceMeasureTaxonomyLevel == TaxonomyLevel.Leaf;
            var taxonomyTierPerformanceMeasures      = taxonomyLeaf.GetTaxonomyTierPerformanceMeasures();
            var relatedPerformanceMeasuresViewData   = new RelatedPerformanceMeasuresViewData(
                associatePerformanceMeasureTaxonomyLevel, true, taxonomyTierPerformanceMeasures,
                canHaveAssociatedPerformanceMeasures);

            var taxonomyLevel   = MultiTenantHelpers.GetTaxonomyLevel();
            var tenantAttribute = MultiTenantHelpers.GetTenantAttributeFromCache();

            var performanceMeasures = taxonomyLeaf.TaxonomyLeafPerformanceMeasures.Select(x => x.PerformanceMeasure)
                                      .ToList();
            var primaryPerformanceMeasureChartViewDataByPerformanceMeasure = performanceMeasures.ToDictionary(
                x => x.PerformanceMeasureID,
                x => new PerformanceMeasureChartViewData(x, CurrentFirmaSession, false, primaryTaxonomyLeafProjects, $"primary{x.GetJavascriptSafeChartUniqueName()}"));
            var secondaryPerformanceMeasureChartViewDataByPerformanceMeasure = performanceMeasures.ToDictionary(
                x => x.PerformanceMeasureID,
                x => new PerformanceMeasureChartViewData(x, CurrentFirmaSession, false, secondaryTaxonomyLeafProjects, $"secondary{x.GetJavascriptSafeChartUniqueName()}"));

            var projectCustomDefaultGridConfigurations = HttpRequestStorage.DatabaseEntities.ProjectCustomGridConfigurations.Where(x => x.IsEnabled && x.ProjectCustomGridTypeID == ProjectCustomGridType.Default.ProjectCustomGridTypeID).OrderBy(x => x.SortOrder).ToList();

            var viewData = new DetailViewData(CurrentFirmaSession, taxonomyLeaf, primaryProjectLocationsMapInitJson,
                                              secondaryProjectLocationsMapInitJson, primaryProjectLocationsMapViewData,
                                              secondaryProjectLocationsMapViewData, canHaveAssociatedPerformanceMeasures,
                                              relatedPerformanceMeasuresViewData, taxonomyLevel, tenantAttribute, performanceMeasures,
                                              primaryPerformanceMeasureChartViewDataByPerformanceMeasure,
                                              secondaryPerformanceMeasureChartViewDataByPerformanceMeasure,
                                              projectCustomDefaultGridConfigurations);

            return(RazorView <Summary, DetailViewData>(viewData));
        }
Exemple #7
0
        public ViewResult ProjectMap()
        {
            List <int> filterValues;
            ProjectLocationFilterType projectLocationFilterType;
            ProjectColorByType        colorByValue;

            var currentPersonCanViewProposals = CurrentFirmaSession.CanViewProposals();

            if (!String.IsNullOrEmpty(Request.QueryString[ProjectMapCustomization.FilterByQueryStringParameter]))
            {
                projectLocationFilterType = ProjectLocationFilterType.ToType(Request
                                                                             .QueryString[ProjectMapCustomization.FilterByQueryStringParameter]
                                                                             .ParseAsEnum <ProjectLocationFilterTypeEnum>());
            }
            else
            {
                projectLocationFilterType = ProjectMapCustomization.DefaultLocationFilterType;
            }

            if (!String.IsNullOrEmpty(Request.QueryString[ProjectMapCustomization.FilterValuesQueryStringParameter]))
            {
                var filterValuesAsString = Request.QueryString[ProjectMapCustomization.FilterValuesQueryStringParameter]
                                           .Split(',');
                filterValues = filterValuesAsString.Select(Int32.Parse).ToList();
            }
            else
            {
                filterValues = GetDefaultFilterValuesForFilterType(projectLocationFilterType.ToEnum, currentPersonCanViewProposals);
            }

            if (!String.IsNullOrEmpty(Request.QueryString[ProjectMapCustomization.ColorByQueryStringParameter]))
            {
                colorByValue = ProjectColorByType.ToType(Request
                                                         .QueryString[ProjectMapCustomization.ColorByQueryStringParameter]
                                                         .ParseAsEnum <ProjectColorByTypeEnum>());
            }
            else
            {
                colorByValue = ProjectMapCustomization.DefaultColorByType;
            }

            var firmaPage = FirmaPageTypeEnum.ProjectMap.GetFirmaPage();

            var projectsToShow = ProjectMapCustomization.ProjectsForMap(currentPersonCanViewProposals, CurrentFirmaSession);

            var initialCustomization =
                new ProjectMapCustomization(projectLocationFilterType, filterValues, colorByValue);
            var projectLocationsLayerGeoJson =
                new LayerGeoJson($"{FieldDefinitionEnum.ProjectLocation.ToType().GetFieldDefinitionLabel()}",
                                 projectsToShow.MappedPointsToGeoJsonFeatureCollection(false, true, true), "red", 1,
                                 LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            var projectLocationsMapInitJson = new ProjectLocationsMapInitJson(projectLocationsLayerGeoJson,
                                                                              initialCustomization, "ProjectLocationsMap", true);

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

            var projectLocationsMapViewData = new ProjectLocationsMapViewData(projectLocationsMapInitJson.MapDivID, null, MultiTenantHelpers.GetTopLevelTaxonomyTiers(), currentPersonCanViewProposals, true);


            var projectLocationFilterTypesAndValues = CreateProjectLocationFilterTypesAndValuesDictionary(currentPersonCanViewProposals);
            var projectLocationsUrl = SitkaRoute <ResultsController> .BuildAbsoluteUrlHttpsFromExpression(x => x.ProjectMap());

            var filteredProjectsWithLocationAreasUrl =
                SitkaRoute <ResultsController> .BuildUrlFromExpression(x => x.FilteredProjectsWithLocationAreas(null));

            var projectColorByTypes = new List <ProjectColorByType> {
                ProjectColorByType.ProjectStage
            };

            if (MultiTenantHelpers.IsTaxonomyLevelTrunk())
            {
                projectColorByTypes.Add(ProjectColorByType.TaxonomyTrunk);
            }
            else if (MultiTenantHelpers.IsTaxonomyLevelBranch())
            {
                projectColorByTypes.Add(ProjectColorByType.TaxonomyBranch);
            }
            var viewData = new ProjectMapViewData(CurrentFirmaSession,
                                                  firmaPage,
                                                  projectLocationsMapInitJson,
                                                  projectLocationsMapViewData,
                                                  projectLocationFilterTypesAndValues,
                                                  projectLocationsUrl, filteredProjectsWithLocationAreasUrl, projectColorByTypes, ProjectColorByType.ProjectStage.GetDisplayNameFieldDefinition());

            return(RazorView <ProjectMap, ProjectMapViewData>(viewData));
        }
Exemple #8
0
        public GridJsonNetJObjectResult <GeospatialAreaIndexGridSimple> IndexGridJsonData(GeospatialAreaTypePrimaryKey geospatialAreaTypePrimaryKey)
        {
            var geospatialAreaType             = geospatialAreaTypePrimaryKey.EntityObject;
            var gridSpec                       = new IndexGridSpec(CurrentFirmaSession, geospatialAreaType);
            var projectIDsViewableByUser       = HttpRequestStorage.DatabaseEntities.Projects.ToList().GetActiveProjectsAndProposals(CurrentFirmaSession.CanViewProposals(), CurrentFirmaSession).Select(x => x.ProjectID).ToList();
            var geospatialAreaIndexGridSimples = GeospatialAreaModelExtensions.GetGeospatialAreaIndexGridSimples(geospatialAreaType, projectIDsViewableByUser).OrderByDescending(x => x.ProjectViewableByUserCount).ToList();
            var gridJsonNetJObjectResult       = new GridJsonNetJObjectResult <GeospatialAreaIndexGridSimple>(geospatialAreaIndexGridSimples, gridSpec);

            return(gridJsonNetJObjectResult);
        }
        public ExcelResult IndexExcelDownload()
        {
            var projects = HttpRequestStorage.DatabaseEntities.Projects.ToList().GetActiveProjectsAndProposals(CurrentFirmaSession.CanViewProposals(), CurrentFirmaSession);

            var projectsSpec = new ProjectAssessmentExcelSpec();
            var wsProjects   = ExcelWorkbookSheetDescriptorFactory.MakeWorksheet("Projects", projectsSpec, projects);

            var questionsSpec = new QuestionsExcelSpec();
            var wsQuestions   = ExcelWorkbookSheetDescriptorFactory.MakeWorksheet("Questions", questionsSpec, HttpRequestStorage.DatabaseEntities.AssessmentQuestions.ToList());

            var workSheets = new List <IExcelWorkbookSheetDescriptor>
            {
                wsProjects,
                wsQuestions
            };

            var wbm           = new ExcelWorkbookMaker(workSheets);
            var excelWorkbook = wbm.ToXLWorkbook();

            return(new ExcelResult(excelWorkbook, $" Assessment as of {DateTime.Now.ToStringDateTime()}"));
        }