Example #1
0
        protected override string ProcessDropdownControl(string variableIdentifier, IVariableSource data,
                                                         SdtContentDropDownList dropdown, List <string> otherParameters)
        {
            //This is the list that we should check to see if the value should be singular or plural
            var list     = data.GetVariable <IList>(variableIdentifier);
            var singular = list.Count <= 1;

            if (dropdown.ChildElements.Count == 0)
            {
                return(null);
            }

            var dropdownChildElement = singular || dropdown.ChildElements.Count == 1
                ? dropdown.ChildElements[0]
                : dropdown.ChildElements[1];

            return(GetListItemValue(dropdownChildElement));
        }
Example #2
0
        protected override string ProcessDropdownControl(string variableIdentifier, IVariableSource data,
                                                         SdtContentDropDownList dropdown, List <string> otherParameters)
        {
            if (dropdown.ChildElements.Count == 0)
            {
                return(null);
            }
            if (dropdown.ChildElements.Count == 1)
            {
                return(GetListItemValue(dropdown.ChildElements[0]));
            }

            var value =
                ConditionalUtils.EvaluateConditionalVariableWithParameters(variableIdentifier, data, otherParameters);

            var dropdownChildElement = value
                ? dropdown.ChildElements[0]
                : dropdown.ChildElements[1];

            return(GetListItemValue(dropdownChildElement));
        }
 /// <summary>
 /// Process a dropdown control, do something with the data and return the value that should get displayed
 /// </summary>
 /// <param name="variableIdentifier">The variable identifier</param>
 /// <param name="variableSource">The source of variable data</param>
 /// <param name="dropdown">The dropdown list element</param>
 /// <param name="otherParameters">Extra parameters passed to the tag</param>
 /// <returns>The string that will go in the content control</returns>
 protected abstract string ProcessDropdownControl(string variableIdentifier, IVariableSource variableSource,
                                                  SdtContentDropDownList dropdown, List <string> otherParameters);