Exemplo n.º 1
0
 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));
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 public static UnikIdType Clone(UnikIdType unikId)
 {
     if (unikId != null)
     {
         return(unikId.MemberwiseClone() as UnikIdType);
     }
     return(null);
 }
Exemplo n.º 3
0
 public VirkningType ToVirkningType()
 {
     return(new VirkningType()
     {
         AktoerRef = UnikIdType.Clone(this.AktoerRef),
         CommentText = this.CommentText,
         FraTidspunkt = TidspunktType.Create(TidspunktType.ToDateTime(this.FraTidspunkt)),
         TilTidspunkt = null
     });
 }
Exemplo n.º 4
0
 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()
             )
     });
 }
Exemplo n.º 5
0
 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");
     }
 }
Exemplo n.º 6
0
 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);
 }