Ejemplo n.º 1
0
        /// <summary>
        /// Split existing fields into different field types.
        /// </summary>
        private void InitFields()
        {
            Int32 fieldIndex;

            // Init field holders.
            _fieldArray = new FactorField[FactorManager.GetFactorFieldMaxCount()];
            for (fieldIndex = 0; fieldIndex < FactorManager.GetFactorFieldMaxCount(); fieldIndex++)
            {
                _fieldArray[fieldIndex] = null;
            }
            _mainField         = null;
            _substantialFields = new FactorFieldList();

            // Add information to field holders.
            foreach (FactorField field in Fields)
            {
                _fieldArray[field.Index] = field;
                if (field.IsSubstantial)
                {
                    _substantialFields.Add(field);
                }
                if (field.IsMain)
                {
                    _mainField = field;
                }
            }
        }
        /// <summary>
        /// Create a SpeciesFactField instance with default data.
        /// </summary>
        /// <param name="speciesFact">The SpeciesFact that this SpeciesFactField belongs to.</param>
        /// <param name="factorField">Factor field for the species fact field</param>
        public SpeciesFactField(SpeciesFact speciesFact,
                                FactorField factorField)
            : base(factorField.Id, factorField.Id)
        {
            _speciesFact = speciesFact;
            _factorField = factorField;

            UpdateData(false, null);
        }
        /// <summary>
        /// Create a SpeciesFactField instance with data from database.
        /// </summary>
        /// <param name="speciesFact">The SpeciesFact that this SpeciesFactField belongs to.</param>
        /// <param name="factorField">Factor field for the species fact field</param>
        /// <param name="hasValue">Indication whether or not a value is initially specified</param>
        /// <param name="value">The value of the species fact field</param>
        public SpeciesFactField(
            SpeciesFact speciesFact,
            FactorField factorField,
            Boolean hasValue,
            Object value)
            : base(factorField.Id, factorField.Id)
        {
            _speciesFact = speciesFact;
            _factorField = factorField;

            UpdateData(hasValue, value);
        }