コード例 #1
0
        public override void CreateOccupants(List <Person> people, List <Gender> genders, HousingContext.Tenancy tenancy, List <Tenant> tenants)
        {
            var mainPerson   = SocialPerson.GetNewAdult(genders, GetNextPersonId(people));
            var socialPerson = new SocialPerson(mainPerson);

            people.Add(mainPerson);
            var jointPerson = socialPerson.CreatePartner(GetNextPersonId(people), genders);

            people.Add(jointPerson);
            tenants.Add(new Tenant()
            {
                Id        = GetNexTenantId(tenants),
                PersonId  = mainPerson,
                TenancyId = tenancy,
                IsPrimary = true,
                IsJoint   = true
            });
            tenants.Add(new Tenant()
            {
                Id        = GetNexTenantId(tenants),
                PersonId  = jointPerson,
                TenancyId = tenancy,
                IsPrimary = false,
                IsJoint   = true
            });
        }
コード例 #2
0
        public override void CreateOccupants(List <Person> people, List <Gender> genders, HousingContext.Tenancy tenancy, List <Tenant> tenants)
        {
            var mainPerson = SocialPerson.GetNewAdult(genders, GetNextPersonId(people));

            people.Add(mainPerson);
            var socialPerson = new SocialPerson(mainPerson);

            if (Faker.RandomNumber.Next(1, 2) == 1)
            {
                people.Add(socialPerson.CreatePartner(GetNextPersonId(people), genders));
                tenants.Add(new Tenant()
                {
                    Id        = GetNexTenantId(tenants),
                    PersonId  = mainPerson,
                    TenancyId = tenancy,
                    IsPrimary = true,
                    IsJoint   = false
                });
            }

            for (var i = 0; i < Faker.RandomNumber.Next(1, 3); i++)
            {
                var kid = socialPerson.CreateChild(GetNextPersonId(people), genders);
                people.Add(kid);
                tenants.Add(new Tenant()
                {
                    Id        = GetNexTenantId(tenants),
                    PersonId  = mainPerson,
                    TenancyId = tenancy,
                    IsPrimary = false,
                    IsJoint   = false
                });
            }
        }