//this is purely for Send_DocuSign_Envelope activity public Tuple <IEnumerable <KeyValueDTO>, IEnumerable <DocuSignTabDTO> > GetTemplateRecipientsTabsAndDocuSignTabs(DocuSignApiConfiguration conf, string templateId) { var tmpApi = new TemplatesApi(conf.Configuration); var recipientsAndTabs = new List <KeyValueDTO>(); var docuTabs = new List <DocuSignTabDTO>(); var recipients = GetRecipients(conf, tmpApi, templateId); recipientsAndTabs.AddRange(MapRecipientsToFieldDTO(recipients)); foreach (var signer in recipients.Signers) { var tabs = tmpApi.ListTabs(conf.AccountId, templateId, signer.RecipientId, new Tabs()); var signersdocutabs = DocuSignTab.ExtractTabs(JObject.Parse(tabs.ToJson()), signer.RoleName).ToList(); docuTabs.AddRange(signersdocutabs); recipientsAndTabs.AddRange(DocuSignTab.MapTabsToFieldDTO(signersdocutabs)); } return(new Tuple <IEnumerable <KeyValueDTO>, IEnumerable <DocuSignTabDTO> >(recipientsAndTabs, docuTabs)); }
public static DocuSignEnvelopeCM_v2 ParseAPIresponsesIntoCM(out DocuSignEnvelopeCM_v2 envelope, TemplateInformation templates, Recipients recipients) { envelope = new DocuSignEnvelopeCM_v2(); envelope.CurrentRoutingOrderId = recipients.CurrentRoutingOrder; if (templates.Templates != null) { foreach (var ds_template in templates.Templates) { DocuSignTemplate template = new DocuSignTemplate(); template.DocumentId = ds_template.DocumentId; template.Name = ds_template.Name; template.TemplateId = ds_template.TemplateId; envelope.Templates.Add(template); } } //Recipients if (recipients.Signers != null) { foreach (var dsrecipient in recipients.Signers) { DocuSignRecipientStatus recipient = new DocuSignRecipientStatus(); recipient.Email = dsrecipient.Email; recipient.Name = dsrecipient.Name; recipient.RecipientId = dsrecipient.RecipientId; recipient.RoutingOrderId = dsrecipient.RoutingOrder; recipient.Status = dsrecipient.Status; recipient.Type = "Signer"; envelope.Recipients.Add(recipient); //Tabs if (dsrecipient.Tabs != null) { var tabsDTO = DocuSignTab.ExtractTabs(JObject.Parse(dsrecipient.Tabs.ToJson()), ""); foreach (var tabDTO in tabsDTO) { DocuSignTabStatus tab = new DocuSignTabStatus(); tab.DocumentId = tabDTO.DocumentId.ToString(); tab.Name = tabDTO.Name; tab.TabType = tabDTO.Type; tab.Value = tabDTO.Value; tab.TabLabel = tabDTO.TabLabel; if (tabDTO is DocuSignMultipleOptionsTabDTO) { var multiTabDTO = (DocuSignMultipleOptionsTabDTO)tabDTO; foreach (var childDTO in multiTabDTO.Items) { var childTab = new DocuSignTabStatus(); childTab.Selected = childDTO.Selected.ToString(); childTab.Value = childDTO.Value; childTab.TabLabel = childDTO.Text; tab.Items.Add(childTab); } } recipient.Tabs.Add(tab); } } } } return(envelope); }