public List <TaxonRank> GetDefaultChildRanks(string parentElemType, string kingdomCode)
        {
            var list = new List <TaxonRank>();

            StoredProcReaderForEach("spBiotaDefGetChildren", (reader) => {
                list.Add(TaxonMapper.MapTaxonRank(reader));
            }, _P("vchrRank", parentElemType), _P("vchrKingdom", kingdomCode));
            return(list);
        }
        public List <Taxon> GetTaxaForParent(int taxonId)
        {
            List <Taxon> taxa = new List <Taxon>();

            StoredProcReaderForEach("spBiotaList", (reader) => {
                taxa.Add(TaxonMapper.MapTaxon(reader));
            }, new SqlParameter("intParentId", taxonId));

            return(taxa);
        }
        public List <Taxon> GetTopLevelTaxa()
        {
            List <Taxon> taxa = new List <Taxon>();

            StoredProcReaderForEach("spBiotaListTop", (reader) => {
                taxa.Add(TaxonMapper.MapTaxon(reader));
            });

            return(taxa);
        }
        public List <Taxon> GetExpandFullTree(int taxonId)
        {
            List <Taxon> taxa = new List <Taxon>();

            StoredProcReaderForEach("spBiotaListFullTree", (reader) => {
                taxa.Add(TaxonMapper.MapTaxon(reader, new ConvertingMapper("NumChildren", (elem) => { return(Int32.Parse(elem == null ? "-1" : elem.ToString())); })));
            }, new SqlParameter("intParentId", taxonId));

            return(taxa);
        }
        public List <TaxonSearchResult> FindTaxa(string searchTerm)
        {
            List <TaxonSearchResult> taxa = new List <TaxonSearchResult>();

            searchTerm = EscapeSearchTerm(searchTerm, true); /// * are wildcards, replace them with the SQL wildcard

            StoredProcReaderForEach("spBiotaFind", (reader) => {
                taxa.Add(TaxonMapper.MapTaxonSearchResult(reader));
            }, new SqlParameter("vchrLimitations", ""), new SqlParameter("vchrTaxaToFind", searchTerm));

            return(taxa);
        }
 /// <summary>
 /// The rank list is cached because it rarely, if ever, changes.
 /// </summary>
 /// <returns></returns>
 public List <TaxonRank> GetTaxonRanks()
 {
     lock (_rankLock) {
         if (_rankList == null)
         {
             _rankList = new List <TaxonRank>();
             StoredProcReaderForEach("spBiotaDefRankGetAll", (reader) => {
                 _rankList.Add(TaxonMapper.MapTaxonRank(reader));
             });
         }
     }
     return(_rankList);
 }