コード例 #1
0
 /// <summary>
 /// Writes the value of <paramref name="likert"/> to the <paramref name="table"/>.
 /// </summary>
 /// <param name="table">The <see cref="MigraDoc.DocumentObjectModel.Tables.Table"/> to write to.</param>
 /// <param name="likert">The control.</param>
 /// <param name="container">The application data container.</param>
 /// <param name="level">The depth down the control tree being rendered (affects indenting).</param>
 private void WriteValueLikert(Table table, LikertControl likert, Dictionary<string, object> container, int level)
 {
     Dictionary<string, object> children = (Dictionary<string, object>)container[likert.Name];
     ControlList proxyControlList = likert.ToProxyControlList();
     this.WriteValue(table, proxyControlList, children, level);
 }
コード例 #2
0
        /// <summary>
        /// Writes the likert.
        /// </summary>
        /// <param name="sb">The string builder.</param>
        /// <param name="likert">The likert.</param>
        /// <param name="applicationData">The application data.</param>
        private void WriteLikert(StringBuilder sb, LikertControl likert, ApplicationData applicationData)
        {
            this.WriteHeaderRow(sb, likert.Label, FormatterResources.RepeaterStyles);

            NestedDictionary likertVals = applicationData.GetValue<NestedDictionary>(likert.Name);
            foreach (var row in likertVals)
            {
                var question = likert.Questions.FirstOrDefault(q => q.Name == row.Key);

                int applicationDataVal;
                bool isValidSelection = int.TryParse(row.Value.ToString(), out applicationDataVal);
                var scaleVal = isValidSelection ? likert.Scale.FirstOrDefault(s => s.Value == applicationDataVal) : null;

                if (question != null)
                {
                    this.WriteRow(sb, question.Label, scaleVal == null ? string.Empty : scaleVal.Description);
                }
            }
        }