public PerformanceMeasureChartViewData(ProjectFirmaModels.Models.PerformanceMeasure performanceMeasure, int height, FirmaSession currentFirmaSession, bool showLastUpdatedDate, bool fromPerformanceMeasureDetailPage, List<ProjectFirmaModels.Models.Project> projects, string chartUniqueName, ProjectFirmaModels.Models.GeospatialArea geospatialArea) { PerformanceMeasure = performanceMeasure; HyperlinkPerformanceMeasureName = !fromPerformanceMeasureDetailPage; GoogleChartJsons = performanceMeasure.GetGoogleChartJsonDictionary(geospatialArea, projects, chartUniqueName); var performanceMeasureActuals = PerformanceMeasure.PerformanceMeasureActuals.Where(x => projects.Contains(x.Project)).ToList(); ChartTotal = performanceMeasureActuals.Any() ? performanceMeasureActuals.Sum(x => x.ActualValue) : (double?) null; ChartTotalFormatted = PerformanceMeasure.MeasurementUnitType.DisplayValue(ChartTotal); var currentPersonHasManagePermission = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); CanManagePerformanceMeasures = currentPersonHasManagePermission && fromPerformanceMeasureDetailPage; ShowLastUpdatedDate = showLastUpdatedDate; ChartTitle = performanceMeasure.GetDisplayName(); ViewGoogleChartViewData = new ViewGoogleChartViewData(GoogleChartJsons, ChartTitle, height, null, chartUniqueName, CanManagePerformanceMeasures, SitkaRoute<GoogleChartController>.BuildUrlFromExpression(c => c.DownloadPerformanceMeasureChartData()), true, true, performanceMeasure, HyperlinkPerformanceMeasureName); }
public ViewResult Detail(PriorityLandscapePrimaryKey priorityLandscapePrimaryKey) { var priorityLandscape = priorityLandscapePrimaryKey.EntityObject; var mapDivID = $"priorityLandscape_{priorityLandscape.PriorityLandscapeID}_Map"; var associatedProjects = priorityLandscape.GetAssociatedProjectsVisibleToUser(CurrentPerson); var layers = PriorityLandscape.GetPriorityLandscapeAndAssociatedProjectLayers(priorityLandscape, associatedProjects); var mapInitJson = new MapInitJson(mapDivID, 10, layers, new BoundingBox(priorityLandscape.PriorityLandscapeLocation)); var projectGrantAllocationExpenditures = associatedProjects.SelectMany(x => x.ProjectGrantAllocationExpenditures); var organizationTypes = HttpRequestStorage.DatabaseEntities.OrganizationTypes.ToList(); const string chartTitle = "Reported Expenditures By Organization Type"; var chartContainerID = chartTitle.Replace(" ", ""); var googleChart = projectGrantAllocationExpenditures.ToGoogleChart(x => x.GrantAllocation.BottommostOrganization.OrganizationType.OrganizationTypeName, organizationTypes.Select(x => x.OrganizationTypeName).ToList(), x => x.GrantAllocation.BottommostOrganization.OrganizationType.OrganizationTypeName, chartContainerID, chartTitle); var viewGoogleChartViewData = new ViewGoogleChartViewData(googleChart, chartTitle, 405, true); var performanceMeasures = associatedProjects .SelectMany(x => x.PerformanceMeasureActuals) .Select(x => x.PerformanceMeasure).Distinct() .OrderBy(x => x.PerformanceMeasureDisplayName) .ToList(); var viewData = new DetailViewData(CurrentPerson, priorityLandscape, mapInitJson, viewGoogleChartViewData, performanceMeasures); return(RazorView <Detail, DetailViewData>(viewData)); }
public DetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.GeospatialArea geospatialArea, MapInitJson mapInitJson, LayerGeoJson projectLocationsLayerGeoJson, ViewGoogleChartViewData viewGoogleChartViewData, List <ProjectFirmaModels.Models.PerformanceMeasure> performanceMeasures, List <ProjectCustomGridConfiguration> projectCustomDefaultGridConfigurations) : base(currentFirmaSession) { GeospatialArea = geospatialArea; MapInitJson = mapInitJson; ProjectLocationsLayerGeoJson = projectLocationsLayerGeoJson; ViewGoogleChartViewData = viewGoogleChartViewData; PageTitle = geospatialArea.GeospatialAreaName; GeospatialAreaTypeName = geospatialArea.GeospatialAreaType.GeospatialAreaTypeName; GeospatialAreaTypeNamePluralized = geospatialArea.GeospatialAreaType.GeospatialAreaTypeNamePluralized; EntityName = $"{GeospatialAreaTypeName}"; UserHasGeospatialAreaManagePermissions = new GeospatialAreaManageFeature().HasPermissionByFirmaSession(currentFirmaSession); IndexUrl = SitkaRoute <GeospatialAreaController> .BuildUrlFromExpression(x => x.Index(geospatialArea.GeospatialAreaType)); 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 = "geospatialAreaProjectListGrid"; ProjectCustomDefaultGridDataUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.GeospatialAreaProjectsGridJsonData(geospatialArea)); PerformanceMeasureChartViewDatas = performanceMeasures.Select(x => geospatialArea.GetPerformanceMeasureChartViewData(x, currentFirmaSession)).ToList(); GeospatialAreaDescriptionViewPageContentViewData = new ViewPageContentViewData(geospatialArea, currentFirmaSession); }
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(); }
public ViewResult Detail(DNRUplandRegionPrimaryKey dnrUplandRegionPrimaryKey) { var region = dnrUplandRegionPrimaryKey.EntityObject; var mapDivID = $"region_{region.DNRUplandRegionID}_Map"; var associatedProjects = region.GetAssociatedProjects(CurrentPerson); var layers = DNRUplandRegion.GetRegionAndAssociatedProjectLayers(region, associatedProjects); var mapInitJson = new MapInitJson(mapDivID, 10, layers, new BoundingBox(region.DNRUplandRegionLocation)); var grantAllocationExpenditures = new List <GrantAllocationExpenditure>(); region.GrantAllocations.ForEach(x => grantAllocationExpenditures.AddRange(x.GrantAllocationExpenditures)); var costTypes = CostType.GetLineItemCostTypes(); const string chartTitle = "Grant Allocation Expenditures By Cost Type"; var chartContainerID = chartTitle.Replace(" ", ""); var googleChart = grantAllocationExpenditures.ToGoogleChart(x => x.CostType?.CostTypeDisplayName, costTypes.Select(ct => ct.CostTypeDisplayName).ToList(), x => x.CostType?.CostTypeDisplayName, chartContainerID, chartTitle); var viewGoogleChartViewData = new ViewGoogleChartViewData(googleChart, chartTitle, 405, true); var performanceMeasures = associatedProjects .SelectMany(x => x.PerformanceMeasureActuals) .Select(x => x.PerformanceMeasure).Distinct() .OrderBy(x => x.PerformanceMeasureDisplayName) .ToList(); var viewData = new DetailViewData(CurrentPerson, region, mapInitJson, viewGoogleChartViewData, performanceMeasures); return(RazorView <Detail, DetailViewData>(viewData)); }
public DetailViewData(Person currentPerson, Models.PriorityLandscape priorityLandscape, MapInitJson mapInitJson, ViewGoogleChartViewData viewGoogleChartViewData, List <Models.PerformanceMeasure> performanceMeasures) : base(currentPerson) { PriorityLandscape = priorityLandscape; MapInitJson = mapInitJson; ViewGoogleChartViewData = viewGoogleChartViewData; PageTitle = priorityLandscape.PriorityLandscapeName; EntityName = "PriorityLandscape"; UserHasPriorityLandscapeManagePermissions = new PriorityLandscapeManageFeature().HasPermissionByPerson(currentPerson); IndexUrl = SitkaRoute <PriorityLandscapeController> .BuildUrlFromExpression(x => x.Index()); BasicProjectInfoGridName = "priorityLandscapeProjectListGrid"; BasicProjectInfoGridSpec = new ProjectIndexGridSpec(CurrentPerson, false, false, new Dictionary <int, vTotalTreatedAcresByProject>()) { ObjectNameSingular = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} in this {Models.FieldDefinition.PriorityLandscape.GetFieldDefinitionLabel()}", ObjectNamePlural = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()} in this {Models.FieldDefinition.PriorityLandscape.GetFieldDefinitionLabel()}", SaveFiltersInCookie = true }; BasicProjectInfoGridDataUrl = SitkaRoute <PriorityLandscapeController> .BuildUrlFromExpression(tc => tc.ProjectsGridJsonData(priorityLandscape)); PerformanceMeasureChartViewDatas = performanceMeasures.Select(x => priorityLandscape.GetPerformanceMeasureChartViewData(x, CurrentPerson)).ToList(); EditPriorityLandscapeBasicsUrl = SitkaRoute <PriorityLandscapeController> .BuildUrlFromExpression(plc => plc.EditPriorityLandscape(priorityLandscape)); PriorityLandscapeFileDetailsViewData = new FileDetailsViewData( EntityDocument.CreateFromEntityDocument(new List <IEntityDocument>(priorityLandscape.PriorityLandscapeFileResources)), SitkaRoute <PriorityLandscapeController> .BuildUrlFromExpression(x => x.NewPriorityLandscapeFiles(priorityLandscape.PrimaryKey)), UserHasPriorityLandscapeManagePermissions, Models.FieldDefinition.PriorityLandscape ); }
public ViewResult GrantAllocationDetail(GrantAllocationPrimaryKey grantAllocationPrimaryKey) { var grantAllocation = grantAllocationPrimaryKey.EntityObject; if (grantAllocation == null) { throw new Exception($"Could not find GrantAllocationID # {grantAllocationPrimaryKey.PrimaryKeyValue}; has it been deleted?"); } var taxonomyLevel = MultiTenantHelpers.GetTaxonomyLevel(); var grantAllocationBasicsViewData = new GrantAllocationBasicsViewData(grantAllocation, false, taxonomyLevel); var userHasEditGrantAllocationPermissions = new GrantAllocationEditAsAdminFeature().HasPermissionByPerson(CurrentPerson); var grantAllocationNotesViewData = new EntityNotesViewData( EntityNote.CreateFromEntityNote(new List <IEntityNote>(grantAllocation.GrantAllocationNotes)), SitkaRoute <GrantAllocationController> .BuildUrlFromExpression(x => x.NewGrantAllocationNote(grantAllocationPrimaryKey)), grantAllocation.GrantAllocationName, userHasEditGrantAllocationPermissions); var grantAllocationNoteInternalsViewData = new EntityNotesViewData( EntityNote.CreateFromEntityNote(new List <IEntityNote>(grantAllocation.GrantAllocationNoteInternals)), SitkaRoute <GrantAllocationController> .BuildUrlFromExpression(x => x.NewGrantAllocationNoteInternal(grantAllocationPrimaryKey)), grantAllocation.GrantAllocationName, userHasEditGrantAllocationPermissions); var costTypes = CostType.All.Where(x => x.IsValidInvoiceLineItemCostType).OrderBy(x => x.CostTypeDisplayName).ToList(); const string chartTitle = "Grant Allocation Expenditures"; var chartContainerID = chartTitle.Replace(" ", ""); // If ProjectGrantAllocationExpenditures is empty, ToGoogleChart returns null... var googleChart = grantAllocation.GrantAllocationExpenditures .ToGoogleChart(x => x.CostType?.CostTypeDisplayName, costTypes.Select(x => x.CostTypeDisplayName).ToList(), x => x.CostType?.CostTypeDisplayName, chartContainerID, grantAllocation.DisplayName); // Which makes this guy bork (bork bork bork) googleChart?.GoogleChartConfiguration.Legend.SetLegendPosition(GoogleChartLegendPosition.Top); var viewGoogleChartViewData = new ViewGoogleChartViewData(googleChart, chartTitle, 350, false); var projectGrantAllocationRequestsGridSpec = new ProjectGrantAllocationRequestsGridSpec() { ObjectNameSingular = "Project", ObjectNamePlural = "Projects", SaveFiltersInCookie = true }; var grantAllocationExpendituresGridSpec = new GrantAllocationExpendituresGridSpec(); var grantAllocationAwardsGridSpec = new GrantAllocationAwardGridSpec(CurrentPerson, grantAllocation); var viewData = new Views.GrantAllocation.DetailViewData(CurrentPerson, grantAllocation, grantAllocationBasicsViewData, grantAllocationNotesViewData, grantAllocationNoteInternalsViewData, viewGoogleChartViewData, projectGrantAllocationRequestsGridSpec, grantAllocationExpendituresGridSpec, grantAllocationAwardsGridSpec); return(RazorView <Views.GrantAllocation.Detail, Views.GrantAllocation.DetailViewData>(viewData)); }
public DetailViewData(Person currentPerson, Models.GrantAllocation grantAllocation , GrantAllocationBasicsViewData grantAllocationBasicsViewData , EntityNotesViewData grantAllocationNotesViewData , EntityNotesViewData grantAllocationNoteInternalsViewData , ViewGoogleChartViewData viewGoogleChartViewData , GridSpec <Models.ProjectGrantAllocationRequest> projectGrantAllocationRequestsGridSpec , GrantAllocationExpendituresGridSpec grantAllocationExpendituresGridSpec) : base(currentPerson, grantAllocation) { PageTitle = grantAllocation.GrantAllocationName.ToEllipsifiedStringClean(110); BreadCrumbTitle = $"{Models.FieldDefinition.GrantAllocation.GetFieldDefinitionLabel()} Detail"; GrantAllocationBasicsViewData = grantAllocationBasicsViewData; GrantAllocationNotesViewData = grantAllocationNotesViewData; NewGrantAllocationNoteUrl = grantAllocation.GetNewNoteUrl(); GrantAllocationNoteInternalsViewData = grantAllocationNoteInternalsViewData; ViewGoogleChartViewData = viewGoogleChartViewData; var projectGrantAllocationExpenditures = GrantAllocation.ProjectGrantAllocationExpenditures.ToList(); CalendarYearsForProjectExpenditures = projectGrantAllocationExpenditures.CalculateCalendarYearRangeForExpenditures(grantAllocation); ProjectCalendarYearExpendituresGridSpec = new ProjectCalendarYearExpendituresGridSpec(CalendarYearsForProjectExpenditures) { ObjectNameSingular = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()}", ObjectNamePlural = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true }; ProjectCalendarYearExpendituresGridName = "projectsCalendarYearExpendituresFromGrantAllocationGrid"; ProjectCalendarYearExpendituresGridDataUrl = SitkaRoute <GrantAllocationController> .BuildUrlFromExpression(tc => tc.ProjectCalendarYearExpendituresGridJsonData(grantAllocation)); ProjectGrantAllocationRequestsGridSpec = projectGrantAllocationRequestsGridSpec; ProjectGrantAllocationRequestsGridName = "projectsGrantAllocationRequestsFromGrantAllocationGrid"; ProjectGrantAllocationRequestsGridDataUrl = SitkaRoute <GrantAllocationController> .BuildUrlFromExpression(tc => tc.ProjectGrantAllocationRequestsGridJsonData(grantAllocation)); GrantAllocationExpendituresGridSpec = grantAllocationExpendituresGridSpec; GrantAllocationExpendituresGridName = "grantAllocationExpendituresGrid"; GrantAllocationExpendituresGridDataUrl = SitkaRoute <GrantAllocationController> .BuildUrlFromExpression(gac => gac.GrantAllocationExpendituresGridJsonData(grantAllocation)); GrantAllocationBudgetLineItemsViewData = new GrantAllocationBudgetLineItemsViewData(currentPerson, grantAllocation, grantAllocation.GrantAllocationBudgetLineItems.ToList()); GrantAllocationBudgetVsActualsViewData = new GrantAllocationBudgetVsActualsViewData(currentPerson, grantAllocation); var canEditDocuments = new GrantAllocationEditAsAdminFeature().HasPermission(currentPerson, grantAllocation).HasPermission; GrantAllocationDetailsFileDetailsViewData = new FileDetailsViewData( EntityDocument.CreateFromEntityDocument(new List <IEntityDocument>(grantAllocation.GrantAllocationFileResources)), SitkaRoute <GrantAllocationController> .BuildUrlFromExpression(x => x.NewGrantAllocationFiles(grantAllocation.PrimaryKey)), canEditDocuments, Models.FieldDefinition.GrantAllocation ); }
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 ObligationItemBudgetGridSpec ObligationItemBudgetGridSpec { get; } //public string ObligationItemBudgetGridName { get; } //public string ObligationItemBudgetGridDataUrl { get; } public DetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FundingSource fundingSource, ViewGoogleChartViewData viewGoogleChartViewData, GridSpec <ProjectFirmaModels.Models.ProjectFundingSourceBudget> projectFundingSourceBudgetGridSpec, DisplayFundingSourceCustomAttributesViewData displayFundingSourceCustomAttributeTypesViewData) : base(currentFirmaSession) { ViewGoogleChartViewData = viewGoogleChartViewData; FundingSource = fundingSource; PageTitle = fundingSource.GetDisplayName(); EntityName = $"{FieldDefinitionEnum.FundingSource.ToType().GetFieldDefinitionLabel()}"; UserHasFundingSourceManagePermissions = new FundingSourceEditFeature().HasPermission(currentFirmaSession, fundingSource).HasPermission; UserHasFundingSourceCustomAttributeManagePermissions = new FundingSourceCustomAttributeEditFeature().HasPermission(currentFirmaSession, fundingSource).HasPermission; UserHasProjectFundingSourceExpenditureManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); EditFundingSourceUrl = fundingSource.GetEditUrl(); EditFundingSourceCustomAttributesUrl = SitkaRoute <FundingSourceCustomAttributesController> .BuildUrlFromExpression(c => c.EditFundingSourceCustomAttributesForFundingSource(fundingSource)); var projectFundingSourceExpenditures = FundingSource.ProjectFundingSourceExpenditures.ToList(); CalendarYearsForProjectExpenditures = projectFundingSourceExpenditures.CalculateCalendarYearRangeForExpenditures(fundingSource); ProjectCalendarYearExpendituresGridSpec = new ProjectCalendarYearExpendituresGridSpec(CalendarYearsForProjectExpenditures) { ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true }; ProjectCalendarYearExpendituresGridName = "projectsCalendarYearExpendituresFromFundingSourceGrid"; ProjectCalendarYearExpendituresGridDataUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(tc => tc.ProjectCalendarYearExpendituresGridJsonData(fundingSource)); ManageFundingSourcesUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(c => c.Index()); ProjectFundingSourceBudgetGridSpec = projectFundingSourceBudgetGridSpec; ProjectFundingSourceBudgetGridName = "projectsFundingSourceRequestsFromFundingSourceGrid"; ProjectFundingSourceBudgetGridDataUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(tc => tc.ProjectFundingSourceBudgetGridJsonData(fundingSource)); DisplayFundingSourceCustomAttributeTypesViewData = displayFundingSourceCustomAttributeTypesViewData; ContractualInvoiceGridName = "fundingSourceContractualInvoicesGrid"; ContractualInvoiceGridSpec = new ContractualInvoiceGridSpec(currentFirmaSession); ContractualInvoiceGridDataUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(fc => fc.ContractualInvoiceGridOnFundDetailJsonData(fundingSource)); //ObligationItemBudgetGridName = "fundingSourceContractualInvoicesGrid"; //ObligationItemBudgetGridSpec = new ObligationItemBudgetGridSpec(currentFirmaSession); //ObligationItemBudgetGridDataUrl = SitkaRoute<FundingSourceController>.BuildUrlFromExpression(fc => fc.ObligationItemBudgetGridOnFundDetailJsonData(fundingSource)); }
public DetailViewData(Person currentPerson, Models.DNRUplandRegion dnrUplandRegion, MapInitJson mapInitJson, ViewGoogleChartViewData viewGoogleChartViewData, List <Models.PerformanceMeasure> performanceMeasures) : base(currentPerson) { DNRUplandRegion = dnrUplandRegion; MapInitJson = mapInitJson; ViewGoogleChartViewData = viewGoogleChartViewData; PageTitle = dnrUplandRegion.DNRUplandRegionName; EntityName = Models.FieldDefinition.DNRUplandRegion.GetFieldDefinitionLabel(); UserHasRegionManagePermissions = new DNRUplandRegionManageFeature().HasPermissionByPerson(currentPerson); IndexUrl = SitkaRoute <DNRUplandRegionController> .BuildUrlFromExpression(x => x.Index()); BasicProjectInfoGridName = "regionProjectListGrid"; BasicProjectInfoGridSpec = new BasicProjectInfoGridSpec(CurrentPerson, false) { ObjectNameSingular = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} in this {Models.FieldDefinition.DNRUplandRegion.GetFieldDefinitionLabel()}", ObjectNamePlural = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()} in this {Models.FieldDefinition.DNRUplandRegion.GetFieldDefinitionLabel()}", SaveFiltersInCookie = true }; BasicProjectInfoGridDataUrl = SitkaRoute <DNRUplandRegionController> .BuildUrlFromExpression(tc => tc.ProjectsGridJsonData(dnrUplandRegion)); PerformanceMeasureChartViewDatas = performanceMeasures.Select(x => dnrUplandRegion.GetPerformanceMeasureChartViewData(x, CurrentPerson)).ToList(); }
public ViewResult Detail(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey) { var geospatialArea = geospatialAreaPrimaryKey.EntityObject; var mapDivID = $"geospatialArea_{geospatialArea.GeospatialAreaID}_Map"; var associatedProjects = geospatialArea.GetAssociatedProjects(CurrentFirmaSession); LayerGeoJson projectLayerGeoJson; var layers = geospatialArea.GetGeospatialAreaAndAssociatedProjectLayers(CurrentFirmaSession, associatedProjects, out projectLayerGeoJson); var mapInitJson = new MapInitJson(mapDivID, 10, layers, MapInitJson.GetExternalMapLayers(), new BoundingBox(geospatialArea.GeospatialAreaFeature)); 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, geospatialArea, mapInitJson, projectLayerGeoJson, viewGoogleChartViewData, performanceMeasures, projectCustomDefaultGridConfigurations); return(RazorView <Detail, DetailViewData>(viewData)); }
public ViewResult Detail(FundingSourcePrimaryKey fundingSourcePrimaryKey) { var fundingSource = fundingSourcePrimaryKey.EntityObject; var taxonomyTrunks = HttpRequestStorage.DatabaseEntities.TaxonomyTrunks.ToList().SortByOrderThenName().ToList(); const string chartTitle = "Reported Expenditures"; var chartContainerID = chartTitle.Replace(" ", ""); // If ProjectFundingSourceExpenditures is empty, ToGoogleChart returns null... var googleChart = fundingSource.ProjectFundingSourceExpenditures .ToGoogleChart(x => x.Project.TaxonomyLeaf.TaxonomyBranch.TaxonomyTrunk.GetDisplayName(), taxonomyTrunks.Select(x => x.GetDisplayName()).ToList(), x => x.Project.TaxonomyLeaf.TaxonomyBranch.TaxonomyTrunk.GetDisplayName(), chartContainerID, fundingSource.GetDisplayName(), null); googleChart?.GoogleChartConfiguration.Legend.SetLegendPosition(GoogleChartLegendPosition.None); var projectFundingSourceBudgetGridSpec = new ProjectFundingSourceBudgetGridSpec() { ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true }; var viewGoogleChartViewData = new ViewGoogleChartViewData(googleChart, chartTitle, 350, false); var fundingSourceCustomAttributeTypes = HttpRequestStorage.DatabaseEntities.FundingSourceCustomAttributeTypes.ToList().Where(x => x.HasViewPermission(CurrentFirmaSession)); var projectCustomAttributeTypesViewData = new DisplayFundingSourceCustomAttributesViewData( fundingSourceCustomAttributeTypes.ToList(), new List <FundingSourceCustomAttribute>(fundingSource.FundingSourceCustomAttributes.ToList())); var viewData = new DetailViewData(CurrentFirmaSession, fundingSource, viewGoogleChartViewData, projectFundingSourceBudgetGridSpec, projectCustomAttributeTypesViewData); return(RazorView <Detail, DetailViewData>(viewData)); }
public PerformanceMeasureChartViewData(Models.PerformanceMeasure performanceMeasure, int height, Person currentPerson, bool showLastUpdatedDate, bool fromPerformanceMeasureDetailPage, List <Models.Project> projects) { PerformanceMeasure = performanceMeasure; HyperlinkPerformanceMeasureName = !fromPerformanceMeasureDetailPage; GoogleChartJsons = performanceMeasure.GetGoogleChartJsonDictionary(projects); var performanceMeasureActuals = PerformanceMeasure.PerformanceMeasureActuals.Where(x => projects.Contains(x.Project)).ToList(); ChartTotal = performanceMeasureActuals.Any() ? performanceMeasureActuals.Sum(x => x.ActualValue) : (double?)null; ChartTotalFormatted = PerformanceMeasure.MeasurementUnitType.DisplayValue(ChartTotal); ChartTotalUnit = PerformanceMeasure.MeasurementUnitType.LegendDisplayName; var currentPersonHasManagePermission = new PerformanceMeasureManageFeature().HasPermissionByPerson(currentPerson); CanManagePerformanceMeasures = currentPersonHasManagePermission && fromPerformanceMeasureDetailPage; ShowLastUpdatedDate = showLastUpdatedDate; ChartTitle = performanceMeasure.DisplayName; ViewGoogleChartViewData = new ViewGoogleChartViewData(GoogleChartJsons, ChartTitle, height, null, performanceMeasure.GetJavascriptSafeChartUniqueName(), CanManagePerformanceMeasures, SitkaRoute <GoogleChartController> .BuildUrlFromExpression(c => c.DownloadPerformanceMeasureChartData()), true, true, performanceMeasure, HyperlinkPerformanceMeasureName); }
public FundingStatusViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage, ProjectFirmaModels.Models.FirmaPage fundingStatusFooter, GoogleChartJson summaryGoogleChart, GoogleChartJson orgTypeGoogleChart) : base(currentFirmaSession, firmaPage) { FundingStatusFooterViewPageContentViewData = new ViewPageContentViewData(fundingStatusFooter, currentFirmaSession); SummaryViewGoogleChartViewData = new ViewGoogleChartViewData(summaryGoogleChart, summaryGoogleChart.GoogleChartConfiguration.Title, 350, true, true); StatusByOwnerOrgTypeViewGoogleChartViewData = new ViewGoogleChartViewData(orgTypeGoogleChart, orgTypeGoogleChart.GoogleChartConfiguration.Title, 400, true); }
public OrganizationDetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Organization organization, MapInitJson mapInitJson, LayerGeoJson projectLocationsLayerGeoJson, bool hasSpatialData, List <ProjectFirmaModels.Models.PerformanceMeasure> performanceMeasures, ViewGoogleChartViewData expendituresDirectlyFromOrganizationViewGoogleChartViewData, ViewGoogleChartViewData expendituresReceivedFromOtherOrganizationsViewGoogleChartViewData, List <MatchmakerTaxonomyTier> topLevelMatchmakerTaxonomyTier, int maximumTaxonomyLeaves, OrganizationDetailTab activeTab, MapInitJson matchMakerAreaOfInterestInitJson, List <IGrouping <ProjectFirmaModels.Models.ClassificationSystem, MatchmakerOrganizationClassification> > matchmakerClassificationsGroupedByClassificationSystem, List <ProjectFirmaModels.Models.ClassificationSystem> allClassificationSystems) : base(currentFirmaSession) { Organization = organization; PageTitle = organization.GetDisplayName(); EntityName = $"{FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabel()}"; UserHasOrganizationManagePermissions = new OrganizationManageFeature().HasPermissionByFirmaSession(currentFirmaSession); UserHasOrganizationManagePrimaryContactPermissions = new OrganizationPrimaryContactManageFeature().HasPermissionByFirmaSession(currentFirmaSession); EditOrganizationUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.Edit(organization)); EditBoundaryUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditBoundary(organization)); DeleteOrganizationBoundaryUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression( c => c.DeleteOrganizationBoundary(organization)); EditOrganizationPrimaryContactUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditPrimaryContact(organization)); ProjectsIncludingLeadImplementingGridSpec = new ProjectsIncludingLeadImplementingGridSpec(organization, currentFirmaSession, false) { ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} associated with {organization.GetDisplayName()}", SaveFiltersInCookie = true }; ProjectOrganizationsGridName = "projectOrganizationsFromOrganizationGrid"; ProjectOrganizationsGridDataUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression( tc => tc.ProjectsIncludingLeadImplementingGridJsonData(organization)); ProjectStewardOrLeadImplementorFieldDefinitionName = MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship() ? FieldDefinitionEnum.ProjectsStewardOrganizationRelationshipToProject.ToType().GetFieldDefinitionLabel() : "Lead Implementer"; ProjectFundingSourceExpendituresForOrganizationGridSpec = new ProjectFundingSourceExpendituresForOrganizationGridSpec(organization) { ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} {FieldDefinitionEnum.ReportedExpenditure.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} {FieldDefinitionEnum.ReportedExpenditure.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true }; ProjectFundingSourceExpendituresForOrganizationGridName = "projectCalendarYearExpendituresForOrganizationGrid"; ProjectFundingSourceExpendituresForOrganizationGridDataUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression( tc => tc.ProjectFundingSourceExpendituresForOrganizationGridJsonData(organization)); ManageFundingSourcesUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(c => c.Index()); IndexUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.Index()); MapInitJson = mapInitJson; ProjectLocationsLayerGeoJson = projectLocationsLayerGeoJson; HasSpatialData = hasSpatialData; ExpendituresDirectlyFromOrganizationViewGoogleChartViewData = expendituresDirectlyFromOrganizationViewGoogleChartViewData; ExpendituresReceivedFromOtherOrganizationsViewGoogleChartViewData = expendituresReceivedFromOtherOrganizationsViewGoogleChartViewData; PerformanceMeasureChartViewDatas = performanceMeasures.Select(x => organization.GetPerformanceMeasureChartViewData(x, currentFirmaSession)).ToList(); NewFundingSourceUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(c => c.New()); CanCreateNewFundingSource = new FundingSourceCreateFeature().HasPermissionByFirmaSession(currentFirmaSession) && (currentFirmaSession.Person.RoleID != ProjectFirmaModels.Models.Role.ProjectSteward.RoleID || // If person is project steward, they can only create funding sources for their organization currentFirmaSession.Person.OrganizationID == organization.OrganizationID); ShowProposals = currentFirmaSession.CanViewProposals(); ProposalsPanelHeader = MultiTenantHelpers.ShowProposalsToThePublic() ? FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabelPluralized() : $"{FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabelPluralized()} (Not Visible to the Public)"; ProposalsGridSpec = new ProjectsIncludingLeadImplementingGridSpec(organization, currentFirmaSession, true) { ObjectNameSingular = $"{FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabelPluralized()} associated with {organization.GetDisplayName()}", SaveFiltersInCookie = true }; ProposalsGridName = "proposalsGrid"; ProposalsGridDataUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression( tc => tc.ProposalsGridJsonData(organization)); ShowPendingProjects = currentFirmaSession.Person.CanViewPendingProjects(); // If they have no permissions, just say "yes" or "no" if GUID set. // If they have manage permissions, show the GUID, otherwise "None". bool hasKeystoneOrganizationGuid = (organization.KeystoneOrganizationGuid != null); string hasKeystoneOrganizationGuidBooleanAsString = hasKeystoneOrganizationGuid.ToYesNo(); string organizationKeystoneGuidAsStringOrNone = hasKeystoneOrganizationGuid ? organization.KeystoneOrganizationGuid.ToString() : "None"; OrganizationKeystoneGuidDisplayString = UserHasOrganizationManagePermissions ? organizationKeystoneGuidAsStringOrNone : hasKeystoneOrganizationGuidBooleanAsString; PendingProjectsGridSpec = new ProjectsIncludingLeadImplementingGridSpec(organization, currentFirmaSession, true) { ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} associated with {organization.GetDisplayName()}", SaveFiltersInCookie = true }; PendingProjectsGridName = "pendingProjectsGrid"; PendingProjectsGridDataUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression( tc => tc.PendingProjectsGridJsonData(organization)); TenantHasCanStewardProjectsOrganizationRelationship = MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship(); var allAssociatedProjects = Organization.GetAllAssociatedProjects(); NumberOfStewardedProjects = allAssociatedProjects.Count(x => x.IsActiveProject() && x.GetCanStewardProjectsOrganization() == Organization); NumberOfLeadImplementedProjects = allAssociatedProjects.Count(x => x.IsActiveProject() && x.GetPrimaryContactOrganization() == Organization); NumberOfProjectsContributedTo = allAssociatedProjects.ToList().GetActiveProjects().Count; DescriptionViewData = new ViewPageContentViewData(organization, currentFirmaSession); UserHasViewEditProfilePermission = new OrganizationProfileViewEditFeature().HasPermission(currentFirmaSession, organization).HasPermission; bool matchmakerEnabledForTenant = MultiTenantHelpers.GetTenantAttributeFromCache().EnableMatchmaker; bool matchmakerOptedInForThisOrganization = Organization.MatchmakerOptIn.HasValue && Organization.MatchmakerOptIn.Value; ShowMatchmakerProfileTab = matchmakerEnabledForTenant; ShowMatchmakerProfileTabDetails = matchmakerEnabledForTenant && (UserHasViewEditProfilePermission || matchmakerOptedInForThisOrganization); FieldDefinitionForProject = FieldDefinitionEnum.Project.ToType(); EditProfileMatchmakerOptIn = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditProfileMatchmakerOptIn(organization)); EditProfileSupplementalInformationUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditProfileSupplementalInformation(organization)); EditProfileTaxonomyUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditProfileTaxonomy(organization)); EditAreaOfInterestUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditMatchMakerAreaOfInterest(organization)); EditAreaOfInterestDialogFormID = OrganizationController.GenerateEditOrganizationMatchMakerAreaOfInterestFormID(organization); HasAreaOfInterest = (Organization.UseOrganizationBoundaryForMatchmaker && Organization.OrganizationBoundary != null) || (!Organization.UseOrganizationBoundaryForMatchmaker && Organization.MatchMakerAreaOfInterestLocations.Any()); AreaOfInterestMapInitJson = matchMakerAreaOfInterestInitJson; OrganizationMatchmakerKeywordsViewData = new OrganizationMatchmakerKeywordsViewData(organization); EditMatchmakerKeywordsUrl = SitkaRoute <KeywordController> .BuildUrlFromExpression(c => c.EditMatchMakerKeywordsModal(organization)); EditMatchmakerKeywordDialogFormID = OrganizationMatchmakerKeywordsViewData.EditMatchmakerKeywordDialogFormID; TopLevelMatchmakerTaxonomyTier = topLevelMatchmakerTaxonomyTier; TaxonomyTrunkDisplayName = FieldDefinitionEnum.TaxonomyTrunk.ToType().GetFieldDefinitionLabel(); TaxonomyBranchDisplayName = FieldDefinitionEnum.TaxonomyBranch.ToType().GetFieldDefinitionLabel(); TaxonomyLeafDisplayName = FieldDefinitionEnum.TaxonomyLeaf.ToType().GetFieldDefinitionLabel(); TaxonomyLevel = MultiTenantHelpers.GetTaxonomyLevel(); MaximumTaxonomyLeaves = maximumTaxonomyLeaves; ActiveTab = activeTab; EditOrgClassificationsUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditMatchMakerClassifications(organization)); MatchmakerClassificationsGroupedByClassificationSystem = matchmakerClassificationsGroupedByClassificationSystem; AllClassificationSystems = allClassificationSystems; EditOrgPerformanceMeasuresUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditMatchMakerPerformanceMeasures(organization)); ProjectFinderPageUrl = SitkaRoute <ProjectFinderController> .BuildUrlFromExpression(c => c.Organization(organization)); MatchmakerProfileCompletionDictionary = organization.GetMatchmakerOrganizationProfileCompletionDictionary(); MatchmakerProfileIncomplete = !MatchmakerProfileCompletionDictionary.Values.Any(x => x); MatchmakerProjectFinderButtonDisabled = !organization.MatchmakerOptIn.HasValue || !organization.MatchmakerOptIn.Value || MatchmakerProfileIncomplete; ShouldShowBackgroundTab = DescriptionViewData.HasPageContent || new OrganizationBackgroundEditFeature().HasPermission(currentFirmaSession, organization).HasPermission; MatchmakerProjectFinderButtonContent = GetMatchmakerProjectFinderButtonContent(organization, MatchmakerProfileCompletionDictionary); ShowFundingSources = Organization.FundingSources.Any() || new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession); }
public DetailViewData(Person currentPerson, Models.Organization organization, MapInitJson mapInitJson, bool hasSpatialData, List <Models.PerformanceMeasure> performanceMeasures, ViewGoogleChartViewData expendituresDirectlyFromOrganizationViewGoogleChartViewData, ViewGoogleChartViewData expendituresReceivedFromOtherOrganizationsViewGoogleChartViewData, bool atLeastOneAgreementHasFile) : base(currentPerson) { Organization = organization; PageTitle = organization.DisplayName; EntityName = $"{Models.FieldDefinition.Organization.GetFieldDefinitionLabel()}"; UserHasOrganizationManagePermissions = new OrganizationManageFeature().HasPermissionByPerson(CurrentPerson); EditOrganizationUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.Edit(organization)); EditBoundaryUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditBoundary(organization)); DeleteOrganizationBoundaryUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression( c => c.DeleteOrganizationBoundary(organization)); ProjectsIncludingLeadImplementingGridSpec = new ProjectsIncludingLeadImplementingGridSpec(organization, CurrentPerson, false) { ObjectNameSingular = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()}", ObjectNamePlural = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()} associated with {organization.DisplayName}", SaveFiltersInCookie = true }; ProjectOrganizationsGridName = "projectOrganizationsFromOrganizationGrid"; ProjectOrganizationsGridDataUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression( tc => tc.ProjectsIncludingLeadImplementingGridJsonData(organization)); AgreementOrganizationsGridSpec = new AgreementGridSpec(CurrentPerson, atLeastOneAgreementHasFile, false, false) { CustomExcelDownloadUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(tc => tc.AgreementsExcelDownload(organization.PrimaryKey)) }; AgreementOrganizationsGridName = "agreementOrganizationsFromOrganizationGrid"; AgreementOrganizationsGridDataUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression( tc => tc.AgreementOrganizationGridJsonData(organization)); ProjectStewardOrLeadImplementorFieldDefinitionName = MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship() ? Models.FieldDefinition.ProjectsStewardOrganizationRelationshipToProject.GetFieldDefinitionLabel() : "Lead Implementer"; ProjectGrantAllocationExpendituresForOrganizationGridSpec = new ProjectGrantAllocationExpendituresForOrganizationGridSpec(organization) { ObjectNameSingular = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} {Models.FieldDefinition.ReportedExpenditure.GetFieldDefinitionLabel()}", ObjectNamePlural = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()} {Models.FieldDefinition.ReportedExpenditure.GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true }; ProjectGrantAllocationExpendituresForOrganizationGridName = "projectCalendarYearExpendituresForOrganizationGrid"; ProjectGrantAllocationExpendituresForOrganizationGridDataUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression( tc => tc.ProjectGrantAllocationExpendituresForOrganizationGridJsonData(organization)); // Might be too weak; do we want to make this more specific? ManageGrantAllocationsUrl = SitkaRoute <GrantController> .BuildUrlFromExpression(c => c.Index()); IndexUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.Index()); MapInitJson = mapInitJson; HasSpatialData = hasSpatialData; ExpendituresDirectlyFromOrganizationViewGoogleChartViewData = expendituresDirectlyFromOrganizationViewGoogleChartViewData; ExpendituresReceivedFromOtherOrganizationsViewGoogleChartViewData = expendituresReceivedFromOtherOrganizationsViewGoogleChartViewData; PerformanceMeasureChartViewDatas = performanceMeasures.Select(x => organization.GetPerformanceMeasureChartViewData(x, currentPerson)).ToList(); ShowProposals = currentPerson.CanViewProposals; ProposalsPanelHeader = MultiTenantHelpers.ShowApplicationsToThePublic() ? Models.FieldDefinition.Application.GetFieldDefinitionLabelPluralized() : $"{Models.FieldDefinition.Application.GetFieldDefinitionLabelPluralized()} (Not Visible to the Public)"; ProposalsGridSpec = new ProjectsIncludingLeadImplementingGridSpec(organization, CurrentPerson, true) { ObjectNameSingular = $"{Models.FieldDefinition.Application.GetFieldDefinitionLabel()}", ObjectNamePlural = $"{Models.FieldDefinition.Application.GetFieldDefinitionLabelPluralized()} associated with {organization.DisplayName}", SaveFiltersInCookie = true }; ProposalsGridName = "proposalsGrid"; ProposalsGridDataUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression( tc => tc.ProposalsGridJsonData(organization)); ProgramGridSpec = new ProgramGridSpec(CurrentPerson, organization) { ObjectNameSingular = $"{Models.FieldDefinition.Program.GetFieldDefinitionLabel()}", ObjectNamePlural = $"{Models.FieldDefinition.Program.GetFieldDefinitionLabelPluralized()} associated with {organization.DisplayName}", SaveFiltersInCookie = true }; ProgramGridName = "organizationProgramGrid"; ProgramGridDataUrl = SitkaRoute <ProgramController> .BuildUrlFromExpression( tc => tc.ProgramGridJsonData(organization)); ShowPendingProjects = currentPerson.CanViewPendingProjects; PendingProjectsGridSpec = new ProjectsIncludingLeadImplementingGridSpec(organization, CurrentPerson, true) { ObjectNameSingular = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabel()}", ObjectNamePlural = $"{Models.FieldDefinition.Project.GetFieldDefinitionLabelPluralized()} associated with {organization.DisplayName}", SaveFiltersInCookie = true }; PendingProjectsGridName = "pendingProjectsGrid"; PendingProjectsGridDataUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression( tc => tc.PendingProjectsGridJsonData(organization)); TenantHasCanStewardProjectsOrganizationRelationship = MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship(); var allAssociatedProjects = Organization.GetAllAssociatedProjectsForOrgVisibleToUser(CurrentPerson); NumberOfStewardedProjects = allAssociatedProjects .Distinct() .Count(x => x.IsActiveProject() && x.GetCanStewardProjectsOrganization() == Organization); NumberOfLeadImplementedProjects = allAssociatedProjects .Distinct() .Count(x => x.IsActiveProject() && x.GetPrimaryContactOrganization() == Organization); NumberOfProjectsContributedTo = allAssociatedProjects.Distinct().ToList().GetActiveProjectsVisibleToUser(currentPerson).Count; }