public static List <WebSpeciesFact> GetSomeSpeciesFacts(WebServiceContext context)
        {
            WebUserParameterSelection userParameterSelection;

            userParameterSelection          = new WebUserParameterSelection();
            userParameterSelection.TaxonIds = TaxonManagerTest.GetSomeTaxonIds();
            return(SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(context, userParameterSelection));
        }
        public void GetSpeciesFactsByUserParameterSelectionToManyError()
        {
            List <WebSpeciesFact>     speciesFacts;
            WebUserParameterSelection userParameterSelection;

            userParameterSelection = new WebUserParameterSelection();
            speciesFacts           = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(GetContext(), userParameterSelection);
            Assert.IsTrue(speciesFacts.IsNotEmpty());
        }
예제 #3
0
        /// <summary>
        /// A method that obtains red list information.
        /// </summary>
        private void LoadRedListInformation()
        {
            SpeciesFactList        speciesFacts;
            UserParameterSelection parameters;

            if (_organismGroupName.IsNull())
            {
                _organismGroupName          = String.Empty;
                _redlistCategoryName        = String.Empty;
                _redlistCategoryShortString = String.Empty;
                _redlistCriteria            = String.Empty;

                parameters = new UserParameterSelection();
                parameters.Taxa.Add(_taxon);
                parameters.Factors.Add(FactorManager.GetFactor(FactorId.RedlistCategory));
                parameters.Factors.Add(FactorManager.GetFactor(FactorId.RedlistCriteriaString));
                parameters.Factors.Add(FactorManager.GetFactor(FactorId.Redlist_OrganismLabel1));
                parameters.Periods.Add(_period);
                speciesFacts = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(parameters);
                if (speciesFacts.IsNotEmpty())
                {
                    foreach (SpeciesFact speciesFact in speciesFacts)
                    {
                        switch (speciesFact.Factor.Id)
                        {
                        case (Int32)FactorId.RedlistCategory:
                            if (speciesFact.HasField1)
                            {
                                _redlistCategoryName = speciesFact.Field1.EnumValue.OriginalLabel;
                                _redlistCategoryName = _redlistCategoryName.Remove(_redlistCategoryName.Length - 5);
                            }
                            if (speciesFact.HasField4)
                            {
                                _redlistCategoryShortString = speciesFact.Field4.StringValue;
                            }
                            break;

                        case (Int32)FactorId.RedlistCriteriaString:
                            if (speciesFact.HasField4 &&
                                speciesFact.Field4.StringValue.IsNotEmpty())
                            {
                                _redlistCriteria = speciesFact.Field4.StringValue.Trim();
                            }
                            break;

                        case (Int32)FactorId.Redlist_OrganismLabel1:
                            if (speciesFact.MainField.HasValue)
                            {
                                _organismGroupName = speciesFact.MainField.EnumValue.OriginalLabel;
                            }
                            break;
                        }
                    }
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Get species facts with species document information.
        /// </summary>
        private void GetSpeciesFacts()
        {
            UserParameterSelection parameters = new UserParameterSelection();
            TaxonList taxa = new TaxonList();

            taxa.Add(_taxon);
            parameters.Taxa = taxa;
            FactorSearchCriteria criteria  = new FactorSearchCriteria();
            List <Int32>         factorIds = new List <Int32>();

            factorIds.Add((Int32)FactorId.SpeciesInformationDocumentGroup);
            criteria.RestrictSearchToFactorIds = factorIds;
            criteria.RestrictReturnToScope     = ArtDatabanken.Data.WebService.FactorSearchScope.LeafFactors;
            parameters.Factors = FactorManager.GetFactorsBySearchCriteria(criteria);
            _speciesFacts      = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(parameters);
        }
        public void GetSpeciesFactsByUserParameterSelection()
        {
            List <Int32> factorIds, hostIds, individualCategoryIds,
                         periodIds, referenceIds, taxonIds;
            List <WebSpeciesFact>     speciesFacts;
            WebUserParameterSelection userParameterSelection;
            Int32 speciesFactCount;

            userParameterSelection = new WebUserParameterSelection();
            factorIds             = FactorManagerTest.GetSomeFactorIds();
            hostIds               = TaxonManagerTest.GetSomeTaxonIds();
            individualCategoryIds = IndividualCategoryManagerTest.GetSomeIndividualCategoryIds(GetContext());
            individualCategoryIds.RemoveAt(0);
            periodIds = PeriodManagerTest.GetSomePeriodIds(GetContext());
            periodIds.RemoveAt(periodIds.Count - 2);
            periodIds.RemoveAt(periodIds.Count - 2);
            referenceIds = ReferenceManagerTest.GetSomeReferenceIds(GetContext());
            taxonIds     = TaxonManagerTest.GetSomeTaxonIds();

            userParameterSelection.TaxonIds = taxonIds;
            speciesFacts = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(GetContext(), userParameterSelection);
            Assert.IsTrue(speciesFacts.IsNotEmpty());
            speciesFactCount = speciesFacts.Count;

            userParameterSelection.FactorIds = factorIds;
            speciesFacts = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(GetContext(), userParameterSelection);
            Assert.IsTrue(speciesFacts.IsNotEmpty());
            Assert.IsTrue(speciesFactCount > speciesFacts.Count);
            userParameterSelection.FactorIds = null;

            userParameterSelection.IndividualCategoryIds = individualCategoryIds;
            speciesFacts = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(GetContext(), userParameterSelection);
            if (speciesFacts.IsNotEmpty())
            {
                Assert.IsTrue(speciesFactCount > speciesFacts.Count);
            }
            userParameterSelection.IndividualCategoryIds = null;

            userParameterSelection.PeriodIds = periodIds;
            speciesFacts = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(GetContext(), userParameterSelection);
            if (speciesFacts.IsNotEmpty())
            {
                Assert.IsTrue(speciesFactCount > speciesFacts.Count);
            }
            userParameterSelection.PeriodIds = null;

            userParameterSelection.HostIds = hostIds;
            speciesFacts = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(GetContext(), userParameterSelection);
            if (speciesFacts.IsNotEmpty())
            {
                Assert.IsTrue(speciesFactCount > speciesFacts.Count);
            }
            userParameterSelection.HostIds = null;

            userParameterSelection.ReferenceIds = referenceIds;
            speciesFacts = SpeciesFactManager.GetSpeciesFactsByUserParameterSelection(GetContext(), userParameterSelection);
            if (speciesFacts.IsNotEmpty())
            {
                Assert.IsTrue(speciesFactCount > speciesFacts.Count);
            }
            userParameterSelection.ReferenceIds = null;
        }