public PersonRelationType[] ToSpouses(CivilStatusKodeType existingStatusCode, CivilStatusKodeType[] terminatedStatusCodes, bool sameGenderSpouseForDead, Func<string, Guid> cpr2uuidFunc) { if (cpr2uuidFunc != null) { if (this.SpousePNR > 0) { var status = Converters.ToCivilStatusKodeType(this.MaritalStatus); if (status == CivilStatusKodeType.Ugift // Dead && this.Spouse != null && sameGenderSpouseForDead == (this.Gender == this.Spouse.Gender) ) { return PersonRelationType.CreateList(cpr2uuidFunc(this.ToSpousePNR()), null, this.ToMaritalStatusDate()); } else if (status == existingStatusCode) // Married or registered partner { return PersonRelationType.CreateList(cpr2uuidFunc(this.ToSpousePNR()), this.ToMaritalStatusDate(), null); } else if (terminatedStatusCodes.Contains(status)) // Terminated relationship (divorced, widow...) { return PersonRelationType.CreateList(cpr2uuidFunc(this.ToSpousePNR()), null, this.ToMaritalStatusDate()); } } return new PersonRelationType[0]; } else { throw new ArgumentNullException("cpr2uuidFunc"); } }
public static PersonRelationType[] ToFatherOrMother(Func <string, Guid> cpr2uuidFunc, string parentPnr, DateTime?parentDate) { if (!string.IsNullOrEmpty(parentPnr)) { return(PersonRelationType.CreateList( cpr2uuidFunc(parentPnr), parentDate, null )); } return(new PersonRelationType[0]); }
public PersonRelationType[] ToMother(Func<string, Guid> cpr2uuidFunc) { if (this.MotherPNR > 0) { if (Converters.IsValidCprNumber(this.MotherPNR)) { if (cpr2uuidFunc != null) { return PersonRelationType.CreateList(cpr2uuidFunc(Converters.ToCprNumber(this.MotherPNR))); } else { throw new ArgumentNullException("cpr2uuidFunc"); } } else { throw new ArgumentException("Invalid MotherPNR", "citizen.MotherPNR"); } } return new PersonRelationType[0]; }