public ITaxon GetTaxon(IUserContext userContext, int taxonId) { if (taxonId == DyntaxaTestSettings.Default.TestTaxonId) { return(GetReferenceTaxon(userContext, taxonId)); } if (taxonId == DyntaxaTestSettings.Default.TestParentTaxonId) { ITaxon parentTaxon = GetReferenceParentTaxon(userContext, taxonId); foreach (ITaxonRelation parent in parentTaxon.GetNearestParentTaxonRelations(userContext)) { TaxonRelationList relations = new TaxonRelationList(); ITaxon grandParentTaxon = GetReferenceGrandParentTaxon(userContext, DyntaxaTestSettings.Default.TestParentTaxonId + 10); ITaxonRelation rel = new TaxonRelation() { ParentTaxon = grandParentTaxon, ValidFromDate = DateTime.Now, ValidToDate = new DateTime(2022, 1, 30), IsMainRelation = true, ReplacedInTaxonRevisionEventId = null }; relations.Add(rel); parent.ChildTaxon = grandParentTaxon; parent.ChildTaxon.SetParentTaxa(relations); } return(parentTaxon); } if (taxonId == DyntaxaTestSettings.Default.PsophusStridulusTaxonId) { return(GetReferenceTaxon(userContext, taxonId)); } if (taxonId == DyntaxaTestSettings.Default.ParnassiusApolloId) { return(GetReferenceTaxon(userContext, taxonId)); } return(null); }
public TaxonRelationList GetTaxonRelations(IUserContext userContext, ITaxonRelationSearchCriteria searchCriteria) { ITaxon parentTaxon = GetReferenceParentTaxon(userContext, 5398); ITaxon taxon = new Taxon(); taxon.Id = 3897845; taxon.SortOrder = 4; taxon.Category = new TaxonCategory() { Id = 2 }; ITaxonRelation taxonRel = new TaxonRelation() { ParentTaxon = parentTaxon, ValidFromDate = DateTime.Now, ValidToDate = new DateTime(2022, 1, 30), IsMainRelation = true, ReplacedInTaxonRevisionEventId = null, ChildTaxon = taxon, }; TaxonRelationList list = new TaxonRelationList(); list.Add(taxonRel); return(list); }