Exemplo n.º 1
0
        public static RegisterOplysningType ToRegisterOplysningType(PersonAttributes db)
        {
            if (db != null)
            {
                var ret = new RegisterOplysningType();

                if (db.CprData != null)
                {
                    ret.Item = CprData.ToXmlType(db.CprData);
                }
                else if (db.ForeignCitizenData != null)
                {
                    ret.Item = ForeignCitizenData.ToXmlType(db.ForeignCitizenData);
                }
                else if (db.UnknownCitizenData != null)
                {
                    ret.Item = UnknownCitizenData.ToXmlType(db.UnknownCitizenData);
                }

                if (ret.Item != null)
                {
                    ret.Virkning = Effect.ToVirkningType(db.Effect);
                    return(ret);
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        public List <SoegObjektType> ToSoegObjektTypes(String name, String address)
        {
            List <NavnStrukturType> navnStrukturTypes = new List <NavnStrukturType>();
            List <SoegObjektType>   soegObjekts       = new List <SoegObjektType>();

            if (name != "" && name.Split(' ').Length == 1)
            {
                for (int i = 0; i < 3; i++)
                {
                    navnStrukturTypes.Add(ToNavnStrukturType(name, i));
                }
            }
            else
            {
                navnStrukturTypes.Add(ToNavnStrukturType(name));
            }

            foreach (NavnStrukturType navnStrukturType in navnStrukturTypes)
            {
                AdresseType addressObject = ToAddressType(address);
                if (navnStrukturType == null && addressObject == null)
                {
                    return(null);
                }

                SoegAttributListeType soegAttributListeType = new SoegAttributListeType();

                // Now fill Egenskab & registerOplysning
                SoegEgenskabType soegEgenskabType = new SoegEgenskabType();
                soegEgenskabType.NavnStruktur      = navnStrukturType;
                soegAttributListeType.SoegEgenskab = new SoegEgenskabType[] { soegEgenskabType };

                if (addressObject != null)
                {
                    RegisterOplysningType registerOplysningType = new RegisterOplysningType();

                    CprBorgerType cprBorgerType = new CprBorgerType();
                    cprBorgerType.FolkeregisterAdresse = addressObject;
                    registerOplysningType.Item         = cprBorgerType;

                    soegAttributListeType.SoegRegisterOplysning = new RegisterOplysningType[] { registerOplysningType };
                }

                SoegObjektType soegObjekt = new SoegObjektType();
                soegObjekt.SoegAttributListe = soegAttributListeType;

                soegObjekts.Add(soegObjekt);
            }

            return(soegObjekts);
        }
Exemplo n.º 3
0
        public SoegObjektType AddressToSoegObjekt(IAddress address)
        {
            if (address == null)
            {
                return(null);
            }

            SoegAttributListeType soegAttributListeType = new SoegAttributListeType();

            // Now fill Egenskab & registerOplysning
            SoegEgenskabType soegEgenskabType = new SoegEgenskabType();

            soegEgenskabType.NavnStruktur      = null;
            soegAttributListeType.SoegEgenskab = new SoegEgenskabType[] { soegEgenskabType };

            if (address != null)
            {
                RegisterOplysningType registerOplysningType = new RegisterOplysningType();

                CprBorgerType cprBorgerType = new CprBorgerType();
                AdresseType   addressObject = getAdresseType(address);
                if (addressObject == null)
                {
                    return(null);
                }

                cprBorgerType.FolkeregisterAdresse = addressObject;
                registerOplysningType.Item         = cprBorgerType;

                soegAttributListeType.SoegRegisterOplysning = new RegisterOplysningType[] { registerOplysningType };
            }

            SoegObjektType soegObjekt = new SoegObjektType();

            soegObjekt.SoegAttributListe = soegAttributListeType;
            return(soegObjekt);
        }
Exemplo n.º 4
0
            public RegisterOplysningType ToRegisterOplysningType(WS_AS78205.EnglishAS78205Response addressResponse)
            {
                var ret = new RegisterOplysningType()
                {
                    Item     = null,
                    Virkning = VirkningType.Create(null, null)
                };

                // TODO: Always return CprBorgerType !!!!
                if (string.Equals(NationalityCode, Constants.DanishNationalityCode))
                {
                    ret.Item = new CprBorgerType()
                    {
                        PersonCivilRegistrationIdentifier = PNR,
                        PersonNationalityCode             = Schemas.Part.CountryIdentificationCodeType.Create(CprBroker.Schemas.Part._CountryIdentificationSchemeType.imk, NationalityCode),
                        FolkeregisterAdresse = addressResponse.ToAdresseType(),
                        // Research protection
                        ForskerBeskyttelseIndikator = Protection.Equals(Constants.ResearchProtection),
                        // Name and address protection
                        NavneAdresseBeskyttelseIndikator = Protection.Equals(Constants.AddressProtection),
                        // Church membership
                        // TODO: Shall this be ChurchRelationship = 'F'?
                        FolkekirkeMedlemIndikator = ChurchRelationship.Length > 0,
                        // No address note
                        AdresseNoteTekst = null,
                        //PNR validity status
                        // TODO: Shall this be set as other providers, false if status is 30,50,60 ?
                        PersonNummerGyldighedStatusIndikator = int.Parse(ReturnCode) < 10,

                        // TODO: Check if this is correct
                        TelefonNummerBeskyttelseIndikator = Protection.Equals(Constants.AddressProtection),
                    };
                    ret.Virkning.FraTidspunkt = TidspunktType.Create(Utilities.GetMaxDate(AddressDate, RelocationDate, ImmigrationDate));
                }
                else if (!string.IsNullOrEmpty(NationalityCode))
                {
                    // TODO: Validate all data in this structure
                    ret.Item = new UdenlandskBorgerType()
                    {
                        // Birth country.Not in KMD
                        FoedselslandKode = null,
                        // TODO: What is that?
                        PersonIdentifikator = "",
                        // Languages. Not implemented here
                        SprogKode = new CprBroker.Schemas.Part.CountryIdentificationCodeType[0],
                        // Citizenships
                        PersonNationalityCode = new CprBroker.Schemas.Part.CountryIdentificationCodeType[] { CprBroker.Schemas.Part.CountryIdentificationCodeType.Create(CprBroker.Schemas.Part._CountryIdentificationSchemeType.imk, NationalityCode) },
                        PersonCivilRegistrationReplacementIdentifier = PNR,
                    };
                    ret.Virkning.FraTidspunkt = TidspunktType.Create(Utilities.GetMaxDate(ImmigrationDate, AbroadDate));
                }
                else
                {
                    // TODO: Validate all data in this structure
                    ret.Item = new UkendtBorgerType()
                    {
                        PersonCivilRegistrationReplacementIdentifier = PNR,
                    };
                    ret.Virkning.FraTidspunkt = TidspunktType.Create(Utilities.GetMaxDate(AbroadDate, AddressDate, DisempowermentDate, ImmigrationDate, PaternityDate, RelocationDate, StatusDate));
                }
                return(ret);
            }