コード例 #1
0
        /// <summary>
        /// Get all child taxa.
        /// Parent taxa are also included in the result.
        /// </summary>
        /// <param name="context">Web service request context.</param>
        /// <param name="parentTaxonGuids">GUIDs for parent taxa.</param>
        /// <returns>All child taxa.</returns>
        private List <WebTaxon> GetChildTaxaByGuids(WebServiceContext context,
                                                    List <String> parentTaxonGuids)
        {
            List <Int32>           parentTaxonIds;
            WebTaxonSearchCriteria searchCriteria;

            // Convert taxon GUIDs to taxon ids.
            parentTaxonIds = new List <Int32>();
            if (parentTaxonGuids.IsNotEmpty())
            {
                foreach (String parentTaxonGuid in parentTaxonGuids)
                {
                    // TODO: This assumption about taxon GUIDs may
                    // change in the future.
                    parentTaxonIds.Add(parentTaxonGuid.WebParseInt32());
                }
            }

            // Create search criteria.
            searchCriteria = new WebTaxonSearchCriteria();
            searchCriteria.IsIsValidTaxonSpecified = true;
            searchCriteria.IsValidTaxon            = true;
            searchCriteria.Scope    = TaxonSearchScope.AllChildTaxa;
            searchCriteria.TaxonIds = parentTaxonIds;

            // Get child taxa.
            return(GetTaxaBySearchCriteria(context, searchCriteria));
        }
コード例 #2
0
        /// <summary>
        /// Get taxa by SearchCriteria.
        /// </summary>
        /// <param name="context">Web service request context.</param>
        /// <param name="searchCriteria">Search criteria.</param>
        /// <returns>List of taxons.</returns>
        public virtual List <WebTaxon> GetTaxaBySearchCriteria(WebServiceContext context, WebTaxonSearchCriteria searchCriteria)
        {
            WebClientInformation clientInformation = GetClientInformation(context, WebServiceId.TaxonService);
            List <WebTaxon>      taxa = new List <WebTaxon>();

            if (searchCriteria.IsNotNull())
            {
                taxa = WebServiceProxy.TaxonService.GetTaxaBySearchCriteria(clientInformation, searchCriteria);
            }

            return(taxa);
        }