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 GridJsonNetJObjectResult <Project> ProjectsGridJsonData(PriorityLandscapePrimaryKey priorityLandscapePrimaryKey) { var treatmentTotals = HttpRequestStorage.DatabaseEntities.vTotalTreatedAcresByProjects.ToList(); var treatmentDictionary = treatmentTotals.ToDictionary(x => x.ProjectID, y => y); var gridSpec = new ProjectIndexGridSpec(CurrentPerson, false, false, treatmentDictionary); var priorityLandscape = priorityLandscapePrimaryKey.EntityObject; var projectPriorityLandscapes = priorityLandscape.GetAssociatedProjectsVisibleToUser(CurrentPerson); var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <Project>(projectPriorityLandscapes, gridSpec); return(gridJsonNetJObjectResult); }