public RelationListeType ToRelationListeType(Func <string, Guid> cpr2UuidFunc) { // Marriages var civilStates = Interval .CreateFromData <TimedTypeWrapper <ICivilStatus> >(this.ItemsAsTimedType, new DataTypeTags[] { DataTypeTags.CivilStatus }) .Select(w => w.TimedObject) .ToList(); var spouses = CivilStatusWrapper.ToSpouses(null, civilStates, cpr2UuidFunc); var partners = CivilStatusWrapper.ToRegisteredPartners(null, civilStates, cpr2UuidFunc); // Now fill the return object return(new RelationListeType() { Aegtefaelle = spouses, RegistreretPartner = partners, Fader = FromLatestRegistration <ParentsInformationType>().ToFather(cpr2UuidFunc), Moder = FromLatestRegistration <ParentsInformationType>().ToMother(cpr2UuidFunc), Boern = ChildType.ToPersonFlerRelationType(LatestRegistration.Child, cpr2UuidFunc), RetligHandleevneVaergemaalsindehaver = ToRetligHandleevneVaergemaalsindehaver(cpr2UuidFunc), Foraeldremyndighedsindehaver = ToForaeldremyndighedsindehaver(cpr2UuidFunc), Bopaelssamling = null, ErstatningAf = ToErstatningAf(cpr2UuidFunc), ErstatningFor = null, Foraeldremyndighedsboern = null, LokalUdvidelse = null, RetligHandleevneVaergeForPersonen = null }); }
public RelationListeType ToRelationListeType(Func <string, Guid> cpr2uuidConverter, DPRDataContext dataContext) { Func <decimal, Guid> cpr2uuidFunc = (cpr) => cpr2uuidConverter(cpr.ToPnrDecimalString()); var ret = new RelationListeType(); // Now fill the relations var fatherPnr = Utilities.ToParentPnr(this.PersonTotal.FatherPersonalOrBirthdate); if (fatherPnr.HasValue) { ret.Fader = new PersonRelationType[] { PersonRelationType.Create( cpr2uuidFunc(fatherPnr.Value), null, null ) }; } var motherPnr = Utilities.ToParentPnr(this.PersonTotal.MotherPersonalOrBirthDate); if (motherPnr.HasValue) { ret.Moder = new PersonRelationType[] { PersonRelationType.Create (cpr2uuidFunc(motherPnr.Value), null, null ) }; } // Fill children (including adults) ret.Boern = Child.ToPersonFlerRelationTypeArray(Children, cpr2uuidFunc); // TODO : Fill custody children ret.Foraeldremyndighedsboern = null; // Normal spouse(s) ret.Aegtefaelle = CivilStatusWrapper.ToSpouses(null, this.CivilStatesAsInterface, cpr2uuidConverter); // Registered partner(s) ret.RegistreretPartner = CivilStatusWrapper.ToRegisteredPartners(null, this.CivilStatesAsInterface, cpr2uuidConverter); //TODO: Has legal authority on ret.RetligHandleevneVaergeForPersonen = null; //TODO: People who have legal authority on this person ret.Foraeldremyndighedsindehaver = null; return(ret); }
public void ToSpouses_InvalidPNR_EmptyArray( [Values('U', 'G', 'F', 'E', 'P', 'O', 'L', 'D')] char maritalStatus, [Values(1, 20, 130, 12345678)] decimal pnr) { var civil = new CurrentCivilStatusType() { CivilStatusCode = maritalStatus, PNR = Converters.DecimalToString(pnr, 10) }; var ret = CivilStatusWrapper.ToSpouses(civil, null, cpr => Guid.NewGuid()); Assert.IsEmpty(ret); }
public PersonRelationType[] ToSpouses(Func <string, Guid> cpr2uuidFunc) { return(CivilStatusWrapper.ToSpouses(this.CurrentCivilStatus, this.HistoricalCivilStatusAsInterface, cpr2uuidFunc)); }