Ejemplo n.º 1
0
        private static IEnumerable <DocuSignTabDTO> AddRadioButtonGroupEnvelopeData(JToken tabs, string tabName, string radiosName, string roleName)
        {
            if (tabs[tabName] != null)
            {
                foreach (var groupTab in tabs[tabName])
                {
                    dynamic grpTab = groupTab;
                    var     groupWrapperEnvelopeData = new DocuSignMultipleOptionsTabDTO()
                    {
                        DocumentId     = Convert.ToInt32(grpTab["documentId"]),
                        RecipientId    = grpTab["recipientId"],
                        Name           = grpTab["groupName"] + (roleName.ToStr().IsNullOrEmpty() ? null : $" ({roleName})"),
                        TabId          = grpTab["tabId"],
                        Fr8DisplayType = ControlTypes.RadioButtonGroup,
                        RoleName       = roleName,
                        TabName        = tabName
                    };

                    if (groupTab[radiosName] != null)
                    {
                        foreach (var listItem in groupTab[radiosName])
                        {
                            dynamic lstItem = listItem;
                            groupWrapperEnvelopeData.Items.Add(new DocuSignOptionItemTabDTO()
                            {
                                Value    = lstItem["value"],
                                Selected = lstItem["selected"]
                            });
                        }
                    }

                    yield return(groupWrapperEnvelopeData);
                }
            }
        }
Ejemplo n.º 2
0
        private static IEnumerable <DocuSignTabDTO> AddDropdownListEnvelopeData(JToken tabs, string tabName, string listItemsName, string roleName)
        {
            if (tabs[tabName] != null)
            {
                foreach (var groupTab in tabs[tabName])
                {
                    dynamic grpTab = groupTab;
                    var     groupWrapperEnvelopeData = new DocuSignMultipleOptionsTabDTO
                    {
                        DocumentId     = grpTab["documentId"],
                        RecipientId    = grpTab["recipientId"],
                        Name           = grpTab["tabLabel"] + (roleName.ToStr().IsNullOrEmpty() ? null : $" ({roleName})"),
                        TabId          = grpTab["tabId"],
                        Fr8DisplayType = ControlTypes.DropDownList,
                        Value          = grpTab["value"],
                        RoleName       = roleName,
                        TabName        = tabName
                    };

                    if (groupTab[listItemsName] != null)
                    {
                        foreach (var listItem in groupTab[listItemsName])
                        {
                            dynamic lstItem = listItem;

                            var item = new DocuSignOptionItemTabDTO
                            {
                                Text     = lstItem["text"],
                                Value    = lstItem["value"],
                                Selected = lstItem["selected"]
                            };

                            if (string.IsNullOrEmpty(item.Text) && string.IsNullOrEmpty(item.Value))
                            {
                                item.Text  = " "; //DS allows to select empty value in DDLB
                                item.Value = " ";
                            }
                            groupWrapperEnvelopeData.Items.Add(item);
                        }
                    }

                    yield return(groupWrapperEnvelopeData);
                }
            }
        }