private void SetParentStatistics(PregNode person, Dictionary <string, PregNode> allpersons) { var hasDad = !string.IsNullOrEmpty(person.DadNin); var hasMom = !string.IsNullOrEmpty(person.MomNin); var dad = (hasDad && allpersons.ContainsKey(person.DadNin) && allpersons[person.DadNin].Confirmed) ? allpersons[person.DadNin] : null; var mom = (hasMom && allpersons.ContainsKey(person.MomNin) && allpersons[person.MomNin].Confirmed) ? allpersons[person.MomNin] : null; if (hasDad) { ParentninExists_GivenHaveParentNin.Update(dad != null ? 1 : 0); } if (hasMom) { ParentninExists_GivenHaveParentNin.Update(mom != null ? 1 : 0); } if (dad != null && mom != null) { ParentSameSex_GivenHaveValidParentNin.Update(dad.Kjonn == mom.Kjonn ? 1:0); } if (hasDad && hasMom) { ParentsAreMarried.Update(dad != null && mom != null && (dad.MarriedNin == mom.Nin || mom.MarriedNin == dad.Nin) ? 1 : 0); } }
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(); }