public static Funding CreateFunding( HedwigContext context, FundingSource source = FundingSource.CDC, Enrollment enrollment = null, ReportingPeriod firstReportingPeriod = null, ReportingPeriod lastReportingPeriod = null, FundingSpace fundingSpace = null ) { enrollment = enrollment ?? EnrollmentHelper.CreateEnrollment(context); fundingSpace = fundingSpace ?? FundingSpaceHelper.CreateFundingSpace(context, enrollment.Site.OrganizationId); var funding = new Funding { EnrollmentId = enrollment.Id, Source = source, FirstReportingPeriodId = firstReportingPeriod != null ? firstReportingPeriod.Id : null as int?, LastReportingPeriodId = lastReportingPeriod != null ? lastReportingPeriod.Id : null as int?, FundingSpaceId = fundingSpace != null ? fundingSpace.Id : null as int? }; context.Fundings.Add(funding); context.SaveChanges(); return(funding); }
public static Enrollment CreateEnrollment( HedwigContext context, string entry = "2000-01-01", string exit = null, Age ageGroup = Age.InfantToddler, Child child = null, Site site = null ) { child = child ?? ChildHelper.CreateChild(context); site = site ?? SiteHelper.CreateSite(context); var enrollment = new Enrollment { ChildId = child.Id, SiteId = site.Id, Entry = DateTime.Parse(entry), AgeGroup = ageGroup }; if (exit != null) { enrollment.Exit = DateTime.Parse(exit); } context.Enrollments.Add(enrollment); context.SaveChanges(); return(enrollment); }
public static Child CreateChild( HedwigContext context, string firstName = "Test", string lastName = "Child", string birthdate = "2000-01-01", Gender gender = Gender.Unknown, Family family = null, Organization organization = null ) { family = family ?? FamilyHelper.CreateFamily(context); organization = organization ?? OrganizationHelper.CreateOrganization(context); var child = new Child { FirstName = firstName, LastName = lastName, Birthdate = DateTime.Parse(birthdate), Gender = gender, FamilyId = family.Id, OrganizationId = organization.Id }; context.Add <Child>(child); context.SaveChanges(); return(child); }
public static Report CreateCdcReport( HedwigContext context, ReportingPeriod reportingPeriod = null, Organization organization = null, string submittedAt = null ) { reportingPeriod = reportingPeriod ?? ReportingPeriodHelper.CreateReportingPeriod(context, type: FundingSource.CDC); organization = organization ?? OrganizationHelper.CreateOrganization(context); var report = new CdcReport { ReportingPeriodId = reportingPeriod.Id, OrganizationId = organization.Id }; if (submittedAt != null) { report.SubmittedAt = DateTime.Parse(submittedAt); } context.Reports.Add(report); context.SaveChanges(); return(report); }
public static FundingSpace CreateFundingSpace( HedwigContext context, int organizationId, FundingSource source = FundingSource.CDC, Age ageGroup = Age.Preschool, FundingTime time = FundingTime.Full, int capacity = 10 ) { var timeSplit = time != FundingTime.Split ? null : new FundingTimeSplit { FullTimeWeeks = 42, PartTimeWeeks = 10 }; var space = new FundingSpace { OrganizationId = organizationId, Source = source, AgeGroup = ageGroup, Capacity = capacity, Time = time, TimeSplit = timeSplit }; context.Add(space); context.SaveChanges(); return space; }
public static Organization CreateOrganization( HedwigContext context, string name = "Test Organization", ICollection <Site> sites = null ) { var organization = new Organization { Name = name, Sites = sites }; context.Organizations.Add(organization); context.SaveChanges(); return(organization); }
public static Family CreateFamily( HedwigContext context, Organization organization = null ) { organization = organization ?? OrganizationHelper.CreateOrganization(context); var family = new Family { OrganizationId = organization.Id }; context.Add(family); context.SaveChanges(); return(family); }
public static Site CreateSite( HedwigContext context, string name = "Test Site", Organization organization = null ) { organization = organization ?? OrganizationHelper.CreateOrganization(context); var site = new Site { Name = name, OrganizationId = organization.Id }; context.Sites.Add(site); context.SaveChanges(); return(site); }
public static OrganizationPermission CreateOrganizationPermission( HedwigContext context, User user = null, Organization org = null ) { user = user ?? UserHelper.CreateUser(context); org = org ?? OrganizationHelper.CreateOrganization(context); var orgPermission = new OrganizationPermission { OrganizationId = org.Id, UserId = user.Id }; context.Permissions.Add(orgPermission); context.SaveChanges(); return(orgPermission); }
public static SitePermission CreateSitePermission( HedwigContext context, User user = null, Site site = null ) { user = user ?? UserHelper.CreateUser(context); site = site ?? SiteHelper.CreateSite(context); var sitePermission = new SitePermission { SiteId = site.Id, UserId = user.Id }; context.Permissions.Add(sitePermission); context.SaveChanges(); return(sitePermission); }
public static User CreateUser( HedwigContext context, string firstName = "Test", string lastName = "User", Guid?wingedKeysId = null ) { Guid _wingedKeysId = wingedKeysId ?? Guid.NewGuid(); var user = new User { FirstName = firstName, LastName = lastName, WingedKeysId = _wingedKeysId }; context.Users.Add(user); context.SaveChanges(); return(user); }
public static ReportingPeriod CreateReportingPeriod( HedwigContext context, FundingSource type = FundingSource.CDC, string period = "2019-10-01", string periodStart = "2019-10-01", string periodEnd = "2019-10-01", string dueAt = "2019-10-01" ) { var reportingPeriod = new ReportingPeriod { Type = type, Period = DateTime.Parse(period), PeriodStart = DateTime.Parse(periodStart), PeriodEnd = DateTime.Parse(periodEnd), DueAt = DateTime.Parse(dueAt) }; context.Add(reportingPeriod); context.SaveChanges(); return(reportingPeriod); }
public static FamilyDetermination CreateDetermination( HedwigContext context, int numberOfPeople = 3, decimal income = 20000M, string determined = "2000-01-01", Family family = null ) { family = family ?? FamilyHelper.CreateFamily(context); var determination = new FamilyDetermination { NumberOfPeople = numberOfPeople, Income = income, DeterminationDate = DateTime.Parse(determined), FamilyId = family.Id }; context.FamilyDeterminations.Add(determination); context.SaveChanges(); return(determination); }