public void TaxonTest()
        {
            SpeciesInformationDocument target = GetTargetSpeciesInformationDocument();

            ArtDatabanken.Data.ArtDatabankenService.Taxon actual = target.Taxon;
            Assert.IsTrue(actual.ScientificName == target.ScientificName);
            Assert.IsTrue(actual.CommonName == target.CommonName);
        }
        public void TaxonTest()
        {
            SpeciesEncyclopediaArticle target = GetTargetSpeciesEncyclopediaArticle();

            ArtDatabanken.Data.ArtDatabankenService.Taxon actual = target.Taxon;
            Assert.IsTrue(actual.ScientificName == target.ScientificName);
            Assert.IsTrue(actual.CommonName == target.CommonName);
        }
Ejemplo n.º 3
0
 private ArtDatabanken.Data.ArtDatabankenService.Taxon GetTaxon()
 {
     if (_taxon.IsNull())
     {
         _taxon = TaxonManagerTest.GetOneTaxon();
     }
     return(_taxon);
 }
 /// <summary>
 /// Creates a species fact instance with data from web service.
 /// </summary>
 /// <param name="id">Id of the species fact</param>
 /// <param name="sortOrder">Sort order 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">Foctor 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="updateUserFullName">Full Name of the pdate user of the species fact</param>
 /// <param name="updateDate">Update date of the species fact</param>
 public SpeciesFactRedList(
     Int32 id,
     Int32 sortOrder,
     Taxon taxon,
     Int32 individualCategoryId,
     Int32 factorId,
     Taxon 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 updateUserFullName,
     DateTime updateDate)
     : base(id,
            sortOrder,
            taxon,
            individualCategoryId,
            factorId,
            host,
            hasHost,
            periodId,
            hasPeriod,
            fieldValue1,
            hasFieldValue1,
            fieldValue2,
            hasFieldValue2,
            fieldValue3,
            hasFieldValue3,
            fieldValue4,
            hasFieldValue4,
            fieldValue5,
            hasFieldValue5,
            qualityId,
            referenceId,
            updateUserFullName,
            updateDate)
 {
     IsInInit          = false;
     RedListCalculator = new RedListCalculator(taxon.TaxonType.Name, taxon.TaxonType.NameDefinite);
 }
 /// <summary>
 /// Create a SpeciesObservationArea instance.
 /// </summary>
 /// <param name='taxon'>Taxon for which the area calculations has been made.</param>
 /// <param name='speciesObservationCount'>Number of species observation used in the calculation.</param>
 /// <param name='gridSquareSize'>Size of grid square used in the calculation.</param>
 /// <param name='gridSquareMaxDistance'>Max distance between grid squares.</param>
 /// <param name='areaOfOccupancy'>Area of Occupancy (AOO) value.</param>
 /// <param name='extentOfOccurrence'>Extent of Occurrence (EOO) value.</param>
 public SpeciesObservationArea(Taxon taxon,
                               Int32 speciesObservationCount,
                               Int32 gridSquareSize,
                               Int32 gridSquareMaxDistance,
                               Int64 areaOfOccupancy,
                               Int64 extentOfOccurrence)
 {
     _taxon = taxon;
     _speciesObservationCount = speciesObservationCount;
     _gridSquareSize          = gridSquareSize;
     _gridSquareMaxDistance   = gridSquareMaxDistance;
     _areaOfOccupancy         = areaOfOccupancy;
     _extentOfOccurrence      = extentOfOccurrence;
 }
 /// <summary>
 /// Creates a species fact instance with data from web service.
 /// </summary>
 /// <param name="id">Id of the species fact</param>
 /// <param name="sortOrder">Sort order 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">Foctor 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="updateUserFullName">Full Name of the pdate user of the species fact</param>
 /// <param name="updateDate">Update date of the species fact</param>
 public SpeciesFactRedListCriteriaDocumentation(
     Int32 id,
     Int32 sortOrder,
     Taxon taxon,
     Int32 individualCategoryId,
     Int32 factorId,
     Taxon 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 updateUserFullName,
     DateTime updateDate)
     : base(id,
            sortOrder,
            taxon,
            individualCategoryId,
            factorId,
            host,
            hasHost,
            periodId,
            hasPeriod,
            fieldValue1,
            hasFieldValue1,
            fieldValue2,
            hasFieldValue2,
            fieldValue3,
            hasFieldValue3,
            fieldValue4,
            hasFieldValue4,
            fieldValue5,
            hasFieldValue5,
            qualityId,
            referenceId,
            updateUserFullName,
            updateDate)
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Creates a instance of a Species Information Document
 /// object based on a list of species facts.
 /// </summary>
 /// <param name="speciesFacts">The species facts related to species information document factors and a single taxon</param>
 /// <param name="period">Period for red list information.</param>
 public SpeciesEncyclopediaArticle(SpeciesFactList speciesFacts,
                                   Period period)
 {
     _period       = period;
     _speciesFacts = speciesFacts;
     if (_speciesFacts.IsEmpty())
     {
         _taxon = null;
     }
     else
     {
         _taxon = _speciesFacts[0].Taxon;
     }
     SetParagraphSpeciesFacts();
 }
 /// <summary>
 /// Create a TaxonCountyOccurrence instance.
 /// </summary>
 /// <param name='taxon'>Taxon.</param>
 /// <param name='countyIdentifier'>County identifier.</param>
 /// <param name='countyOccurrence'>County occurrence.</param>
 /// <param name='originalCountyOccurrence'>Original county occurrence.</param>
 public TaxonCountyOccurrence(Taxon taxon,
                              String countyIdentifier,
                              String countyOccurrence,
                              String originalCountyOccurrence)
 {
     _taxon                    = taxon;
     _county                   = GeographicManager.GetCounty(countyIdentifier);
     _countyOccurrence         = countyOccurrence;
     _hasSourceId              = false;
     _sourceId                 = DEFAULT_SOURCE_ID;
     _source                   = null;
     _hasArtDataId             = false;
     _artDataId                = DEFAULT_ART_DATA_ID;
     _originalCountyOccurrence = originalCountyOccurrence;
 }
 /// <summary>
 /// Creates a instance of a Species Information Document
 /// object based on a list of species facts.
 /// </summary>
 /// <param name="speciesFacts">The species facts related to species information document factors and a single taxon</param>
 /// <param name="period">Period for red list information.</param>
 public SpeciesInformationDocument(SpeciesFactList speciesFacts,
                                   Period period)
 {
     _period       = period;
     _speciesFacts = speciesFacts;
     if (_speciesFacts.IsEmpty())
     {
         _taxon = null;
     }
     else
     {
         _taxon = _speciesFacts[0].Taxon;
     }
     SetParagraphSpeciesFacts();
 }
        /// <summary>
        /// Get index for specified taxon.
        /// </summary>
        /// <param name='taxon'>Searched taxon.</param>
        /// <returns>Index for specified taxon.</returns>
        public Int32 GetIndex(Taxon taxon)
        {
            Int32 taxonIndex;

            if (this.IsNotEmpty())
            {
                for (taxonIndex = 0; taxonIndex < this.Count; taxonIndex++)
                {
                    if (this[taxonIndex].Id == taxon.Id)
                    {
                        return(taxonIndex);
                    }
                }
            }
            return(-1);
        }
        /// <summary>
        /// Get species fact with a unique combination of parameters
        /// </summary>
        /// <param name="taxon">Taxon for requested species fact.</param>
        /// <param name="individualCategory">Individual Category for requested species fact.</param>
        /// <param name="factor">Factor for requested species fact.</param>
        /// <param name="host">Host for the requested species fact</param>
        /// <param name="period">Period for the requested species fact</param>
        /// <returns>Requested species fact</returns>
        public SpeciesFact Get(
            Taxon taxon,
            IndividualCategory individualCategory,
            Factor factor,
            Taxon host,
            Period period)
        {
            String identifier;

            identifier = SpeciesFactManager.GetSpeciesFactIdentifier(taxon,
                                                                     individualCategory,
                                                                     factor,
                                                                     host,
                                                                     period);
            return(Get(identifier));
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Create a TaxonName instance.
 /// </summary>
 /// <param name='id'>Id for taxon name.</param>
 /// <param name='taxonId'>Id for the taxon that this name belongs to.</param>
 /// <param name='taxonNameTypeId'>Id for type of name.</param>
 /// <param name='taxonNameUseTypeId'>Id for use of name.</param>
 /// <param name='name'>Name for taxon name.</param>
 /// <param name='author'>Author of this taxon name.</param>
 /// <param name='isRecommended'>Information about if this is the recommended name.</param>
 public TaxonName(Int32 id,
                  Int32 taxonId,
                  Int32 taxonNameTypeId,
                  Int32 taxonNameUseTypeId,
                  String name,
                  String author,
                  Boolean isRecommended)
     : base(id)
 {
     _taxonId          = taxonId;
     _taxonNameType    = TaxonManager.GetTaxonNameType(taxonNameTypeId);
     _taxonNameUseType = TaxonManager.GetTaxonNameUseType(taxonNameUseTypeId);
     _name             = name;
     _author           = author;
     _taxon            = null;
     _isRecommended    = isRecommended;
 }
        /// <summary>
        /// Get a subset of this species fact list based on parameters
        /// </summary>
        /// <param name="taxon">The taxon for the requested species facts.</param>
        /// <param name="individualCategory">The individidual category for the requested species facts.</param>
        /// <param name="factor">The factor for the requested species facts.</param>
        /// <param name="period">The period for the requested species facts.</param>
        /// <returns></returns>
        public SpeciesFactList GetSpeciesFactsByParameters(
            Taxon taxon,
            IndividualCategory individualCategory,
            Factor factor,
            Period period)
        {
            SpeciesFactList speciesFacts = new SpeciesFactList();
            var             subset       = from SpeciesFact speciesFact in this
                                           where speciesFact.Taxon.Id == taxon.Id &&
                                           speciesFact.IndividualCategory.Id == individualCategory.Id &&
                                           speciesFact.Factor.Id == factor.Id &&
                                           ((speciesFact.Period == period) || (speciesFact.Period == null))
                                           select speciesFact;

            speciesFacts.AddRange(subset.ToArray());
            return(speciesFacts);
        }
        public void GetHostTaxa()
        {
            Int32 factorId = 1142;

            ArtDatabanken.Data.ArtDatabankenService.TaxonList taxa;

            foreach (TaxonInformationType taxonInformationType in Enum.GetValues(typeof(TaxonInformationType)))
            {
                taxa = ArtDatabanken.Data.ArtDatabankenService.TaxonManager.GetHostTaxa(factorId, taxonInformationType);
                Assert.IsNotNull(taxa);
                Assert.IsTrue(taxa.Count > 10);
                if (taxonInformationType == TaxonInformationType.Basic)
                {
                    ArtDatabanken.Data.ArtDatabankenService.Taxon taxon = taxa.Get(0);
                    Assert.AreEqual(taxon.ScientificName, "Saknas");
                }
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Get Taxon instance with data from WebTaxon instance.
        /// </summary>
        /// <param name="webTaxon">WebTaxon instance with data.</param>
        /// <returns>Taxon instance.</returns>
        private static Taxon GetTaxon(WebTaxon webTaxon)
        {
            DataFieldList dataFields;
            Taxon         taxon;

            dataFields = new DataFieldList(webTaxon.DataFields);
            switch (webTaxon.TaxonInformationType)
            {
            case TaxonInformationType.Basic:
                taxon = new Taxon(webTaxon.Id,
                                  webTaxon.TaxonTypeId,
                                  webTaxon.SortOrder,
                                  webTaxon.TaxonInformationType,
                                  webTaxon.ScientificName,
                                  webTaxon.Author,
                                  webTaxon.CommonName);
                break;

            case TaxonInformationType.PrintObs:
                taxon = new TaxonPrintObs(webTaxon.Id,
                                          webTaxon.TaxonTypeId,
                                          webTaxon.SortOrder,
                                          webTaxon.TaxonInformationType,
                                          webTaxon.ScientificName,
                                          webTaxon.Author,
                                          webTaxon.CommonName,
                                          dataFields.GetString(TaxonPrintObs.PHYLUM_DATA_FIELD),
                                          dataFields.GetString(TaxonPrintObs.CLASS_DATA_FIELD),
                                          dataFields.GetString(TaxonPrintObs.ORDER_DATA_FIELD),
                                          dataFields.GetString(TaxonPrintObs.FAMILY_DATA_FIELD));
                break;

            default:
                throw new Exception("Unknown taxon information type " + webTaxon.TaxonInformationType.ToString() + "!");
            }
            return(taxon);
        }
 /// <summary>
 /// Create a DataIdentifier instance with information from
 /// a taxon.
 /// </summary>
 /// <param name='taxon'>A taxon.</param>
 /// <param name='dataType'>
 /// Data type is needed to distinguish between taxon and host.
 /// Default is taxon.
 /// </param>
 public DataIdentifier(Taxon taxon, DataTypeId dataType)
 {
     _data       = taxon;
     _dataType   = dataType;
     _identifier = taxon.Id.ToString();
 }
 /// <summary>
 /// Add a taxon to the data identifier list.
 /// Data type is added to distinguish between taxon and host.
 /// Default is taxon.
 /// </summary>
 /// <param name='taxon'>A taxon.</param>
 public void Add(Taxon taxon)
 {
     this.Add(taxon, DataTypeId.Taxon);
 }
 /// <summary>
 /// Create a DataIdentifier instance with information from
 /// a taxon.
 /// Data type is added to distinguish between taxon and host.
 /// Default is taxon.
 /// </summary>
 /// <param name='taxon'>A taxon.</param>
 public DataIdentifier(Taxon taxon)
     : this(taxon, DataTypeId.Taxon)
 {
 }
Ejemplo n.º 19
0
 public TaxonTest()
 {
     _taxon = null;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Creates a instance of a Species Information Document
 /// object based on taxon.
 /// </summary>
 /// <param name="taxon">Taxon.</param>
 public SpeciesEncyclopediaArticle(Taxon taxon)
     : this(taxon, PeriodManager.GetCurrentPublicPeriod())
 {
 }
        /// <summary>
        /// Creates a species fact instance with no data from web service.
        /// </summary>
        /// <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(
            Taxon taxon,
            IndividualCategory individualCategory,
            Factor factor,
            Taxon host,
            Period period)
            : base(-1, -1)
        {
            Int32 fieldIndex;

            _fields            = null;
            _substantialFields = null;
            _mainField         = null;
            _hasId             = false;

            _identifier = SpeciesFactManager.GetSpeciesFactIdentifier(
                taxon,
                individualCategory,
                factor,
                host,
                period);

            _taxon = taxon;
            _individualCategory = individualCategory;
            _factor             = factor;
            _host               = host;
            _hasHost            = _host.IsNotNull();
            _period             = period;
            _hasPeriod          = _period.IsNotNull();
            _quality            = SpeciesFactManager.GetDefaultSpeciesFactQuality();
            _oldQuality         = _quality;
            _reference          = null;
            _oldReference       = null;
            _updateUserFullName = null;
            _updateDate         = DateTime.MinValue;
            _hasUpdateDate      = false;

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

                foreach (FactorField factorField in _factor.FactorDataType.Fields)
                {
                    SpeciesFactField 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;
                    }
                }
            }
            _shouldBeSaved = AllowUpdate;
        }
        /// <summary>
        /// Creates a species fact instance with data from web service.
        /// </summary>
        /// <param name="id">Id of the species fact</param>
        /// <param name="sortOrder">Sort order 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">Foctor 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="updateUserFullName">Full Name of the pdate user of the species fact</param>
        /// <param name="updateDate">Update date of the species fact</param>
        public SpeciesFact(
            Int32 id,
            Int32 sortOrder,
            Taxon taxon,
            Int32 individualCategoryId,
            Int32 factorId,
            Taxon 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 updateUserFullName,
            DateTime updateDate)
            : base(id, sortOrder)
        {
            Int32 hostId;
            Int32 fieldIndex;

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

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

            _taxon = taxon;
            _individualCategory = IndividualCategoryManager.GetIndividualCategory(individualCategoryId);
            _factor             = FactorManager.GetFactor(factorId);

            if (hasHost)
            {
                _host    = host;
                _hasHost = hasHost;
            }
            else
            {
                if (_factor.IsTaxonomic)
                {
                    _host = TaxonManager.GetTaxon(0, TaxonInformationType.Basic);
                }
                else
                {
                    _host = null;
                }
                _hasHost = _host.IsNotNull();
            }



            if (hasPeriod)
            {
                _period = PeriodManager.GetPeriod(periodId);
            }
            else
            {
                _period = null;
            }
            _hasPeriod = hasPeriod;

            _quality            = SpeciesFactManager.GetSpeciesFactQuality(qualityId);
            _oldQuality         = _quality;
            _reference          = ReferenceManager.GetReference(referenceId);
            _oldReference       = _reference;
            _updateUserFullName = updateUserFullName;
            _updateDate         = updateDate;
            _hasUpdateDate      = true;

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

                foreach (FactorField factorField in _factor.FactorDataType.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;
                    }
                }
            }
            _shouldBeSaved = AllowUpdate;
        }
 /// <summary>
 /// Creates a instance of a Species Information Document
 /// object based on taxon.
 /// </summary>
 /// <param name="taxon">Taxon.</param>
 public SpeciesInformationDocument(Taxon taxon)
     : this(taxon, PeriodManager.GetCurrentPublicPeriod())
 {
 }