Exemplo n.º 1
0
        /// <summary>
        /// Sets <see cref="thisPerson"/> home-related data to the same values of <see cref="livesWithThisOne"/>
        /// </summary>
        /// <param name="thisPerson"></param>
        /// <param name="livesWithThisOne"></param>
        public static void SetNAmerCohabitants(American thisPerson, American livesWithThisOne)
        {
            if (thisPerson == null || livesWithThisOne == null)
            {
                return;
            }
            var addrMatchTo = livesWithThisOne.GetAddressAt(null);

            if (addrMatchTo == null)
            {
                return;
            }
            thisPerson.AddAddress(addrMatchTo);
            thisPerson.GetPhoneNumbers().Clear();
            if (livesWithThisOne.GetPhoneNumbers().Any(p => p.Descriptor == KindsOfLabels.Home))
            {
                thisPerson.AddPhone(livesWithThisOne.GetPhoneNumbers().First(p => p.Descriptor == KindsOfLabels.Home));
            }
            if (thisPerson.GetAgeAt(null) < 12 ||
                String.IsNullOrWhiteSpace(addrMatchTo.CityArea?.GetPostalCodePrefix()))
            {
                return;
            }

            var mobilePhone = NorthAmericanPhone.RandomAmericanPhone(addrMatchTo.CityArea.GetPostalCodePrefix());

            mobilePhone.Descriptor = KindsOfLabels.Mobile;
            thisPerson.AddPhone(mobilePhone);
        }
Exemplo n.º 2
0
        public static IPerson RandomParent(DateTime?childDob, Gender parentGender, LinearEquation age2FirstMarriageEq = null)
        {
            var parentDob = RandomParentBirthDate(childDob, parentGender, age2FirstMarriageEq);

            var aParent = American.RandomAmerican(parentDob, parentGender, false);

            return(aParent);
        }
Exemplo n.º 3
0
        public static IPerson RandomSpouse(DateTime?myDob, Gender gender, int maxAgeDiff = 4)
        {
            if (gender == Gender.Unknown)
            {
                return(null);
            }

            myDob = myDob ?? Etx.RandomAdultBirthDate();

            var ageDiff = Etx.RandomInteger(0, maxAgeDiff);

            ageDiff = gender == Gender.Female ? ageDiff * -1 : ageDiff;

            //randomize dob of spouse
            var spouseDob = myDob.Value.AddYears(ageDiff).AddDays(Etx.RandomInteger(1, 360) * Etx.RandomPlusOrMinus());

            //define spouse
            return(American.RandomAmerican(spouseDob, gender == Gender.Female ? Gender.Male : Gender.Female));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Utility method to dump all the spouse data on an instance of <see cref="American"/>
 /// </summary>
 /// <param name="nAmer"></param>
 /// <returns></returns>
 public static List <Spouse> DumpAllSpouses(American nAmer)
 {
     return(nAmer.GetSpouses().ToList());
 }