コード例 #1
0
 private async Task AddRowsAsync(FieldDataToAdd fieldDataToAdd, string select, int fieldDataId)
 {
     if (fieldDataToAdd.Rows == null)
     {
         await Task.CompletedTask;
     }
     foreach (var row in fieldDataToAdd.Rows)
     {
         await AddRowAsync(fieldDataId, row.RowPosition, row.Input);
     }
 }
コード例 #2
0
        private async Task AddChoiceOptionsAsync(FieldDataToAdd fieldDataToAdd, string select, int fieldDataId)
        {
            if (fieldDataToAdd.ChoiceOptions != null)
            {
                var counter = 0;
                foreach (var choiceOption in fieldDataToAdd.ChoiceOptions)
                {
                    await AddChoiceOptionsAsync(fieldDataId, counter,
                                                choiceOption.Value, choiceOption.ViewValue);

                    counter++;
                }
            }
        }
コード例 #3
0
        private async Task AddChoiceOptionsAndRowsAsync(int questionTemplateId, string select, FieldDataToAdd fieldDataToAdd)
        {
            var fieldDataId = await AddFieldDataToQuestionAsync(questionTemplateId,
                                                                fieldDataToAdd.Input,
                                                                fieldDataToAdd.MinValue,
                                                                fieldDataToAdd.MaxValue,
                                                                fieldDataToAdd.MinLabel,
                                                                fieldDataToAdd.MaxLabel);

            if (select == "single-grid" || select == "multiple-grid")
            {
                await AddRowsAsync(fieldDataToAdd, select, fieldDataId);
                await AddChoiceOptionsAsync(fieldDataToAdd, select, fieldDataId);
            }
            else if (select == "single-choice" || select == "multiple-choice" || select == "dropdown-menu" ||
                     select == "single-grid" || select == "multiple-grid")
            {
                await AddChoiceOptionsAsync(fieldDataToAdd, select, fieldDataId);
            }
            else
            {
                await Task.CompletedTask;
            }
        }