public void AssignUuids(Func <string, Guid> cprToUuidFunc) { foreach (var rels in new IPersonRelationType[][] { this.Aegtefaelle, this.Boern, this.Bopaelssamling, this.ErstatningAf, this.ErstatningFor, this.Fader, this.Foraeldremyndighedsboern, this.Foraeldremyndighedsindehaver, this.Moder, this.RegistreretPartner, this.RetligHandleevneVaergeForPersonen, this.RetligHandleevneVaergemaalsindehaver }) { if (rels != null) { foreach (var rel in rels) { if (rel != null) { rel.ReferenceID = UnikIdType.Create(cprToUuidFunc(rel.CprNumber)); } } } } }
public static UnikIdType Clone(UnikIdType unikId) { if (unikId != null) { return(unikId.MemberwiseClone() as UnikIdType); } return(null); }
public VirkningType ToVirkningType() { return(new VirkningType() { AktoerRef = UnikIdType.Clone(this.AktoerRef), CommentText = this.CommentText, FraTidspunkt = TidspunktType.Create(TidspunktType.ToDateTime(this.FraTidspunkt)), TilTidspunkt = null }); }
public PersonRelationType ToPersonRelationType(Func <string, Guid> cpr2uuidFunc, bool forPreviousInterval) { return(new PersonRelationType() { ReferenceID = UnikIdType.Create(cpr2uuidFunc(ToSpousePnr())), CommentText = "", Virkning = VirkningType.Create( forPreviousInterval ? null : _CivilStatus.ToStartTS(), forPreviousInterval ? _CivilStatus.ToStartTS() : _CivilStatus.ToEndTS() ) }); }
public static TRelation Create <TRelation>(Guid targetUuid, DateTime?fromDate, DateTime?toDate) where TRelation : IPersonRelationType, new() { if (targetUuid != Guid.Empty) { return(new TRelation() { //TODO: Add comment text CommentText = null, CprNumber = null, ReferenceID = UnikIdType.Create(targetUuid), // TODO: Fill virkning object from parameters Virkning = VirkningType.Create(fromDate, toDate) }); } else { throw new ArgumentNullException("targetUuid"); } }
public bool Overwrites(PersonRelationType olderRelation) { return(DateTime.Equals(this.Virkning.FraTidspunkt.ToDateTime(), olderRelation.Virkning.FraTidspunkt.ToDateTime()) && UnikIdType.Equals(this.ReferenceID, olderRelation.ReferenceID) && !olderRelation.Virkning.TilTidspunkt.ToDateTime().HasValue); }