public ViewResult Detail(PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey) { var performanceMeasure = performanceMeasurePrimaryKey.EntityObject; var canManagePerformanceMeasure = new PerformanceMeasureManageFeature().HasPermissionByFirmaSession(CurrentFirmaSession); var isAdmin = new FirmaAdminFeature().HasPermissionByFirmaSession(CurrentFirmaSession); var performanceMeasureChartViewData = new PerformanceMeasureChartViewData(performanceMeasure, CurrentFirmaSession, false, canManagePerformanceMeasure, performanceMeasure.GetAssociatedProjectsWithReportedValues(CurrentFirmaSession)); // Avoid scrolling the legend if it can be displayed on two lines performanceMeasureChartViewData.ViewGoogleChartViewData.GoogleChartJsons.ForEach(x => { if (x.GoogleChartConfiguration.Legend != null && x.GoogleChartConfiguration.Legend.MaxLines == null) { x.GoogleChartConfiguration.Legend.MaxLines = 2; } }); var entityNotesViewData = new EntityNotesViewData( EntityNote.CreateFromEntityNote(performanceMeasure.PerformanceMeasureNotes), SitkaRoute <PerformanceMeasureNoteController> .BuildUrlFromExpression(c => c.New(performanceMeasure.PrimaryKey)), performanceMeasure.PerformanceMeasureDisplayName, canManagePerformanceMeasure); var viewData = new DetailViewData(CurrentFirmaSession, performanceMeasure, performanceMeasureChartViewData, entityNotesViewData, canManagePerformanceMeasure, isAdmin); return(RazorView <Detail, DetailViewData>(viewData)); }
public ViewResult SpendingByPerformanceMeasureByProject(int?performanceMeasureID) { var firmaPage = FirmaPageTypeEnum.SpendingByPerformanceMeasureByProject.GetFirmaPage(); var performanceMeasures = HttpRequestStorage.DatabaseEntities.PerformanceMeasures.ToList(); var selectedPerformanceMeasure = performanceMeasureID.HasValue ? performanceMeasures.Single(x => x.PerformanceMeasureID == performanceMeasureID) : performanceMeasures.First(); var accomplishmentsChartViewData = new PerformanceMeasureChartViewData(selectedPerformanceMeasure, CurrentFirmaSession, false, new List <Project>()); var viewData = new SpendingByPerformanceMeasureByProjectViewData(CurrentFirmaSession, firmaPage, performanceMeasures, selectedPerformanceMeasure, accomplishmentsChartViewData); var viewModel = new SpendingByPerformanceMeasureByProjectViewModel(); return(RazorView <SpendingByPerformanceMeasureByProject, SpendingByPerformanceMeasureByProjectViewData, SpendingByPerformanceMeasureByProjectViewModel>(viewData, viewModel)); }
public SpendingByPerformanceMeasureByProjectViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage, List <ProjectFirmaModels.Models.PerformanceMeasure> performanceMeasures, ProjectFirmaModels.Models.PerformanceMeasure selectedPerformanceMeasure, PerformanceMeasureChartViewData performanceMeasureChartViewData) : base(currentFirmaSession, firmaPage) { PageTitle = $"Spending by {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} for Selected {MultiTenantHelpers.GetPerformanceMeasureNamePluralized()}"; PerformanceMeasures = performanceMeasures; SelectedPerformanceMeasure = selectedPerformanceMeasure; PerformanceMeasureChartViewData = performanceMeasureChartViewData; SpendingByPerformanceMeasureByProjectUrl = SitkaRoute <ResultsController> .BuildUrlFromExpression(x => x.SpendingByPerformanceMeasureByProject(UrlTemplate.Parameter1Int)); GridSpec = new SpendingByPerformanceMeasureByProjectGridSpec(SelectedPerformanceMeasure) { ObjectNameSingular = $"record by {MultiTenantHelpers.GetPerformanceMeasureName()} {SelectedPerformanceMeasure.PerformanceMeasureID}: {SelectedPerformanceMeasure.PerformanceMeasureDisplayName}", ObjectNamePlural = $"records by {MultiTenantHelpers.GetPerformanceMeasureName()} {SelectedPerformanceMeasure.PerformanceMeasureID}: {SelectedPerformanceMeasure.PerformanceMeasureDisplayName}", SaveFiltersInCookie = true }; GridName = "projectFundingSourceExpendituresByOrganizationTypeGrid"; GridDataUrl = SitkaRoute <ResultsController> .BuildUrlFromExpression(x => x.SpendingByPerformanceMeasureByProjectGridJsonData(selectedPerformanceMeasure.PerformanceMeasureID)); }