public void AddSelectionHost() { FactorList factors; IFactor factor1, factor2; Int32 speciesFactCount; ITaxon host, taxon1, taxon2; TaxonList taxa; factor1 = CoreData.FactorManager.GetFactor(GetUserContext(), 1137); // Svampdelar (inkl lavar). factor2 = CoreData.FactorManager.GetFactor(GetUserContext(), 1138); // Mycel. taxon1 = CoreData.TaxonManager.GetTaxon(GetUserContext(), 100090); // Nötkråka. taxon2 = CoreData.TaxonManager.GetTaxon(GetUserContext(), 100381); //tvåfläckig barkskinnbagge factors = new FactorList(); factors.Add(factor1); factors.Add(factor2); taxa = new TaxonList(); taxa.Add(taxon1); taxa.Add(taxon2); GetDataSet(true).AddSelection(GetUserContext(), factors); GetDataSet().AddSelectionTaxa(GetUserContext(), taxa); speciesFactCount = GetDataSet().SpeciesFacts.Count; host = CoreData.TaxonManager.GetTaxon(GetUserContext(), 230260); // skägglav. GetDataSet().AddSelectionHost(GetUserContext(), host); Assert.IsTrue(speciesFactCount > GetDataSet().SpeciesFacts.Count); host = null; GetDataSet().AddSelectionHost(GetUserContext(), host); }
public void RemoveSelectionTaxon() { FactorList factors; IFactor factor1, factor2; Int32 speciesFactCount; ITaxon taxon1, taxon2; TaxonList taxa; factor1 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.SwedishHistory); factor2 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.SwedishOccurrence); taxon1 = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.DrumGrasshopper); taxon2 = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.Wolverine); factors = new FactorList(); factors.Add(factor1); factors.Add(factor2); taxa = new TaxonList(); taxa.Add(taxon1); taxa.Add(taxon2); GetDataSet(true).AddSelection(GetUserContext(), factors); GetDataSet().AddSelectionTaxa(GetUserContext(), taxa); speciesFactCount = GetDataSet().SpeciesFacts.Count; Assert.IsFalse(GetDataSet().Taxa.IsEmpty()); Assert.IsFalse(GetDataSet().SpeciesFacts.IsEmpty()); GetDataSet().RemoveSelectionTaxon(GetUserContext(), taxon1); Assert.IsFalse(GetDataSet().Taxa.IsEmpty()); Assert.IsFalse(GetDataSet().SpeciesFacts.IsEmpty()); Assert.IsTrue(speciesFactCount > GetDataSet().SpeciesFacts.Count); taxon1 = null; GetDataSet().RemoveSelectionTaxon(GetUserContext(), taxon1); }
public void RemoveSelectionSpeciesFactDataSetSelection() { FactorList factors; IFactor factor1, factor2; Int32 speciesFactCount; ISpeciesFactDataSetSelection selection; ITaxon taxon1, taxon2; TaxonList taxa; factor1 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.RedlistCategory); factor2 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.Redlist_OrganismLabel1); taxon1 = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.DrumGrasshopper); taxon2 = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.Wolverine); factors = new FactorList(); factors.Add(factor1); factors.Add(factor2); taxa = new TaxonList(); taxa.Add(taxon1); taxa.Add(taxon2); selection = new SpeciesFactDataSetSelection(); selection.Factors = factors; selection.Taxa = taxa; GetDataSet(true).AddSelection(GetUserContext(), selection); Assert.IsFalse(GetDataSet().Factors.IsEmpty()); Assert.IsFalse(GetDataSet().Taxa.IsEmpty()); Assert.IsFalse(GetDataSet().SpeciesFacts.IsEmpty()); speciesFactCount = GetDataSet().SpeciesFacts.Count; selection = new SpeciesFactDataSetSelection(); selection.Factors.Add(factor1); selection.Taxa.Add(taxon1); GetDataSet().RemoveSelection(GetUserContext(), selection); Assert.IsTrue(speciesFactCount > GetDataSet().SpeciesFacts.Count); }
/// <summary> /// Constructor of a County occurrece map object. Make sure that the static methos InitializeMap is called before using this constructor. /// </summary> /// <param name="userContext"> /// The user Context. /// </param> /// <param name="taxon"> /// A taxon object /// </param> public CountyOccurrenceMap(IUserContext userContext, ITaxon taxon) { FontName = TEXT_FONT; IFactorSearchCriteria factorSearchCrieteria = new FactorSearchCriteria(); List <Int32> countyIds = new List <Int32>(); countyIds.Add((Int32)FactorId.CountyOccurrence); factorSearchCrieteria.RestrictSearchToFactorIds = countyIds; factorSearchCrieteria.RestrictReturnToScope = ArtDatabanken.Data.FactorSearchScope.LeafFactors; _counties = CoreData.FactorManager.GetFactors(userContext, factorSearchCrieteria); ISpeciesFactSearchCriteria parameters = new SpeciesFactSearchCriteria(); parameters.Taxa = new TaxonList { taxon }; parameters.Factors = new FactorList(); parameters.Factors = _counties; parameters.IncludeNotValidHosts = true; parameters.IncludeNotValidTaxa = true; _countyInformation = CoreData.SpeciesFactManager.GetSpeciesFacts(userContext, parameters); UpdateInformation = null; if (!_countyInformation.IsNotEmpty()) { _countyInformationExist = false; } }
/// <summary> /// Get all species facts that are needed to initialize /// properties in class TaxonListInformation. /// </summary> /// <param name="taxa">The taxa.</param> /// <returns>Taxon list information about specified taxa.</returns> private SpeciesFactList GetSpeciesFacts(IEnumerable <ITaxon> taxa) { ISpeciesFactSearchCriteria searchCriteria = new SpeciesFactSearchCriteria(); searchCriteria.Factors = new FactorList(); FactorList landscapeFactors = CoreData.FactorManager.GetFactorTree(mContext, FactorId.LandscapeFactors).GetAllLeafFactors(); searchCriteria.Factors.AddRange(landscapeFactors); IFactor redlistCategoryFactor = CoreData.FactorManager.GetFactor(mContext, FactorId.RedlistCategory); searchCriteria.Factors.Add(redlistCategoryFactor); IFactor redlistTaxonTypeFactor = CoreData.FactorManager.GetFactor(mContext, FactorId.Redlist_TaxonType); searchCriteria.Factors.Add(redlistTaxonTypeFactor); IFactor redlistOrganismLabel1 = CoreData.FactorManager.GetFactor(mContext, FactorId.Redlist_OrganismLabel1); searchCriteria.Factors.Add(redlistOrganismLabel1); IFactor redlistCriteriaFactor = CoreData.FactorManager.GetFactor(mContext, FactorId.RedlistCriteriaString); searchCriteria.Factors.Add(redlistCriteriaFactor); searchCriteria.IndividualCategories = new IndividualCategoryList { CoreData.FactorManager.GetDefaultIndividualCategory(mContext) }; searchCriteria.Periods = new PeriodList { CoreData.FactorManager.GetCurrentRedListPeriod(mContext) }; searchCriteria.Taxa = new TaxonList(); searchCriteria.Taxa.AddRange(taxa); ISpeciesFactDataSource speciesFactDataSource = new RedListSpeciesFactDataSource(); SpeciesFactList speciesFacts = speciesFactDataSource.GetSpeciesFacts(mContext, searchCriteria); return(speciesFacts); }
public void AddSelectionIndividualCategory() { FactorList factors; IFactor factor1, factor2; IIndividualCategory individualCategory; Int32 speciesFactCount; ITaxon taxon1, taxon2; TaxonList taxa; factor1 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.SwedishHistory); factor2 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.SwedishOccurrence); taxon1 = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.DrumGrasshopper); taxon2 = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.Wolverine); factors = new FactorList(); factors.Add(factor1); factors.Add(factor2); taxa = new TaxonList(); taxa.Add(taxon1); taxa.Add(taxon2); GetDataSet(true).AddSelection(GetUserContext(), factors); GetDataSet().AddSelectionTaxa(GetUserContext(), taxa); speciesFactCount = GetDataSet().SpeciesFacts.Count; individualCategory = CoreData.FactorManager.GetDefaultIndividualCategory(GetUserContext()); GetDataSet().AddSelection(GetUserContext(), individualCategory); Assert.IsFalse(GetDataSet().Factors.IsEmpty()); Assert.IsFalse(GetDataSet().SpeciesFacts.IsEmpty()); Assert.AreEqual(speciesFactCount, GetDataSet().SpeciesFacts.Count); GetDataSet().AddSelection(GetUserContext(), CoreData.FactorManager.GetIndividualCategories(GetUserContext())[3]); Assert.IsTrue(speciesFactCount < GetDataSet().SpeciesFacts.Count); individualCategory = null; GetDataSet().AddSelection(GetUserContext(), individualCategory); }
public void RemoveSelectionPeriods() { FactorList factors; IFactor factor1, factor2; Int32 speciesFactCount; ITaxon taxon1, taxon2; PeriodList periods; TaxonList taxa; factor1 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.RedlistCategory); factor2 = CoreData.FactorManager.GetFactor(GetUserContext(), FactorId.Redlist_OrganismLabel1); taxon1 = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.DrumGrasshopper); taxon2 = CoreData.TaxonManager.GetTaxon(GetUserContext(), TaxonId.Wolverine); factors = new FactorList(); factors.Add(factor1); factors.Add(factor2); taxa = new TaxonList(); taxa.Add(taxon1); taxa.Add(taxon2); GetDataSet(true).AddSelection(GetUserContext(), factors); GetDataSet().AddSelectionTaxa(GetUserContext(), taxa); GetDataSet().AddSelection(GetUserContext(), CoreData.FactorManager.GetPeriods(GetUserContext())); speciesFactCount = GetDataSet().SpeciesFacts.Count; periods = new PeriodList(); periods.Add(GetDataSet().Periods[0]); periods.Add(GetDataSet().Periods[1]); GetDataSet().RemoveSelection(GetUserContext(), periods); Assert.IsFalse(GetDataSet().Factors.IsEmpty()); Assert.IsFalse(GetDataSet().SpeciesFacts.IsEmpty()); Assert.IsTrue(speciesFactCount > GetDataSet().SpeciesFacts.Count); periods = null; GetDataSet().RemoveSelection(GetUserContext(), periods); }
/// <summary> /// Get landscape type species facts. /// </summary> private void GetLandscapeTypeSpeciesFactsToCache() { ISpeciesFactSearchCriteria searchCriteria = new SpeciesFactSearchCriteria(); searchCriteria.Factors = new FactorList(); FactorList factors = CoreData.FactorManager.GetFactorTree(mContext, FactorId.LandscapeFactors).GetAllLeafFactors(); searchCriteria.Factors.AddRange(factors); searchCriteria.IndividualCategories = new IndividualCategoryList { CoreData.FactorManager.GetDefaultIndividualCategory(mContext) }; ISpeciesFactDataSource speciesFactDataSource = new RedListSpeciesFactDataSource(); SpeciesFactList speciesFacts = speciesFactDataSource.GetSpeciesFacts(mContext, searchCriteria); if (speciesFacts.IsNotEmpty()) { foreach (ISpeciesFact speciesFact in speciesFacts) { if (TaxonInformationCache.TaxonInformation.ContainsKey(speciesFact.Taxon.Id)) { TaxonInformationCache.TaxonInformation[speciesFact.Taxon.Id].SetSpeciesFact(speciesFact); } } } }
/// <summary> /// Convert a list of WebSpeciesFact instances /// to a SpeciesFactList. /// </summary> /// <param name="userContext"> /// Information about the user that makes this method call. /// </param> /// <param name="webSpeciesFacts">List of WebSpeciesFact instances.</param> /// <returns>List of SpeciesFact instances.</returns> protected override SpeciesFactList GetSpeciesFacts( IUserContext userContext, List <WebSpeciesFact> webSpeciesFacts) { SpeciesFactList speciesFacts; FactorList factors = CoreData.FactorManager.GetFactors(userContext); IndividualCategoryList individualCategories = CoreData.FactorManager.GetIndividualCategories(userContext); PeriodList periods = CoreData.FactorManager.GetPeriods(userContext); speciesFacts = null; if (webSpeciesFacts.IsNotEmpty()) { speciesFacts = new SpeciesFactList(); foreach (WebSpeciesFact webSpeciesFact in webSpeciesFacts) { if (webSpeciesFact.QualityId <= (int)SpeciesFactQualityId.Acceptable) { speciesFacts.Add(GetSpeciesFact(webSpeciesFact, factors, individualCategories, periods)); } // else: Bad quality, do not use this species fact. } } return(speciesFacts); }
/// <summary> /// Convert a list of WebSpeciesFact instances /// to a SpeciesFactList. /// </summary> /// <param name="userContext"> /// Information about the user that makes this method call. /// </param> /// <param name="webSpeciesFacts">List of WebSpeciesFact instances.</param> /// <returns>List of SpeciesFact instances.</returns> protected virtual SpeciesFactList GetSpeciesFacts(IUserContext userContext, List <WebSpeciesFact> webSpeciesFacts) { SpeciesFactList speciesFacts; FactorList factors = CoreData.FactorManager.GetFactors(userContext); IndividualCategoryList individualCategories = CoreData.FactorManager.GetIndividualCategories(userContext); PeriodList periods = CoreData.FactorManager.GetPeriods(userContext); ReferenceList references; SpeciesFactQualityList speciesFactQualities = CoreData.SpeciesFactManager.GetSpeciesFactQualities(userContext); List <Int32> referenceIds, taxonIds; TaxonList taxa; speciesFacts = null; if (webSpeciesFacts.IsNotEmpty()) { referenceIds = GetReferenceIds(webSpeciesFacts); references = CoreData.ReferenceManager.GetReferences(userContext, referenceIds); taxonIds = GetTaxonIds(webSpeciesFacts); taxa = CoreData.TaxonManager.GetTaxa(userContext, taxonIds); speciesFacts = new SpeciesFactList(); foreach (WebSpeciesFact webSpeciesFact in webSpeciesFacts) { speciesFacts.Add(GetSpeciesFact(userContext, webSpeciesFact, factors, individualCategories, periods, references, speciesFactQualities, taxa)); } } return(speciesFacts); }
public void CountyMapSecondConstructorTest() { IUserContext userContext = LoginTestUser(); IFactorSearchCriteria factorSearchCrieteria = new FactorSearchCriteria(); List <Int32> countyIds = new List <Int32>(); countyIds.Add((Int32)FactorId.CountyOccurrence); factorSearchCrieteria.RestrictSearchToFactorIds = countyIds; factorSearchCrieteria.RestrictReturnToScope = ArtDatabanken.Data.FactorSearchScope.LeafFactors; FactorList counties = CoreData.FactorManager.GetFactors(userContext, factorSearchCrieteria); ISpeciesFactSearchCriteria parameters = new SpeciesFactSearchCriteria(); ITaxon taxon = CoreData.TaxonManager.GetTaxon(userContext, 101656); parameters.Taxa = new TaxonList { taxon }; parameters.Factors = counties; parameters.IncludeNotValidHosts = true; parameters.IncludeNotValidTaxa = true; SpeciesFactList countyInformation = CoreData.SpeciesFactManager.GetSpeciesFacts(userContext, parameters); string shapeFileName = Path.Combine(AbsoluteResourceFolderPath, "Sverigekarta med län.shp"); Console.WriteLine("Reading file: {0}", shapeFileName); CountyOccurrenceMap.InitializeMap(shapeFileName); CountyOccurrenceMap countyOccurenceMap = new CountyOccurrenceMap(countyInformation); string imagePath = Path.Combine(AbsoluteTempFolderPath, "testSpeciesFactMapWithLegend.png"); Console.WriteLine("Generating image: {0}", imagePath); countyOccurenceMap.Save(imagePath, System.Drawing.Imaging.ImageFormat.Png); }
public static FactorList GetSomeFactors() { FactorList factors; factors = new FactorList(); foreach (Factor factor in Data.ArtDatabankenService.FactorManager.GetFactors()) { if (factor.Id == LANDSCAPE_AGRICULTURE_FACTOR_ID) { factors.Add(factor); } if (factor.Id == LANDSCAPE_FOREST_FACTOR_ID) { factors.Add(factor); } if (factor.Id == LANDSCAPE_MOUNTAIN_FACTOR_ID) { factors.Add(factor); } if (factor.Id == LANDSCAPE_FRESH_WATER_FACTOR_ID) { factors.Add(factor); } } return(factors); }
///// <summary> ///// Get factors that are used in Alva. ///// </summary> //private void GetSpeciesInformationDocument() //{ // IFactor speciesInformationDocumentIsPublishableFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.SpeciesInformationDocumentIsPublishable); // ISpeciesFactSearchCriteria searchCriteria = new SpeciesFactSearchCriteria // { // Factors = new FactorList { speciesInformationDocumentIsPublishableFactor }, // Taxa = new TaxonList { mTaxon } // }; // SpeciesFactList speciesFacts = CoreData.SpeciesFactManager.GetSpeciesFacts(mUserContext, searchCriteria); // if (speciesFacts.IsNotEmpty()) // { // ISpeciesFact speciesInformationDocumentIsPublishableSpeciesFact = speciesFacts[0]; // if (speciesInformationDocumentIsPublishableSpeciesFact.IsSpeciesInformationDocumentIsPublishableSpecified()) // { // mTaxonSpeciesFact.IsSpeciesInformationDocumentPublishable = speciesInformationDocumentIsPublishableSpeciesFact.MainField.BooleanValue; // if (mTaxonSpeciesFact.IsSpeciesInformationDocumentPublishable) // { // IFactor speciesInformationDocumentPreambleFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.SpeciesInformationDocumentPreamble); // IFactor speciesInformationDocumentDescriptionFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.SpeciesInformationDocumentDescription); // IFactor speciesInformationDocumentDistributionFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.SpeciesInformationDocumentDistribution); // IFactor speciesInformationDocumentEcologyFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.SpeciesInformationDocumentEcology); // IFactor speciesInformationDocumentThreatsFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.SpeciesInformationDocumentThreats); // IFactor speciesInformationDocumentMeasuresFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.SpeciesInformationDocumentMeasures); // IFactor speciesInformationDocumentExtraFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.SpeciesInformationDocumentExtra); // IFactor speciesInformationDocumentReferencesFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.SpeciesInformationDocumentReferences); // IFactor speciesInformationDocumentAuthorAndYearFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.SpeciesInformationDocumentAuthorAndYear); // IFactor speciesInformationDocumentItalicsInReferences = CoreData.FactorManager.GetFactor(mUserContext, FactorId.SpeciesInformationDocumentItalicsInReferences); // IFactor speciesInformationDocumentItalicsInText = CoreData.FactorManager.GetFactor(mUserContext, FactorId.SpeciesInformationDocumentItalicsInText); // ISpeciesFact speciesInformationDocumentPreambleSpeciesFact = null; // ISpeciesFact speciesInformationDocumentDescriptionSpeciesFact = null; // ISpeciesFact speciesInformationDocumentDistributionSpeciesFact = null; // ISpeciesFact speciesInformationDocumentEcologySpeciesFact = null; // ISpeciesFact speciesInformationDocumentThreatsSpeciesFact = null; // ISpeciesFact speciesInformationDocumentMeasuresSpeciesFact = null; // ISpeciesFact speciesInformationDocumentExtraSpeciesFact = null; // ISpeciesFact speciesInformationDocumentReferencesSpeciesFact = null; // ISpeciesFact speciesInformationDocumentAuthorAndYearSpeciesFact = null; // ISpeciesFact speciesInformationDocumentItalicsInReferencesSpeciesFact = null; // ISpeciesFact speciesInformationDocumentItalicsInTextSpeciesFact = null; // searchCriteria.Factors.Remove(speciesInformationDocumentIsPublishableFactor); // searchCriteria.Add(speciesInformationDocumentPreambleFactor); // searchCriteria.Add(speciesInformationDocumentDescriptionFactor); // searchCriteria.Add(speciesInformationDocumentDistributionFactor); // searchCriteria.Add(speciesInformationDocumentEcologyFactor); // searchCriteria.Add(speciesInformationDocumentThreatsFactor); // searchCriteria.Add(speciesInformationDocumentMeasuresFactor); // searchCriteria.Add(speciesInformationDocumentExtraFactor); // searchCriteria.Add(speciesInformationDocumentReferencesFactor); // searchCriteria.Add(speciesInformationDocumentAuthorAndYearFactor); // searchCriteria.Add(speciesInformationDocumentItalicsInReferences); // searchCriteria.Add(speciesInformationDocumentItalicsInText); // speciesFacts = CoreData.SpeciesFactManager.GetSpeciesFacts(mUserContext, searchCriteria); // if (speciesFacts.IsNotEmpty()) // { // foreach (ISpeciesFact speciesFact in speciesFacts) // { // switch (speciesFact.Factor.Id) // { // case (int)FactorId.SpeciesInformationDocumentPreamble: // speciesInformationDocumentPreambleSpeciesFact = speciesFact; // break; // case (int)FactorId.SpeciesInformationDocumentDescription: // speciesInformationDocumentDescriptionSpeciesFact = speciesFact; // break; // case (int)FactorId.SpeciesInformationDocumentDistribution: // speciesInformationDocumentDistributionSpeciesFact = speciesFact; // break; // case (int)FactorId.SpeciesInformationDocumentEcology: // speciesInformationDocumentEcologySpeciesFact = speciesFact; // break; // case (int)FactorId.SpeciesInformationDocumentThreats: // speciesInformationDocumentThreatsSpeciesFact = speciesFact; // break; // case (int)FactorId.SpeciesInformationDocumentMeasures: // speciesInformationDocumentMeasuresSpeciesFact = speciesFact; // break; // case (int)FactorId.SpeciesInformationDocumentExtra: // speciesInformationDocumentExtraSpeciesFact = speciesFact; // break; // case (int)FactorId.SpeciesInformationDocumentReferences: // speciesInformationDocumentReferencesSpeciesFact = speciesFact; // break; // case (int)FactorId.SpeciesInformationDocumentAuthorAndYear: // speciesInformationDocumentAuthorAndYearSpeciesFact = speciesFact; // break; // case (int)FactorId.SpeciesInformationDocumentItalicsInReferences: // speciesInformationDocumentItalicsInReferencesSpeciesFact = speciesFact; // break; // case (int)FactorId.SpeciesInformationDocumentItalicsInText: // speciesInformationDocumentItalicsInTextSpeciesFact = speciesFact; // break; // } // } // } // mTaxonSpeciesFact.InitSpeciesInformationDocumentInformation(speciesInformationDocumentPreambleSpeciesFact, // speciesInformationDocumentDescriptionSpeciesFact, // speciesInformationDocumentDistributionSpeciesFact, // speciesInformationDocumentEcologySpeciesFact, // speciesInformationDocumentThreatsSpeciesFact, // speciesInformationDocumentMeasuresSpeciesFact, // speciesInformationDocumentExtraSpeciesFact, // speciesInformationDocumentReferencesSpeciesFact, // speciesInformationDocumentAuthorAndYearSpeciesFact, // speciesInformationDocumentItalicsInReferencesSpeciesFact, // speciesInformationDocumentItalicsInTextSpeciesFact); // } // } // } //} ///// <summary> ///// Creates a list of Link items for all links recommended for a certain taxon. ///// </summary> ///// <param name="taxonId">The taxon.</param> ///// <returns>A list of link items.</returns> //public static List<LinkItem> GetRecommendedLinks(int taxonId) //{ // var sp = new Stopwatch(); // sp.Start(); // var links = new List<LinkItem>(); // var linkManager = new LinkManager(); // LinkItem item; // IUserContext userContext = CoreData.UserManager.GetCurrentUser(); // ITaxon taxon = CoreData.TaxonManager.GetTaxon(userContext, taxonId); // // Add link to Photos from Artportalen // string url = linkManager.GetUrlToMediaAp(taxon.Id.ToString(CultureInfo.InvariantCulture)); // if (url.IsNotEmpty()) // { // item = new LinkItem(LinkType.Url, LinkQuality.ApprovedByExpert, RedListResource.LinkToPhotosAPLabel, url); // links.Add(item); // } // // Add links to search in Dyntaxa // url = linkManager.GetUrlToDyntaxa(taxon.Id.ToString(CultureInfo.InvariantCulture)); // if (url.IsNotEmpty()) // { // item = new LinkItem(LinkType.Url, LinkQuality.ApprovedByExpert, RedListResource.LinkToDyntaxaLabel, url); // links.Add(item); // } // // Add link to Google images. // url = linkManager.GetUrlToGoogleImagesResults(taxon.ScientificName); // if (url.IsNotEmpty()) // { // item = new LinkItem(LinkType.Url, LinkQuality.Automatic, RedListResource.LinkToGoogleImagesLabel, url); // links.Add(item); // } // if (taxon.ScientificName.IsNotEmpty()) // { // // Add link to GBIF // url = linkManager.GetUrlToGbif(taxon.ScientificName); // if (url.IsNotEmpty()) // { // item = new LinkItem(LinkType.Url, LinkQuality.Automatic, RedListResource.LinkToGbifLabel, url); // links.Add(item); // } // // Add link to EoL // url = linkManager.GetUrlToEoL(taxon.ScientificName); // if (url.IsNotEmpty()) // { // item = new LinkItem(LinkType.Url, LinkQuality.Automatic, RedListResource.LinkToEoLLabel, url); // links.Add(item); // } // // Add link to Biodiversity Heritage Library. // url = linkManager.GetUrlToBiodiversityHeritageLibrary(taxon.ScientificName); // if (url.IsNotEmpty()) // { // item = new LinkItem(LinkType.Url, LinkQuality.Automatic, "Biodiversity Heritage Library", url); // links.Add(item); // } // } // // Add a link to ITIS Taxon information. // var itisNumberNames = taxon.GetTaxonNamesBySearchCriteria(userContext, (int)TaxonNameCategoryId.ItisNumber, null, null, true, false, false); // foreach (var name in itisNumberNames) // { // url = AppSettings.Default.UrlToGetITISTaxonInformation.Replace("[Id]", name.Name); // var linkItem = new LinkItem(LinkType.Url, LinkQuality.ApprovedByExpert, RedListResource.LinkToItisLabel, url); // links.Add(linkItem); // } // var guidNames = taxon.GetTaxonNamesBySearchCriteria(userContext, (int)TaxonNameCategoryId.Guid, null, null, null, false, false); // foreach (var name in guidNames) // { // LinkItem linkItem; // // Add a link to PESI Taxon information. // url = AppSettings.Default.UrlToGetPESITaxonInformation.Replace("[GUID]", name.Name); // if (name.IsRecommended) // { // linkItem = new LinkItem(LinkType.Url, LinkQuality.ApprovedByExpert, RedListResource.LinkToPesiLabel, url); // links.Add(linkItem); // } // else // { // linkItem = new LinkItem(LinkType.Url, LinkQuality.Automatic, RedListResource.LinkToPesiLabel, url); // links.Add(linkItem); // } // // Add a link to Fauna Europea Taxon information. // url = linkManager.GetUrlToFaunaEuropeaTaxonInformation(name.Name); // if (url.IsNotEmpty()) // { // linkItem = new LinkItem(LinkType.Url, LinkQuality.Automatic, RedListResource.LinkToFaunaEuropeaLabel, url); // links.Add(linkItem); // } // // Add a link to Marbef (ERMS) Taxon information. // url = linkManager.GetUrlToMarbefTaxonInformation(name.Name); // if (url.IsNotEmpty()) // { // linkItem = new LinkItem(LinkType.Url, LinkQuality.Automatic, RedListResource.LinkToMarbefLabel, url); // links.Add(linkItem); // url = linkManager.GetUrlToNordicMicroalgaeTaxonInformation(taxon.ScientificName); // linkItem = new LinkItem(LinkType.Url, LinkQuality.Automatic, RedListResource.LinkToNordicMicroalgaeLabel, url); // links.Add(linkItem); // } // // Add a link to Algaebase Taxon information. // url = linkManager.GetUrlToAlgaebaseTaxonInformation(name.Name); // if (url.IsNotEmpty()) // { // linkItem = new LinkItem(LinkType.Url, LinkQuality.Automatic, RedListResource.LinkToAlgaebaseLabel, url); // links.Add(linkItem); // url = linkManager.GetUrlToNordicMicroalgaeTaxonInformation(taxon.ScientificName); // linkItem = new LinkItem(LinkType.Url, LinkQuality.Automatic, RedListResource.LinkToNordicMicroalgaeLabel, url); // links.Add(linkItem); // } // } // // Add link to Naturforskaren taxon information // url = linkManager.GetUrlToNaturforskaren(taxon.ScientificName); // if (url.IsNotEmpty()) // { // item = new LinkItem(LinkType.Url, LinkQuality.Automatic, RedListResource.LinkToNaturforskarenLabel, url); // links.Add(item); // } // // Add link to WIKI taxon information // url = linkManager.GetUrlToWikipedia(taxon.ScientificName); // if (url.IsNotEmpty()) // { // item = new LinkItem(LinkType.Url, LinkQuality.Automatic, RedListResource.LinkToWikipediaLabel, url); // links.Add(item); // } // sp.Stop(); // Debug.WriteLine("TaxonInfo - Retrieving links: {0:N0} milliseconds", sp.ElapsedMilliseconds); // return links; //} //public byte[] GetCountyMap(ITaxon taxon) //{ // // Set swedish locale // SetSwedishLangugage(); // // Check so that we have a valid SpeciesFactList containing elements // if (IsSpeciesFactFactListEmpty(taxon)) // { // return null; // } // byte[] buffer = null; // var returnStream = new MemoryStream(); // try // { // var countyMapProvider = new RedListCountyOccurrenceMap(mUserContext, taxon); // if (countyMapProvider.CountyInformationExist) // { // countyMapProvider.Height = 800; // countyMapProvider.UpdateInformation = RedListResource.TaxonInfoDistributionInSwedenCountyOccurrence; // var map = countyMapProvider.Bitmap; // map.Save(returnStream, ImageFormat.Png); // buffer = returnStream.GetBuffer(); // returnStream.Close(); // } // } // catch (Exception ex) // { // throw new Exception("Failed to update county map cache", ex); // } // return buffer; //} private bool IsSpeciesFactFactListEmpty(ITaxon taxon) { IFactorSearchCriteria factorSearchCrieteria = new FactorSearchCriteria(); var countyIds = new List <int> { (int)FactorId.CountyOccurrence }; factorSearchCrieteria.RestrictSearchToFactorIds = countyIds; factorSearchCrieteria.RestrictReturnToScope = FactorSearchScope.LeafFactors; FactorList counties = CoreData.FactorManager.GetFactors(mUserContext, factorSearchCrieteria); ISpeciesFactSearchCriteria parameters = new SpeciesFactSearchCriteria(); parameters.Taxa = new TaxonList { taxon }; parameters.Factors = new FactorList(); parameters.Factors = counties; parameters.IncludeNotValidHosts = true; parameters.IncludeNotValidTaxa = true; SpeciesFactList sList = CoreData.SpeciesFactManager.GetSpeciesFacts(mUserContext, parameters); return(sList.IsEmpty()); }
/// <summary> /// Get factors for the species facts that are cached. /// </summary> /// <param name="userContext">The user context.</param> /// <returns>Factors for the species facts that are cached.</returns> public static FactorList GetFactors(IUserContext userContext) { FactorList factors; factors = new FactorList { CoreData.FactorManager.GetFactor(userContext, FactorId.RedlistCategory) }; return(factors); }
/// <summary> /// The get factors value lists. /// </summary> /// <param name="userContext"> /// The user context. /// </param> /// <param name="factorIds"> /// The factor ids. /// </param> /// <returns> /// The <see cref="Dictionary"/>. /// </returns> public static Dictionary <FactorId, IList <FactorFieldEnumValue> > GetFactorsValueLists(IUserContext userContext, IEnumerable <FactorId> factorIds) { var dic = new Dictionary <FactorId, IList <FactorFieldEnumValue> >(); var intFactorIds = new List <int>(factorIds.Select(factorId => (int)factorId)); FactorList factors = CoreData.FactorManager.GetFactors(userContext, intFactorIds); foreach (IFactor factor in factors) { dic.Add((FactorId)factor.Id, factor.DataType.MainField.Enum.Values.Cast <FactorFieldEnumValue>().ToList()); } return(dic); }
/// <summary> /// The get species facts. /// </summary> /// <param name="userContext"> /// The user context. /// </param> /// <param name="taxa"> /// The taxa. /// </param> /// <param name="factorIds"> /// The factor ids. /// </param> /// <param name="speciesFactList"> /// The species fact list. /// </param> /// <returns> /// The <see cref="Dictionary"/>. /// </returns> public static Dictionary <int, Dictionary <FactorId, SpeciesFact> > GetSpeciesFacts( IUserContext userContext, IEnumerable <ITaxon> taxa, IEnumerable <FactorId> factorIds, out SpeciesFactList speciesFactList) { var intFactorIds = new List <int>(factorIds.Select(factorId => (int)factorId)); FactorList factors = CoreData.FactorManager.GetFactors(userContext, intFactorIds); ISpeciesFactSearchCriteria speciesFactSearchCriteria = new SpeciesFactSearchCriteria(); IPeriod period = CoreData.FactorManager.GetCurrentPublicPeriod(userContext); speciesFactSearchCriteria.EnsureNoListsAreNull(); speciesFactSearchCriteria.IncludeNotValidHosts = true; speciesFactSearchCriteria.IncludeNotValidTaxa = true; speciesFactSearchCriteria.Add(period); speciesFactSearchCriteria.Add(CoreData.FactorManager.GetDefaultIndividualCategory(userContext)); speciesFactSearchCriteria.Taxa = new TaxonList(); foreach (ITaxon taxon in taxa) { speciesFactSearchCriteria.Taxa.Add(taxon); } speciesFactSearchCriteria.Factors = new FactorList(); foreach (IFactor factor in factors) { speciesFactSearchCriteria.Factors.Add(factor); } speciesFactList = CoreData.SpeciesFactManager.GetSpeciesFacts(userContext, speciesFactSearchCriteria); //speciesFactList = CoreData.SpeciesFactManager.GetDyntaxaSpeciesFacts(userContext, speciesFactSearchCriteria); var dic = new Dictionary <int, Dictionary <FactorId, SpeciesFact> >(); foreach (SpeciesFact speciesFact in speciesFactList) { var factorId = (FactorId)speciesFact.Factor.Id; if (!dic.ContainsKey(speciesFact.Taxon.Id)) { dic.Add(speciesFact.Taxon.Id, new Dictionary <FactorId, SpeciesFact>()); } if (!dic[speciesFact.Taxon.Id].ContainsKey(factorId)) { dic[speciesFact.Taxon.Id].Add(factorId, speciesFact); } } return(dic); }
/// <summary> /// Constructor of a County occurrece map object. /// Make sure that the static methos InitializeMap is called before using this constructor. /// </summary> /// <param name="countyOccurrences">Information about county occurrence.</param> public CountyOccurrenceMap(SpeciesFactList countyOccurrences) { FontName = TEXT_FONT; _countyInformation = countyOccurrences; _counties = new FactorList(); if (_countyInformation.IsNotEmpty()) { foreach (SpeciesFact fact in _countyInformation) { _counties.Add(fact.Factor); } } UpdateInformation = null; }
public double GetProbabilityOfRanking() { var factorList = new FactorList <GaussianDistribution>(); foreach (var currentLayer in _Layers) { foreach (var currentFactor in currentLayer.UntypedFactors) { factorList.AddFactor(currentFactor); } } double logZ = factorList.LogNormalization; return(Math.Exp(logZ)); }
/// <summary> /// Reads species fact. /// </summary> private void InitSpeciesFact() { Stopwatch sp = new Stopwatch(); sp.Start(); try { ISpeciesFactSearchCriteria speciesFactSearchCriteria = new SpeciesFactSearchCriteria(); speciesFactSearchCriteria.EnsureNoListsAreNull(); speciesFactSearchCriteria.IncludeNotValidHosts = true; speciesFactSearchCriteria.IncludeNotValidTaxa = true; speciesFactSearchCriteria.Taxa = new TaxonList(); speciesFactSearchCriteria.Taxa.Add(_taxon); var factorIds = new List <Int32> { (int)FactorId.SwedishOccurrence, (int)FactorId.SwedishHistory }; FactorList factors = CoreData.FactorManager.GetFactors(_user, factorIds); speciesFactSearchCriteria.Factors = new FactorList(); foreach (IFactor factor in factors) { speciesFactSearchCriteria.Factors.Add(factor); } SpeciesFactList speciesFacts = CoreData.SpeciesFactManager.GetDyntaxaSpeciesFacts(_user, speciesFactSearchCriteria); foreach (SpeciesFact speciesFact in speciesFacts) { if (speciesFact.Factor.Id == (int)FactorId.SwedishOccurrence) { _swedishOccourrenceFact = speciesFact; } if (speciesFact.Factor.Id == (int)FactorId.SwedishHistory) { _swedishHistoryFact = speciesFact; } } } catch (Exception ex) { DyntaxaLogger.WriteMessage("Dyntaxa - InitSpeciesFact: " + ex.Message); } sp.Stop(); Debug.WriteLine("Retrieving species fact: {0:N0} milliseconds", sp.ElapsedMilliseconds); }
/// <summary> /// Read rows from the excel xml format. /// Overridden by each class that inherits this class. /// </summary> /// <param name="userContext"> /// Information about the user that makes this method call. /// </param> /// <param name='xmlDoc'>The xml document that the row node will be read from.</param> /// <param name="nsmgr">Namespacemanager containing all namespaces used by the excel compatible xml format</param> protected override void ReadExcelXmlRows(IUserContext userContext, XmlDocument xmlDoc, XmlNamespaceManager nsmgr) { FactorList factors; XmlNode dataNode; XmlNodeList rowNodes; rowNodes = xmlDoc.SelectNodes("/ss:Workbook/ss:Worksheet/ss:Table/ss:Row", nsmgr); factors = new FactorList(); foreach (XmlNode rowNode in rowNodes) { dataNode = rowNode.SelectSingleNode("ss:Cell/ss:Data", nsmgr); factors.Add(CoreData.FactorManager.GetFactor(userContext, dataNode.InnerText.WebParseInt32())); } Factors = factors; }
/// <summary> /// Save UserDataSet to xml file. /// </summary> /// <param name='fileName'>File name.</param> /// <param name='userDataSet'>UserDataSet to save.</param> /// <param name='dictionaryURI'>Path.</param> /// <param name='renewCommonDefinitions'>Indicates if common definitions should be updated.</param> public static void Serialize(String fileName, UserDataSet userDataSet, String dictionaryURI, Boolean renewCommonDefinitions) { BinaryFormatter formatter = new BinaryFormatter(); Stream stream = File.OpenWrite(fileName); formatter.Serialize(stream, userDataSet); stream.Close(); if (renewCommonDefinitions) { String factorFileName = dictionaryURI + @"\Factors.bin"; stream = File.OpenWrite(factorFileName); FactorList allFactors = FactorManager.GetFactors(); formatter.Serialize(stream, allFactors); stream.Close(); FactorTreeSearchCriteria searchCriteria = new FactorTreeSearchCriteria(); FactorTreeNodeList factorTrees = new FactorTreeNodeList(); foreach (Factor factor in allFactors) { List <Int32> factorIds = new List <Int32>(); factorIds.Add(factor.Id); searchCriteria.RestrictSearchToFactorIds = factorIds; } String factorTreeFileName = dictionaryURI + @"\FactorTrees.bin"; stream = File.OpenWrite(factorTreeFileName); formatter.Serialize(stream, factorTrees); stream.Close(); String speciesFactQualityFileName = dictionaryURI + @"\SpeciesFactQualities.bin"; stream = File.OpenWrite(speciesFactQualityFileName); formatter.Serialize(stream, SpeciesFactManager.GetSpeciesFactQualities()); stream.Close(); String periodsFileName = dictionaryURI + @"\Periods.bin"; stream = File.OpenWrite(periodsFileName); formatter.Serialize(stream, PeriodManager.GetPeriods()); stream.Close(); } }
/// <summary> /// Convert a list of WebFactor instances /// to a FactorList. /// </summary> /// <param name="userContext"> /// Information about the user that makes this method call. /// </param> /// <param name="webFactors">List of WebFactor instances.</param> /// <returns>Factors.</returns> private FactorList GetFactors(IUserContext userContext, List <WebFactor> webFactors) { FactorList factors; FactorDataTypeList factorDataTypes = CoreData.FactorManager.GetFactorDataTypes(userContext); FactorOriginList factorOrigins = CoreData.FactorManager.GetFactorOrigins(userContext); FactorUpdateModeList factorUpdateModes = CoreData.FactorManager.GetFactorUpdateModes(userContext); factors = null; if (webFactors.IsNotEmpty()) { factors = new FactorList(); foreach (WebFactor webFactor in webFactors) { factors.Add(GetFactor(userContext, webFactor, factorDataTypes, factorOrigins, factorUpdateModes)); } factors.Sort(); } return(factors); }
/// <summary> /// Read UserDataSet from xml file. /// </summary> /// <param name='fileName'>File name.</param> /// <param name='dictionaryURI'>Path.</param> /// <returns>The read UserDataSet.</returns> public static UserDataSet Deserialize(String fileName, String dictionaryURI) { Stream stream = File.OpenRead(fileName); BinaryFormatter formatter = new BinaryFormatter(); UserDataSet userDataSet = (UserDataSet)formatter.Deserialize(stream); stream.Close(); stream = File.OpenRead(dictionaryURI + @"\Factors.bin"); FactorList allFactors = ((FactorList)formatter.Deserialize(stream)); stream.Close(); stream = File.OpenRead(dictionaryURI + @"\FactorTrees.bin"); FactorTreeNodeList factorTrees = ((FactorTreeNodeList)formatter.Deserialize(stream)); stream.Close(); stream = File.OpenRead(dictionaryURI + @"\SpeciesFactQualities.bin"); SpeciesFactQualityList speciesFactQualities = ((SpeciesFactQualityList)formatter.Deserialize(stream)); stream.Close(); stream = File.OpenRead(dictionaryURI + @"\Periods.bin"); PeriodList periods = ((PeriodList)formatter.Deserialize(stream)); stream.Close(); PeriodManager.InitialisePeriods(periods); SpeciesFactManager.InitialiseSpeciesFactQualities(speciesFactQualities); FactorManager.InitialiseAllFactors(allFactors, factorTrees); SpeciesFactManager.InitAutomatedCalculations(userDataSet.SpeciesFacts); return(userDataSet); }
/// <summary> /// Retrieves information about the specified taxon. /// </summary> /// <param name="taxonId">Id of the taxon.</param> /// <returns>Information about the specified taxon.</returns> public TaxonSpeciesFactViewModel GetTaxonSpeciesFact(int taxonId) { mTaxon = CoreData.TaxonManager.GetTaxon(mUserContext, taxonId); mTaxonSpeciesFact = new TaxonSpeciesFactViewModel(mUserContext, mTaxon); IIndividualCategory individualCategory = CoreData.FactorManager.GetDefaultIndividualCategory(mUserContext); IPeriod period = CoreData.FactorManager.GetCurrentRedListPeriod(mUserContext); PeriodList periods = CoreData.FactorManager.GetPublicPeriods(mUserContext); IFactor categoryFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.RedlistCategory); IFactor criteriaDocumentationFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.RedlistCriteriaDocumentation); IFactor criteriaFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.RedlistCriteriaString); IFactor globalCategoryFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.GlobalRedlistCategory); //FactorList landscapeTypesFactors = LandscapeTypeCache.GetFactors(mUserContext); //FactorList lifeFormFactors = LifeFormCache.GetFactors(mUserContext); FactorList conventionFactors = CoreData.FactorManager.GetFactorTree(mUserContext, FactorId.Conventions).GetAllLeafFactors(); IFactor organismGroup1Factor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.Redlist_OrganismLabel1); IFactor organismGroup2Factor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.Redlist_OrganismLabel2); //FactorList countyOccurrenceFactors = CountyOccurrenceCache.GetFactors(mUserContext); //FactorList biotopeFactors = BiotopeCache.GetFactors(mUserContext); //FactorList substrateFactors = SubstrateCache.GetFactors(mUserContext); //FactorList impactFactors = ImpactCache.GetFactors(mUserContext); IFactor actionPlanFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.ActionPlan); IFactor protectedByLawFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.ProtectedByLaw); IFactor swedishOccurrenceFactor = CoreData.FactorManager.GetFactor(mUserContext, FactorId.SwedishOccurrence); //FactorList hostFactors = HostCache.GetFactors(mUserContext); // Get species facts. var countyOccurrenceSpeciesFacts = new SpeciesFactList(); var landscapeTypeSpeciesFacts = new SpeciesFactList(); var biotopeSpeciesFacts = new SpeciesFactList(); var lifeFormSpeciesFacts = new SpeciesFactList(); var conventionSpeciesFacts = new SpeciesFactList(); var previouslyCategorySpeciesFact = new SpeciesFactList(); ISpeciesFact categorySpeciesFact = null; ISpeciesFact criteriaDocumentationSpeciesFact = null; ISpeciesFact criteriaSpeciesFact = null; ISpeciesFact globalCategorySpeciesFact = null; ISpeciesFact organismGroup1SpeciesFact = null; ISpeciesFact organismGroup2SpeciesFact = null; var substrateSpeciesFacts = new SpeciesFactList(); var impactSpeciesFacts = new SpeciesFactList(); ISpeciesFact actionPlanSpeciesFact = null; ISpeciesFact protectedByLawSpeciesFact = null; ISpeciesFact swedishOccurrenceSpeciesFact = null; var hostSpeciesFacts = new SpeciesFactList(); ISpeciesFactSearchCriteria searchCriteria = new SpeciesFactSearchCriteria { Factors = new FactorList() }; searchCriteria.AddTaxon(mTaxon); searchCriteria.Add(individualCategory); foreach (IPeriod tempPeriod in periods) { searchCriteria.Add(tempPeriod); } // Add current period if not exist. bool currentPeriodExist = periods.Any(tempPeriod => tempPeriod.Id == period.Id); if (!currentPeriodExist) { searchCriteria.Add(period); } searchCriteria.Add(categoryFactor); searchCriteria.Add(criteriaDocumentationFactor); searchCriteria.Add(criteriaFactor); searchCriteria.Add(globalCategoryFactor); //searchCriteria.Factors.AddRange(landscapeTypesFactors); //searchCriteria.Factors.AddRange(lifeFormFactors); searchCriteria.Factors.AddRange(conventionFactors); searchCriteria.Add(organismGroup1Factor); searchCriteria.Add(organismGroup2Factor); //searchCriteria.Factors.AddRange(countyOccurrenceFactors); //searchCriteria.Factors.AddRange(biotopeFactors); //searchCriteria.Factors.AddRange(substrateFactors); //searchCriteria.Factors.AddRange(impactFactors); searchCriteria.Add(actionPlanFactor); searchCriteria.Add(protectedByLawFactor); searchCriteria.Add(swedishOccurrenceFactor); //searchCriteria.Factors.AddRange(hostFactors); SpeciesFactList speciesFacts = CoreData.SpeciesFactManager.GetSpeciesFacts(mUserContext, searchCriteria); // Split species facts into information groups. if (speciesFacts.IsNotEmpty()) { foreach (ISpeciesFact speciesFact in speciesFacts) { //if (countyOccurrenceFactors.Exists(speciesFact.Factor)) //{ // countyOccurrenceSpeciesFacts.Add(speciesFact); //} //else if (landscapeTypesFactors.Exists(speciesFact.Factor)) //{ // landscapeTypeSpeciesFacts.Add(speciesFact); //} //else if (biotopeFactors.Exists(speciesFact.Factor)) //{ // biotopeSpeciesFacts.Add(speciesFact); //} //else if (substrateFactors.Exists(speciesFact.Factor)) //{ // substrateSpeciesFacts.Add(speciesFact); // if (hostFactors.Exists(speciesFact.Factor)) // { // hostSpeciesFacts.Add(speciesFact); // } //} //else if (impactFactors.Exists(speciesFact.Factor)) //{ // impactSpeciesFacts.Add(speciesFact); //} //else if (lifeFormFactors.Exists(speciesFact.Factor)) //{ // lifeFormSpeciesFacts.Add(speciesFact); //} if (conventionFactors.Exists(speciesFact.Factor)) { conventionSpeciesFacts.Add(speciesFact); } else if (speciesFact.Factor.Id == (int)FactorId.RedlistCategory && speciesFact.Period.Id != period.Id) { previouslyCategorySpeciesFact.Add(speciesFact); } else { switch (speciesFact.Factor.Id) { case (int)FactorId.ActionPlan: actionPlanSpeciesFact = speciesFact; break; case (int)FactorId.GlobalRedlistCategory: globalCategorySpeciesFact = speciesFact; break; case (int)FactorId.ProtectedByLaw: protectedByLawSpeciesFact = speciesFact; break; case (int)FactorId.RedlistCategory: categorySpeciesFact = speciesFact; break; case (int)FactorId.RedlistCriteriaDocumentation: criteriaDocumentationSpeciesFact = speciesFact; break; case (int)FactorId.RedlistCriteriaString: criteriaSpeciesFact = speciesFact; break; case (int)FactorId.Redlist_OrganismLabel1: organismGroup1SpeciesFact = speciesFact; break; case (int)FactorId.Redlist_OrganismLabel2: organismGroup2SpeciesFact = speciesFact; break; case (int)FactorId.SwedishOccurrence: swedishOccurrenceSpeciesFact = speciesFact; break; } } } } //mTaxonSpeciesFact.InitCountyOccurrenceInformation(countyOccurrenceSpeciesFacts); //mTaxonSpeciesFact.InitLandscapeTypeInformation(landscapeTypeSpeciesFacts); //mTaxonSpeciesFact.InitBiotopeInformation(biotopeSpeciesFacts); //mTaxonSpeciesFact.InitLifeFormInformation(lifeFormSpeciesFacts); //mTaxonSpeciesFact.InitConventionInformation(conventionSpeciesFacts); InitRedListInformation( mTaxonSpeciesFact, categorySpeciesFact, criteriaSpeciesFact, criteriaDocumentationSpeciesFact, globalCategorySpeciesFact, period); //mTaxonSpeciesFact.InitOrganismGroupInformation(organismGroup1SpeciesFact, // organismGroup2SpeciesFact); //mTaxonSpeciesFact.InitSubstrateInformation(substrateSpeciesFacts); //mTaxonSpeciesFact.InitImpactInformation(impactSpeciesFacts); //mTaxonSpeciesFact.InitActionPlanInformation(actionPlanSpeciesFact); //mTaxonSpeciesFact.InitProtectedByLawInformation(protectedByLawSpeciesFact); //mTaxonSpeciesFact.InitHostInformation(hostSpeciesFacts, mUserContext); //mTaxonSpeciesFact.InitSwedishOccurrenceInformation(swedishOccurrenceSpeciesFact); //mTaxonSpeciesFact.InitPreviouslyRedListedCategories(previouslyCategorySpeciesFact); //GetSpeciesInformationDocument(); //long pictureId; //mTaxonSpeciesFact.HasImage = !string.IsNullOrWhiteSpace(GetPictureByTaxon(mTaxon, // AppSettings.Default.PictureXtraLargeHeight, // AppSettings.Default.PictureXtraLargeWidth, // AppSettings.Default.PictureLargeSize, // true, // string.Empty, // out pictureId)); //mTaxonSpeciesFact.ImageMetaData = GetPictureMetadataByPictureId(pictureId); //mTaxonSpeciesFact.HasCountyMap = GetCountyMap(mTaxon) != null; //mTaxonSpeciesFact.HasObservationMap = SpeciesFilter.IsTaxaSpeciesOrBelow(mTaxon) && // SpeciesFactCacheManager.Instance.GetObservationMap(mTaxon.Id.ToString(CultureInfo.InvariantCulture)) != null; mTaxonSpeciesFact.HasSpeciesFacts = HasSpeciesFacts(speciesFacts); mTaxonSpeciesFact.IsValid = CheckIfTaxonValid(); //mTaxonSpeciesFact.Synonyms = mTaxon.GetSynonymsViewModel(mUserContext); // Identify higher level taxa //mTaxonSpeciesFact.CategoryNameHighLevel = SpeciesFilter.IsTaxaSpeciesOrBelow(mTaxon) ? "" : mTaxon.Category.Name + " - "; //// Ignore if not higher taxa //if ((mTaxonSpeciesFact.IsHigherTaxa = !SpeciesFilter.IsTaxaSpeciesOrBelow(mTaxon)) == false) //{ // return mTaxonSpeciesFact; //} // Count all occurences for each category in underlying taxa //var taxonNameSearchInformation = TaxonNameSearchManager.Instance.GetInformation(this.mTaxon.Id); //foreach (var category in RedListedHelper.GetAllRedListCategories()) //{ // mTaxonSpeciesFact.RedListCategoryTaxa[category] = new List<int>(); //} //foreach (var taxonInfoType in taxonNameSearchInformation.AllChildTaxaIdsInScope) //{ // if (SpeciesFilter.IsTaxaSpeciesOrBelow(taxonInfoType.CategoryId, taxonInfoType.ParentCategoryId) && taxonInfoType.HasValidRedListCategory) // { // mTaxonSpeciesFact.RedListCategoryTaxa[taxonInfoType.RedListCategoryId].Add(taxonInfoType.TaxonId); // } //} return(mTaxonSpeciesFact); }
//public static void InitSwedishOccurrenceInformation(this SearchViewModel searchViewModel) //{ // if (mSearchViewModelFromSession.IsNotNull() && mSearchViewModelFromSession.SwedishOccurrences.IsNotNull()) // { // searchViewModel.IsSwedishOccurrenceEnabled = mSearchViewModelFromSession.IsSwedishOccurrenceEnabled; // searchViewModel.SwedishOccurrenceTitle = mSearchViewModelFromSession.SwedishOccurrenceTitle; // searchViewModel.SwedishOccurrences = mSearchViewModelFromSession.SwedishOccurrences; // } // else // { // searchViewModel.SwedishOccurrences = new List<RedListSwedishOccurrenceItemViewModel>(); // // Get swedish occurrence factor // FactorList swedishOccurrenceFactors = SwedishOccurrenceCache.GetFactors(mUser); // // Populate swedish occurrence // foreach (var swedishOccurrenceFactor in swedishOccurrenceFactors) // { // foreach (var swedishOccurrenceItem in swedishOccurrenceFactor.DataType.Field1.Enum.Values) // { // // The level of swedish occurrence is defined in the appsettings // if (swedishOccurrenceItem.KeyInt.HasValue && swedishOccurrenceItem.KeyInt.Value > AppSettings.Default.SwedishOccurrenceExist) // { // var redListSwedishOccurrenceItemViewModel = new RedListSwedishOccurrenceItemViewModel // { // Id = swedishOccurrenceItem.KeyInt.Value, // Name = swedishOccurrenceItem.OriginalLabel, // Selected = true, // }; // searchViewModel.SwedishOccurrences.Add(redListSwedishOccurrenceItemViewModel); // } // } // } // // Set swedish occurrences to true as default // searchViewModel.IsSwedishOccurrenceEnabled = true; // } //} ///// <summary> ///// Init Biotopes information. ///// </summary> ///// <param name="searchViewModel">Search criteria view model.</param> //public static void InitBiotopeInformation(this SearchViewModel searchViewModel) //{ // if (mSearchViewModelFromSession.IsNotNull() && mSearchViewModelFromSession.Biotopes.IsNotNull()) // { // searchViewModel.IsBiotopeEnabled = mSearchViewModelFromSession.IsBiotopeEnabled; // searchViewModel.IsBiotopeImportant = mSearchViewModelFromSession.IsBiotopeImportant; // searchViewModel.BiotopeOperator = mSearchViewModelFromSession.BiotopeOperator; // searchViewModel.Biotopes = mSearchViewModelFromSession.Biotopes; // searchViewModel.BiotopesTitle = mSearchViewModelFromSession.BiotopesTitle; // } // else // { // searchViewModel.Biotopes = new List<RedListBiotopeItemViewModel>(); // // Get superior factor for biotopes. // IFactor superiorFactor = CoreData.FactorManager.GetFactor(mUser, FactorId.Biotopes); // // Get biotope factors // FactorList biotopeFactors = BiotopeCache.GetFactors(mUser); // // Set title for biotopes, from factor. // searchViewModel.BiotopesTitle = superiorFactor.Label; // // Populate biotopes // foreach (var biotopeFactor in biotopeFactors) // { // var redListBiotopeItemViewModel = new RedListBiotopeItemViewModel // { // Id = biotopeFactor.Id, // Name = biotopeFactor.Name // }; // searchViewModel.Biotopes.Add(redListBiotopeItemViewModel); // } // searchViewModel.BiotopeOperator = LogicalOperator.Or; // } //} ///// <summary> ///// Init CountyOccurrences information. ///// </summary> ///// <param name="searchViewModel">Search criteria view model.</param> //public static void InitCountyOccurrencesInformation(this SearchViewModel searchViewModel) //{ // if (mSearchViewModelFromSession.IsNotNull() && mSearchViewModelFromSession.CountyOccurrences.IsNotNull()) // { // searchViewModel.IsCountyOccurrenceEnabled = mSearchViewModelFromSession.IsCountyOccurrenceEnabled; // searchViewModel.CountyOccurrences = mSearchViewModelFromSession.CountyOccurrences; // searchViewModel.CountyOccurrencesTitle = mSearchViewModelFromSession.CountyOccurrencesTitle; // } // else // { // searchViewModel.CountyOccurrences = new List<RedListCountyOccurrenceItemViewModel>(); // // Get superior factor, for county occurrence. // IFactor superiorFactor = CoreData.FactorManager.GetFactor(mUser, FactorId.CountyOccurrence); // // Get county occurrence factors // FactorList countyOccurenceFactors = CountyOccurrenceCache.GetFactors(mUser); // // Set title for county occurrence, from factor. // searchViewModel.CountyOccurrencesTitle = superiorFactor.Label; // // Populate county occurrence // foreach (var countyOccurenceFactor in countyOccurenceFactors) // { // var redListCountyOccurrenceItemViewModel = new RedListCountyOccurrenceItemViewModel // { // Id = countyOccurenceFactor.Id, // Name = countyOccurenceFactor.Name // }; // searchViewModel.CountyOccurrences.Add(redListCountyOccurrenceItemViewModel); // } // } //} ///// <summary> ///// Init ThematicLists information. ///// </summary> ///// <param name="searchViewModel">Search criteria view model.</param> //public static void InitThematicListInformation(this SearchViewModel searchViewModel) //{ // searchViewModel.ThematicLists = new List<RedListThematicListItemViewModel>(); // if (mSearchViewModelFromSession.IsNotNull() && mSearchViewModelFromSession.ThematicLists.IsNotNull()) // { // searchViewModel.IsThematicListEnabled = mSearchViewModelFromSession.IsThematicListEnabled; // searchViewModel.ThematicListOperator = mSearchViewModelFromSession.ThematicListOperator; // searchViewModel.ThematicLists = mSearchViewModelFromSession.ThematicLists; // } // else // { // foreach (ThematicListEnum @enum in Enum.GetValues(typeof(ThematicListEnum)).Cast<ThematicListEnum>()) // { // var redListThematicListItemViewModel = new RedListThematicListItemViewModel(); // switch (@enum) // { // case ThematicListEnum.ContinuousDecline: // redListThematicListItemViewModel.Id = (int)@enum; // redListThematicListItemViewModel.Name = RedListResource.TaxonSearchThematicListContinuousDecline; // break; // case ThematicListEnum.ExtremeFluctuations: // redListThematicListItemViewModel.Id = (int)@enum; // redListThematicListItemViewModel.Name = RedListResource.TaxonSearchThematicListExtremeFluctuations; // break; // case ThematicListEnum.SevereleyFragmented: // redListThematicListItemViewModel.Id = (int)@enum; // redListThematicListItemViewModel.Name = RedListResource.TaxonSearchThematicListSeverelyFragmented; // break; // case ThematicListEnum.SmallPopulationOrDistribution: // redListThematicListItemViewModel.Id = (int)@enum; // redListThematicListItemViewModel.Name = RedListResource.TaxonSearchThematicListSmallPopulationOrDistribution; // break; // } // searchViewModel.ThematicLists.Add(redListThematicListItemViewModel); // } // searchViewModel.ThematicListOperator = LogicalOperator.Or; // } //} /// <summary> /// Init RedListCategories information. /// </summary> /// <param name="searchViewModel">Search criteria view model.</param> public static void InitRedListCategories(this SearchViewModel searchViewModel) { if (mSearchViewModelFromSession.IsNotNull() && mSearchViewModelFromSession.RedListCategories.IsNotNull()) { searchViewModel.IsRedListCategoriesEnabled = mSearchViewModelFromSession.IsRedListCategoriesEnabled; searchViewModel.RedListCategories = mSearchViewModelFromSession.RedListCategories; searchViewModel.RedListCategoriesTitle = mSearchViewModelFromSession.RedListCategoriesTitle; } else { var otherListedGroupCategoryIds = new List <int>(); // Get red list category factor FactorList redListCategoryFactors = RedListCategoryCache.GetFactors(mUser); // Set red list categories title, from factor. searchViewModel.RedListCategoriesTitle = redListCategoryFactors[0].Label; // Group a limited list of red list categories; "red listed group" var categories = RedListedHelper.GetRedListCategoriesDdToNt(); List <int> redListedGroupCategoryIds = categories.Select(cat => (int)cat).ToList(); // Group a limited list of red list categories; "other group" RedListCategory redListCategory; for (redListCategory = RedListCategory.LC; redListCategory <= RedListCategory.NE; redListCategory++) { otherListedGroupCategoryIds.Add((int)redListCategory); } searchViewModel.RedListCategories = new List <RedListCategoryItemViewModel>(); // Populate red list categories RedListCategoryItemViewModel redListCategoryItemViewModel; foreach (var redListCategoryFactor in redListCategoryFactors) { foreach (var redListCategoryItem in redListCategoryFactor.DataType.Field1.Enum.Values) { if (redListCategoryItem.KeyInt.HasValue && redListedGroupCategoryIds.Contains(redListCategoryItem.KeyInt.Value)) { redListCategoryItemViewModel = new RedListCategoryItemViewModel { Id = redListCategoryItem.Id, Name = redListCategoryItem.OriginalLabel, OrderNumber = redListCategoryItem.KeyInt.Value, Selected = true, InRedListedGroup = true, InOtherGroup = false }; searchViewModel.RedListCategories.Add(redListCategoryItemViewModel); } if (redListCategoryItem.KeyInt.HasValue && otherListedGroupCategoryIds.Contains(redListCategoryItem.KeyInt.Value)) { redListCategoryItemViewModel = new RedListCategoryItemViewModel { Id = redListCategoryItem.Id, Name = redListCategoryItem.OriginalLabel, OrderNumber = redListCategoryItem.KeyInt.Value, Selected = false, InRedListedGroup = false, InOtherGroup = true }; searchViewModel.RedListCategories.Add(redListCategoryItemViewModel); } } } const bool ShowNonCategorizedTaxa = true; const int NonCategorizedTaxaId = 1000; // Add value for non categorized taxa. Ie taxa that dont have category 743 if (ShowNonCategorizedTaxa) { redListCategoryItemViewModel = new RedListCategoryItemViewModel { Id = NonCategorizedTaxaId, Name = "Non categorized taxa -TEST", //RedListResource.TaxonSearchNonCategorizedTaxaLabel, OrderNumber = NonCategorizedTaxaId, Selected = false, InRedListedGroup = false, InOtherGroup = true }; searchViewModel.RedListCategories.Add(redListCategoryItemViewModel); } // Preselect red list category group as default searchViewModel.IsRedListCategoriesEnabled = true; } }
/// <summary> /// Convert a WebSpeciesFact instance into /// an ISpeciesFact instance. /// </summary> /// <param name="userContext"> /// Information about the user that makes this method call. /// </param> /// <param name="webSpeciesFact">A WebSpeciesFact instance.</param> /// <param name="factors">List of factors.</param> /// <param name="individualCategories">List of individual categories.</param> /// <param name="periods">List of periods.</param> /// <param name="references">List of references.</param> /// <param name="speciesFactQualities">List of species fact qualities.</param> /// <param name="taxa">Taxa that are used in the species facts.</param> /// <returns>An ISpeciesFact instance.</returns> private ISpeciesFact GetSpeciesFact(IUserContext userContext, WebSpeciesFact webSpeciesFact, FactorList factors, IndividualCategoryList individualCategories, PeriodList periods, ReferenceList references, SpeciesFactQualityList speciesFactQualities, TaxonList taxa) { IFactor factor; IPeriod period; ISpeciesFact speciesFact; ITaxon host, taxon; factor = factors.Get(webSpeciesFact.FactorId); if (webSpeciesFact.IsHostSpecified) { #if EXAMINE_PROBLEM if (!(taxa.Contains(webSpeciesFact.HostId))) { throw new Exception("Host with id = " + webSpeciesFact.HostId + " is not in taxon list." + webSpeciesFact.GetString()); } #endif host = taxa.Get(webSpeciesFact.HostId); } else { if (factor.IsTaxonomic) { host = CoreData.TaxonManager.GetTaxon(userContext, 0); } else { host = null; } } if (webSpeciesFact.IsPeriodSpecified) { #if EXAMINE_PROBLEM if (!(periods.Contains(webSpeciesFact.PeriodId))) { throw new Exception("Period with id = " + webSpeciesFact.PeriodId + " is not in period list." + webSpeciesFact.GetString()); } #endif period = periods.Get(webSpeciesFact.PeriodId); } else { period = null; } #if EXAMINE_PROBLEM if (!(taxa.Contains(webSpeciesFact.TaxonId))) { throw new Exception("Taxon with id = " + webSpeciesFact.TaxonId + " is not in taxon list." + webSpeciesFact.GetString()); } #endif taxon = taxa.Get(webSpeciesFact.TaxonId); #if EXAMINE_PROBLEM if (!(individualCategories.Contains(webSpeciesFact.IndividualCategoryId))) { throw new Exception("Individual category with id = " + webSpeciesFact.IndividualCategoryId + " is not in individual category list." + webSpeciesFact.GetString()); } if (!(speciesFactQualities.Contains(webSpeciesFact.QualityId))) { throw new Exception("Quality with id = " + webSpeciesFact.QualityId + " is not in quality list." + webSpeciesFact.GetString()); } if (!(references.Contains(webSpeciesFact.ReferenceId))) { throw new Exception("Reference with id = " + webSpeciesFact.ReferenceId + " is not in reference list." + webSpeciesFact.GetString()); } #endif speciesFact = CoreData.SpeciesFactManager.GetSpeciesFact(userContext, webSpeciesFact.Id, taxon, individualCategories.Get(webSpeciesFact.IndividualCategoryId), factor, host, period, webSpeciesFact.FieldValue1, webSpeciesFact.IsFieldValue1Specified, webSpeciesFact.FieldValue2, webSpeciesFact.IsFieldValue2Specified, webSpeciesFact.FieldValue3, webSpeciesFact.IsFieldValue3Specified, webSpeciesFact.FieldValue4, webSpeciesFact.IsFieldValue4Specified, webSpeciesFact.FieldValue5, webSpeciesFact.IsFieldValue5Specified, speciesFactQualities.Get(webSpeciesFact.QualityId), references.Get(webSpeciesFact.ReferenceId), webSpeciesFact.ModifiedBy, webSpeciesFact.ModifiedDate); return(speciesFact); }
///// <summary> ///// Get all taxa that occurs in specified landscape types. ///// </summary> ///// <param name="landscapeTypes">Landscape types.</param> ///// <param name="isLandscapeTypeImportant">If true, landscape type must be important for returned taxa.</param> ///// <param name="dataQueryType">Data query type (only OR and AND is handled in this method)</param> ///// <returns>All taxa that occurs in specified landscape types.</returns> //public static TaxonList GetTaxa(List<String> landscapeTypes, // Boolean isLandscapeTypeImportant, // DataQueryType dataQueryType) //{ // TaxonList landscapeTypeOccurrenceTaxa, tempTaxa; // landscapeTypeOccurrenceTaxa = null; // if (landscapeTypes.IsNotEmpty()) // { // foreach (String landscapeType in landscapeTypes) // { // if (_landscapeTypeOccurrence[landscapeType].IsNotNull()) // { // switch (dataQueryType) // { // case DataQueryType.AndCondition: // if (landscapeTypeOccurrenceTaxa.IsNull()) // { // landscapeTypeOccurrenceTaxa = new TaxonList(true); // landscapeTypeOccurrenceTaxa.AddRange((TaxonList)(_landscapeTypeOccurrence[landscapeType])); // if (!isLandscapeTypeImportant && // (_landscapeTypeOccurrence[landscapeType.ToLower()].IsNotNull())) // { // landscapeTypeOccurrenceTaxa.AddRange((TaxonList)(_landscapeTypeOccurrence[landscapeType.ToLower()])); // } // } // else // { // tempTaxa = new TaxonList(true); // tempTaxa.AddRange((TaxonList)(_landscapeTypeOccurrence[landscapeType])); // if (!isLandscapeTypeImportant && // (_landscapeTypeOccurrence[landscapeType.ToLower()].IsNotNull())) // { // tempTaxa.AddRange((TaxonList)(_landscapeTypeOccurrence[landscapeType.ToLower()])); // } // landscapeTypeOccurrenceTaxa.Subset(tempTaxa); // } // break; // case DataQueryType.OrCondition: // if (landscapeTypeOccurrenceTaxa.IsNull()) // { // landscapeTypeOccurrenceTaxa = new TaxonList(true); // } // landscapeTypeOccurrenceTaxa.Merge((TaxonList)(_landscapeTypeOccurrence[landscapeType])); // if (!isLandscapeTypeImportant && // (_landscapeTypeOccurrence[landscapeType.ToLower()].IsNotNull())) // { // landscapeTypeOccurrenceTaxa.Merge((TaxonList)(_landscapeTypeOccurrence[landscapeType.ToLower()])); // } // break; // } // } // } // } // return landscapeTypeOccurrenceTaxa; //} /// <summary> /// Load information about landscape type /// factors into run time memory. /// </summary> public static void LoadLandscapeTypeFactors(IUserContext userContext) { mLandscapeTypeFactors = CoreData.FactorManager.GetFactorTree(userContext, FactorId.LandscapeFactors).GetAllLeafFactors(); }
/// <summary> /// Convert a WebSpeciesFact instance into /// an ISpeciesFact instance. /// </summary> /// <param name="webSpeciesFact">A WebSpeciesFact instance.</param> /// <param name="factors">List of factors.</param> /// <param name="individualCategories">List of individual categories.</param> /// <param name="periods">List of periods.</param> /// <returns>An ISpeciesFact instance.</returns> private ISpeciesFact GetSpeciesFact( WebSpeciesFact webSpeciesFact, FactorList factors, IndividualCategoryList individualCategories, PeriodList periods) { IFactor factor; IPeriod period; ISpeciesFact speciesFact; ITaxon host, taxon; factor = factors.Get(webSpeciesFact.FactorId); if (webSpeciesFact.IsHostSpecified) { host = new Data.Taxon(); host.Id = webSpeciesFact.HostId; } else { if (factor.IsTaxonomic) { host = new Data.Taxon { Id = (int)TaxonId.Life }; } else { host = null; } } if (webSpeciesFact.IsPeriodSpecified) { period = periods.Get(webSpeciesFact.PeriodId); } else { period = null; } taxon = new Data.Taxon(); taxon.Id = webSpeciesFact.TaxonId; speciesFact = new SpeciesFact( webSpeciesFact.Id, taxon, individualCategories.Get(webSpeciesFact.IndividualCategoryId), factor, host, period, webSpeciesFact.FieldValue1, webSpeciesFact.IsFieldValue1Specified, webSpeciesFact.FieldValue2, webSpeciesFact.IsFieldValue2Specified, webSpeciesFact.FieldValue3, webSpeciesFact.IsFieldValue3Specified, webSpeciesFact.FieldValue4, webSpeciesFact.IsFieldValue4Specified, webSpeciesFact.FieldValue5, webSpeciesFact.IsFieldValue5Specified, null, null, webSpeciesFact.ModifiedBy, webSpeciesFact.ModifiedDate); return(speciesFact); }