Esempio n. 1
0
        /// <summary>
        /// Update species fact with new data from database.
        /// </summary>
        /// <param name="id">Id of the species fact.</param>
        /// <param name="reference">Reference of the species fact.</param>
        /// <param name="modifiedDate">Modified date of the species fact.</param>
        /// <param name="modifiedBy">Name of the update user of the species fact.</param>
        /// <param name="hasFieldValue1">Indicates if field 1 has a value.</param>
        /// <param name="fieldValue1">Field value of field 1 for the species fact.</param>
        /// <param name="hasFieldValue2">Indicates if field 2 has a value.</param>
        /// <param name="fieldValue2">Field value of field 2 for the species fact.</param>
        /// <param name="hasFieldValue3">Indicates if field 3 has a value.</param>
        /// <param name="fieldValue3">Field value of field 3 for the species fact.</param>
        /// <param name="hasFieldValue4">Indicates if field 4 has a value.</param>
        /// <param name="fieldValue4">Field value of field 4 for the species fact.</param>
        /// <param name="hasFieldValue5">Indicates if field 5 has a value.</param>
        /// <param name="fieldValue5">Field value of field 5 for the species fact.</param>
        /// <param name="quality">Quality of the species fact.</param>
        public void Update(Int32 id,
                           IReference reference,
                           DateTime modifiedDate,
                           String modifiedBy,
                           Boolean hasFieldValue1,
                           Double fieldValue1,
                           Boolean hasFieldValue2,
                           Double fieldValue2,
                           Boolean hasFieldValue3,
                           Double fieldValue3,
                           Boolean hasFieldValue4,
                           String fieldValue4,
                           Boolean hasFieldValue5,
                           String fieldValue5,
                           ISpeciesFactQuality quality)
        {
            Id               = id;
            _hasId           = true;
            _quality         = quality;
            _oldQuality      = _quality;
            _reference       = reference;
            _oldReference    = reference;
            _modifiedBy      = modifiedBy;
            _modifiedDate    = modifiedDate;
            _hasModifiedDate = true;

            foreach (ISpeciesFactField field in _fields)
            {
                switch (field.Index)
                {
                case 0:
                    field.Update(hasFieldValue1, fieldValue1);
                    break;

                case 1:
                    field.Update(hasFieldValue2, fieldValue2);
                    break;

                case 2:
                    field.Update(hasFieldValue3, fieldValue3);
                    break;

                case 3:
                    field.Update(hasFieldValue4, fieldValue4);
                    break;

                case 4:
                    field.Update(hasFieldValue5, fieldValue5);
                    break;

                default:
                    throw new Exception("Unknown data field!");
                }
            }
        }
        /// <summary>
        /// Get a subset of this species fact list by quality.
        /// </summary>
        /// <param name="quality">The quality for the requested species facts.</param>
        /// <returns>A species fact list.</returns>
        public SpeciesFactList GetSpeciesFacts(ISpeciesFactQuality quality)
        {
            SpeciesFactList speciesFacts = new SpeciesFactList();
            var             subset       = from SpeciesFact speciesFact in this
                                           where speciesFact.Quality == quality
                                           select speciesFact;

            if (subset.IsNotNull() && subset.Any())
            {
                speciesFacts.AddRange(subset.ToArray());
            }

            return(speciesFacts);
        }
Esempio n. 3
0
 /// <summary>
 /// Reset species fact that has been deleted from database.
 /// Set all values to default or null.
 /// </summary>
 /// <param name="userContext">
 /// Information about the user that makes this method call.
 /// </param>
 public void Reset(IUserContext userContext)
 {
     Id                 = -1;
     _hasId             = false;
     _quality           = CoreData.SpeciesFactManager.GetDefaultSpeciesFactQuality(userContext);
     _oldQuality        = _quality;
     this._reference    = null;
     this._oldReference = null;
     _modifiedBy        = null;
     _modifiedDate      = DateTime.MinValue;
     _hasModifiedDate   = false;
     foreach (ISpeciesFactField field in _fields)
     {
         field.Reset();
     }
 }
        /// <summary>
        /// Gets the quality identifier.
        /// </summary>
        /// <param name="speciesFact">The species fact.</param>
        /// <returns>Species fact quality identifier; otherwise null.</returns>
        public static Int32?GetQualityId(this ISpeciesFact speciesFact)
        {
            if (speciesFact == null)
            {
                return(null);
            }

            ISpeciesFactQuality val = speciesFact.Quality;

            if (val != null)
            {
                return(val.Id);
            }

            return(null);
        }
        /// <summary>
        /// Gets the name of the quality.
        /// </summary>
        /// <param name="speciesFact">The species fact.</param>
        /// <returns>Species fact quality name; otherwise null.</returns>
        public static String GetQualityName(this ISpeciesFact speciesFact)
        {
            if (speciesFact == null)
            {
                return(null);
            }

            ISpeciesFactQuality val = speciesFact.Quality;

            if (val != null)
            {
                return(val.Name);
            }

            return(null);
        }
 /// <summary>
 /// Creates a species fact instance with data from data source.
 /// </summary>
 /// <param name="userContext">
 /// Information about the user that makes this method call.
 /// </param>
 /// <param name="id">Id of the species fact.</param>
 /// <param name="taxon">Taxon of the species fact.</param>
 /// <param name="individualCategory">Individual Category of the species fact.</param>
 /// <param name="factor">Factor of the species fact.</param>
 /// <param name="host">Host taxon associated with the species fact.</param>
 /// <param name="period">Period of the species fact.</param>
 /// <param name="fieldValue1">Field value of field 1 for the species fact.</param>
 /// <param name="hasFieldValue1">Indicates if field 1 has a value.</param>
 /// <param name="fieldValue2">Field value of field 2 for the species fact.</param>
 /// <param name="hasFieldValue2">Indicates if field 2 has a value.</param>
 /// <param name="fieldValue3">Field value of field 3 for the species fact.</param>
 /// <param name="hasFieldValue3">Indicates if field 3 has a value.</param>
 /// <param name="fieldValue4">Field value of field 4 for the species fact.</param>
 /// <param name="hasFieldValue4">Indicates if field 4 has a value.</param>
 /// <param name="fieldValue5">Field value of field 5 for the species fact.</param>
 /// <param name="hasFieldValue5">Indicates if field 5 has a value.</param>
 /// <param name="quality">Quality of the species fact.</param>
 /// <param name="reference">Reference of the species fact.</param>
 /// <param name="modifiedBy">Full name of the update user of the species fact.</param>
 /// <param name="modifiedDate">Update date of the species fact.</param>
 public SpeciesFactRedListCategory(IUserContext userContext,
                                   Int32 id,
                                   ITaxon taxon,
                                   IIndividualCategory individualCategory,
                                   IFactor factor,
                                   ITaxon host,
                                   IPeriod period,
                                   Double fieldValue1,
                                   Boolean hasFieldValue1,
                                   Double fieldValue2,
                                   Boolean hasFieldValue2,
                                   Double fieldValue3,
                                   Boolean hasFieldValue3,
                                   String fieldValue4,
                                   Boolean hasFieldValue4,
                                   String fieldValue5,
                                   Boolean hasFieldValue5,
                                   ISpeciesFactQuality quality,
                                   IReference reference,
                                   String modifiedBy,
                                   DateTime modifiedDate)
     : base(userContext,
            id,
            taxon,
            individualCategory,
            factor,
            host,
            period,
            fieldValue1,
            hasFieldValue1,
            fieldValue2,
            hasFieldValue2,
            fieldValue3,
            hasFieldValue3,
            fieldValue4,
            hasFieldValue4,
            fieldValue5,
            hasFieldValue5,
            quality,
            reference,
            modifiedBy,
            modifiedDate)
 {
     _redListCategoryAutomaticFactor = CoreData.FactorManager.GetFactor(userContext, FactorId.RedListCategoryAutomatic);
 }
 /// <summary>
 /// Creates a species fact instance with data from data source.
 /// </summary>
 /// <param name="userContext">
 /// Information about the user that makes this method call.
 /// </param>
 /// <param name="id">Id of the species fact.</param>
 /// <param name="taxon">Taxon of the species fact.</param>
 /// <param name="individualCategory">Individual Category of the species fact.</param>
 /// <param name="factor">Factor of the species fact.</param>
 /// <param name="host">Host taxon associated with the species fact.</param>
 /// <param name="period">Period of the species fact.</param>
 /// <param name="fieldValue1">Field value of field 1 for the species fact.</param>
 /// <param name="hasFieldValue1">Indicates if field 1 has a value.</param>
 /// <param name="fieldValue2">Field value of field 2 for the species fact.</param>
 /// <param name="hasFieldValue2">Indicates if field 2 has a value.</param>
 /// <param name="fieldValue3">Field value of field 3 for the species fact.</param>
 /// <param name="hasFieldValue3">Indicates if field 3 has a value.</param>
 /// <param name="fieldValue4">Field value of field 4 for the species fact.</param>
 /// <param name="hasFieldValue4">Indicates if field 4 has a value.</param>
 /// <param name="fieldValue5">Field value of field 5 for the species fact.</param>
 /// <param name="hasFieldValue5">Indicates if field 5 has a value.</param>
 /// <param name="quality">Quality of the species fact.</param>
 /// <param name="reference">Reference of the species fact.</param>
 /// <param name="modifiedBy">Full name of the update user of the species fact.</param>
 /// <param name="modifiedDate">Update date of the species fact.</param>
 public SpeciesFactRedListCriteriaDocumentation(IUserContext userContext,
                                                Int32 id,
                                                ITaxon taxon,
                                                IIndividualCategory individualCategory,
                                                IFactor factor,
                                                ITaxon host,
                                                IPeriod period,
                                                Double fieldValue1,
                                                Boolean hasFieldValue1,
                                                Double fieldValue2,
                                                Boolean hasFieldValue2,
                                                Double fieldValue3,
                                                Boolean hasFieldValue3,
                                                String fieldValue4,
                                                Boolean hasFieldValue4,
                                                String fieldValue5,
                                                Boolean hasFieldValue5,
                                                ISpeciesFactQuality quality,
                                                IReference reference,
                                                String modifiedBy,
                                                DateTime modifiedDate)
     : base(userContext,
            id,
            taxon,
            individualCategory,
            factor,
            host,
            period,
            fieldValue1,
            hasFieldValue1,
            fieldValue2,
            hasFieldValue2,
            fieldValue3,
            hasFieldValue3,
            fieldValue4,
            hasFieldValue4,
            fieldValue5,
            hasFieldValue5,
            quality,
            reference,
            modifiedBy,
            modifiedDate)
 {
 }
        /// <summary>
        /// Sets quality for a species fact.
        /// </summary>
        /// <param name="speciesFact">The species fact.</param>
        /// <param name="userContext">The user context.</param>
        /// <param name="qualityId">The quality id.</param>
        public static void SetQuality(this ISpeciesFact speciesFact, IUserContext userContext, int?qualityId)
        {
            int?currentQualityId = GetQualityId(speciesFact);

            if (currentQualityId.HasValue && currentQualityId.Value == qualityId)
            {
                return;
            }
            if (!qualityId.HasValue)
            {
                speciesFact.Quality = null;
                return;
            }

            ISpeciesFactQuality speciesFactQuality = CoreData.SpeciesFactManager.GetSpeciesFactQuality(userContext, qualityId.Value);

            if (speciesFactQuality != null)
            {
                speciesFact.Quality = speciesFactQuality;
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Creates a species fact instance with data from data source.
        /// </summary>
        /// <param name="id">Id of the species fact.</param>
        /// <param name="taxon">Taxon of the species fact.</param>
        /// <param name="individualCategory">Individual Category of the species fact.</param>
        /// <param name="factor">Factor of the species fact.</param>
        /// <param name="host">Host taxon associated with the species fact.</param>
        /// <param name="period">Period of the species fact.</param>
        /// <param name="fieldValue1">Field value of field 1 for the species fact.</param>
        /// <param name="hasFieldValue1">Indicates if field 1 has a value.</param>
        /// <param name="fieldValue2">Field value of field 2 for the species fact.</param>
        /// <param name="hasFieldValue2">Indicates if field 2 has a value.</param>
        /// <param name="fieldValue3">Field value of field 3 for the species fact.</param>
        /// <param name="hasFieldValue3">Indicates if field 3 has a value.</param>
        /// <param name="fieldValue4">Field value of field 4 for the species fact.</param>
        /// <param name="hasFieldValue4">Indicates if field 4 has a value.</param>
        /// <param name="fieldValue5">Field value of field 5 for the species fact.</param>
        /// <param name="hasFieldValue5">Indicates if field 5 has a value.</param>
        /// <param name="quality">Quality of the species fact.</param>
        /// <param name="reference">Reference of the species fact.</param>
        /// <param name="modifiedBy">Full name of the update user of the species fact.</param>
        /// <param name="modifiedDate">Update date of the species fact.</param>
        public SpeciesFact(Int32 id,
                           ITaxon taxon,
                           IIndividualCategory individualCategory,
                           IFactor factor,
                           ITaxon host,
                           IPeriod period,
                           Double fieldValue1,
                           Boolean hasFieldValue1,
                           Double fieldValue2,
                           Boolean hasFieldValue2,
                           Double fieldValue3,
                           Boolean hasFieldValue3,
                           String fieldValue4,
                           Boolean hasFieldValue4,
                           String fieldValue5,
                           Boolean hasFieldValue5,
                           ISpeciesFactQuality quality,
                           IReference reference,
                           String modifiedBy,
                           DateTime modifiedDate)
        {
            Int32 fieldIndex;

            Id                 = id;
            _fields            = null;
            _substantialFields = null;
            _mainField         = null;
            _hasId             = true;
            _identifier        = CoreData.SpeciesFactManager.GetSpeciesFactIdentifier(taxon,
                                                                                      individualCategory,
                                                                                      factor,
                                                                                      host,
                                                                                      period);

            _taxon = taxon;
            _individualCategory = individualCategory;
            _factor             = factor;
            _host            = host;
            _hasHost         = host.IsNotNull();
            _period          = period;
            _hasPeriod       = period.IsNotNull();
            _quality         = quality;
            _oldQuality      = quality;
            _reference       = reference;
            _oldReference    = reference;
            _modifiedBy      = modifiedBy;
            _modifiedDate    = modifiedDate;
            _hasModifiedDate = true;

            if (!_factor.UpdateMode.IsHeader)
            {
                _fields            = new SpeciesFactFieldList();
                _substantialFields = new SpeciesFactFieldList();
                _fieldArray        = new ISpeciesFactField[CoreData.FactorManager.GetFactorFieldMaxCount()];
                for (fieldIndex = 0; fieldIndex < CoreData.FactorManager.GetFactorFieldMaxCount(); fieldIndex++)
                {
                    _fieldArray[fieldIndex] = null;
                }

                foreach (FactorField factorField in _factor.DataType.Fields)
                {
                    Boolean          hasFieldValue;
                    SpeciesFactField field;
                    Object           fieldValue;

                    switch (factorField.Index)
                    {
                    case 0:
                        fieldValue    = fieldValue1;
                        hasFieldValue = hasFieldValue1;
                        break;

                    case 1:
                        fieldValue    = fieldValue2;
                        hasFieldValue = hasFieldValue2;
                        break;

                    case 2:
                        fieldValue    = fieldValue3;
                        hasFieldValue = hasFieldValue3;
                        break;

                    case 3:
                        fieldValue    = fieldValue4;
                        hasFieldValue = hasFieldValue4;
                        break;

                    case 4:
                        fieldValue    = fieldValue5;
                        hasFieldValue = hasFieldValue5;
                        break;

                    default:
                        throw new Exception("Unknown data field!");
                    }

                    field = new SpeciesFactField(this, factorField, hasFieldValue, fieldValue);
                    _fields.Add(field);
                    _fieldArray[field.Index] = field;

                    if (factorField.IsSubstantial)
                    {
                        _substantialFields.Add(field);
                    }

                    if (factorField.IsMain)
                    {
                        _mainField = field;
                    }
                }
            }

            Fields.Sort();
            _shouldBeSaved = AllowUpdate;
        }
Esempio n. 10
0
        /// <summary>
        /// Creates a species fact instance with no data from web service.
        /// </summary>
        /// <param name="userContext">
        /// Information about the user that makes this method call.
        /// </param>
        /// <param name="taxon">Taxon object of the species fact.</param>
        /// <param name="individualCategory">Individual category object of the species fact.</param>
        /// <param name="factor">Factor object of the species fact.</param>
        /// <param name="host">Host taxon object of the species fact.</param>
        /// <param name="period">Period object of the species fact.</param>
        public SpeciesFact(IUserContext userContext,
                           ITaxon taxon,
                           IIndividualCategory individualCategory,
                           IFactor factor,
                           ITaxon host,
                           IPeriod period)
        {
            Int32 fieldIndex;

            Id                 = -1;
            _fields            = null;
            _substantialFields = null;
            _mainField         = null;
            _hasId             = false;

            _identifier = CoreData.SpeciesFactManager.GetSpeciesFactIdentifier(taxon,
                                                                               individualCategory,
                                                                               factor,
                                                                               host,
                                                                               period);
            _taxon = taxon;
            _individualCategory = individualCategory;
            _factor             = factor;
            _host            = host;
            _hasHost         = _host.IsNotNull();
            _period          = period;
            _hasPeriod       = _period.IsNotNull();
            _quality         = CoreData.SpeciesFactManager.GetDefaultSpeciesFactQuality(userContext);
            _oldQuality      = _quality;
            _reference       = null;
            _oldReference    = null;
            _modifiedBy      = null;
            _modifiedDate    = DateTime.MinValue;
            _hasModifiedDate = false;

            if (!_factor.UpdateMode.IsHeader)
            {
                _fields            = new SpeciesFactFieldList();
                _substantialFields = new SpeciesFactFieldList();
                _fieldArray        = new ISpeciesFactField[CoreData.FactorManager.GetFactorFieldMaxCount()];
                for (fieldIndex = 0; fieldIndex < CoreData.FactorManager.GetFactorFieldMaxCount(); fieldIndex++)
                {
                    _fieldArray[fieldIndex] = null;
                }

                foreach (FactorField factorField in _factor.DataType.Fields)
                {
                    ISpeciesFactField field;

                    field = new SpeciesFactField(this, factorField, false, null);
                    _fields.Add(field);
                    _fieldArray[field.Index] = field;

                    if (factorField.IsSubstantial)
                    {
                        _substantialFields.Add(field);
                    }

                    if (factorField.IsMain)
                    {
                        _mainField = field;
                    }
                }
            }

            Fields.Sort();
            _shouldBeSaved = AllowUpdate;
        }
Esempio n. 11
0
        /// <summary>
        /// Creates a species fact instance with data from web service.
        /// </summary>
        /// <param name="userContext">
        /// Information about the user that makes this method call.
        /// </param>
        /// <param name="id">Id of the species fact.</param>
        /// <param name="taxon">Taxon of the species fact.</param>
        /// <param name="individualCategoryId">Individual Category Id of the species fact.</param>
        /// <param name="factorId">Factor id of the species fact.</param>
        /// <param name="host">Host taxon associated with the species fact.</param>
        /// <param name="hasHost">Indicates if this species fact has a host.</param>
        /// <param name="periodId">Period Id of the species fact.</param>
        /// <param name="hasPeriod">Indicates if this species fact has a period.</param>
        /// <param name="fieldValue1">Field value of field 1 for the species fact.</param>
        /// <param name="hasFieldValue1">Indicates if field 1 has a value.</param>
        /// <param name="fieldValue2">Field value of field 2 for the species fact.</param>
        /// <param name="hasFieldValue2">Indicates if field 2 has a value.</param>
        /// <param name="fieldValue3">Field value of field 3 for the species fact.</param>
        /// <param name="hasFieldValue3">Indicates if field 3 has a value.</param>
        /// <param name="fieldValue4">Field value of field 4 for the species fact.</param>
        /// <param name="hasFieldValue4">Indicates if field 4 has a value.</param>
        /// <param name="fieldValue5">Field value of field 5 for the species fact.</param>
        /// <param name="hasFieldValue5">Indicates if field 5 has a value.</param>
        /// <param name="qualityId">Quality Id of the species fact.</param>
        /// <param name="referenceId">Reference id of the species fact.</param>
        /// <param name="modifiedBy">Full name of the update user of the species fact.</param>
        /// <param name="modifiedDate">Update date of the species fact.</param>
        public SpeciesFact(IUserContext userContext,
                           Int32 id,
                           ITaxon taxon,
                           Int32 individualCategoryId,
                           Int32 factorId,
                           ITaxon host,
                           Boolean hasHost,
                           Int32 periodId,
                           Boolean hasPeriod,
                           Double fieldValue1,
                           Boolean hasFieldValue1,
                           Double fieldValue2,
                           Boolean hasFieldValue2,
                           Double fieldValue3,
                           Boolean hasFieldValue3,
                           String fieldValue4,
                           Boolean hasFieldValue4,
                           String fieldValue5,
                           Boolean hasFieldValue5,
                           Int32 qualityId,
                           Int32 referenceId,
                           String modifiedBy,
                           DateTime modifiedDate)
        {
            Int32 hostId;
            Int32 fieldIndex;

            Id                 = id;
            _fields            = null;
            _substantialFields = null;
            _mainField         = null;
            _hasId             = true;
            hostId             = 0;
            if (hasHost)
            {
                hostId = host.Id;
            }

            _identifier = CoreData.SpeciesFactManager.GetSpeciesFactIdentifier(taxon.Id,
                                                                               individualCategoryId,
                                                                               factorId,
                                                                               hasHost,
                                                                               hostId,
                                                                               hasPeriod,
                                                                               periodId);

            _taxon = taxon;
            _individualCategory = CoreData.FactorManager.GetIndividualCategory(userContext, individualCategoryId);
            _factor             = CoreData.FactorManager.GetFactor(userContext, factorId);

            if (hasHost)
            {
                _host    = host;
                _hasHost = true;
            }
            else
            {
                if (_factor.IsTaxonomic)
                {
                    _host = CoreData.TaxonManager.GetTaxon(userContext, 0);
                }
                else
                {
                    _host = null;
                }

                _hasHost = _host.IsNotNull();
            }

            if (hasPeriod)
            {
                _period = CoreData.FactorManager.GetPeriod(userContext, periodId);
            }
            else
            {
                _period = null;
            }

            _hasPeriod = hasPeriod;

            _quality         = CoreData.SpeciesFactManager.GetSpeciesFactQuality(userContext, qualityId);
            _oldQuality      = _quality;
            _reference       = CoreData.ReferenceManager.GetReference(userContext, referenceId);
            _oldReference    = _reference;
            _modifiedBy      = modifiedBy;
            _modifiedDate    = modifiedDate;
            _hasModifiedDate = true;

            if (!_factor.UpdateMode.IsHeader)
            {
                _fields            = new SpeciesFactFieldList();
                _substantialFields = new SpeciesFactFieldList();
                _fieldArray        = new ISpeciesFactField[CoreData.FactorManager.GetFactorFieldMaxCount()];
                for (fieldIndex = 0; fieldIndex < CoreData.FactorManager.GetFactorFieldMaxCount(); fieldIndex++)
                {
                    _fieldArray[fieldIndex] = null;
                }

                foreach (FactorField factorField in _factor.DataType.Fields)
                {
                    Boolean          hasFieldValue;
                    SpeciesFactField field;
                    Object           fieldValue;

                    switch (factorField.Index)
                    {
                    case 0:
                        fieldValue    = fieldValue1;
                        hasFieldValue = hasFieldValue1;
                        break;

                    case 1:
                        fieldValue    = fieldValue2;
                        hasFieldValue = hasFieldValue2;
                        break;

                    case 2:
                        fieldValue    = fieldValue3;
                        hasFieldValue = hasFieldValue3;
                        break;

                    case 3:
                        fieldValue    = fieldValue4;
                        hasFieldValue = hasFieldValue4;
                        break;

                    case 4:
                        fieldValue    = fieldValue5;
                        hasFieldValue = hasFieldValue5;
                        break;

                    default:
                        throw new Exception("Unknown data field!");
                    }

                    field = new SpeciesFactField(this, factorField, hasFieldValue, fieldValue);
                    _fields.Add(field);
                    _fieldArray[field.Index] = field;

                    if (factorField.IsSubstantial)
                    {
                        _substantialFields.Add(field);
                    }

                    if (factorField.IsMain)
                    {
                        _mainField = field;
                    }
                }
            }

            Fields.Sort();
            _shouldBeSaved = AllowUpdate;
        }
Esempio n. 12
0
        /// <summary>
        /// Creates a species fact instance with data from data source.
        /// </summary>
        /// <param name="userContext">
        /// Information about the user that makes this method call.
        /// </param>
        /// <param name="id">Id of the species fact.</param>
        /// <param name="taxon">Taxon of the species fact.</param>
        /// <param name="individualCategory">Individual Category of the species fact.</param>
        /// <param name="factor">Factor of the species fact.</param>
        /// <param name="host">Host taxon associated with the species fact.</param>
        /// <param name="period">Period of the species fact.</param>
        /// <param name="fieldValue1">Field value of field 1 for the species fact.</param>
        /// <param name="hasFieldValue1">Indicates if field 1 has a value.</param>
        /// <param name="fieldValue2">Field value of field 2 for the species fact.</param>
        /// <param name="hasFieldValue2">Indicates if field 2 has a value.</param>
        /// <param name="fieldValue3">Field value of field 3 for the species fact.</param>
        /// <param name="hasFieldValue3">Indicates if field 3 has a value.</param>
        /// <param name="fieldValue4">Field value of field 4 for the species fact.</param>
        /// <param name="hasFieldValue4">Indicates if field 4 has a value.</param>
        /// <param name="fieldValue5">Field value of field 5 for the species fact.</param>
        /// <param name="hasFieldValue5">Indicates if field 5 has a value.</param>
        /// <param name="quality">Quality of the species fact.</param>
        /// <param name="reference">Reference of the species fact.</param>
        /// <param name="modifiedBy">Full name of the update user of the species fact.</param>
        /// <param name="modifiedDate">Update date of the species fact.</param>
        public virtual ISpeciesFact GetSpeciesFact(IUserContext userContext,
                                                   Int32 id,
                                                   ITaxon taxon,
                                                   IIndividualCategory individualCategory,
                                                   IFactor factor,
                                                   ITaxon host,
                                                   IPeriod period,
                                                   Double fieldValue1,
                                                   Boolean hasFieldValue1,
                                                   Double fieldValue2,
                                                   Boolean hasFieldValue2,
                                                   Double fieldValue3,
                                                   Boolean hasFieldValue3,
                                                   String fieldValue4,
                                                   Boolean hasFieldValue4,
                                                   String fieldValue5,
                                                   Boolean hasFieldValue5,
                                                   ISpeciesFactQuality quality,
                                                   IReference reference,
                                                   String modifiedBy,
                                                   DateTime modifiedDate)
        {
            ISpeciesFact speciesFact;

            switch (factor.Id)
            {
            case (Int32)(FactorId.RedListCategoryAutomatic):
                speciesFact = new SpeciesFactRedListCategory(userContext,
                                                             id,
                                                             taxon,
                                                             individualCategory,
                                                             factor,
                                                             host,
                                                             period,
                                                             fieldValue1,
                                                             hasFieldValue1,
                                                             fieldValue2,
                                                             hasFieldValue2,
                                                             fieldValue3,
                                                             hasFieldValue3,
                                                             fieldValue4,
                                                             hasFieldValue4,
                                                             fieldValue5,
                                                             hasFieldValue5,
                                                             quality,
                                                             reference,
                                                             modifiedBy,
                                                             modifiedDate);
                break;

            case (Int32)(FactorId.RedListCriteriaAutomatic):
                speciesFact = new SpeciesFactRedListCriteria(userContext,
                                                             id,
                                                             taxon,
                                                             individualCategory,
                                                             factor,
                                                             host,
                                                             period,
                                                             fieldValue1,
                                                             hasFieldValue1,
                                                             fieldValue2,
                                                             hasFieldValue2,
                                                             fieldValue3,
                                                             hasFieldValue3,
                                                             fieldValue4,
                                                             hasFieldValue4,
                                                             fieldValue5,
                                                             hasFieldValue5,
                                                             quality,
                                                             reference,
                                                             modifiedBy,
                                                             modifiedDate);
                break;

            case (Int32)(FactorId.RedListCriteriaDocumentationAutomatic):
                speciesFact = new SpeciesFactRedListCriteriaDocumentation(userContext,
                                                                          id,
                                                                          taxon,
                                                                          individualCategory,
                                                                          factor,
                                                                          host,
                                                                          period,
                                                                          fieldValue1,
                                                                          hasFieldValue1,
                                                                          fieldValue2,
                                                                          hasFieldValue2,
                                                                          fieldValue3,
                                                                          hasFieldValue3,
                                                                          fieldValue4,
                                                                          hasFieldValue4,
                                                                          fieldValue5,
                                                                          hasFieldValue5,
                                                                          quality,
                                                                          reference,
                                                                          modifiedBy,
                                                                          modifiedDate);
                break;

            default:
                speciesFact = new SpeciesFact(id,
                                              taxon,
                                              individualCategory,
                                              factor,
                                              host,
                                              period,
                                              fieldValue1,
                                              hasFieldValue1,
                                              fieldValue2,
                                              hasFieldValue2,
                                              fieldValue3,
                                              hasFieldValue3,
                                              fieldValue4,
                                              hasFieldValue4,
                                              fieldValue5,
                                              hasFieldValue5,
                                              quality,
                                              reference,
                                              modifiedBy,
                                              modifiedDate);
                break;
            }

            return(speciesFact);
        }