public ProjectUpdateStatusGridSpec(FirmaSession currentFirmaSession, ProjectUpdateStatusFilterTypeEnum projectUpdateStatusFilterTypeEnum, bool canStewardProjects) { _canStewardProjects = canStewardProjects; AddViewEditColumn(projectUpdateStatusFilterTypeEnum); Add("Reporting Period Update Status", x => { var projectUpdateState = x.GetLatestUpdateStateResilientToDuplicateUpdateBatches(); var latestApprovedUpdateBatch = x.GetLatestApprovedUpdateBatch(); if (projectUpdateState == null || (projectUpdateState == ProjectUpdateState.Approved && latestApprovedUpdateBatch != null && !latestApprovedUpdateBatch.LastUpdateDate.IsDateInRange(FirmaDateUtilities.LastReportingPeriodStartDate(), FirmaDateUtilities.LastReportingPeriodEndDate()))) { return("Not Started"); } return(projectUpdateState.ToEnum.ToString()); }, 110, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.ProjectName.ToType().ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.ProjectName), 180, DhtmlxGridColumnFilterType.Html); Add(FieldDefinitionEnum.OrganizationPrimaryContact.ToType().ToGridHeaderString(), x => x.GetPrimaryContact() == null ? ViewUtilities.NoneString.ToHTMLFormattedString() : x.GetPrimaryContact().GetFullNameFirstLastAndOrgShortNameAsUrl(currentFirmaSession), 95); Add(FieldDefinitionEnum.IsPrimaryContactOrganization.ToType().ToGridHeaderString(), x => x.GetPrimaryContactOrganization().GetDisplayNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html); Add(FieldDefinitionEnum.ProjectStage.ToType().ToGridHeaderString(), x => x.ProjectStage.ProjectStageDisplayName, 80, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.PlanningDesignStartYear.ToType().ToGridHeaderString(), x => ProjectModelExtensions.GetPlanningDesignStartYear(x), 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.ImplementationStartYear.ToType().ToGridHeaderString(), x => ProjectModelExtensions.GetImplementationStartYear(x), 115, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.CompletionYear.ToType().ToGridHeaderString(), x => ProjectModelExtensions.GetCompletionYear(x), 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(FieldDefinitionEnum.EstimatedTotalCost.ToType().ToGridHeaderString(), x => x.GetEstimatedTotalRegardlessOfFundingType(), 100, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total); Add(FieldDefinitionEnum.SecuredFunding.ToType().ToGridHeaderString(), x => x.GetSecuredFunding(), 95, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total); if (projectUpdateStatusFilterTypeEnum != ProjectUpdateStatusFilterTypeEnum.MySubmittedProjects) { AddSubmitColumn(); } Add("Last Updated", x => !x.ProjectUpdateBatches.Any() ? (DateTime?)null : x.ProjectUpdateBatches.Max(y => y.LastUpdateDate), 120); Add("Last Updated By", x => !x.ProjectUpdateBatches.Any() ? string.Empty : x.ProjectUpdateBatches.OrderByDescending(y => y.LastUpdateDate).First().LastUpdatePerson.GetFullNameFirstLast(), 120); Add("Last Submitted", x => x.GetLatestUpdateSubmittalDate(), 120); Add("Last Submitted By", x => x.GetLatestUpdateSubmittalPerson() != null ? x.GetLatestUpdateSubmittalPerson().GetFullNameFirstLast() : string.Empty, 120); Add("Last Approved", x => { var latestApprovedUpdateBatch = x.GetLatestApprovedUpdateBatch(); return(latestApprovedUpdateBatch?.LastUpdateDate); }, 120); Add("Last Approved By", x => { var latestApprovedUpdateBatch = x.GetLatestApprovedUpdateBatch(); return(latestApprovedUpdateBatch?.LastUpdatePerson.GetFullNameFirstLast()); }, 120); }