Skip to content

Commit 1472f14

Browse files
authored
Merge pull request #116 from docusign/DEVDOCS-9594
DEVDOCS-9594 and DEVDOCS-9566 - Numerical tabs added to eSign examples 15 (via example 8) and 16
2 parents 0cee850 + fe3fdc6 commit 1472f14

File tree

5 files changed

+65
-50
lines changed

5 files changed

+65
-50
lines changed

launcher-csharp/eSignature/Controllers/SetEnvelopeTabValue.cs

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ namespace DocuSign.CodeExamples.Controllers
66
{
77
using DocuSign.CodeExamples.Common;
88
using DocuSign.CodeExamples.Models;
9+
using DocuSign.eSign.Client;
910
using Microsoft.AspNetCore.Mvc;
1011

1112
[Area("eSignature")]
@@ -54,20 +55,30 @@ public IActionResult Create(string signerEmail, string signerName)
5455
var accessToken = this.RequestItemsService.User.AccessToken; // Represents your {ACCESS_TOKEN}
5556
var accountId = this.RequestItemsService.Session.AccountId; // Represents your {ACCOUNT_ID}
5657

57-
// Call the Examples API method to create an envelope and set the tab values
58-
(string envelopeId, string redirectUrl) = global::ESignature.Examples.SetEnvelopeTabValue.CreateEnvelopeAndUpdateTabData(
59-
signerEmail,
60-
signerName,
61-
this.signerClientId,
62-
accessToken,
63-
basePath,
64-
accountId,
65-
this.Config.TabsDocx,
66-
this.dsReturnUrl,
67-
this.dsPingUrl);
58+
try
59+
{
60+
// Call the Examples API method to create an envelope and set the tab values
61+
(string envelopeId, string redirectUrl) = global::ESignature.Examples.SetEnvelopeTabValue.CreateEnvelopeAndUpdateTabData(
62+
signerEmail,
63+
signerName,
64+
this.signerClientId,
65+
accessToken,
66+
basePath,
67+
accountId,
68+
this.Config.TabsDocx,
69+
this.dsReturnUrl,
70+
this.dsPingUrl);
6871

69-
this.RequestItemsService.EnvelopeId = envelopeId;
70-
return this.Redirect(redirectUrl);
72+
this.RequestItemsService.EnvelopeId = envelopeId;
73+
return this.Redirect(redirectUrl);
74+
}
75+
catch (ApiException apiException)
76+
{
77+
this.ViewBag.errorCode = apiException.ErrorCode;
78+
this.ViewBag.errorMessage = apiException.Message;
79+
80+
return this.View("Error");
81+
}
7182
}
7283
}
7384
}

launcher-csharp/eSignature/Examples/CreateNewTemplate.cs

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace ESignature.Examples
1212

1313
public static class CreateNewTemplate
1414
{
15-
private static string templateName = "Example Signer and CC template";
15+
private static string templateName = "Example Signer and CC template v2";
1616

1717
/// <summary>
1818
/// Generates a new DocuSign Template based on static information in this class
@@ -28,7 +28,7 @@ public static (bool createdNewTemplate, string templateId, string resultsTemplat
2828
docuSignClient.Configuration.DefaultHeader.Add("Authorization", "Bearer " + accessToken);
2929
TemplatesApi templatesApi = new TemplatesApi(docuSignClient);
3030
TemplatesApi.ListTemplatesOptions options = new TemplatesApi.ListTemplatesOptions();
31-
options.searchText = "Example Signer and CC template";
31+
options.searchText = "Example Signer and CC template v2";
3232
EnvelopeTemplateResults results = templatesApi.ListTemplates(accountId, options);
3333

3434
string templateId;
@@ -156,23 +156,19 @@ public static EnvelopeTemplate MakeTemplate(string resultsTemplateName, string d
156156
new ListItem { Text = "Violet", Value = "Violet" },
157157
};
158158

159-
// The SDK can't create a number tab at this time. Bug DCM-2732
160-
// Until it is fixed, use a text tab instead.
161-
// , number = docusign.Number.constructFromObject({
162-
// documentId: "1", pageNumber: "1", xPosition: "163", yPosition: "260",
163-
// font: "helvetica", fontSize: "size14", tabLabel: "numbersOnly",
164-
// height: "23", width: "84", required: "false"})
165-
Text textInsteadOfNumber = new Text();
166-
textInsteadOfNumber.DocumentId = "1";
167-
textInsteadOfNumber.PageNumber = "1";
168-
textInsteadOfNumber.XPosition = "153";
169-
textInsteadOfNumber.YPosition = "260";
170-
textInsteadOfNumber.Font = "helvetica";
171-
textInsteadOfNumber.FontSize = "size14";
172-
textInsteadOfNumber.TabLabel = "numbersOnly";
173-
textInsteadOfNumber.Height = "23";
174-
textInsteadOfNumber.Width = "84";
175-
textInsteadOfNumber.Required = "false";
159+
Numerical numerical = new Numerical();
160+
numerical.ValidationType = "Currency";
161+
numerical.DocumentId = "1";
162+
numerical.PageNumber = "1";
163+
numerical.XPosition = "153";
164+
numerical.YPosition = "260";
165+
numerical.Font = "helvetica";
166+
numerical.FontSize = "size14";
167+
numerical.TabLabel = "numericalCurrency";
168+
numerical.Height = "23";
169+
numerical.Width = "84";
170+
numerical.Required = "false";
171+
176172

177173
RadioGroup radioGroup = new RadioGroup();
178174
radioGroup.DocumentId = "1";
@@ -209,7 +205,8 @@ public static EnvelopeTemplate MakeTemplate(string resultsTemplateName, string d
209205
// numberTabs: [number],
210206
signer1Tabs.RadioGroupTabs = new List<RadioGroup> { radioGroup };
211207
signer1Tabs.SignHereTabs = new List<SignHere> { signHere };
212-
signer1Tabs.TextTabs = new List<Text> { text, textInsteadOfNumber };
208+
signer1Tabs.TextTabs = new List<Text> { text };
209+
signer1Tabs.NumericalTabs = new List<Numerical> { numerical };
213210

214211
signer1.Tabs = signer1Tabs;
215212

launcher-csharp/eSignature/Examples/SetEnvelopeTabValue.cs

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,28 @@ public static (string, string) CreateEnvelopeAndUpdateTabData(
8383
// and as a pure number in a custom field ('salary') in the envelope
8484
int salary = 123000;
8585

86-
Text textSalary = new Text
86+
Numerical numericalSalary = new Numerical
8787
{
88-
AnchorString = "/salary/",
89-
AnchorUnits = "pixels",
90-
AnchorYOffset = "-9",
91-
AnchorXOffset = "5",
92-
Font = "helvetica",
93-
FontSize = "size11",
94-
Bold = "true",
95-
Locked = "true",
96-
97-
// Convert number to String: 'C2' sets the string
98-
// to currency format with two decimal places
99-
Value = salary.ToString("C2"),
88+
ValidationType = "Currency",
89+
XPosition = "210",
90+
YPosition = "235",
91+
Height = "20",
92+
Width = "70",
93+
PageNumber = "1",
94+
DocumentId = "1",
95+
MinNumericalValue = "0",
96+
MaxNumericalValue = "1000000",
10097
TabId = "salary",
10198
TabLabel = "Salary",
99+
NumericalValue = salary.ToString(),
100+
LocalePolicy = new LocalePolicyTab
101+
{
102+
CultureName = "en-US",
103+
CurrencyCode = "usd",
104+
CurrencyPositiveFormat = "csym_1_comma_234_comma_567_period_89",
105+
CurrencyNegativeFormat = "minus_csym_1_comma_234_comma_567_period_89",
106+
UseLongCurrencyFormat = "true",
107+
},
102108
};
103109

104110
TextCustomField salaryCustomField = new TextCustomField
@@ -131,7 +137,8 @@ public static (string, string) CreateEnvelopeAndUpdateTabData(
131137
Tabs signer1Tabs = new Tabs
132138
{
133139
SignHereTabs = new List<SignHere> { signHere },
134-
TextTabs = new List<Text> { textLegal, textFamiliar, textSalary },
140+
TextTabs = new List<Text> { textLegal, textFamiliar },
141+
NumericalTabs = new List<Numerical> { numericalSalary },
135142
};
136143
signer1.Tabs = signer1Tabs;
137144
Recipients recipients = new Recipients

launcher-csharp/eSignature/Views/SetEnvelopeTabValue/eg016.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@{
22
int formNumber = 0;
3-
int signerEmailInputNumber = 0;
4-
int signerNameInputNumber = 1;
3+
int signerEmailInputNumber = 1;
4+
int signerNameInputNumber = 0;
55
}
66

77
<h4>@Html.Raw(ViewBag.CodeExampleText.ExampleName)</h4>

launcher-csharp/launcher-csharp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<ItemGroup>
3939
<PackageReference Include="DocuSign.Admin" Version="1.1.0" />
4040
<PackageReference Include="DocuSign.Click" Version="1.2.2" />
41-
<PackageReference Include="DocuSign.eSign.dll" Version="6.0.0" />
41+
<PackageReference Include="DocuSign.eSign.dll" Version="6.2.0" />
4242
<PackageReference Include="DocuSign.Monitor" Version="1.1.0" />
4343
<PackageReference Include="DocuSign.Rooms" Version="1.3.0" />
4444
<PackageReference Include="Microsoft.AspNetCore.Session" Version="2.2.0" />

0 commit comments

Comments
 (0)