Skip to content

Commit

Permalink
Updating the DocumentGeneration.cs example with Dynamic tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
InbarGazit committed Apr 15, 2024
1 parent d8aad6f commit e9ad236
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 9 deletions.
15 changes: 15 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ steps:

- script: dir $(Build.SourcesDirectory)/code-examples-csharp-private

- script: |
echo "Checking for running Docker containers..."
containers=$(docker ps -q)
if [ ! -z "$containers" ]; then
echo "Stopping running Docker containers..."
docker stop $(docker ps -q)
else
echo "No Docker containers are running."
fi
displayName: "check for running containers"

- script: |
docker system prune -a --force
displayName: "cleanup docker files"

- task: Docker@2
displayName: Build csharp image
inputs:
Expand Down
Binary file added launcher-csharp/Offer_Letter_Dynamic_Table.docx
Binary file not shown.
2 changes: 2 additions & 0 deletions launcher-csharp/eSignature/Controllers/DocumentGeneration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public IActionResult Create(
string managerName,
string jobTitle,
string salary,
int rsus,
DateTime startDate)
{
string accessToken = this.RequestItemsService.User.AccessToken;
Expand All @@ -57,6 +58,7 @@ public IActionResult Create(
managerName,
jobTitle,
salary,
rsus,
startDate,
this.Config.OfferDocDocx);
}
Expand Down
65 changes: 60 additions & 5 deletions launcher-csharp/eSignature/Examples/DocumentGeneration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class DocumentGeneration
/// <param name="managerName">Manager name.</param>
/// <param name="jobTitle">Job title.</param>
/// <param name="salary">Salary for potential candidate.</param>
/// <param name="rsus">Restricted stock units (RSUs) for potential candidate.</param>
/// <param name="startDate">Start date of the offer.</param>
/// <param name="offerDocDocx">String of bytes representing the offer document (pdf).</param>
/// <returns>EnvelopeId for the new envelope.</returns>
Expand All @@ -39,6 +40,7 @@ public static string DocumentGenerationExample(
string managerName,
string jobTitle,
string salary,
int rsus,
DateTime startDate,
string offerDocDocx)
{
Expand Down Expand Up @@ -76,6 +78,7 @@ public static string DocumentGenerationExample(
managerName,
jobTitle,
salary,
rsus.ToString(),
startDate.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture));

envelopesApi.UpdateEnvelopeDocGenFormFields(
Expand Down Expand Up @@ -138,7 +141,7 @@ public static TemplateTabs PrepareTabs()

DateSigned dateSignedTabs = new DateSigned
{
AnchorString = "Date",
AnchorString = "Date Signed",
AnchorUnits = "pixels",
AnchorYOffset = "-22",
};
Expand Down Expand Up @@ -201,6 +204,7 @@ public static DocGenFormFieldRequest FormFields(
string managerName,
string jobTitle,
string salary,
string rsus,
string startDate)
{
return new DocGenFormFieldRequest
Expand Down Expand Up @@ -229,13 +233,64 @@ public static DocGenFormFieldRequest FormFields(
},
new DocGenFormField
{
Name = "Salary",
Value = salary,
Name = "Start_Date",
Value = startDate,
},
new DocGenFormField
{
Name = "Start_Date",
Value = startDate,
Name = "Compensation_Package",
Type = "TableRow",
RowValues = new List<DocGenFormFieldRowValue>
{
new DocGenFormFieldRowValue
{
DocGenFormFieldList = new List<DocGenFormField>
{
new DocGenFormField
{
Name = "Compensation_Component",
Value = "Salary",
},
new DocGenFormField
{
Name = "Details",
Value = "$" + salary,
},
},
},
new DocGenFormFieldRowValue
{
DocGenFormFieldList = new List<DocGenFormField>
{
new DocGenFormField
{
Name = "Compensation_Component",
Value = "Bonus",
},
new DocGenFormField
{
Name = "Details",
Value = "20%",
},
},
},
new DocGenFormFieldRowValue
{
DocGenFormFieldList = new List<DocGenFormField>
{
new DocGenFormField
{
Name = "Compensation_Component",
Value = "RSUs",
},
new DocGenFormField
{
Name = "Details",
Value = rsus,
},
},
},
},
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion launcher-csharp/eSignature/Models/DSConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class DsConfiguration
public string DocPdf = "World_Wide_Corp_lorem.pdf";
public string DocumentTemplatePdf = "World_Wide_Corp_Web_Form.pdf";
public string WebFormConfig = "web-form-config.json";
public string OfferDocDocx = "Offer_Letter_Demo.docx";
public string OfferDocDocx = "Offer_Letter_Dynamic_Table.docx";
public string DocCsv = "UserData.csv";
public string DocHtml = "doc_1.html";
public string ExportUsersPath = @"..\..\..\ExportedUserData.csv";
Expand Down
17 changes: 15 additions & 2 deletions launcher-csharp/eSignature/Views/DocumentGeneration/eg042.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
int jobTitleIndex = 3;
int salaryIndex = 4;
int startDateIndex = 5;
int rsusIndex = 6;
}

<h4>@Html.Raw(ViewBag.CodeExampleText.ExampleName)</h4>
Expand Down Expand Up @@ -84,8 +85,7 @@

<select class="form-control" id="jobTitle" name="jobTitle">
<option value="Software Engineer">Software Engineer</option>
<option value="Product Manager">Product Manager</option>
<option value="Sales Representative">Sales Representative</option>
<option value="Account Executive">Account Executive</option>
</select>
</div>

Expand All @@ -101,6 +101,19 @@
required />
</div>

<div class="form-group">
<label for="rsus">
@Html.Raw(ViewBag.CodeExampleText.Forms[formNumber].Inputs[rsusIndex].InputName)
</label>
<input type="number"
min="0"
class="form-control"
id="rsus"
placeholder="@ViewBag.CodeExampleText.Forms[formNumber].Inputs[rsusIndex].InputPlaceholder"
name="rsus"
required />
</div>

<div class="form-group">
<label for="startDate">
@Html.Raw(ViewBag.CodeExampleText.Forms[formNumber].Inputs[startDateIndex].InputName)
Expand Down
2 changes: 1 addition & 1 deletion launcher-csharp/launcher-csharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<ItemGroup>
<PackageReference Include="DocuSign.Admin" Version="1.4.0" />
<PackageReference Include="DocuSign.Click" Version="1.2.2" />
<PackageReference Include="DocuSign.eSign.dll" Version="6.6.0" />
<PackageReference Include="DocuSign.eSign.dll" Version="6.9.0-rc1" />
<PackageReference Include="DocuSign.Monitor" Version="1.1.1" />
<PackageReference Include="DocuSign.Maestro" Version="1.0.0-rc1" />
<PackageReference Include="DocuSign.Rooms" Version="1.3.0" />
Expand Down

0 comments on commit e9ad236

Please sign in to comment.