示例#1
0
        /// <summary>
        /// Get bag residential object service.
        /// </summary>
        /// <param name="bag">Factory to extend.</param>
        /// <returns>See <see cref="Bag.ResidentialObjectService"/>.</returns>
        public static ResidentialObjectService ResidentialObjectService(this KadasterBag bag)
        {
            if (bag == null)
            {
                throw new ArgumentNullException(nameof(bag));
            }

            return(bag.GetService(BagService.ResidentialObject) as ResidentialObjectService);
        }
示例#2
0
        /// <summary>
        /// Get bag public space service.
        /// </summary>
        /// <param name="bag">Factory to extend.</param>
        /// <returns>See <see cref="Bag.PublicSpaceService"/>.</returns>
        public static PublicSpaceService PublicSpaceService(this KadasterBag bag)
        {
            if (bag == null)
            {
                throw new ArgumentNullException(nameof(bag));
            }

            return(bag.GetService(BagService.PublicSpace) as PublicSpaceService);
        }
示例#3
0
        /// <summary>
        /// Get bag city service.
        /// </summary>
        /// <param name="bag">Factory to extend.</param>
        /// <returns>See <see cref="Bag.CityService"/>.</returns>
        public static CityService CityService(this KadasterBag bag)
        {
            if (bag == null)
            {
                throw new ArgumentNullException(nameof(bag));
            }

            return(bag.GetService(BagService.City) as CityService);
        }
示例#4
0
        /// <summary>
        /// Get bag designation service.
        /// </summary>
        /// <param name="bag">Factory to extend.</param>
        /// <returns>See <see cref="Bag.DesignationService"/>.</returns>
        public static DesignationService DesignationService(this KadasterBag bag)
        {
            if (bag == null)
            {
                throw new ArgumentNullException(nameof(bag));
            }

            return(bag.GetService(BagService.Designation) as DesignationService);
        }
示例#5
0
        /// <summary>
        /// Request city from designation.
        /// </summary>
        /// <param name="bagObject">Entity to extend.</param>
        /// <param name="bag">BAG registrar.</param>
        /// <returns><see cref="BagObject{City}"/>.</returns>
        public static BagObject <City> City(this BagObject <PublicSpace> bagObject, KadasterBag bag)
        {
            if (bagObject == null)
            {
                throw new ArgumentNullException(nameof(bagObject));
            }

            if (bag == null)
            {
                throw new ArgumentNullException(nameof(bag));
            }

            var cityService = bag.CityService();
            var uri         = bagObject.Value.Links.City.Href;
            var id          = uri.Segments[4]; // TODO: This may not always be true;

            return(cityService.GetById(new BagId(id)));
        }
示例#6
0
        /// <summary>
        /// Request residential object from premise.
        /// </summary>
        /// <param name="bagObject">Entity to extend.</param>
        /// <param name="bag">BAG registrar.</param>
        /// <returns><see cref="BagObject{ResidentialObject}"/>.</returns>
        public static BagObject <ResidentialObject> ResidentialObject(this BagObject <Premise> bagObject, KadasterBag bag)
        {
            if (bagObject == null)
            {
                throw new ArgumentNullException(nameof(bagObject));
            }

            if (bag == null)
            {
                throw new ArgumentNullException(nameof(bag));
            }

            var residentialObjectService = bag.ResidentialObjectService();
            var uri = bagObject.Value.Links.ResidentialObject.Href;
            var id  = uri.Segments[4]; // TODO: This may not always be true;

            return(residentialObjectService.GetById(new BagId(id)));
        }
示例#7
0
        /// <summary>
        /// Request residential object from designation.
        /// </summary>
        /// <param name="bagObject">Entity to extend.</param>
        /// <param name="bag">BAG registrar.</param>
        /// <returns><see cref="BagObject{ResidentialObject}"/>.</returns>
        public static BagObject <ResidentialObject> ResidentialObject(this BagObject <Designation> bagObject, KadasterBag bag)
        {
            if (bagObject == null)
            {
                throw new ArgumentNullException(nameof(bagObject));
            }

            if (bag == null)
            {
                throw new ArgumentNullException(nameof(bag));
            }

            var residentialObjectService = bag.ResidentialObjectService();
            var uri = bagObject.Value.Links.AddressObject.Href;

            switch (uri.Segments[3].Replace("/", null).Trim().ToLower())
            {
            case "verblijfsobjecten":
                var id = uri.Segments[4];     // TODO: This may not always be true;
                return(residentialObjectService.GetById(new BagId(id)));

            default:
                break;
            }

            return(null);
        }