private ProjectGrantAllocationExpenditureBulk(ProjectGrantAllocationExpenditureUpdate projectGrantAllocationExpenditureUpdate, List <ProjectGrantAllocationExpenditureUpdate> projectGrantAllocationExpenditureUpdates, IEnumerable <int> calendarYearsToPopulate) { ProjectID = projectGrantAllocationExpenditureUpdate.ProjectUpdateBatch.ProjectID; GrantAllocationID = projectGrantAllocationExpenditureUpdate.GrantAllocationID; CalendarYearExpenditures = new List <CalendarYearMonetaryAmount>(); Add(projectGrantAllocationExpenditureUpdates); // we need to fill in the other calendar years with blanks var usedCalendarYears = projectGrantAllocationExpenditureUpdates.Select(x => x.CalendarYear).ToList(); CalendarYearExpenditures.AddRange(calendarYearsToPopulate.Where(x => !usedCalendarYears.Contains(x)).ToList().Select(x => new CalendarYearMonetaryAmount(x, null))); }
public static ProjectUpdateBatch CreateNewProjectUpdateBatchForProject(Project project, Person currentPerson) { var projectUpdateBatch = CreateProjectUpdateBatchAndLogTransition(project, currentPerson); // basics & map ProjectUpdate.CreateFromProject(projectUpdateBatch); // expenditures ProjectGrantAllocationExpenditureUpdate.CreateFromProject(projectUpdateBatch); // project expenditures exempt reporting years ProjectExemptReportingYearUpdate.CreateExpendituresExemptReportingYearsFromProject(projectUpdateBatch); // expenditures exempt explanation projectUpdateBatch.SyncExpendituresYearsExemptionExplanation(); // Expected Funding ProjectGrantAllocationRequestUpdate.CreateFromProject(projectUpdateBatch); // performance measures // TODO Neutered Per WA DNR #1446. May decide to bring it back later //PerformanceMeasureActualUpdate.CreateFromProject(projectUpdateBatch); // project performance measures exempt reporting years ProjectExemptReportingYearUpdate.CreatePerformanceMeasuresExemptReportingYearsFromProject(projectUpdateBatch); // project exempt reporting years reason projectUpdateBatch.SyncPerformanceMeasureActualYearsExemptionExplanation(); // project locations - detailed ProjectLocationUpdate.CreateFromProject(projectUpdateBatch); // project priority landscape ProjectPriorityLandscapeUpdate.CreateFromProject(projectUpdateBatch); // project region ProjectRegionUpdate.CreateFromProject(projectUpdateBatch); // photos ProjectImageUpdate.CreateFromProject(projectUpdateBatch); projectUpdateBatch.IsPhotosUpdated = false; // external links ProjectExternalLinkUpdate.CreateFromProject(projectUpdateBatch); // notes ProjectNoteUpdate.CreateFromProject(projectUpdateBatch); // organizations ProjectOrganizationUpdate.CreateFromProject(projectUpdateBatch); ProjectPersonUpdate.CreateFromProject(projectUpdateBatch); // Documents ProjectDocumentUpdate.CreateFromProject(projectUpdateBatch); // Custom attributes ProjectCustomAttributeUpdate.CreateFromProject(projectUpdateBatch); return(projectUpdateBatch); }
public static void DeleteProjectGrantAllocationExpenditureUpdate(this IQueryable <ProjectGrantAllocationExpenditureUpdate> projectGrantAllocationExpenditureUpdates, ProjectGrantAllocationExpenditureUpdate projectGrantAllocationExpenditureUpdateToDelete) { DeleteProjectGrantAllocationExpenditureUpdate(projectGrantAllocationExpenditureUpdates, new List <ProjectGrantAllocationExpenditureUpdate> { projectGrantAllocationExpenditureUpdateToDelete }); }
public void Add(ProjectGrantAllocationExpenditureUpdate projectGrantAllocationExpenditureUpdate) { Check.Require(projectGrantAllocationExpenditureUpdate.ProjectUpdateBatch.ProjectID == ProjectID && projectGrantAllocationExpenditureUpdate.GrantAllocationID == GrantAllocationID, "Row doesn't align with collection mismatch ProjectID and GrantAllocationID"); CalendarYearExpenditures.Add(new CalendarYearMonetaryAmount(projectGrantAllocationExpenditureUpdate.CalendarYear, projectGrantAllocationExpenditureUpdate.ExpenditureAmount)); }