Ejemplo n.º 1
0
        /// <summary>
        /// Retrieve all rec areas associated with a specific organization.
        /// </summary>
        /// <param name="orgId">The id for the organization.</param>
        /// <returns>An array containing all of the recreation areas associated with an organization.</returns>
        public RIDBRecArea[] GetAllRecAreas(int orgId)
        {
            GetPageDelegate <RIDBRecArea> del = delegate(RIDBSearchParameters searchParams)
            {
                return(SearchRecAreas(orgId, searchParams));
            };

            return(Client.GetAll <RIDBRecArea>(null, del));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieve all events associated with a specific recreation area.
        /// </summary>
        /// <param name="recAreaId">The id of the recreation area.</param>
        /// <returns>An array of event objects.</returns>
        public RIDBEvent[] GetAllEvents(int recAreaId)
        {
            GetPageDelegate <RIDBEvent> del = delegate(RIDBSearchParameters searchParams)
            {
                return(SearchEvents(recAreaId, searchParams));
            };

            return(Client.GetAll <RIDBEvent>(null, del));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get all of the addresses associated with a single recreation area.
        /// </summary>
        /// <param name="recAreaId">The id for the recreation area.</param>
        /// <returns>An array of all of the addresses associated with that recreation area.</returns>
        public RIDBRecAreaAddress[] GetAllAddresses(int recAreaId)
        {
            GetPageDelegate <RIDBRecAreaAddress> del = delegate(RIDBSearchParameters searchParams)
            {
                return(SearchAddresses(recAreaId, searchParams));
            };

            return(Client.GetAll <RIDBRecAreaAddress>(null, del));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Retrieve all of the media objects associated with a recreation area.
        /// </summary>
        /// <param name="recAreaId">The id of the recreation area.</param>
        /// <returns>An array of media objects.</returns>
        public RIDBEntityMedia[] GetAllMedia(int recAreaId)
        {
            GetPageDelegate <RIDBEntityMedia> del = delegate(RIDBSearchParameters searchParams)
            {
                return(SearchMedia(recAreaId, searchParams));
            };

            return(Client.GetAll <RIDBEntityMedia>(null, del));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Get all of the tours associated with a specific facility.
        /// </summary>
        /// <param name="facilityId">The id of the facility.</param>
        /// <returns>An array of tour objects.</returns>
        public RIDBTour[] GetAllTours(int facilityId)
        {
            GetPageDelegate <RIDBTour> del = delegate(RIDBSearchParameters searchParams)
            {
                return(SearchTours(facilityId, searchParams));
            };

            return(Client.GetAll <RIDBTour>(null, del));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Get all of the addresses associated with all facilities.  Warning:  This retrieves thousands of records!
        /// </summary>
        /// <returns>An array containing ALL of the addresses for all facilities.</returns>
        public RIDBFacilityAddress[] GetAllAddresses()
        {
            GetPageDelegate <RIDBFacilityAddress> del = delegate(RIDBSearchParameters searchParams)
            {
                return(SearchAddresses(searchParams));
            };

            return(Client.GetAll <RIDBFacilityAddress>(null, del));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Get all of the permit entrances associated with a specific facility.
        /// </summary>
        /// <param name="facilityId">The id of the facility.</param>
        /// <returns>An array of permit entrance objects.</returns>
        public RIDBPermitEntrance[] GetAllPermitEntrances(int facilityId)
        {
            GetPageDelegate <RIDBPermitEntrance> del = delegate(RIDBSearchParameters searchParams)
            {
                return(SearchPermitEntrances(facilityId, searchParams));
            };

            return(Client.GetAll <RIDBPermitEntrance>(null, del));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Get all of the campsites associated with a specific facility.
        /// </summary>
        /// <param name="facilityId">The id of the facility.</param>
        /// <returns>An array of campsite objects.</returns>
        public RIDBCampsite[] GetAllCampsites(int facilityId)
        {
            GetPageDelegate <RIDBCampsite> del = delegate(RIDBSearchParameters searchParams)
            {
                return(SearchCampsites(facilityId, searchParams));
            };

            return(Client.GetAll <RIDBCampsite>(null, del));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Get all of the activities associated with a specific facility.
        /// </summary>
        /// <param name="facilityId">The id of the facility.</param>
        /// <returns>An array of activity objects.</returns>
        public RIDBActivity[] GetAllActivities(int facilityId)
        {
            GetPageDelegate <RIDBActivity> del = delegate(RIDBSearchParameters searchParams)
            {
                return(SearchActivities(facilityId, searchParams));
            };

            return(Client.GetAll <RIDBActivity>(null, del));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Retrieve all facilities associated with a specific recreation area.
        /// </summary>
        /// <param name="recAreaId">The id for the recreation area.</param>
        /// <returns>An array containing all of the facilities associated with an organization.</returns>
        public RIDBFacility[] GetAllFacilities(int recAreaId)
        {
            GetPageDelegate <RIDBFacility> del = delegate(RIDBSearchParameters searchParams)
            {
                return(SearchFacilities(recAreaId, searchParams));
            };

            return(Client.GetAll <RIDBFacility>(null, del));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Retrieve all of the links associated with a recreation area.
        /// </summary>
        /// <param name="recAreaId">The id of the recreation area.</param>
        /// <returns>An array of link objects.</returns>
        public RIDBEntityLink[] GetAllLinks(int recAreaId)
        {
            GetPageDelegate <RIDBEntityLink> del = delegate(RIDBSearchParameters searchParams)
            {
                return(SearchLinks(recAreaId, searchParams));
            };

            return(Client.GetAll <RIDBEntityLink>(null, del));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Retrieve all links in RIDB.  Warning: this retrieves all pages of link results and will return thousands
        /// of objects.  This method should be only used when all links need handled at the same time.
        /// </summary>
        /// <returns>An array containing all of the links in RIDB.</returns>
        public RIDBEntityLink[] GetAll()
        {
            GetPageDelegate <RIDBEntityLink> del = delegate(RIDBSearchParameters searchParams)
            {
                return(Search(searchParams));
            };

            return(Client.GetAll <RIDBEntityLink>(null, del));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Retrieve all of the attributes associated with a permit entrance.
        /// </summary>
        /// <param name="permitEntranceId">The id of the permit entrance.</param>
        /// <returns>An array of all of the attributes for that permit entrance.</returns>
        public RIDBAttribute[] GetAllAttributes(int permitEntranceId)
        {
            GetPageDelegate <RIDBAttribute> del = delegate(RIDBSearchParameters searchParams)
            {
                return(SearchAttributes(permitEntranceId, searchParams));
            };

            return(Client.GetAll <RIDBAttribute>(null, del));
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Retrieve all organizations in RIDB.
        /// </summary>
        /// <returns>An array containing all of the organizations in RIDB.</returns>
        public RIDBOrganization[] GetAll()
        {
            GetPageDelegate <RIDBOrganization> del = delegate(RIDBSearchParameters searchParams)
            {
                return(Search(searchParams));
            };

            return(Client.GetAll <RIDBOrganization>(null, del));
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Retrieve all permit entrances in RIDB.  Warning: this retrieves many recordss.  This method should be only used
        /// when all permit entrances need handled.
        /// </summary>
        /// <returns>An array containing all of the permit entrances in RIDB.</returns>
        public RIDBPermitEntrance[] GetAll()
        {
            GetPageDelegate <RIDBPermitEntrance> del = delegate(RIDBSearchParameters searchParams)
            {
                return(Search(searchParams));
            };

            return(Client.GetAll <RIDBPermitEntrance>(null, del));
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Retrieve all permitted equipment for a specific campsite.
        /// </summary>
        /// <param name="campsiteId">The id for the campsite.</param>
        /// <returns>An array containing all of the permitted equipment for that campsite.</returns>
        public RIDBPermittedEquipment[] GetAllPermittedEquipment(int campsiteId)
        {
            GetPageDelegate <RIDBPermittedEquipment> del = delegate(RIDBSearchParameters searchParams)
            {
                return(SearchPermittedEquipment(campsiteId, searchParams));
            };

            return(Client.GetAll <RIDBPermittedEquipment>(null, del));
        }
        /// <summary>
        /// Retrieve all activities from RIDB.
        /// </summary>
        /// <returns>Array contraining all RIDB activities.</returns>
        public RIDBActivity[] GetAll()
        {
            GetPageDelegate <RIDBActivity> del = delegate(RIDBSearchParameters searchParams)
            {
                return(Search(searchParams));
            };

            return(Client.GetAll <RIDBActivity>(null, del));
        }
Ejemplo n.º 18
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="AsyncPageCursor&lt;TItem&gt;" /> class
 /// </summary>
 /// <param name="getPage">Method to retrieve a page of results syncronously</param>
 /// <param name="getPageAsync">Method to retrieve a page of results asyncronously</param>
 /// <param name="pageSize">The number of results to return per page</param>
 public AsyncPageCursor(GetPageDelegate getPage, GetPageAsyncDelegate getPageAsync, short pageSize)
 {
     if (getPage == null)
     {
         throw new ArgumentNullException(nameof(getPage));
     }
     if (getPageAsync == null)
     {
         throw new ArgumentNullException(nameof(getPageAsync));
     }
     _getPage      = getPage;
     _getPageAsync = getPageAsync;
     _pageSize     = pageSize;
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Returns all results from a call.  When searching RIDB, pages of results are generated.  This method
        /// will call a method repeatedly to aggregate all of the results from all pages of results.  This method should not
        /// typically be called directly.  Instead call the methods on each of the client modules which will in turn use this method if
        /// the module function requires retrieval of all results.
        /// </summary>
        /// <typeparam name="T">The type of RIDB object included in the results.</typeparam>
        /// <param name="searchParams">Any search parameters</param>
        /// <param name="pager">A delegate that is expected to return a single page of results.</param>
        /// <returns>An array of all of the results from all result pages.</returns>
        public T[] GetAll <T>(RIDBSearchParameters searchParams, GetPageDelegate <T> pager)
        {
            if (searchParams == null)
            {
                searchParams = new RIDBSearchParameters();
            }
            searchParams.Offset = 0;
            searchParams.Limit  = 50;

            var  results = new List <T>();
            bool atEnd   = false;

            while (!atEnd)
            {
                var page = pager(searchParams);
                results.AddRange(page.Data);
                atEnd = (results.Count >= page.Metadata.Results.TotalCount) || (page.Metadata.Results.CurrentCount == 0);
                searchParams.Offset += page.Metadata.Results.CurrentCount;
            }

            return(results.ToArray());
        }