Ejemplo n.º 1
0
 public LinkedTemplateReferenceRoleAssignment(DocuSignWeb.Recipient signer, string roleName)
 {
     this.signer = signer;
     referenceRoleAssignment.RoleName = roleName;
 }
Ejemplo n.º 2
0
 public static LinkedTab CreateTab(DocuSignWeb.Recipient recipient,
     string name, string value,
     int pageNumber, int XPosition, int YPosition, bool required, bool locked)
 {
     LinkedTab tab = new LinkedTab();
     tab.Recipient = recipient;
     tab.Tab.Type = Signing.DocuSignWeb.TabTypeCode.Custom;
     tab.Tab.Name = name;
     tab.Tab.TabLabel = name;
     tab.Tab.Value = value;
     tab.Tab.PageNumber = Convert.ToString(pageNumber);
     tab.Tab.XPosition = Convert.ToString(XPosition);
     tab.Tab.YPosition = Convert.ToString(YPosition);
     tab.Tab.CustomTabRequired = required;
     tab.Tab.CustomTabRequiredSpecified = true;
     tab.Tab.CustomTabLocked = locked;
     tab.Tab.CustomTabLockedSpecified = true;
     return tab;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// A function that creates a standard tab. The reason this was created is to make sure
 /// that all the necessary fields are filled in when you create a standard tab.
 /// </summary>
 /// <param name="tabType"></param>
 /// <param name="recipient"></param>
 /// <param name="pageNumber"></param>
 /// <param name="XPosition"></param>
 /// <param name="YPosition"></param>
 /// <returns>A LinkedTab which has all the fields filled in</returns>
 public static LinkedTab CreateTab(DocuSignWeb.TabTypeCode tabType,
     DocuSignWeb.Recipient recipient,
     int pageNumber, int XPosition, int YPosition)
 {
     Debug.Assert(tabType != DocuSignWeb.TabTypeCode.Custom, "A wrong helper function is used" +
         " custom tabs should not be created with CreateStandardTab");
     LinkedTab tab = new LinkedTab();
     tab.Recipient = recipient;
     tab.Tab.Type = tabType;
     tab.Tab.PageNumber = Convert.ToString(pageNumber);
     tab.Tab.XPosition = Convert.ToString(XPosition);
     tab.Tab.YPosition = Convert.ToString(YPosition);
     return tab;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Initial method / factory instanciation.
        /// In case the call is successfully completed you will get back an 
        /// envelope object that can be used to work with this envelope.
        /// In case the envelope is misconstructed an exception will be thrown
        /// The IDs on both the recipients and documents are going to be altered
        /// after the call and the Tabs will be linked to the appropriate document and 
        /// recipient ids.
        /// </summary>
        /// <param name="signers">A collection of signer objects that describes who is going to 
        /// recieve the documents.  You should have at least one signer.  Every signer
        /// must have at least one signature.</param>
        /// <param name="documents">A set of documents with tabs attached
        /// to them.  There should be at least one document in the envelope and there should be
        /// at least one tab on the envelope.</param>
        /// <param name="subject">Subject of the e-mail that the signers
        /// are going to receive</param>
        /// <param name="emailBlurb">e-mail blurb that will be inserted
        /// into the messages delivered to signers</param>
        /// <returns>An envelope object that can be used to work with this envelope.</returns>
        public static Envelope CreateEnvelopeFromTemplates(AccountCredentials accountCredentials,
            DocuSignWeb.Recipient[] signers,
            LinkedTemplateReferenceRoleAssignment[] roleAssignments,
            string template,
            string subject, string emailBlurb,
            DocuSignWeb.CustomField[] fields)
        {
            //
            // Assign sequential IDs to all the recipients
            //
            int nextRecipientId = 1;
            foreach (DocuSignWeb.Recipient recipient in signers)
            {
                recipient.ID = nextRecipientId.ToString(System.Globalization.CultureInfo.InvariantCulture);
                nextRecipientId++;
            }

            //
            // update the template references
            //
            TemplateReferenceRoleAssignment[] finalRoleAssignments = new TemplateReferenceRoleAssignment[roleAssignments.Length];
            for( int i = 0; i < roleAssignments.Length; ++i)
            {
                roleAssignments[i].referenceRoleAssignment.RecipientID = roleAssignments[i].signer.ID;
                finalRoleAssignments[i] = roleAssignments[i].referenceRoleAssignment;
            }

            //
            // setting up the template
            //
            TemplateReference templateReference = new TemplateReference();
            templateReference.Template = template;
            templateReference.TemplateLocation = TemplateLocationCode.SOAP;
            templateReference.RoleAssignments = finalRoleAssignments;

            //
            // Envelope wide information
            //
            DocuSignWeb.EnvelopeInformation envelopeInfo = new EnvelopeInformation();
            envelopeInfo.AccountId = accountCredentials.AccountId;
            envelopeInfo.CustomFields = fields;
            envelopeInfo.EmailBlurb = emailBlurb;
            envelopeInfo.Subject = subject;

            DocuSignWeb.APIServiceSoap apiService = CreateApiProxy(accountCredentials);
            DocuSignWeb.EnvelopeStatus envStatus = apiService.CreateEnvelopeFromTemplates(
                new TemplateReference[] { templateReference },
                signers, envelopeInfo, true);
            return new Envelope(envStatus.EnvelopeID, accountCredentials);
        }
Ejemplo n.º 5
0
 public string RequestRecipientToken(
     DocuSignWeb.Recipient recipient,
     DocuSignWeb.RequestRecipientTokenAuthenticationAssertion authenticationAssertion,
     DocuSignWeb.RequestRecipientTokenClientURLs clientURLs)
 {
     Debug.Assert(String.IsNullOrEmpty(_envelopeId) == false);
     DocuSignWeb.APIServiceSoap apiService = CreateApiProxy(_accountCredentials);
     return apiService.RequestRecipientToken(_envelopeId, recipient.CaptiveInfo.ClientUserId,
         recipient.UserName, recipient.Email, authenticationAssertion, clientURLs);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initial method / factory instanciation.
 /// In case the call is successfully completed you will get back an 
 /// envelope object that can be used to work with this envelope.
 /// In case the envelope is misconstructed an exception will be thrown
 /// The IDs on both the recipients and documents are going to be altered
 /// after the call and the Tabs will be linked to the appropriate document and 
 /// recipient ids.
 /// </summary>
 /// <param name="signers">A collection of signer objects that describes who is going to 
 /// recieve the documents.  You should have at least one signer.  Every signer
 /// must have at least one signature.</param>
 /// <param name="documents">A set of documents with tabs attached
 /// to them.  There should be at least one document in the envelope and there should be
 /// at least one tab on the envelope.</param>
 /// <param name="subject">Subject of the e-mail that the signers
 /// are going to receive</param>
 /// <param name="emailBlurb">e-mail blurb that will be inserted
 /// into the messages delivered to signers</param>
 /// <returns>An envelope object that can be used to work with this envelope.</returns>
 public static Envelope CreateAndSendEnvelope(AccountCredentials accountCredentials, DocuSignWeb.Recipient[] signers, LinkedDocument[] documents, string subject, string emailBlurb, DocuSignWeb.CustomField[] fields)
 {
     return CreateAndSendEnvelope(accountCredentials, signers, documents, subject, emailBlurb, fields, null);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Initial method / factory instanciation.
        /// In case the call is successfully completed you will get back an 
        /// envelope object that can be used to work with this envelope.
        /// In case the envelope is misconstructed an exception will be thrown
        /// The IDs on both the recipients and documents are going to be altered
        /// after the call and the Tabs will be linked to the appropriate document and 
        /// recipient ids.
        /// </summary>
        /// <param name="signers">A collection of signer objects that describes who is going to 
        /// recieve the documents.  You should have at least one signer.  Every signer
        /// must have at least one signature.</param>
        /// <param name="documents">A set of documents with tabs attached
        /// to them.  There should be at least one document in the envelope and there should be
        /// at least one tab on the envelope.</param>
        /// <param name="subject">Subject of the e-mail that the signers
        /// are going to receive</param>
        /// <param name="emailBlurb">e-mail blurb that will be inserted
        /// into the messages delivered to signers</param>
        /// <returns>An envelope object that can be used to work with this envelope.</returns>
        public static Envelope CreateAndSendEnvelope(AccountCredentials accountCredentials, DocuSignWeb.Recipient[] signers, LinkedDocument[] documents, string subject, string emailBlurb, DocuSignWeb.CustomField[] fields, DocuSignWeb.Attachment[] attachments)
        {
            //
            // Assign sequential IDs to all the recipients
            //
            int nextRecipientId = 1;
            foreach (DocuSignWeb.Recipient recipient in signers)
            {
                recipient.ID = nextRecipientId.ToString(System.Globalization.CultureInfo.InvariantCulture);
                nextRecipientId++;
            }

            //
            // go through the documents
            // assign them appropriate IDs
            // and then pull out the tabs and properly assign
            // recipients to for them.
            //
            List<DocuSignWeb.Tab> tabs = new List<DocuSignWeb.Tab>();
            int nextDocId = 1;
            foreach (LinkedDocument linkedDoc in documents)
            {
                linkedDoc.Document.ID = nextDocId.ToString(CultureInfo.InvariantCulture);

                foreach (LinkedTab linkedTab in linkedDoc.Tabs)
                {
                    linkedTab.Tab.DocumentID = linkedDoc.Document.ID;
                    linkedTab.Tab.RecipientID = linkedTab.Recipient.ID;
                    tabs.Add(linkedTab.Tab);
                }
                nextDocId++;
            }

            //
            // Envelope wide initialization
            //
            DocuSignWeb.Envelope envelope = new DocuSignWeb.Envelope();
            envelope.Subject = subject;
            envelope.EmailBlurb = emailBlurb;
            envelope.Recipients = signers;
            envelope.AccountId = accountCredentials.AccountId;

            // assign the document array
            envelope.Documents = new DocuSignWeb.Document[documents.Length];
            for (int i = 0; i < documents.Length; ++i)
            {
                envelope.Documents[i] = documents[i].Document;
            }

            // assign the tabs to the envelope
            envelope.Tabs = tabs.ToArray();

            envelope.CustomFields = fields;
            envelope.EnvelopeAttachment = attachments;

            DocuSignWeb.APIServiceSoap apiService = CreateApiProxy(accountCredentials);
            DocuSignWeb.EnvelopeStatus envStatus = apiService.CreateAndSendEnvelope(envelope);
            return new Envelope(envStatus.EnvelopeID, accountCredentials);
        }
 /// <summary>
 /// Void a specific envelope
 /// </summary>
 /// <param name="envelopeID">envelope ID</param>
 /// <param name="apiClient">API proxy</param>
 /// <returns></returns>
 internal static DocuSignWeb.VoidEnvelopeStatus VoidEnvelope(String envelopeID, DocuSignWeb.APIServiceSoapClient apiClient)
 {
     return apiClient.VoidEnvelope(envelopeID, "void envelope test");
 }
 /// <summary>
 /// Purge the documents from a specific envelope
 /// </summary>
 /// <param name="envelopeID">envelope ID</param>
 /// <param name="apiClient">API proxy</param>
 /// <returns></returns>
 internal static DocuSignWeb.PurgeDocumentStatus PurgeEnvelope(String envelopeID, DocuSignWeb.APIServiceSoapClient apiClient)
 {
     return apiClient.PurgeDocuments(envelopeID);
 }
Ejemplo n.º 10
0
 internal static LinkedTab OneTextTab1(DocuSignWeb.Recipient signer)
 {
     LinkedTab ret = new LinkedTab();
     ret.Recipient = signer;
     ret.Tab.Type = DocuSignWeb.TabTypeCode.Custom;
     ret.Tab.Name = "Name2";
     ret.Tab.TabLabel = "Label2";
     ret.Tab.Value = "";
     ret.Tab.PageNumber = Convert.ToString("1", CultureInfo.InvariantCulture);
     ret.Tab.XPosition = Convert.ToString("380", CultureInfo.InvariantCulture);
     ret.Tab.YPosition = Convert.ToString("600", CultureInfo.InvariantCulture);
     return ret;
 }
 /// <summary>
 /// Create a basic envelope with documents and tabs in preparation for sending
 /// </summary>
 /// <param name="envelope">already created envelope</param>
 /// <returns>updated envelope</returns>
 internal static DocuSignWeb.Envelope CreateEnvelopeWithDocumentAndTabs(DocuSignWeb.Envelope envelope)
 {
     envelope.Documents = new DocuSignWeb.Document[1];
     DocuSignWeb.Document doc = new DocuSignWeb.Document();
     doc.ID = "1";
     doc.Name = "Picture PDF";
     doc.PDFBytes = Resource.picturePdf;
     Assert.IsNotNull(doc.PDFBytes);
     envelope.Documents[0] = doc;
     DocuSignWeb.Tab tab = new DocuSignWeb.Tab();
     tab.DocumentID = "1";
     tab.RecipientID = "1";
     tab.Type = DocuSignWeb.TabTypeCode.SignHere;
     tab.PageNumber = "1";
     tab.XPosition = "100";
     tab.YPosition = "100";
     envelope.Tabs = new DocuSignWeb.Tab[1];
     envelope.Tabs[0] = tab;
     return envelope;
 }
Ejemplo n.º 12
0
 internal static LinkedTab[] OneTabArray(DocuSignWeb.Recipient signer)
 {
     LinkedTab[] ret = { OneTab(signer) };
     return ret;
 }
Ejemplo n.º 13
0
 internal static LinkedTab OneTab(DocuSignWeb.Recipient signer)
 {
     LinkedTab ret = new LinkedTab();
     ret.Recipient = signer;
     ret.Tab.Type = DocuSignWeb.TabTypeCode.SignHere;
     ret.Tab.PageNumber = Convert.ToString("1", CultureInfo.InvariantCulture);
     ret.Tab.XPosition = Convert.ToString("100", CultureInfo.InvariantCulture);
     ret.Tab.YPosition = Convert.ToString("300", CultureInfo.InvariantCulture);
     return ret;
 }
Ejemplo n.º 14
0
 internal static LinkedTab OneRadioTab1(DocuSignWeb.Recipient signer)
 {
     LinkedTab ret = new LinkedTab();
     ret.Recipient = signer;
     ret.Tab.Type = DocuSignWeb.TabTypeCode.Custom;
     ret.Tab.Name = "Radio2";
     ret.Tab.TabLabel = "This goes into the tooltip";
     ret.Tab.Value = "";
     ret.Tab.CustomTabType = Signing.DocuSignWeb.CustomTabType.Radio;
     ret.Tab.CustomTabTypeSpecified = true;
     ret.Tab.CustomTabLocked = false;
     ret.Tab.CustomTabLockedSpecified = true;
     ret.Tab.CustomTabRadioGroupName = "Radio Group #1";
     ret.Tab.PageNumber = Convert.ToString("1", CultureInfo.InvariantCulture);
     ret.Tab.XPosition = Convert.ToString("380", CultureInfo.InvariantCulture);
     ret.Tab.YPosition = Convert.ToString("550", CultureInfo.InvariantCulture);
     return ret;
 }
Ejemplo n.º 15
0
 internal static LinkedTab OneCheckBox(DocuSignWeb.Recipient signer)
 {
     LinkedTab ret = new LinkedTab();
     ret.Recipient = signer;
     ret.Tab.Type = DocuSignWeb.TabTypeCode.Custom;
     ret.Tab.Name = "The Name";
     ret.Tab.TabLabel = "This goes into the tooltip";
     ret.Tab.Value = "X";
     ret.Tab.CustomTabType = Signing.DocuSignWeb.CustomTabType.Checkbox;
     ret.Tab.CustomTabTypeSpecified = true;
     ret.Tab.CustomTabLocked = false;
     ret.Tab.CustomTabLockedSpecified = true;
     ret.Tab.PageNumber = Convert.ToString("1", CultureInfo.InvariantCulture);
     ret.Tab.XPosition = Convert.ToString("300", CultureInfo.InvariantCulture);
     ret.Tab.YPosition = Convert.ToString("500", CultureInfo.InvariantCulture);
     return ret;
 }
Ejemplo n.º 16
0
 internal static LinkedDocument[] LoadPicturePdf(DocuSignWeb.Recipient signer)
 {
     LinkedDocument[] docs = { new LinkedDocument() };
     docs[0].Document.Name = "Picture PDF";
     docs[0].Document.PDFBytes = Resource.picturePdf;
     docs[0].Tabs = new LinkedTab[] {
         OneTab(signer), OneDateTab(signer), OneFullNameTab(signer),
         OneRadioTab0(signer), OneRadioTab1(signer),
         OneTextTab0(signer), OneTextTab1(signer),
         OneCheckBox(signer) };
     return docs;
 }