public ProjectGrantAllocationExpenditureBulk(ProjectGrantAllocationExpenditure projectGrantAllocationExpenditure,
                                                     List <ProjectGrantAllocationExpenditure> projectGrantAllocationExpenditures,
                                                     IEnumerable <int> calendarYearsToPopulate)
        {
            ProjectID                = projectGrantAllocationExpenditure.ProjectID;
            GrantAllocationID        = projectGrantAllocationExpenditure.GrantAllocationID;
            CalendarYearExpenditures = new List <CalendarYearMonetaryAmount>();
            Add(projectGrantAllocationExpenditures);
            // we need to fill in the other calendar years with blanks
            var usedCalendarYears = projectGrantAllocationExpenditures.Select(x => x.CalendarYear).ToList();

            CalendarYearExpenditures.AddRange(calendarYearsToPopulate.Where(x => !usedCalendarYears.Contains(x)).ToList().Select(x => new CalendarYearMonetaryAmount(x, null)));
        }
 public static void DeleteProjectGrantAllocationExpenditure(this IQueryable <ProjectGrantAllocationExpenditure> projectGrantAllocationExpenditures, ProjectGrantAllocationExpenditure projectGrantAllocationExpenditureToDelete)
 {
     DeleteProjectGrantAllocationExpenditure(projectGrantAllocationExpenditures, new List <ProjectGrantAllocationExpenditure> {
         projectGrantAllocationExpenditureToDelete
     });
 }
 private static ProjectGrantAllocationExpenditureUpdate MakeNewProjectGrantAllocationExpenditureUpdate(ProjectUpdateBatch projectUpdateBatch, ProjectGrantAllocationExpenditure projectGrantAllocationExpenditure)
 {
     return(new ProjectGrantAllocationExpenditureUpdate(projectUpdateBatch,
                                                        projectGrantAllocationExpenditure.CalendarYear,
                                                        projectGrantAllocationExpenditure.ExpenditureAmount,
                                                        projectGrantAllocationExpenditure.GrantAllocation));
 }
 public void Add(ProjectGrantAllocationExpenditure projectGrantAllocationExpenditure)
 {
     Check.Require(projectGrantAllocationExpenditure.ProjectID == ProjectID && projectGrantAllocationExpenditure.GrantAllocationID == GrantAllocationID,
                   "Row doesn't align with collection mismatch ProjectID and GrantAllocationID");
     CalendarYearExpenditures.Add(new CalendarYearMonetaryAmount(projectGrantAllocationExpenditure.CalendarYear, projectGrantAllocationExpenditure.ExpenditureAmount));
 }