Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyEntry"/> class.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <param name="name">Initial value for Display Name</param>
        /// <param name="description">Initial description - overide of description found in <c>value</c> object</param>
        /// <param name="relevance">The relevance - override of info found in <c>value</c></param>
        /// <seealso cref="imbSCI.Core.interfaces.IValueWithRoleInfo"/>
        /// <seealso cref="imbSCI.Core.interfaces.IValueWithUnitInfo"/>
        /// <seealso cref="imbSCI.Core.interfaces.IValueWithImportanceInfo"/>
        /// <seealso cref="IObjectWithNameAndDescription"/>
        public PropertyEntry(Object key, Object value, String name = "", String description = "", dataPointImportance relevance = dataPointImportance.normal)
        {
            // this.setFromEnumType(typeof(PropertyEntryColumn));

            this[PropertyEntryColumn.entry_key] = key;

            Object input = value;

            this[PropertyEntryColumn.entry_name]        = name;
            this[PropertyEntryColumn.entry_description] = description;
            this[PropertyEntryColumn.entry_importance]  = relevance.ToString();

            this[PropertyEntryColumn.entry_value] = value;

            if (value is IValueWithUnitInfo)
            {
                IValueWithUnitInfo value_IValueWithUnitInfo = (IValueWithUnitInfo)value;
                this[PropertyEntryColumn.entry_unit]     = value_IValueWithUnitInfo.unit_sufix;
                this[PropertyEntryColumn.entry_unitname] = value_IValueWithUnitInfo.unit_name;
            }

            if (input is IValueWithRoleInfo)
            {
                IValueWithRoleInfo input_IValueWithRoleInfo = (IValueWithRoleInfo)input;
                this[PropertyEntryColumn.role_letter] = input_IValueWithRoleInfo.role_letter;
                this[PropertyEntryColumn.role_name]   = input_IValueWithRoleInfo.role_name;
                this[PropertyEntryColumn.role_symbol] = input_IValueWithRoleInfo.role_symbol;
            }

            if (input is IObjectWithNameAndDescription)
            {
                IObjectWithNameAndDescription input_IObjectWithNameAndDescription = (IObjectWithNameAndDescription)input;

                this[PropertyEntryColumn.entry_name]        = input_IObjectWithNameAndDescription.name;
                this[PropertyEntryColumn.entry_description] = input_IObjectWithNameAndDescription.description;
            }

            if (input is IValueWithImportanceInfo)
            {
                IValueWithImportanceInfo input_IValueWithImportanceInfo = (IValueWithImportanceInfo)input;
                this[PropertyEntryColumn.entry_importance] = input_IValueWithImportanceInfo.relevance.ToString();
            }

            if (imbSciStringExtensions.isNullOrEmptyString(this[PropertyEntryColumn.entry_name]))
            {
                this[PropertyEntryColumn.entry_name] = key.ToString().imbTitleCamelOperation(true);
            }

            if (imbSciStringExtensions.isNullOrEmptyString(this[PropertyEntryColumn.entry_description]))
            {
                //this[PropertyEntryColumn.entry_description] = this.  this.getStringLine(",", PropertyEntryColumn.role_name, PropertyEntryColumn.entry_unitname, PropertyEntryColumn.role_letter);
            }
        }
Example #2
0
 public PropertyEntry relevance(dataPointImportance level)
 {
     this[PropertyEntryColumn.entry_importance] = level.ToString();
     return(this);
 }