예제 #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));
        }
예제 #2
0
        public ViewResult Index()
        {
            var firmaPageTypeHomePage       = FirmaPageType.ToType(FirmaPageTypeEnum.HomePage);
            var firmaPageByPageTypeHomePage = FirmaPage.GetFirmaPageByPageType(firmaPageTypeHomePage);

            var firmaPageTypeHomePageAdditionalInfo       = FirmaPageType.ToType(FirmaPageTypeEnum.HomeAdditionalInfo);
            var firmaPageByPageTypeHomePageAdditionalInfo = FirmaPage.GetFirmaPageByPageType(firmaPageTypeHomePageAdditionalInfo);

            var firmaPageTypeHomePageMapInfo       = FirmaPageType.ToType(FirmaPageTypeEnum.HomeMapInfo);
            var firmaPageByPageTypeHomePageMapInfo = FirmaPage.GetFirmaPageByPageType(firmaPageTypeHomePageMapInfo);

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

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

            var projectMapCustomization      = ProjectMapCustomization.CreateDefaultCustomization(projectsToShow, currentPersonCanViewProposals);
            var projectLocationsLayerGeoJson = new LayerGeoJson($"{FieldDefinition.ProjectLocation.GetFieldDefinitionLabelPluralized()}", Project.MappedPointsToGeoJsonFeatureCollection(projectsToShow, false, true), "red", 1, LayerInitialVisibility.Show);
            var projectLocationsMapInitJson  = new ProjectLocationsMapInitJson(projectLocationsLayerGeoJson,
                                                                               projectMapCustomization, "ProjectLocationsMap")
            {
                AllowFullScreen = false,
                Layers          = HttpRequestStorage.DatabaseEntities.Organizations.GetBoundaryLayerGeoJson().Where(x => x.LayerInitialVisibility == LayerInitialVisibility.Show).ToList()
            };
            var projectLocationsMapViewData = new ProjectLocationsMapViewData(projectLocationsMapInitJson.MapDivID, ProjectColorByType.ProjectStage.DisplayName, MultiTenantHelpers.GetTopLevelTaxonomyTiers(), currentPersonCanViewProposals);

            var featuredProjectsViewData = new FeaturedProjectsViewData(HttpRequestStorage.DatabaseEntities.Projects.Where(x => x.IsFeatured).ToList().GetActiveProjectsVisibleToUser(CurrentPerson));

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

            return(RazorView <Index, IndexViewData>(viewData));
        }
예제 #3
0
        public ViewResult Organization(OrganizationPrimaryKey organizationPrimaryKey)
        {
            var organization = organizationPrimaryKey.EntityObject;

            var organizationHasOptedIn = organization.MatchmakerOptIn ?? false;

            var projectFinderGridSpec = new ProjectFinderGridSpec(CurrentFirmaSession);
            var projectMatchmakerScoresForOrganization = organizationHasOptedIn ? new ProjectOrganizationMatchmaker().GetPartnerOrganizationMatchMakerScoresForParticularOrganization(CurrentFirmaSession, organization) : new List <PartnerOrganizationMatchMakerScore>();
            var projectsToShow = projectMatchmakerScoresForOrganization.Select(x => x.Project).Where(x => x.ProjectStage.ShouldIncludeInMatchmaker()).ToList();


            var filterValues = ResultsController.GetDefaultFilterValuesForFilterType(ProjectMapCustomization.DefaultLocationFilterType.ToEnum, true);

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

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

            var profileCompletionDictionary = organization.GetMatchmakerOrganizationProfileCompletionDictionary();

            DisplayMatchMakerToastMessagesIfAny(organization, projectMatchmakerScoresForOrganization, profileCompletionDictionary, organizationHasOptedIn);

            var matchMakerAreaOfInterestGeoJson = GetMatchMakerAreaOfInterestGeoJson(organization);

            var viewData = new ProjectFinderOrganizationViewData(CurrentFirmaSession, organization, projectMatchmakerScoresForOrganization, projectFinderGridSpec, projectLocationsMapInitJson, matchMakerAreaOfInterestGeoJson);

            return(RazorView <ProjectFinderOrganization, ProjectFinderOrganizationViewData>(viewData));
        }
예제 #4
0
        public DetailViewData(FirmaSession currentFirmaSession,
                              ProjectFirmaModels.Models.Classification classification,
                              ProjectLocationsMapViewData projectLocationsMapViewData,
                              ProjectLocationsMapInitJson projectLocationsMapInitJson, ViewGoogleChartViewData viewGoogleChartViewData,
                              List <ProjectFirmaModels.Models.PerformanceMeasure> performanceMeasures,
                              List <ProjectCustomGridConfiguration> projectCustomDefaultGridConfigurations)
            : base(currentFirmaSession)
        {
            Classification = classification;
            ProjectLocationsMapViewData = projectLocationsMapViewData;
            ProjectLocationsMapInitJson = projectLocationsMapInitJson;
            ViewGoogleChartViewData     = viewGoogleChartViewData;
            PageTitle             = ClassificationSystemModelExtensions.GetClassificationSystemNamePluralized(classification.ClassificationSystem);
            EditClassificationUrl = SitkaRoute <ClassificationController> .BuildUrlFromExpression(c => c.Edit(classification));

            IndexUrl = SitkaRoute <ProgramInfoController> .BuildUrlFromExpression(c => c.ClassificationSystem(classification.ClassificationSystem));

            UserHasClassificationManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession);
            ClassificationDisplayNamePluralized    = ClassificationSystemModelExtensions.GetClassificationSystemNamePluralized(classification.ClassificationSystem);
            ClassificationDisplayName = classification.ClassificationSystem.ClassificationSystemName;
            var projectDetails = HttpRequestStorage.DatabaseEntities.vProjectDetails.ToDictionary(x => x.ProjectID);

            ProjectCustomDefaultGridSpec = new ProjectCustomGridSpec(currentFirmaSession, projectCustomDefaultGridConfigurations, ProjectCustomGridType.Default.ToEnum, projectDetails, currentFirmaSession.Tenant)
            {
                ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true
            };

            ProjectCustomDefaultGridName    = "classificationProjectListGrid";
            ProjectCustomDefaultGridDataUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.ClassificationProjectsGridJsonData(classification));

            PerformanceMeasureChartViewDatas = performanceMeasures.Select(x => classification.GetPerformanceMeasureChartViewData(x, CurrentFirmaSession)).ToList();
        }
예제 #5
0
        public IndexViewData(FirmaSession firmaSession, ProjectFirmaModels.Models.FirmaPage firmaPageHomePage, ProjectFirmaModels.Models.FirmaPage firmaPageAdditionalInfo, ProjectFirmaModels.Models.FirmaPage firmaPageMapInfo,
                             FeaturedProjectsViewData featuredProjectsViewData, ProjectLocationsMapViewData projectLocationsMapViewData, ProjectLocationsMapInitJson projectLocationsMapInitJson,
                             List <ProjectFirmaModels.Models.FirmaHomePageImage> firmaHomePageImages) : base(firmaSession, firmaPageHomePage)
        {
            PageTitle = MultiTenantHelpers.GetToolDisplayName();

            Check.EnsureNotNull(firmaPageHomePage, "firmaPageHomePage not found; is one defined?");
            bool hasPermissionToManageHomePage = new FirmaPageManageFeature().HasPermission(firmaSession, firmaPageHomePage).HasPermission;

            Check.EnsureNotNull(firmaPageAdditionalInfo, "firmaPageAdditionalInfo not found; is one defined?");
            bool hasPermissionToManageAdditionalInfo = new FirmaPageManageFeature().HasPermission(firmaSession, firmaPageAdditionalInfo).HasPermission;

            Check.EnsureNotNull(firmaPageMapInfo, "firmaPageMapInfo not found; is one defined?");
            bool hasPermissionToManagePageMapInfo = new FirmaPageManageFeature().HasPermission(firmaSession, firmaPageMapInfo).HasPermission;

            CustomHomePageTextViewData = new ViewPageContentViewData(firmaPageHomePage, hasPermissionToManageHomePage);
            CustomHomePageAdditionalInfoTextViewData = new ViewPageContentViewData(firmaPageAdditionalInfo, hasPermissionToManageAdditionalInfo);
            CustomHomePageMapTextViewData            = new ViewPageContentViewData(firmaPageMapInfo, hasPermissionToManagePageMapInfo);
            FeaturedProjectsViewData = featuredProjectsViewData;
            FullMapUrl = SitkaRoute <ResultsController> .BuildUrlFromExpression(x => x.ProjectMap());

            ProjectLocationsMapViewData = projectLocationsMapViewData;
            ProjectLocationsMapInitJson = projectLocationsMapInitJson;
            FirmaHomePageCarouselImages = firmaHomePageImages;
            ProposeNewProjectUrl        = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.InstructionsProposal(null));

            ProjectUpdatesUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.MyProjectsRequiringAnUpdate());

            DisplayActionButtons = !firmaSession.IsAnonymousOrUnassigned();
        }
예제 #6
0
 public ProjectMapViewData(Person currentPerson, Models.FirmaPage firmaPage, ProjectLocationsMapInitJson projectLocationsMapInitJson, ProjectLocationsMapViewData projectLocationsMapViewData, Dictionary <ProjectLocationFilterTypeSimple, IEnumerable <SelectListItem> > projectLocationFilterTypesAndValues, string projectLocationsUrl, string filteredProjectsWithLocationAreasUrl, List <ProjectMapLocationJson> projectMapLocationJsons) : base(currentPerson, firmaPage)
 {
     PageTitle = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} Map";
     ProjectLocationsMapInitJson         = projectLocationsMapInitJson;
     ProjectLocationFilterTypesAndValues = projectLocationFilterTypesAndValues;
     ProjectLocationsMapViewData         = projectLocationsMapViewData;
     ProjectLocationsUrl = projectLocationsUrl;
     FilteredProjectsWithLocationAreasUrl = filteredProjectsWithLocationAreasUrl;
     ProjectMapViewDataForAngular         = new ProjectMapViewDataForAngular(projectLocationsMapInitJson, projectLocationsMapInitJson.ProjectLocationsLayerGeoJson, projectMapLocationJsons);
 }
 public ProjectMapViewData(Person currentPerson, Models.FirmaPage firmaPage, ProjectLocationsMapInitJson projectLocationsMapInitJson, ProjectLocationsMapViewData projectLocationsMapViewData, Dictionary <ProjectLocationFilterTypeSimple, IEnumerable <SelectListItem> > projectLocationFilterTypesAndValues, string projectLocationsUrl, string filteredProjectsWithLocationAreasUrl, List <ProjectMapLocationJson> projectMapLocationJsons) : base(currentPerson, firmaPage)
 {
     PageTitle = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} Map";
     ProjectLocationsMapInitJson         = projectLocationsMapInitJson;
     ProjectLocationFilterTypesAndValues = projectLocationFilterTypesAndValues;
     ProjectLocationsMapViewData         = projectLocationsMapViewData;
     ProjectLocationsUrl = projectLocationsUrl;
     FilteredProjectsWithLocationAreasUrl = filteredProjectsWithLocationAreasUrl;
     ProjectMapViewDataForAngular         = new ProjectMapViewDataForAngular(projectLocationsMapInitJson, projectLocationsMapInitJson.ProjectLocationsLayerGeoJson, projectMapLocationJsons);
     GeocodeAddressUrl = SitkaRoute <ResultsController> .BuildAbsoluteUrlHttpsFromExpression(x => x.GeocodeAddress(null, null));;
 }
        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));
        }
예제 #9
0
        public DetailViewData(FirmaSession currentFirmaSession,
                              ProjectFirmaModels.Models.TaxonomyTrunk taxonomyTrunk,
                              ProjectLocationsMapInitJson projectLocationsMapInitJson,
                              ProjectLocationsMapViewData projectLocationsMapViewData, bool canHaveAssociatedPerformanceMeasures,
                              RelatedPerformanceMeasuresViewData relatedPerformanceMeasuresViewData,
                              List <PerformanceMeasureChartViewData> performanceMeasureChartViewDatas, TaxonomyLevel taxonomyLevel,
                              List <ProjectCustomGridConfiguration> projectCustomDefaultGridConfigurations) : base(currentFirmaSession)
        {
            TaxonomyTrunk                       = taxonomyTrunk;
            TaxonomyTrunkDisplayName            = FieldDefinitionEnum.TaxonomyTrunk.ToType().GetFieldDefinitionLabel();
            TaxonomyTrunkDisplayNamePluralized  = FieldDefinitionEnum.TaxonomyTrunk.ToType().GetFieldDefinitionLabelPluralized();
            TaxonomyBranchDisplayNamePluralized = FieldDefinitionEnum.TaxonomyBranch.ToType().GetFieldDefinitionLabelPluralized();
            TaxonomyLeafDisplayNamePluralized   = FieldDefinitionEnum.TaxonomyLeaf.ToType().GetFieldDefinitionLabelPluralized();

            ProjectLocationsMapInitJson = projectLocationsMapInitJson;
            ProjectLocationsMapViewData = projectLocationsMapViewData;

            ProjectMapFilteredUrl = ProjectLocationsMapInitJson.ProjectMapCustomization.GetCustomizedUrl();

            PageTitle  = taxonomyTrunk.GetDisplayName();
            EntityName = TaxonomyTrunkDisplayName;
            IndexUrl   = SitkaRoute <ProgramInfoController> .BuildUrlFromExpression(c => c.Taxonomy());

            UserHasTaxonomyTrunkManagePermissions = new TaxonomyTrunkManageFeature().HasPermissionByFirmaSession(CurrentFirmaSession);
            UserHasProjectTaxonomyTrunkExpenditureManagePermissions = new TaxonomyTrunkManageFeature().HasPermissionByFirmaSession(CurrentFirmaSession);
            EditTaxonomyTrunkUrl = SitkaRoute <TaxonomyTrunkController> .BuildUrlFromExpression(c => c.Edit(taxonomyTrunk.TaxonomyTrunkID));

            TaxonomyBranchIndexUrl = SitkaRoute <TaxonomyBranchController> .BuildUrlFromExpression(c => c.Index());

            var projectDetails = HttpRequestStorage.DatabaseEntities.vProjectDetails.ToDictionary(x => x.ProjectID);

            ProjectCustomDefaultGridSpec = new ProjectCustomGridSpec(currentFirmaSession, projectCustomDefaultGridConfigurations, ProjectCustomGridType.Default.ToEnum, projectDetails, currentFirmaSession.Tenant)
            {
                ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true
            };

            ProjectCustomDefaultGridName    = "taxonomyTrunkProjectListGrid";
            ProjectCustomDefaultGridDataUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.TaxonomyTrunkProjectsGridJsonData(taxonomyTrunk));

            ProjectTaxonomyViewData = new ProjectTaxonomyViewData(taxonomyTrunk, taxonomyLevel);

            CanHaveAssociatedPerformanceMeasures = canHaveAssociatedPerformanceMeasures;
            PerformanceMeasureChartViewDatas     = performanceMeasureChartViewDatas;
            RelatedPerformanceMeasuresViewData   = relatedPerformanceMeasuresViewData;

            EditChildrenSortOrderUrl = SitkaRoute <TaxonomyTrunkController> .BuildUrlFromExpression(x => x.EditChildrenSortOrder(taxonomyTrunk));
        }
예제 #10
0
        public DetailViewData(Person currentPerson,
                              Models.TaxonomyTrunk taxonomyTrunk,
                              ProjectLocationsMapInitJson projectLocationsMapInitJson,
                              ProjectLocationsMapViewData projectLocationsMapViewData, bool canHaveAssociatedPerformanceMeasures,
                              RelatedPerformanceMeasuresViewData relatedPerformanceMeasuresViewData,
                              List <PerformanceMeasureChartViewData> performanceMeasureChartViewDatas, TaxonomyLevel taxonomyLevel) : base(currentPerson)
        {
            TaxonomyTrunk                       = taxonomyTrunk;
            TaxonomyTrunkDisplayName            = Models.FieldDefinition.TaxonomyTrunk.GetFieldDefinitionLabel();
            TaxonomyTrunkDisplayNamePluralized  = Models.FieldDefinition.TaxonomyTrunk.GetFieldDefinitionLabelPluralized();
            TaxonomyBranchDisplayNamePluralized = Models.FieldDefinition.TaxonomyBranch.GetFieldDefinitionLabelPluralized();
            ProjectTypeDisplayNamePluralized    = Models.FieldDefinition.ProjectType.GetFieldDefinitionLabelPluralized();

            ProjectLocationsMapInitJson = projectLocationsMapInitJson;
            ProjectLocationsMapViewData = projectLocationsMapViewData;

            ProjectMapFilteredUrl = ProjectLocationsMapInitJson.ProjectMapCustomization.GetCustomizedUrl();

            PageTitle  = taxonomyTrunk.DisplayName;
            EntityName = TaxonomyTrunkDisplayName;
            IndexUrl   = SitkaRoute <ProgramInfoController> .BuildUrlFromExpression(c => c.Taxonomy());

            UserHasTaxonomyTrunkManagePermissions = new TaxonomyTrunkManageFeature().HasPermissionByPerson(CurrentPerson);
            UserHasProjectTaxonomyTrunkExpenditureManagePermissions = new TaxonomyTrunkManageFeature().HasPermissionByPerson(currentPerson);
            EditTaxonomyTrunkUrl = SitkaRoute <TaxonomyTrunkController> .BuildUrlFromExpression(c => c.Edit(taxonomyTrunk.TaxonomyTrunkID));

            TaxonomyBranchIndexUrl = SitkaRoute <TaxonomyBranchController> .BuildUrlFromExpression(c => c.Index());

            BasicProjectInfoGridName = "taxonomyTrunkProjectListGrid";
            BasicProjectInfoGridSpec = new BasicProjectInfoGridSpec(CurrentPerson, true)
            {
                ObjectNameSingular  = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} with this {TaxonomyTrunkDisplayName}",
                ObjectNamePlural    = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()} with this {TaxonomyTrunkDisplayName}",
                SaveFiltersInCookie = true
            };

            BasicProjectInfoGridDataUrl = SitkaRoute <TaxonomyTrunkController> .BuildUrlFromExpression(tc => tc.ProjectsGridJsonData(taxonomyTrunk));

            ProjectTaxonomyViewData = new ProjectTaxonomyViewData(taxonomyTrunk, taxonomyLevel);

            CanHaveAssociatedPerformanceMeasures = canHaveAssociatedPerformanceMeasures;
            PerformanceMeasureChartViewDatas     = performanceMeasureChartViewDatas;
            RelatedPerformanceMeasuresViewData   = relatedPerformanceMeasuresViewData;

            EditChildrenSortOrderUrl = SitkaRoute <TaxonomyTrunkController> .BuildUrlFromExpression(x => x.EditChildrenSortOrder(taxonomyTrunk));
        }
예제 #11
0
 public ProjectMapViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage,
                           ProjectLocationsMapInitJson projectLocationsMapInitJson,
                           ProjectLocationsMapViewData projectLocationsMapViewData,
                           Dictionary <ProjectLocationFilterTypeSimple, IEnumerable <SelectListItem> >
                           projectLocationFilterTypesAndValues, string projectLocationsUrl,
                           string filteredProjectsWithLocationAreasUrl, List <ProjectColorByType> projectColorByTypes,
                           ProjectFirmaModels.Models.FieldDefinition fieldDefinitionForInitialColorByType) : base(currentFirmaSession, firmaPage)
 {
     PageTitle = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Map";
     ProjectLocationsMapInitJson         = projectLocationsMapInitJson;
     ProjectLocationFilterTypesAndValues = projectLocationFilterTypesAndValues;
     ProjectLocationsMapViewData         = projectLocationsMapViewData;
     ProjectLocationsUrl = projectLocationsUrl;
     FilteredProjectsWithLocationAreasUrl = filteredProjectsWithLocationAreasUrl;
     ProjectColorByTypes = projectColorByTypes;
     FieldDefinitionForInitialColorByType = fieldDefinitionForInitialColorByType;
 }
예제 #12
0
        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));
        }
예제 #13
0
        public DetailViewData(Person currentPerson,
                              Models.ProjectType projectType,
                              ProjectLocationsMapInitJson projectLocationsMapInitJson,
                              ProjectLocationsMapViewData projectLocationsMapViewData, bool canHaveAssociatedPerformanceMeasures,
                              RelatedPerformanceMeasuresViewData relatedPerformanceMeasuresViewData,
                              List <PerformanceMeasureChartViewData> performanceMeasureChartViewDatas, TaxonomyLevel taxonomyLevel) : base(currentPerson)
        {
            ProjectType = projectType;
            PageTitle   = projectType.DisplayName;
            var fieldDefinitionProjectType = Models.FieldDefinition.ProjectType;
            var projectTypeDisplayName     = fieldDefinitionProjectType.GetFieldDefinitionLabel();

            EntityName = projectTypeDisplayName;

            ProjectLocationsMapInitJson = projectLocationsMapInitJson;
            ProjectLocationsMapViewData = projectLocationsMapViewData;
            ProjectMapFilteredUrl       = ProjectLocationsMapInitJson.ProjectMapCustomization.GetCustomizedUrl();

            UserHasProjectTypeManagePermissions = new ProjectTypeManageFeature().HasPermissionByPerson(CurrentPerson);
            EditProjectTypeUrl = SitkaRoute <ProjectTypeController> .BuildUrlFromExpression(c => c.Edit(projectType));

            IndexUrl = SitkaRoute <ProgramInfoController> .BuildUrlFromExpression(x => x.Taxonomy());

            BasicProjectInfoGridName = "projectTypeProjectListGrid";
            BasicProjectInfoGridSpec = new BasicProjectInfoGridSpec(CurrentPerson, true)
            {
                ObjectNameSingular  = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} with this {projectTypeDisplayName}",
                ObjectNamePlural    = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()} with this {projectTypeDisplayName}",
                SaveFiltersInCookie = true
            };

            BasicProjectInfoGridDataUrl = SitkaRoute <ProjectTypeController> .BuildUrlFromExpression(tc => tc.ProjectsGridJsonData(projectType));

            ProjectTaxonomyViewData = new ProjectTaxonomyViewData(projectType, taxonomyLevel);

            ProjectTypeDisplayName           = projectTypeDisplayName;
            ProjectTypeDisplayNamePluralized = fieldDefinitionProjectType.GetFieldDefinitionLabelPluralized();

            CanHaveAssociatedPerformanceMeasures = canHaveAssociatedPerformanceMeasures;
            PerformanceMeasureChartViewDatas     = performanceMeasureChartViewDatas;
            RelatedPerformanceMeasuresViewData   = relatedPerformanceMeasuresViewData;
        }
        public ProjectFinderOrganizationViewData(FirmaSession currentFirmaSession,
                                                 ProjectFirmaModels.Models.Organization organization,
                                                 List <PartnerOrganizationMatchMakerScore> projectMatchmakerScoresForOrganization,
                                                 ProjectFinderGridSpec projectFinderGridSpec, ProjectLocationsMapInitJson projectLocationsMapInitJson,
                                                 LayerGeoJson matchMakerAreaOfInterestGeoJson) : base(currentFirmaSession)
        {
            ContainerFluid           = true;
            PageTitle                = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Finder";
            PageSubTitle             = $"({organization.OrganizationName})";
            ProjectFinderGridSpec    = projectFinderGridSpec;
            ProjectFinderGridName    = "projectFinderGrid";
            ProjectFinderGridDataUrl = SitkaRoute <ProjectFinderController> .BuildUrlFromExpression(tc => tc.ProjectFinderGridFullJsonData(organization.OrganizationID));

            Organization = organization;


            LegendFormats = ProjectMapLegendElement.BuildLegendFormatDictionary(MultiTenantHelpers.GetTopLevelTaxonomyTiers(), true);
            ProjectLocationsMapInitJson     = projectLocationsMapInitJson;
            MatchMakerAreaOfInterestGeoJson = matchMakerAreaOfInterestGeoJson;
        }
예제 #15
0
        public IndexViewData(Person currentPerson, Models.FirmaPage firmaPageHomePage, Models.FirmaPage firmaPageAdditionalInfo, Models.FirmaPage firmaPageMapInfo,
                             FeaturedProjectsViewData featuredProjectsViewData, ProjectLocationsMapViewData projectLocationsMapViewData, ProjectLocationsMapInitJson projectLocationsMapInitJson,
                             List <Models.FirmaHomePageImage> firmaHomePageImages) : base(currentPerson, firmaPageHomePage)
        {
            PageTitle = MultiTenantHelpers.GetToolDisplayName();

            CustomHomePageTextViewData = new ViewPageContentViewData(firmaPageHomePage, new FirmaPageManageFeature().HasPermission(currentPerson, firmaPageHomePage).HasPermission);
            CustomHomePageAdditionalInfoTextViewData = new ViewPageContentViewData(firmaPageAdditionalInfo, new FirmaPageManageFeature().HasPermission(currentPerson, firmaPageAdditionalInfo).HasPermission);
            CustomHomePageMapTextViewData            = new ViewPageContentViewData(firmaPageMapInfo, new FirmaPageManageFeature().HasPermission(currentPerson, firmaPageMapInfo).HasPermission);
            FeaturedProjectsViewData = featuredProjectsViewData;
            FullMapUrl = SitkaRoute <ResultsController> .BuildUrlFromExpression(x => x.ProjectMap());

            ProjectLocationsMapViewData = projectLocationsMapViewData;
            ProjectLocationsMapInitJson = projectLocationsMapInitJson;
            FirmaHomePageCarouselImages = firmaHomePageImages;
            ProposeNewProjectUrl        = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.InstructionsProposal(null));

            ProjectUpdatesUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.MyProjectsRequiringAnUpdate());

            DisplayActionButtons = !currentPerson.IsAnonymousOrUnassigned;
        }
예제 #16
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));
        }
예제 #17
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));
        }
예제 #18
0
        public ViewResult ProjectMap()
        {
            List <int> filterValues;
            ProjectLocationFilterType projectLocationFilterType;
            ProjectColorByType        colorByValue;

            var currentPersonCanViewProposals = CurrentPerson.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 = ProjectMapCustomization.GetDefaultLocationFilterValues(currentPersonCanViewProposals);
            }

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

            var firmaPage = FirmaPage.GetFirmaPageByPageType(FirmaPageType.ProjectMap);

            var projectsToShow = ProjectMapCustomization.ProjectsForMap(CurrentPerson);

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

            projectLocationsMapInitJson.Layers.AddRange(HttpRequestStorage.DatabaseEntities.Organizations.GetBoundaryLayerGeoJson());

            var interactionEventLayer = HttpRequestStorage.DatabaseEntities.InteractionEvents.GetInteractionEventsLayerGeoJson();

            projectLocationsMapInitJson.Layers.Add(interactionEventLayer);
            projectLocationsMapInitJson.Layers.Add(MapInitJson.GetWashingtonCountyLayer());
            projectLocationsMapInitJson.Layers.Add(MapInitJson.GetWashingtonLegislativeDistrictLayer());


            var projectLocationsMapViewData = new ProjectLocationsMapViewData(projectLocationsMapInitJson.MapDivID,
                                                                              colorByValue.DisplayName,
                                                                              MultiTenantHelpers.GetTopLevelTaxonomyTiers(),
                                                                              currentPersonCanViewProposals);


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

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

            var projectMapLocationJsons = new List <ProjectMapLocationJson>();
            var filteredProjectList     = projectsToShow.Where(x1 => x1.HasProjectLocationPoint).Where(x => x.ProjectStage.ShouldShowOnMap()).ToList();

            projectMapLocationJsons = filteredProjectList.ToList().Select(p => new ProjectMapLocationJson(p)).ToList();

            var viewData = new ProjectMapViewData(CurrentPerson,
                                                  firmaPage,
                                                  projectLocationsMapInitJson,
                                                  projectLocationsMapViewData,
                                                  projectLocationFilterTypesAndValues,
                                                  projectLocationsUrl,
                                                  filteredProjectsWithLocationAreasUrl,
                                                  projectMapLocationJsons);

            return(RazorView <ProjectMap, ProjectMapViewData>(viewData));
        }
예제 #19
0
        public DetailViewData(FirmaSession currentFirmaSession,
                              ProjectFirmaModels.Models.TaxonomyLeaf taxonomyLeaf,
                              ProjectLocationsMapInitJson primaryProjectLocationsMapInitJson,
                              ProjectLocationsMapInitJson secondaryProjectLocationsMapInitJson,
                              ProjectLocationsMapViewData primaryProjectLocationsMapViewData,
                              ProjectLocationsMapViewData secondaryProjectLocationsMapViewData,
                              bool canHaveAssociatedPerformanceMeasures,
                              RelatedPerformanceMeasuresViewData relatedPerformanceMeasuresViewData,
                              TaxonomyLevel taxonomyLevel,
                              TenantAttribute tenantAttribute,
                              IEnumerable <ProjectFirmaModels.Models.PerformanceMeasure> performanceMeasures,
                              Dictionary <int, PerformanceMeasureChartViewData> primaryPerformanceMeasureChartViewDataByPerformanceMeasure,
                              Dictionary <int, PerformanceMeasureChartViewData> secondaryPerformanceMeasureChartViewDataByPerformanceMeasure,
                              List <ProjectCustomGridConfiguration> projectCustomDefaultGridConfigurations) : base(currentFirmaSession)
        {
            TaxonomyLeaf = taxonomyLeaf;
            PageTitle    = taxonomyLeaf.GetDisplayName();
            var fieldDefinitionTaxonomyLeaf = FieldDefinitionEnum.TaxonomyLeaf;
            var taxonomyLeafDisplayName     = fieldDefinitionTaxonomyLeaf.ToType().GetFieldDefinitionLabel();

            EntityName = taxonomyLeafDisplayName;

            PrimaryProjectLocationsMapInitJson   = primaryProjectLocationsMapInitJson;
            PrimaryProjectLocationsMapViewData   = primaryProjectLocationsMapViewData;
            SecondaryProjectLocationsMapInitJson = secondaryProjectLocationsMapInitJson;
            SecondaryProjectLocationsMapViewData = secondaryProjectLocationsMapViewData;
            ProjectMapFilteredUrl = PrimaryProjectLocationsMapInitJson.ProjectMapCustomization.GetCustomizedUrl();

            UserHasTaxonomyLeafManagePermissions = new TaxonomyLeafManageFeature().HasPermissionByFirmaSession(currentFirmaSession);
            EditTaxonomyLeafUrl = SitkaRoute <TaxonomyLeafController> .BuildUrlFromExpression(c => c.Edit(taxonomyLeaf));

            IndexUrl = SitkaRoute <ProgramInfoController> .BuildUrlFromExpression(x => x.Taxonomy());

            SecondaryBasicProjectInfoGridName = "secondaryLeafProjectListGrid";
            BasicProjectInfoGridSpec          = new ProjectForTaxonomyLeafGridSpec(currentFirmaSession, true, taxonomyLeaf)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} with this {taxonomyLeafDisplayName}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} with this {taxonomyLeafDisplayName}",
                SaveFiltersInCookie = true
            };

            SecondaryBasicProjectInfoGridDataUrl = SitkaRoute <TaxonomyLeafController> .BuildUrlFromExpression(tc => tc.SecondaryProjectsGridJsonData(taxonomyLeaf));

            ProjectTaxonomyViewData = new ProjectTaxonomyViewData(taxonomyLeaf, taxonomyLevel);

            var projectDetails = HttpRequestStorage.DatabaseEntities.vProjectDetails.ToDictionary(x => x.ProjectID);

            ProjectCustomDefaultGridSpec = new ProjectCustomGridSpec(currentFirmaSession, projectCustomDefaultGridConfigurations, ProjectCustomGridType.Default.ToEnum, projectDetails, currentFirmaSession.Tenant)
            {
                ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true
            };

            ProjectCustomDefaultGridName    = "taxonomyLeafProjectListGrid";
            ProjectCustomDefaultGridDataUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.TaxonomyLeafProjectsGridJsonData(taxonomyLeaf));

            TaxonomyLeafDisplayName           = taxonomyLeafDisplayName;
            TaxonomyLeafDisplayNamePluralized = fieldDefinitionTaxonomyLeaf.ToType().GetFieldDefinitionLabelPluralized();

            CanHaveAssociatedPerformanceMeasures = canHaveAssociatedPerformanceMeasures;
            PerformanceMeasures = performanceMeasures;
            PrimaryPerformanceMeasureChartViewDataByPerformanceMeasure   = primaryPerformanceMeasureChartViewDataByPerformanceMeasure;
            SecondaryPerformanceMeasureChartViewDataByPerformanceMeasure = secondaryPerformanceMeasureChartViewDataByPerformanceMeasure;
            RelatedPerformanceMeasuresViewData = relatedPerformanceMeasuresViewData;

            TenantAttribute = tenantAttribute;
        }