示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }