Example #1
0
        public void SetTaxon(ITaxon taxon, MatchSettingsViewModel options)
        {
            IUserContext userContext = CoreData.UserManager.GetCurrentUser();

            this.TaxonId        = taxon.Id;
            this.ScientificName = taxon.ScientificName;
            this.GUID           = taxon.Guid;
            this.Author         = taxon.Author;
            this.CommonName     = taxon.CommonName.IsNotEmpty() ? taxon.CommonName : "";
            this.TaxonCategory  = taxon.Category.Name;
            if (options.OutputRecommendedGUID)
            {
                this.RecommendedGUID = taxon.GetRecommendedGuid(userContext);
            }

            if (options.OutputSwedishOccurrence)
            {
                try
                {
                    //Dictionary<FactorId, SpeciesFact> dicSpeciesFacts = SpeciesFactHelper.GetSpeciesFacts(taxon, new[] { FactorId.SwedishOccurence, FactorId.SwedishHistory });
                    Dictionary <ArtDatabanken.Data.FactorId, ArtDatabanken.Data.SpeciesFact> dicSpeciesFacts = SpeciesFactHelper.GetCommonDyntaxaSpeciesFacts(userContext, taxon);
                    this.SwedishOccurrence = SpeciesFactHelper.GetFactorValue(dicSpeciesFacts, ArtDatabanken.Data.FactorId.SwedishOccurrence);
                    //this.SwedishHistory = SpeciesFactHelper.GetFactorValue(dicSpeciesFacts, FactorId.SwedishHistory);
                }
                catch (Exception)
                {
                    this.SwedishOccurrence = "";
                }
            }

            //base.SetTaxon(taxon);
            //base.Author = taxon.Author;
            //base.CommonName = taxon.CommonName;
            //base.Id = taxon.Id;
            //base.ScientificName = taxon.ScientificName;
            //base.TaxonCategory = taxon.TaxonType.Name;
            //base.TaxonCategoryId = taxon.TaxonType.Id;
            //base.TaxonCategorySortOrder = taxon.TaxonType.SortOrder;
            //base.TaxonId = taxon.Id.ToString();
            //base.GUID = Resources.DyntaxaSettings.Default.LSIDString.Replace("[TaxonId]", taxon.Id.ToString());
        }