예제 #1
0
        /// <summary>
        /// Convert TaxonTreeSearchCriteria to WebTaxonTreeSearchCriteria.
        /// </summary>
        /// <param name="searchCriteria">A TaxonTreeSearchCriteria instance.</param>
        /// <returns>A WebTaxonTreeSearchCriteria instance.</returns>
        private static WebTaxonTreeSearchCriteria GetTaxonTreeSearchCriteria(TaxonTreeSearchCriteria searchCriteria)
        {
            WebTaxonTreeSearchCriteria webSearchCriteria;

            webSearchCriteria = new WebTaxonTreeSearchCriteria();
            if (searchCriteria.RestrictSearchToTaxonIds.IsNotNull())
            {
                webSearchCriteria.RestrictSearchToTaxonIds = searchCriteria.RestrictSearchToTaxonIds;
            }
            if (searchCriteria.RestrictSearchToTaxonTypeIds.IsNotNull())
            {
                webSearchCriteria.RestrictSearchToTaxonTypeIds = searchCriteria.RestrictSearchToTaxonTypeIds;
            }
            webSearchCriteria.TaxonInformationType = searchCriteria.TaxonInformationType;
#if DATA_SPECIFIED_EXISTS
            webSearchCriteria.TaxonInformationTypeSpecified = true;
#endif
            return(webSearchCriteria);
        }
예제 #2
0
        /// <summary>
        /// Get information about taxon trees that matches the search criteria.
        /// </summary>
        /// <param name="searchCriteria">The taxon trees search criteria.</param>
        /// <returns>Taxon trees</returns>
        /// <exception cref="ArgumentException">Thrown if searchCriteria is null.</exception>
        public static TaxonTreeNodeList GetTaxonTreesBySearchCriteria(TaxonTreeSearchCriteria searchCriteria)
        {
            TaxonTreeNodeList          taxonTrees;
            List <WebTaxonTreeNode>    webTaxonTrees;
            WebTaxonTreeSearchCriteria webSearchCriteria;

            // Check arguments.
            searchCriteria.CheckNotNull("searchCriteria");

            // Get data from web service.
            webSearchCriteria = GetTaxonTreeSearchCriteria(searchCriteria);
            webTaxonTrees     = WebServiceClient.GetTaxonTreesBySearchCriteria(webSearchCriteria);
            taxonTrees        = new TaxonTreeNodeList();
            foreach (WebTaxonTreeNode webTaxonTree in webTaxonTrees)
            {
                taxonTrees.Add(GetTaxonTree(webTaxonTree));
            }
            return(taxonTrees);
        }