internal static string CreateCompleteAddress(AddressLinkSyndicationItem address, SyndicationContext context)
        {
            // update streetname, municipality
            var streetName   = context.StreetNameLatestItems.AsNoTracking().First(x => x.StreetNameId == address.StreetNameId);
            var municipality = context.MunicipalityLatestItems.AsNoTracking().First(x => x.NisCode == streetName.NisCode);

            var municipalityName = string.Empty;
            var streetNameName   = string.Empty;

            switch (municipality.PrimaryLanguage)
            {
            case null:
            case Taal.NL:
            default:
                municipalityName = municipality.NameDutch;
                streetNameName   = streetName.NameDutch;
                break;

            case Taal.FR:
                municipalityName = municipality.NameFrench;
                streetNameName   = streetName.NameFrench;
                break;

            case Taal.DE:
                municipalityName = municipality.NameGerman;
                streetNameName   = streetName.NameGerman;
                break;

            case Taal.EN:
                municipalityName = municipality.NameEnglish;
                streetNameName   = streetName.NameEnglish;
                break;
            }

            return
                (new VolledigAdres(
                     streetNameName,
                     address.HouseNumber,
                     address.BoxNumber,
                     address.PostalCode,
                     municipalityName,
                     Taal.NL)
                 .GeografischeNaam
                 .Spelling);
        }
        private byte[] CreateDbaseRecord(Parcel parcel, AddressLinkSyndicationItem address, SyndicationContext context)
        {
            var record = new AddressLinkDbaseRecord
            {
                objecttype = { Value = "Perceel" },
                adresobjid = { Value = string.IsNullOrEmpty(parcel.Identificator.ObjectId) ? "" : parcel.Identificator.ObjectId },
            };

            if (address != null)
            {
                if (!string.IsNullOrEmpty(address.PersistentLocalId))
                {
                    record.adresid.Value = Convert.ToInt32(address.PersistentLocalId);
                }

                record.voladres.Value = AddressBuildingUnitLinkProjections.CreateCompleteAddress(address, context);
            }

            return(record.ToBytes(_encoding));
        }
Ejemplo n.º 3
0
        internal static string CreateCompleteAddress(AddressLinkSyndicationItem address, SyndicationContext context)
        {
            // update streetname, municipality
            var streetName   = context.StreetNameLatestItems.AsNoTracking().First(x => x.StreetNameId == address.StreetNameId);
            var municipality = context.MunicipalityLatestItems.AsNoTracking().First(x => x.NisCode == streetName.NisCode);

            var municipalityName = string.Empty;
            var streetNameName   = string.Empty;

            switch (municipality.PrimaryLanguage)
            {
            case null:
            case Taal.NL:
            default:
                municipalityName = municipality.NameDutch;
                streetNameName   = streetName.NameDutch;
                break;

            case Taal.FR:
                municipalityName = municipality.NameFrench;
                streetNameName   = streetName.NameFrench;
                break;

            case Taal.DE:
                municipalityName = municipality.NameGerman;
                streetNameName   = streetName.NameGerman;
                break;

            case Taal.EN:
                municipalityName = municipality.NameEnglish;
                streetNameName   = streetName.NameEnglish;
                break;
            }

            return(string.IsNullOrEmpty(address.BoxNumber)
                ? $"{streetNameName} {address.HouseNumber}, {address.PostalCode}, {municipalityName}"
                : $"{streetNameName} {address.HouseNumber} bus {address.BoxNumber}, {address.PostalCode}, {municipalityName}");
        }
        private byte[] CreateDbaseRecord(BuildingUnitSyndicationContent buildingUnit, AddressLinkSyndicationItem address, SyndicationContext context)
        {
            var record = new AddressLinkDbaseRecord
            {
                objecttype = { Value = "Gebouweenheid" },
                adresobjid = { Value = string.IsNullOrEmpty(buildingUnit.Identificator.ObjectId) ? "" : buildingUnit.Identificator.ObjectId },
            };

            if (address != null)
            {
                if (!string.IsNullOrEmpty(address.PersistentLocalId))
                {
                    record.adresid.Value = Convert.ToInt32(address.PersistentLocalId);
                }

                record.voladres.Value = CreateCompleteAddress(address, context);
            }

            return(record.ToBytes(_encoding));
        }