示例#1
0
        public TaxonPropertiesList GetTaxonProperties(IUserContext userContext, ITaxon taxon)
        {
            TaxonPropertiesList properties      = new TaxonPropertiesList();
            ITaxonCategory      taxonCategory   = GetReferenceTaxonCategory(userContext, 1);
            ITaxonProperties    taxonProperties = new TaxonProperties()
            {
                DataContext = new DataContext(userContext), IsValid = true, TaxonCategory = taxonCategory, ValidToDate = new DateTime(2111, 12, 31)
            };

            taxon.SetTaxonProperties(new List <ITaxonProperties>()
            {
                taxonProperties
            });
            properties.Add(taxonProperties);
            return(properties);
        }
示例#2
0
        /// <summary>
        /// Creates a taxon for test
        /// </summary>
        /// <returns></returns>
        public ITaxon GetReferenceParentTaxon(IUserContext userContext, int taxonId)
        {
            ITaxon refTaxon = new Taxon();

            string   conceptDefinitionPartString = "";
            DateTime createdDate   = new DateTime(2004, 01, 20);
            Int32    createdBy     = userContext.User.Id;
            string   personName    = @"Hölje Soderås";
            DateTime validFromDate = new DateTime(1763, 02, 08);
            DateTime validToDate   = new DateTime(2447, 08, 01);

            // refTaxon.ConceptDefinitionFullGeneratedString = conceptDefinitionFullGeneratedString;
            refTaxon.PartOfConceptDefinition = conceptDefinitionPartString;
            refTaxon.CreatedBy        = createdBy;
            refTaxon.CreatedDate      = createdDate;
            refTaxon.DataContext      = new DataContext(userContext);
            refTaxon.ModifiedByPerson = personName;
            refTaxon.ValidFromDate    = validFromDate;
            refTaxon.ValidToDate      = validToDate;
            refTaxon.Id = taxonId;
            int taxonNameId = DyntaxaTestSettings.Default.TestParentTaxonNameId;
            // ITaxonName refTaxonName = GetReferenceTaxonName(userContext, taxonId, taxonNameId);
            ITaxonCategory   taxonCategory   = GetReferenceTaxonCategory(userContext, 1);
            ITaxonProperties taxonProperties = new TaxonProperties()
            {
                IsValid = true, DataContext = new DataContext(userContext), TaxonCategory = taxonCategory, ValidToDate = new DateTime(2111, 12, 31)
            };

            refTaxon.SetTaxonProperties(new List <ITaxonProperties>()
            {
                taxonProperties
            });
            refTaxon.Category = taxonCategory;
            // ITaxonName recName = new TaxonName(userContext);
            refTaxon.Author         = "ReferenceParentAuthor";        //GetReferenceTaxonName(userContext, taxonId, taxonNameId).Author;
            refTaxon.ScientificName = "ReferenceParentScentificName"; //GetReferenceTaxonName(userContext, taxonId, taxonNameId).Name;
            refTaxon.CommonName     = "ReferenceParentCommonName";    //GetReferenceTaxonName(userContext, taxonId, taxonNameId + 1).Name;
            //ITaxon grandParentTaxon = GetReferenceGrandParentTaxon(userContext, DyntaxaTestSettings.Default.TestParentTaxonId +10);
            //refTaxon.GetParentTaxa(userContext).Add(new TaxonRelation() { RelatedTaxon = grandParentTaxon, ValidFromDate = DateTime.Now, ValidToDate = new DateTime(2022, 1, 30) });
            //List<ITaxonRelation> grandParentsList = new List<ITaxonRelation>();
            //grandParentsList.Add(new TaxonRelation() { RelatedTaxon = grandParentTaxon, ValidFromDate = DateTime.Now, ValidToDate = new DateTime(2022, 1, 30) });

            //refTaxon.ParentTaxa = grandParentsList;
            return(refTaxon);
        }
示例#3
0
        /// <summary>
        /// Creates a taxon for test
        /// </summary>
        /// <returns></returns>
        public ITaxon GetReferenceGrandParentTaxon(IUserContext userContext, int taxonId)
        {
            ITaxon refTaxon = new Taxon();

            string   conceptDefinitionPartString = "";
            DateTime createdDate   = new DateTime(2004, 01, 20);
            Int32    createdBy     = userContext.User.Id;
            string   personName    = @"Hölje KAos";
            DateTime validFromDate = new DateTime(1763, 02, 08);
            DateTime validToDate   = new DateTime(2447, 08, 01);

            // refTaxon.ConceptDefinitionFullGeneratedString = conceptDefinitionFullGeneratedString;
            refTaxon.PartOfConceptDefinition = conceptDefinitionPartString;
            refTaxon.CreatedBy        = createdBy;
            refTaxon.CreatedDate      = createdDate;
            refTaxon.DataContext      = new DataContext(userContext);
            refTaxon.ModifiedByPerson = personName;
            refTaxon.ValidFromDate    = validFromDate;
            refTaxon.ValidToDate      = validToDate;
            refTaxon.Id = taxonId;
            // ITaxonName refTaxonName = GetReferenceTaxonName(userContext, taxonId, taxonNameId);
            ITaxonCategory   taxonCategory   = GetReferenceTaxonCategory(userContext, 1);
            ITaxonProperties taxonProperties = new TaxonProperties()
            {
                IsValid = true, TaxonCategory = taxonCategory, ValidToDate = new DateTime(2111, 12, 31)
            };

            refTaxon.SetTaxonProperties(new List <ITaxonProperties>()
            {
                taxonProperties
            });
            refTaxon.Category = taxonCategory;
            // ITaxonName recName = new TaxonName(userContext);
            refTaxon.Author         = "ReferenceGrandParentAuthor";        //GetReferenceTaxonName(userContext, taxonId, taxonNameId).Author;
            refTaxon.ScientificName = "ReferenceGrandParentScentificName"; //GetReferenceTaxonName(userContext, taxonId, taxonNameId).Name;
            refTaxon.CommonName     = "ReferenceGrandParentCommonName";    //GetReferenceTaxonName(userContext, taxonId, taxonNameId + 1).Name;

            return(refTaxon);
        }
示例#4
0
        /// <summary>
        /// Creates a taxon for test
        /// </summary>
        /// <returns></returns>
        public ITaxon GetReferenceTaxon(IUserContext userContext, int taxonId)
        {
            ITaxon refTaxon = new Taxon();

            string   conceptDefinitionPartString = "ConceptDefinitionPartString Text";
            DateTime createdDate   = new DateTime(2004, 01, 20);
            Int32    createdBy     = userContext.User.Id;
            string   personName    = @"Hölje Soderås";
            DateTime validFromDate = new DateTime(1763, 02, 08);
            DateTime validToDate   = new DateTime(2447, 08, 01);

            // refTaxon.ConceptDefinitionFullGeneratedString = conceptDefinitionFullGeneratedString;
            refTaxon.PartOfConceptDefinition = conceptDefinitionPartString;
            refTaxon.CreatedBy        = createdBy;
            refTaxon.CreatedDate      = createdDate;
            refTaxon.DataContext      = new DataContext(userContext);
            refTaxon.ModifiedByPerson = personName;
            refTaxon.ValidFromDate    = validFromDate;
            refTaxon.ValidToDate      = validToDate;
            refTaxon.Id = taxonId;
            int taxonNameId = DyntaxaTestSettings.Default.TestTaxonNameId;
            //ITaxonName refTaxonName = GetReferenceTaxonName(userContext, taxonId, taxonNameId);
            //ITaxonName refTaxonName2 = GetReferenceTaxonName(userContext, taxonId, taxonNameId +1);
            //refTaxonName2.IsRecommended = false;
            ITaxonCategory   taxonCategory   = GetReferenceTaxonCategory(userContext, 0);
            ITaxonProperties taxonProperties = new TaxonProperties()
            {
                DataContext = new DataContext(userContext), IsValid = true, TaxonCategory = taxonCategory, ValidToDate = new DateTime(2111, 12, 31)
            };

            refTaxon.SetTaxonProperties(new List <ITaxonProperties>()
            {
                taxonProperties
            });
            refTaxon.Category = taxonCategory;
            //ITaxonName recName = new TaxonName(userContext);
            refTaxon.Author         = "ReferenceAuthor";        //GetReferenceTaxonName(userContext, taxonId, taxonNameId).Author;
            refTaxon.ScientificName = "ReferenceScentificName"; //GetReferenceTaxonName(userContext, taxonId, taxonNameId).Name;
            refTaxon.CommonName     = "ReferenceCommonName";    //GetReferenceTaxonName(userContext, taxonId, taxonNameId + 1).Name;

            ITaxon parentTaxon = GetReferenceParentTaxon(userContext, DyntaxaTestSettings.Default.TestParentTaxonId);

            //TaxonRelationList relationList = refTaxon.GetNearestParentTaxonRelations(userContext);
            //ITaxonRelation taxonRel = new TaxonRelation() { ParentTaxon = parentTaxon, ValidFromDate = DateTime.Now, ValidToDate = new DateTime(2022, 1, 30), IsMainRelation = true, ReplacedInTaxonRevisionEventId = null };
            //relationList.Add(taxonRel);
            refTaxon.GetNearestParentTaxonRelations(userContext).Add(new TaxonRelation()
            {
                ParentTaxon = parentTaxon, ValidFromDate = DateTime.Now, ValidToDate = new DateTime(2022, 1, 30), IsMainRelation = true, ReplacedInTaxonRevisionEventId = null
            });
            ITaxon taxon = new Taxon();

            taxon.Id        = 3897845;
            taxon.SortOrder = 4;
            taxon.Category  = new TaxonCategory()
            {
                Id = 2
            };
            TaxonRelationList parentsList = new TaxonRelationList();

            parentsList.Add(new TaxonRelation()
            {
                ParentTaxon = parentTaxon, ValidFromDate = DateTime.Now, ValidToDate = new DateTime(2022, 1, 30), IsMainRelation = true, ReplacedInTaxonRevisionEventId = null, ChildTaxon = taxon
            });
            refTaxon.IsInRevision = true;
            refTaxon.SetParentTaxa(parentsList);

            return(refTaxon);
        }