/// <summary> /// Adds a species note to a species. /// </summary> /// <param name="taxon">the species to receive the new note</param> /// <returns>the species note</returns> protected BO.Taxonomy.TaxonomyNote AddTaxonomyNote(BOTaxon taxon) { BO.Taxonomy.TaxonomyNote note = new BO.Taxonomy.TaxonomyNote(); note.OtherId = taxon.Id; note.Content = "Test"; note.Subject = "Test"; note.Active = true; note = (BO.Taxonomy.TaxonomyNote)note.Save(); Assert.IsNotNull(note); Assert.IsTrue(note.NoteId > 0); return(note); }
/// <summary> /// Adds an animal delegation authority to a species. /// </summary> /// <param name="taxon">the species to receive the new authority</param> /// <param name="availableCode">a string containing two ids in the form "ddd,aaa" where ddd is /// the delegation code and aaa is the application type id</param> /// <returns>the animal delegation authority</returns> protected BOAnimalDelegationAuthority AddAnimalDelegationAuthority(BOTaxon taxon, string availableCode) { BOAnimalDelegationAuthority authority = new BOAnimalDelegationAuthority(); string[] parts = availableCode.Split(",".ToCharArray()); authority.DelegationCode = Int32.Parse(parts[0]); authority.ApplicationTypeID = Int32.Parse(parts[1]); authority.SpeciesKingdomID = taxon.KingdomID; authority.SpeciesTaxonomyID = taxon.TaxonId; authority.SpeciesTaxonTypeID = taxon.TaxonTypeID; authority.HyperlinkRTARoadmap = "www.unittest.com"; return((BOAnimalDelegationAuthority)authority.Save()); }
public void Setup() { SetCriteria(); mCommonCriteria.SearchForComponentType = SearchableTaxonomyComponentEnum.SpeciesTaxon; mStringCriteria.SearchString = string.Empty; Assert.AreEqual(mStringCriteria.SearchString, string.Empty); mSearchResults = BO.Taxonomy.TaxonomySearch.SearchTaxa(mCommonCriteria, mStringCriteria); Assert.IsNotNull(mSearchResults); Assert.IsNotNull(mSearchResults.Taxa); Assert.IsTrue(mSearchResults.Taxa.Length > 0); mSpecies = mSearchResults.Taxa[0]; }
/// <summary> /// Retrieve a collection of available guideline codes for a particular species /// </summary> /// <param name="taxon">the species</param> /// <returns>a collection of strings containing two ids in the form "ddd,aaa" where ddd is /// the delegation code and aaa is the application type id</returns> public ArrayList GetAvailableGuidelineCodes(BOTaxon taxon) { DelegationGuidelineBoundCollection guidelines = BODelegationGuideline.GetAll(false); BOAnimalDelegationAuthorityDisplay[] displays = GetDelegationDisplays(taxon); ArrayList available = new ArrayList(); Assert.IsNotNull(displays); Assert.IsNotNull(guidelines); foreach (DelegationGuideline guideline in guidelines) // build up array of "x,y" strings { available.Add(guideline.Code.ToString() + "," + guideline.ApplicationTypeCode.ToString()); } foreach (BOAnimalDelegationAuthorityDisplay display in displays) // reduce array as "x,y" strings are found { BOAnimalDelegationAuthority authority = GetAuthority(display); available.Remove(authority.DelegationCode.ToString() + "," + authority.ApplicationTypeID.ToString()); } return(available); // any left? }
/// <summary> /// Retrieves a collection of delegation "display" objects for a particular species. /// </summary> /// <param name="taxon">the species</param> /// <returns>the collection of delegation "display" objects</returns> protected BOAnimalDelegationAuthorityDisplay[] GetDelegationDisplays(BOTaxon taxon) { BOAnimalDelegationAuthorityDisplay[] displays = taxon.GetAnimalDelegationAuthority(); Assert.IsNotNull(displays); return(displays); }