private static List <int> GetYearRangesImpl(IProject projectUpdate, DateTime?startDate) { var currentYearToUse = FirmaDateUtilities.CalculateCurrentYearToUseForUpToAllowableInputInReporting(); if (projectUpdate != null) { if (startDate.HasValue && startDate.Value.Year < MultiTenantHelpers.GetMinimumYear() && (projectUpdate.GetCompletionYear().HasValue&& projectUpdate.GetCompletionYear().Value < MultiTenantHelpers.GetMinimumYear())) { // both start and completion year are before the minimum year, so no year range required return(new List <int>()); } if (startDate.HasValue && startDate.Value.Year > currentYearToUse && (projectUpdate.GetCompletionYear().HasValue&& projectUpdate.GetCompletionYear().Value > currentYearToUse)) { return(new List <int>()); } if (startDate.HasValue && projectUpdate.GetCompletionYear().HasValue&& startDate.Value.Year > projectUpdate.GetCompletionYear().Value) { return(new List <int>()); } } return(FirmaDateUtilities.CalculateCalendarYearRangeAccountingForExistingYears(new List <int>(), startDate, projectUpdate.GetCompletionYear(), currentYearToUse, MultiTenantHelpers.GetMinimumYear(), currentYearToUse)); }
public static List <int> CalculateCalendarYearRangeForExpenditures(this IEnumerable <ProjectFundingSourceExpenditure> projectFundingSourceExpenditures, FundingSource fundingSource) { var existingYears = projectFundingSourceExpenditures.Select(x => x.CalendarYear).ToList(); return(FirmaDateUtilities.CalculateCalendarYearRangeAccountingForExistingYears(existingYears, fundingSource.GetProjectsWhereYouAreTheFundingSourceMinCalendarYear(), fundingSource.GetProjectsWhereYouAreTheFundingSourceMaxCalendarYear(), DateTime.Today.Year, MultiTenantHelpers.GetMinimumYear(), null)); }
public static List <int> CalculateCalendarYearRangeForExpenditures(this IEnumerable <ProjectGrantAllocationExpenditure> projectGrantAllocationExpenditures, GrantAllocation grantAllocation) { var existingYears = projectGrantAllocationExpenditures.Select(x => x.CalendarYear).ToList(); var grantAllocationProjectsWhereYouAreTheGrantAllocationMinCalendarYear = grantAllocation.ProjectsWhereYouAreTheGrantAllocationMinCalendarYear; return(FirmaDateUtilities.CalculateCalendarYearRangeAccountingForExistingYears(existingYears, grantAllocationProjectsWhereYouAreTheGrantAllocationMinCalendarYear.HasValue ? (DateTime?)new DateTime(grantAllocationProjectsWhereYouAreTheGrantAllocationMinCalendarYear.Value, 1, 1) : null, grantAllocation.ProjectsWhereYouAreTheGrantAllocationMaxCalendarYear, DateTime.Today.Year, MultiTenantHelpers.GetMinimumYear(), null)); }