コード例 #1
0
        /// <summary>
        /// Update the model code property of itself and all contained rows recursively
        /// </summary>
        public void UpdateModelCode()
        {
            IValueSet valueSet = null;

            if (this.Thing is Parameter)
            {
                valueSet = this.GetParameterValueSet();
            }
            else if (this.Thing is ParameterOverride)
            {
                valueSet = this.GetParameterOverrideValueSet();
            }
            else if (this.Thing is ParameterSubscription)
            {
                valueSet = this.GetParameterSubscriptionValueSet();
            }

            if (valueSet == null)
            {
                logger.Error("No Value set was found for the option: {0}, state: {1}", (this.ActualOption == null) ? "null" : this.ActualOption.Name, (this.ActualState == null) ? "null" : this.ActualState.Name);
                return;
            }

            this.ModelCode = valueSet.ModelCode(this.ValueIndex);

            foreach (var containedRow in this.ContainedRows)
            {
                var modelCodeRow = containedRow as IHaveModelCode;
                modelCodeRow?.UpdateModelCode();
            }
        }