Exemplo n.º 1
0
 public static ContactChannel FromXmlType(KontaktKanalType oio)
 {
     if (oio != null)
     {
         var ret = new ContactChannel()
         {
             UsageLimits = oio.BegraensetAnvendelseTekst,
             Note        = oio.NoteTekst,
         };
         if (oio.Item is string)
         {
             ret.Value = oio.Item as string;
         }
         else if (oio.Item is TelefonType)
         {
             var tel = oio.Item as TelefonType;
             ret.CanSendSms = tel.KanBrugesTilSmsIndikator;
             ret.Value      = tel.TelephoneNumberIdentifier;
         }
         else if (oio.Item is AndenKontaktKanalType)
         {
             var other = oio.Item as AndenKontaktKanalType;
             ret.Value     = other.KontaktKanalTekst;
             ret.OtherNote = other.NoteTekst;
         }
         return(ret);
     }
     return(null);
 }
Exemplo n.º 2
0
 public static EgenskabType ToXmlType(PersonProperties db)
 {
     if (db != null)
     {
         new EgenskabType()
         {
             BirthDate        = db.BirthDate,
             PersonGenderCode = Data.Part.Gender.GetPartGender(db.GenderId),
             NavnStruktur     = new NavnStrukturType()
             {
                 KaldenavnTekst = db.NickName,
                 NoteTekst      = db.NameNoteText,
                 PersonNameForAddressingName = db.AddressingName,
                 PersonNameStructure         = PersonName.ToXmlType(db.PersonName),
             },
             FoedestedNavn = db.BirthPlace,
             FoedselsregistreringMyndighedNavn = db.BirthRegistrationAuthority,
             KontaktKanal         = ContactChannel.ToXmlType(db.ContactChannel),
             NaermestePaaroerende = ContactChannel.ToXmlType(db.NextOfKinContactChannel),
             AndreAdresser        = Address.ToXmlType(db.OtherAddress),
             Virkning             = Effect.ToVirkningType(db.PersonAttributes.Effect)
         };
     }
     return(null);
 }
Exemplo n.º 3
0
        public static PersonAttributes[] FromXmlType(EgenskabType[] oio)
        {
            if (oio != null)
            {
                return(oio
                       .Where(o => o != null)
                       .Select(o =>
                               new PersonAttributes()
                {
                    PersonAttributesId = Guid.NewGuid(),
                    Effect = Effect.FromVirkningType(o.Virkning),
                    PersonProperties = new PersonProperties()
                    {
                        BirthDate = o.BirthDate,

                        GenderId = Data.Part.Gender.GetPartCode(o.PersonGenderCode),
                        BirthPlace = o.FoedestedNavn,
                        BirthRegistrationAuthority = o.FoedselsregistreringMyndighedNavn,

                        PersonName = PersonName.FromXmlType(o.NavnStruktur),

                        NickName = PersonName.GetNickName(o.NavnStruktur),
                        NameNoteText = PersonName.GetNameNoteText(o.NavnStruktur),
                        AddressingName = PersonName.GeAddressingName(o.NavnStruktur),

                        ContactChannel = ContactChannel.FromXmlType(o.KontaktKanal),
                        NextOfKinContactChannel = ContactChannel.FromXmlType(o.NaermestePaaroerende),
                        OtherAddress = Address.FromXmlType(o.AndreAdresser),
                    }
                }
                               )
                       .ToArray());
            }
            return(new PersonAttributes[0]);
        }
Exemplo n.º 4
0
        public static void SetChildLoadOptions(DataLoadOptions loadOptions)
        {
            loadOptions.LoadWith <PersonProperties>(pp => pp.ContactChannel);
            loadOptions.LoadWith <PersonProperties>(pp => pp.NextOfKinContactChannel);
            loadOptions.LoadWith <PersonProperties>(pp => pp.OtherAddress);
            loadOptions.LoadWith <PersonProperties>(pp => pp.Gender);
            loadOptions.LoadWith <PersonProperties>(pp => pp.PersonName);

            ContactChannel.SetChildLoadOptions(loadOptions);
            Address.SetChildLoadOptions(loadOptions);
        }
Exemplo n.º 5
0
        public static KontaktKanalType ToXmlType(ContactChannel db)
        {
            if (db != null)
            {
                KontaktKanalType ret = new KontaktKanalType()
                {
                    BegraensetAnvendelseTekst = db.UsageLimits,
                    NoteTekst = db.Note,
                    Item      = null
                };

                switch ((Part.ContactChannelType.ChannelTypes)db.ContactChannelTypeId)
                {
                case ContactChannelType.ChannelTypes.Email:
                    ret.Item = db.Value;
                    break;

                case ContactChannelType.ChannelTypes.Telephone:
                    ret.Item = new TelefonType()
                    {
                        KanBrugesTilSmsIndikator  = db.CanSendSms.HasValue && db.CanSendSms.Value,
                        TelephoneNumberIdentifier = db.Value,
                    };
                    break;

                case ContactChannelType.ChannelTypes.Other:
                    ret.Item = new AndenKontaktKanalType()
                    {
                        KontaktKanalTekst = db.Value,
                        NoteTekst         = db.OtherNote,
                    };
                    break;
                }
                return(ret);
            }
            return(null);
        }