public ProjectUpdateStatusGridSpec(ProjectUpdateStatusFilterTypeEnum projectUpdateStatusFilterTypeEnum, bool canStewardProjects) { _canStewardProjects = canStewardProjects; AddViewEditColumn(projectUpdateStatusFilterTypeEnum); Add("Reporting Period Update Status", x => { var projectUpdateState = x.GetLatestUpdateState(); if (projectUpdateState == null || (projectUpdateState == ProjectUpdateState.Approved && x.GetLatestApprovedUpdateBatch().LastUpdateDate < FirmaDateUtilities.LastReportingPeriodStartDate())) { return("Not Started"); } return(projectUpdateState.ToEnum.ToString()); }, 110, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(Models.FieldDefinition.FhtProjectNumber.ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.FhtProjectNumber), 100, DhtmlxGridColumnFilterType.Text); Add(Models.FieldDefinition.ProjectName.ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.ProjectName), 180, DhtmlxGridColumnFilterType.Html); Add(Models.FieldDefinition.OrganizationPrimaryContact.ToGridHeaderString(), x => x.GetPrimaryContact() == null ? ViewUtilities.NoneString.ToHTMLFormattedString() : x.GetPrimaryContact().GetFullNameFirstLastAndOrgShortNameAsUrl(), 95); Add(Models.FieldDefinition.ProjectStage.ToGridHeaderString(), x => x.ProjectStage.ProjectStageDisplayName, 80, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(Models.FieldDefinition.StartApprovalDate.ToGridHeaderString(), x => x.GetPlannedDate(), 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(Models.FieldDefinition.ExpirationDate.ToGridHeaderString(), x => x.GetExpirationDateFormatted(), 115, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(Models.FieldDefinition.CompletionDate.ToGridHeaderString(), x => x.GetCompletionDateFormatted(), 90, DhtmlxGridColumnFilterType.SelectFilterStrict); Add(Models.FieldDefinition.EstimatedTotalCost.ToGridHeaderString(), x => x.EstimatedTotalCost, 100, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total); Add(Models.FieldDefinition.ProjectGrantAllocationRequestTotalAmount.ToGridHeaderString(), x => x.GetTotalFunding(), 95, DhtmlxGridColumnFormatType.CurrencyWithCents, 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 Submitted", x => x.GetLatestUpdateSubmittalDate(), 120); Add("Last Approved", x => { var latestApprovedUpdateBatch = x.GetLatestApprovedUpdateBatch(); return(latestApprovedUpdateBatch?.LastUpdateDate); }, 120); }
public PeopleReceivingReminderGridSpec(bool showCheckbox, FirmaSession currentFirmaSession) { if (showCheckbox) { AddCheckBoxColumn(); Add("PersonID", x => x.PersonID, 0); } Add(FieldDefinitionEnum.OrganizationPrimaryContact.ToType().ToGridHeaderString(), x => x.GetFullNameFirstLastAndOrgShortNameAsUrl(currentFirmaSession), 220); Add("Email", a => a.Email, 170); Add($"Total Updateable {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", x => x.GetPrimaryContactUpdatableProjects(currentFirmaSession).Count, 75, DhtmlxGridColumnAggregationType.Total); Add("Updates Not Started", x => { return(x.GetPrimaryContactUpdatableProjects(currentFirmaSession).Count(y => { var latestNotApprovedUpdateBatch = y.GetLatestNotApprovedUpdateBatch(); var latestApprovedUpdateBatch = y.GetLatestApprovedUpdateBatch(); return latestNotApprovedUpdateBatch == null && (latestApprovedUpdateBatch == null || latestApprovedUpdateBatch.LastUpdateDate < FirmaDateUtilities.LastReportingPeriodStartDate()); })); }, 70, DhtmlxGridColumnAggregationType.Total); Add("Updates In Progress", x => { return(x.GetPrimaryContactUpdatableProjects(currentFirmaSession).Count(y => { var latestNotApprovedUpdateBatch = y.GetLatestNotApprovedUpdateBatch(); return latestNotApprovedUpdateBatch != null && latestNotApprovedUpdateBatch.IsCreated(); })); }, 70, DhtmlxGridColumnAggregationType.Total); Add("Updates Submitted", x => { return(x.GetPrimaryContactUpdatableProjects(currentFirmaSession).Count(y => { var latestNotApprovedUpdateBatch = y.GetLatestNotApprovedUpdateBatch(); return latestNotApprovedUpdateBatch != null && latestNotApprovedUpdateBatch.IsSubmitted(); })); }, 75, DhtmlxGridColumnAggregationType.Total); Add("Updates Returned", x => { return(x.GetPrimaryContactUpdatableProjects(currentFirmaSession).Count(y => { var latestNotApprovedUpdateBatch = y.GetLatestNotApprovedUpdateBatch(); return latestNotApprovedUpdateBatch != null && latestNotApprovedUpdateBatch.IsReturned(); })); }, 70, DhtmlxGridColumnAggregationType.Total); Add("Updates Approved", x => { return(x.GetPrimaryContactUpdatableProjects(currentFirmaSession).Count(y => { var latestApprovedUpdateBatch = y.GetLatestApprovedUpdateBatch(); return latestApprovedUpdateBatch != null && latestApprovedUpdateBatch.LastUpdateDate >= FirmaDateUtilities.LastReportingPeriodStartDate(); })); }, 70, DhtmlxGridColumnAggregationType.Total); Add("Reminders Sent", x => x.Notifications.Count( y => y.NotificationType == NotificationType.ProjectUpdateReminder && y.NotificationDate >= FirmaDateUtilities.LastReportingPeriodStartDate()), 80); Add("Date of Last Reminder Message", x => { var mostRecentReminder = x.GetMostRecentReminder(); return(mostRecentReminder?.NotificationDate); }, 130); }
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); }