object ReadObjectRef() { return(refs.Get(b.ReadUInt16())); }
/// <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); }