private PregNode SetSpouseStatistics(PregNode person, Dictionary <string, PregNode> allpersons) { if (string.IsNullOrEmpty(person.MarriedNin)) { return(null); } var spouse = allpersons.ContainsKey(person.MarriedNin) && allpersons[person.MarriedNin].Confirmed ? allpersons[person.MarriedNin] : null; SpouseExists_GivenHasSpouse.Update(spouse != null ? 1 : 0); if (spouse == null) { return(null); } SpouseSameSex_GivenHasValidSpouse.Update(spouse.Kjonn == person.Kjonn ? 1 : 0); SpouseDuplex_GivenHasValidSpouse.Update(spouse.MarriedNin == person.Nin ? 1 : 0); if (person.BirthDay.HasValue && spouse.BirthDay.HasValue) { SpouseAgeDifferentialInYears.Update(Math.Abs(person.BirthDay.Value.Subtract(spouse.BirthDay.Value).TotalDays / 365)); } return(spouse); }
public void DisposeSamples() { ParentninExists_GivenHaveParentNin.DisposeSamples(); SpouseExists_GivenHasSpouse.DisposeSamples(); SpouseSameSex_GivenHasValidSpouse.DisposeSamples(); SpouseDuplex_GivenHasValidSpouse.DisposeSamples(); ParentSameSex_GivenHaveValidParentNin.DisposeSamples(); HasChildren_GivenHasSpouseNin.DisposeSamples(); HasChildren_GivenHasNotSpouseNin.DisposeSamples(); HasChildrenWithBetterHalf_GivenValidSpouseNinAndHaveChildren.DisposeSamples(); HaveMoreThanOneKidTogether_GivenHaveOneKidTogether.DisposeSamples(); NumberOfChildren_GivenHaveChildren.DisposeSamples(); AgeDifferentalInYearsToParent.DisposeSamples(); Custody_HaveParentNin.DisposeSamples(); Custody_HaveNotParentNin.DisposeSamples(); ParentsAreMarried.DisposeSamples(); SpouseAgeDifferentialInYears.DisposeSamples(); }