public void GetNatura2000Taxa()
        {
            Data.ArtDatabankenService.Factor factor;
            SpeciesFactCondition             speciesFactCondition;
            SpeciesFactFieldCondition        speciesFactFieldCondition;

            Data.ArtDatabankenService.TaxonList taxa;

            speciesFactCondition = new SpeciesFactCondition();
            factor = Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.Natura2000BirdsDirective);
            speciesFactCondition.Factors.Add(factor);
            speciesFactCondition.Factors.Add(Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.Natura2000HabitatsDirectiveArticle2));
            speciesFactCondition.Factors.Add(Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.Natura2000HabitatsDirectiveArticle4));
            speciesFactCondition.Factors.Add(Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.Natura2000HabitatsDirectiveArticle5));
            speciesFactCondition.IndividualCategories.Add(IndividualCategoryManager.GetDefaultIndividualCategory());
            speciesFactFieldCondition             = new SpeciesFactFieldCondition();
            speciesFactFieldCondition.FactorField = factor.FactorDataType.Field1;
            speciesFactFieldCondition.SetValue(true);
            speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition);

            // The merge is necessary if there are problems in Dyntaxa.
            taxa = new Data.ArtDatabankenService.TaxonList();
            taxa.Merge(Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, TaxonInformationType.Basic));
            Assert.IsTrue(taxa.IsNotEmpty());
            Assert.AreEqual(308, taxa.Count);
        }
        public void GetActionPlanTaxa()
        {
            Data.ArtDatabankenService.Factor          factor;
            Data.ArtDatabankenService.FactorFieldEnum factorFieldEnum;
            SpeciesFactCondition      speciesFactCondition;
            SpeciesFactFieldCondition speciesFactFieldCondition;

            Data.ArtDatabankenService.TaxonList taxa;

            speciesFactCondition = new SpeciesFactCondition();
            // factor = FactorManager.GetFactor(FactorId.ActionPlan);
            factor = Data.ArtDatabankenService.FactorManager.GetFactor(2017);
            speciesFactCondition.Factors.Add(factor);
            speciesFactCondition.IndividualCategories.Add(IndividualCategoryManager.GetDefaultIndividualCategory());
            factorFieldEnum = factor.FactorDataType.Field1.FactorFieldEnum;
            foreach (FactorFieldEnumValue enumValue in factorFieldEnum.Values)
            {
                speciesFactFieldCondition             = new SpeciesFactFieldCondition();
                speciesFactFieldCondition.FactorField = factor.FactorDataType.Field1;
                speciesFactFieldCondition.SetValue(enumValue.KeyInt);
                speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition);
            }

            // The merge is necessary if there are problems in Dyntaxa.
            taxa = new Data.ArtDatabankenService.TaxonList();
            taxa.Merge(Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, TaxonInformationType.Basic));
            Assert.IsTrue(taxa.IsNotEmpty());
            Assert.AreEqual(1, taxa.Count);
        }
        public void GetRelistedTaxa()
        {
            Data.ArtDatabankenService.Factor factor;
            RedListCategoryEnum       redListCategory;
            SpeciesFactCondition      speciesFactCondition;
            SpeciesFactFieldCondition speciesFactFieldCondition;

            Data.ArtDatabankenService.TaxonList taxa;

            speciesFactCondition = new SpeciesFactCondition();
            factor = Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.RedlistCategory);
            speciesFactCondition.Factors.Add(factor);
            speciesFactCondition.IndividualCategories.Add(IndividualCategoryManager.GetDefaultIndividualCategory());
            speciesFactCondition.Periods.Add(PeriodManager.GetCurrentPublicPeriod());

            for (redListCategory = RedListCategoryEnum.DD; redListCategory <= RedListCategoryEnum.NT; redListCategory++)
            {
                speciesFactFieldCondition             = new SpeciesFactFieldCondition();
                speciesFactFieldCondition.FactorField = factor.FactorDataType.Field1;
                speciesFactFieldCondition.SetValue((Int32)redListCategory);
                speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition);
            }

            // The merge is necessary if there are problems in Dyntaxa.
            taxa = new Data.ArtDatabankenService.TaxonList();
            taxa.Merge(Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, TaxonInformationType.Basic));
            Assert.IsTrue(taxa.IsNotEmpty());
            Assert.AreEqual(4261, taxa.Count);
        }
        public void GetProtectedByLawTaxa()
        {
            Data.ArtDatabankenService.Factor factor;
            SpeciesFactCondition             speciesFactCondition;

            Data.ArtDatabankenService.TaxonList taxa;

            speciesFactCondition = new SpeciesFactCondition();
            //factor = FactorManager.GetFactor(FactorId.ProtectedByLaw);
            factor = Data.ArtDatabankenService.FactorManager.GetFactor(2009);
            speciesFactCondition.Factors.Add(factor);
            speciesFactCondition.IndividualCategories.Add(IndividualCategoryManager.GetDefaultIndividualCategory());

            // The merge is necessary if there are problems in Dyntaxa.
            taxa = new Data.ArtDatabankenService.TaxonList();
            taxa.Merge(Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, TaxonInformationType.Basic));
            Assert.IsTrue(taxa.IsNotEmpty());
            Assert.AreEqual(508, taxa.Count);
        }
Example #5
0
        private static List <ArtDatabanken.Data.WebService.WebSpeciesFact> GetSpeciesFacts(WebServiceContext context, int FactorId)
        {
            List <ArtDatabanken.Data.WebService.WebSpeciesFact> webSpeciesFacts;
            WebUserParameterSelection webUserParameterSelection = new WebUserParameterSelection();

            webUserParameterSelection.FactorIds = new List <Int32>();
            webUserParameterSelection.FactorIds.Add(FactorId);

            webUserParameterSelection.IndividualCategoryIds = new List <Int32>();
            try {
                IndividualCategory individualcategory = IndividualCategoryManager.GetDefaultIndividualCategory();
                webUserParameterSelection.IndividualCategoryIds.Add(individualcategory.Id);
            }
            catch (Exception ex)
            {
                LogResult(context,
                          "Failed calling ArtDatabankenService. WebServiceAddress: " + WebServiceClient.WebServiceAddress);
                LogResult(context, "Exception: " + ex.Message);
            }

            // Get data from web service.
            webSpeciesFacts = WebServiceClient.GetSpeciesFactsByUserParameterSelection(webUserParameterSelection);
            return(webSpeciesFacts);
        }