-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram_NEW.cs
More file actions
737 lines (549 loc) · 28.8 KB
/
Program_NEW.cs
File metadata and controls
737 lines (549 loc) · 28.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
using System.Configuration;
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
using System.Data;
using System.Data.SqlClient;
using DocuSign.eSign.Api;
using DocuSign.eSign.Model;
using DocuSign.eSign.Client;
using iTextSharp.text;
using iTextSharp.text.pdf;
using Document = DocuSign.eSign.Model.Document;
namespace DocuSign_AUA
{
class DocuSignTemplate
{
static string startDate = "10/10/2016";
static string formID = "1";
static string formID2 = "2"; //Form ID change for testing purposes
static int batchRunID = 0;
// Integrator Key (aka API key) is needed to authenticate your API calls. This is an application-wide key
readonly string INTEGRATOR_KEY = ConfigurationManager.AppSettings["INTEGRATOR_KEY"];
public string Username { get; } = ConfigurationManager.AppSettings["username"];
readonly string password = ConfigurationManager.AppSettings["password"];
static string StudentClerkshipEvaluationForm = ConfigurationManager.AppSettings["StudentClerkshipEvaluationForm_TemplateID"]; //Form 1 [Student Only]
static string StudentClerkshipEvaluationDocumentId = ConfigurationManager.AppSettings["StudentClerkshipEvaluationForm_DocumentId"]; //Form 1 [Student Only]
static string StudentFacultyEvaluationForm = ConfigurationManager.AppSettings["StudentFacultyEvaluationForm_TemplateID"]; //Form 2 [Student Only]
static string MidClerkshipAssessmentForm = ConfigurationManager.AppSettings["MidClerkshipAssessmentForm_TemplateID"]; //Form 3 [Student & Preceptor]
static string StudentPortfolioForm = ConfigurationManager.AppSettings["StudentPortfolio_TemplateID"]; //Form 4 [Student Only]
static string ComprehensiveStudentClerkshipAssessmentForm = ConfigurationManager.AppSettings["ComprehensiveStudentClerkshipAssessmentForm_TemplateID"]; //Form 5 [Preceptor & DME]
//////////////////////////////////////////////////////////
// Main()
//////////////////////////////////////////////////////////
//CLASS SCOPE
public static int batchRunId;
public static void Main(string[] args)
{
SetHeader();
batchRunId = GetBatchRunID();
GetStudentRotationInfo();
Console.Read();
}
public static void SetHeader()
{
//ApiClient apiClient = DocuSign.eSign.Client.Configuration.Default.ApiClient;
string authHeader = "{\"Username\":\"" + ConfigurationManager.AppSettings["username"] + "\"," +
" \"Password\":\"" + ConfigurationManager.AppSettings["password"] + "\"," +
" \"IntegratorKey\":\"" + ConfigurationManager.AppSettings["INTEGRATOR_KEY"] + "\"}";
DocuSign.eSign.Client.Configuration.Default.AddDefaultHeader("X-DocuSign-Authentication", authHeader);
}
public static void GetStudentRotationInfo()
{
SqlConnection conn = null;
SqlDataReader rdr = null;
string sendDatesProcedure = "sp_DocuSignFormSendDates_Demo";
Student student = new Student();
EnvelopeSummary envelopeSumm = new EnvelopeSummary();
try
{
conn = new SqlConnection(ConfigurationManager.AppSettings["SMSDB_CONNSTRING2"]);
conn.Open();
var cmd = new SqlCommand(sendDatesProcedure, conn)
{
CommandType = CommandType.StoredProcedure
};
cmd.Parameters.AddWithValue("@StartDate", startDate);
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
student.StudentId = rdr["StudentID"].ToString();
student.StudentFirstName = rdr["StudentFirstName"].ToString();
student.StudentLastName = rdr["StudentLastName"].ToString();
student.StudentName = rdr["StudentName"].ToString();
student.StudentPicturePath = rdr["StudentPicturePath"].ToString();
student.CourseId = rdr["CourseUID"].ToString();
//FOR QA - Uncomment for PROD
//student.StudentEmailSchool = rdr["StudentEmailSchool"].ToString();
//****************************************************************************************************
//FOR Testing - Comment out for PROD
student.StudentEmailSchool = "cgrenard@auamed.org";
//****************************************************************************************************
student.CourseId = rdr["CourseUID"].ToString();
student.ClinicalRotation = rdr["CourseTitle"].ToString();
student.CreditWeeks = rdr["CourseCreditWeeks"].ToString();
student.ClinicalSite = rdr["HospitalName"].ToString();
student.StartDate = rdr["CourseDateStart"].ToString();
student.EndDate = rdr["CourseDateEnd"].ToString();
envelopeSumm = RequestStudentSignatureFromTemplate(student);
//CALL TO INSERT FORMSENT & ENVELOPE_HISTORY RECORDs
InsertFormAndEnvelopeInfo(student, envelopeSumm, batchRunID);
} //END WHILE LOOP
} //END Try
finally
{
// close reader
rdr?.Close();
// close connection
conn?.Close();
}
}
public static EnvelopeSummary RequestStudentSignatureFromTemplate(Student student)
{
// instantiate api client with appropriate environment (for production change to www.docusign.net/restapi)
//configureApiClient("https://na2.docusign.net/restapi");
configureApiClient("https://demo.docusign.net/restapi");
// var envID = envDef.EnvelopeId;
//AUA --> DME --> ?PRECEPTOR?
var envDef = new EnvelopeDefinition { CompositeTemplates = new List<CompositeTemplate>() };
// studentSigner = CreateSigner(student.StudentEmailSchool, student.StudentName, templateRoleName, routingOrder, recipientId);
Signer studentSigner = new Signer();
Signer preceptorSigner = new Signer();
Signer DMESigner = new Signer();
Signer signer = new Signer();
Agent agent = new Agent();
CarbonCopy DME_CC = new CarbonCopy();
SetEnvelopeReminders(student, envDef);
string formName = "";
//Assign the correct template
//Adds all controls to List<Recipients>
//Make a list of forms to
var formsList = new List<string>();
// if Student
formsList.Add("1");
//formsList.Add("2");
//formsList.Add("4");
// if DME/Preceptor
//formsList.Add("3");
//formsList.Add("5");
int i = 1;
foreach (string form in formsList)
{
CompositeTemplate ct = new CompositeTemplate
{
ServerTemplates = new List<ServerTemplate>(),
InlineTemplates = new List<InlineTemplate>()
};
ServerTemplate st = new ServerTemplate(); //??
InlineTemplate it = new InlineTemplate
{
Recipients = new Recipients(),
Documents = new List<Document>()
};
st.Sequence = i.ToString();
ct.ServerTemplates.Add(st);
Recipients r = new Recipients();
r.Signers = new List<Signer>();
string documentId = string.Empty;
switch (form)
{
case "1":
formName = "Student Clerkship Evaluation Form";
st.TemplateId = StudentClerkshipEvaluationForm;
documentId = StudentClerkshipEvaluationDocumentId;
envDef.EmailBlurb = "Please complete your Clerkship Evaluation on the last Friday of this rotation.";
envDef.EmailSubject = "AUA - Student Clerkship Evaluation Form";
studentSigner = CreateSigner(student.StudentEmailSchool, student.StudentName, "Student", "1", "1");
r.Signers.Add(studentSigner);
signer = studentSigner;
break;
case "2":
formName = "Student Faculty Evaluation Form";
st.TemplateId = StudentFacultyEvaluationForm;
documentId = "";
envDef.EmailBlurb = "Please complete your Faculty Evaluation on the last Friday of this rotation.";
envDef.EmailSubject = "AUA - Student Faculty Evaluation Form";
studentSigner = CreateSigner(student.StudentEmailSchool, student.StudentName, "Student", "1", "1");
r.Signers.Add(studentSigner);
signer = studentSigner;
break;
case "3":
formName = "Mid Clerkship Assessment Form";
st.TemplateId = MidClerkshipAssessmentForm;
documentId = "";
envDef.EmailBlurb = "Please complete this Mid-Clerkship Assessment Form at the middle of the rotation.";
envDef.EmailSubject = "AUA - Mid Clerkship Assessment Form";
//DME FIRST (1)
// DMESigner = CreateSigner("cgrenard@auamed.org", "Chris Grenard", "DME", "2", "3");
// r.Signers.Add(DMESigner);
// CarbonCopy carbonCopy = new CarbonCopy();
DME_CC = CreateCarbonCopy("cgrenard@auamed.org", "Chris Grenard", "DME", "2", "3");
if (r.CarbonCopies == null)
{
r.CarbonCopies = new List<CarbonCopy>();
}
r.CarbonCopies.Add(DME_CC);
//BEGIN PRECEPTOR CHECK
//If we don't know the preceptor then create agent.
//AGENT SECOND (2)
agent = CreateAgent("cgrenard@gmail.com", "Chris G", "DMEAgent", "1", "4");
if (r.Agents == null)
{
r.Agents = new List<Agent>();
}
r.Agents.Add(agent);
//else Create a precpetor using their ACTUAL INFO***
//PRECEP (3)
preceptorSigner = CreateSigner("", "", "Preceptor", "3", "1");
r.Signers.Add(preceptorSigner);
//end if
//Student (4)
studentSigner = CreateSigner(student.StudentEmailSchool, student.StudentName, "Student", "4", "2");
r.Signers.Add(studentSigner);
// Commented out b/c I don't need to prepopulate
signer = preceptorSigner;
break;
case "4":
formName = "Student Portfolio Form";
st.TemplateId = StudentPortfolioForm;
documentId = "";
envDef.EmailBlurb = "Please complete your Student Portfolio prior to the end of this rotation.";
envDef.EmailSubject = "AUA - Student Portfolio";
studentSigner = CreateSigner(student.StudentEmailSchool, student.StudentName, "Student", "1", "1");
r.Signers.Add(studentSigner);
signer = studentSigner;
break;
case "5":
formName = "Comprehensive Student Clerkship Assessment Form";
st.TemplateId = ComprehensiveStudentClerkshipAssessmentForm;
documentId = "";
envDef.EmailBlurb = "Please complete this Comprehensive Clerkship Assessment Form for each respective student.";
envDef.EmailSubject = "AUA - Comprehensive Student Clerkship Assessment Form";
preceptorSigner = CreateSigner("cgrenard@auamed.org", "Dr. Gometi", "Preceptor", "1", "2");
DMESigner = CreateSigner("cgrenard@auamed.org", "Janes Rice, PHd.", "DME", "2", "3");
r.Signers.Add(preceptorSigner);
r.Signers.Add(DMESigner);
signer = preceptorSigner;
break;
default:
break;
}
it.Recipients = r; //might need to change
it.Sequence = i.ToString();
Document doc = new Document
{
Name = formName,
DocumentBase64 = CreatePersonalizedForm(student, Convert.ToInt32(form)),
DocumentId = documentId
};
//why #2?
it.Documents.Add(doc);
ct.InlineTemplates.Add(it);
envDef.CompositeTemplates.Add(ct);
#region FormTabs
/*
The font type used for the information in the tab. Possible values are:
Arial, ArialNarrow, Calibri, CourierNew, Garamond, Georgia, Helvetica, LucidaConsole, Tahoma, TimesNewRoman, Trebuchet, and Verdana.
The font size used for the information in the tab.
Possible values are: Size7, Size8, Size9, Size10, Size11, Size12, Size14, Size16, Size18, Size20, Size22, Size24, Size26, Size28, Size36, Size48, or Size72.
The font color used for the information in the tab. Possible values are: Black, BrightBlue, BrightRed, DarkGreen, DarkRed, Gold, Green, NavyBlue, Purple, or White.
*/
//Create a List<> for Checkboxes and add them to the collection
//REFACTOR SOMEDAY INTO NEW METHOD SO WE CAN DYNAMICALLY ASSIGN TABS PER ROLE TYPE...
signer.Tabs.CheckboxTabs = new List<Checkbox>();
string core = "false";
string elective = "false";
string rotationType = "";
rotationType = student.ClinicalRotation;
// rotationType = rotationType.ToUpper();
if (rotationType.ToUpper().Contains("CORE"))
{
core = "true";
}
else
{
elective = "true";
}
Checkbox chkCore = new Checkbox
{
TabLabel = "chkCore",
Selected = core
};
signer.Tabs.CheckboxTabs.Add(chkCore);
Checkbox chkElective = new Checkbox
{
TabLabel = "chkElective",
Selected = elective
};
signer.Tabs.CheckboxTabs.Add(chkElective);
Text StudentName = new Text
{
TabLabel = "StudentName",
Value = student.StudentFirstName + " " + student.StudentLastName
};
signer.Tabs.TextTabs.Add(StudentName);
Text CourseId = new Text
{
TabLabel = "CourseId",
Value = student.CourseId,
FontColor = "White"
};
signer.Tabs.TextTabs.Add(CourseId);
Text ClinicalRotationName = new Text
{
TabLabel = "ClinicalRotationName",
Value = student.ClinicalRotation
};
signer.Tabs.TextTabs.Add(ClinicalRotationName);
Text ClinicalRotationSite = new Text
{
TabLabel = "ClinicalRotationSite",
Value = student.ClinicalSite
};
signer.Tabs.TextTabs.Add(ClinicalRotationSite);
Text StartDate = new Text
{
TabLabel = "StartDate",
Value = student.StartDate
};
signer.Tabs.TextTabs.Add(StartDate);
Text EndDate = new Text
{
TabLabel = "EndDate",
Value = student.EndDate
};
signer.Tabs.TextTabs.Add(EndDate);
Text txtStudentID = new Text
{
TabLabel = "txtStudentID",
Value = student.StudentId
};
signer.Tabs.TextTabs.Add(txtStudentID);
#endregion FormTabs
i++;
}
//Setting Status to sent sends the email
envDef.Status = "sent";
// |EnvelopesApi| contains methods related to creating and sending Envelopes (aka signature requests)
EnvelopesApi envelopesApi = new EnvelopesApi();
EnvelopeSummary envelopeSummary = envelopesApi.CreateEnvelope(ConfigurationManager.AppSettings["accountId"], envDef);
// print the JSON response
Console.WriteLine("EnvelopeSummary:\n{0}", JsonConvert.SerializeObject(envelopeSummary));
//write a log file method or store to DB to show file was sent
return envelopeSummary;
}
public static void InsertFormAndEnvelopeInfo(Student student, EnvelopeSummary envelopeSumm, int batchRunId)
{
string insertProcedure = "dbo.sp_InsertFormAndEnvelopeInfo_Demo";
using (SqlConnection SQLCon = new SqlConnection(ConfigurationManager.AppSettings["DocuSign_DB_CONNSTRING"]))
{
try
{
SqlCommand SQLcmd = new SqlCommand(insertProcedure, SQLCon)
{
CommandType = CommandType.StoredProcedure
};
// Create the input paramenters
SQLcmd.Parameters.AddWithValue("@batchRunId", batchRunID);
SQLcmd.Parameters.AddWithValue("@formId", formID);
SQLcmd.Parameters.AddWithValue("@studentId", student.StudentId);
SQLcmd.Parameters.AddWithValue("@courseId", student.CourseId);
SQLcmd.Parameters.AddWithValue("@envelopeId", envelopeSumm.EnvelopeId);
SQLcmd.Parameters.AddWithValue("@envelopeStatus", envelopeSumm.Status);
SQLcmd.Parameters.AddWithValue("@statusDate", Convert.ToDateTime(envelopeSumm.StatusDateTime));
SQLcmd.Parameters.AddWithValue("@receipientRoleId", 1); // Student = 1, DME = 2, Preceptor = 3
SQLcmd.Connection = SQLCon;
SQLCon.Open();
SQLcmd.ExecuteNonQuery();
}
finally
{
SQLCon.Close();
SQLCon.Dispose();
}
}
}
public static int GetBatchRunID()
{
string storedProc = "dbo.sp_GetBatchRunID_Demo";
using (SqlConnection SQLCon = new SqlConnection(ConfigurationManager.AppSettings["SMSDB_CONNSTRING2"]))
{
try
{
var SQLcmd = new SqlCommand(storedProc, SQLCon);
SQLcmd.CommandType = CommandType.StoredProcedure;
SQLcmd.Parameters.AddWithValue("@startDate", startDate).Direction = ParameterDirection.Input;
SQLcmd.Parameters.AddWithValue("@sendDate", Convert.ToString(DateTime.Now)).Direction = ParameterDirection.Input;
SQLcmd.Parameters.Add("@runId", SqlDbType.Int).Direction = ParameterDirection.Output;
SQLcmd.Connection = SQLCon;
SQLCon.Open();
SQLcmd.ExecuteNonQuery();
batchRunID = (int)SQLcmd.Parameters["@runId"].Value;
// GetStudentRotationInfo(batchRunID);
}
finally
{
SQLCon.Close();
SQLCon.Dispose();
}
}
return batchRunID;
}
private static void SetEnvelopeReminders(Student student, EnvelopeDefinition envDef)
{
string newReminderDelay = "";
switch (student.CreditWeeks)
{
case "4":
newReminderDelay = "28";
break;
case "6":
newReminderDelay = "42";
break;
case "8":
newReminderDelay = "56";
break;
case "12":
newReminderDelay = "84";
break;
default:
newReminderDelay = "40";
break;
}
//Set Dynamic Notifications
envDef.Notification = new Notification
{
UseAccountDefaults = "false",
Reminders = new Reminders
{
ReminderEnabled = "true",
ReminderFrequency = "2",
ReminderDelay = newReminderDelay
},
Expirations = new Expirations
{
ExpireEnabled = "true",
ExpireWarn = "7",
ExpireAfter = "120"
}
};
}
// end requestSignatureFromTemplateTest()
public static string CreatePersonalizedForm(Student s, int pdfFormId)
{
string currentForm = "";
string outputForm = "";
string imagePath = "";
imagePath = @"w:\data\aua\StudentPhotos\" + s.StudentPicturePath + "_" + s.StudentId + ".jpg";
//imagePath.Replace(" ", "");
switch (pdfFormId)
{
case 1:
currentForm = @"C:\Docusign\AUA_Forms\StudentClerkshipEvaluationForm.pdf";
outputForm = @"C:\Docusign\AUA_Forms\StudentClerkshipEvaluationForm_" + s.StudentId + ".pdf";
break;
case 2:
currentForm = @"C:\Docusign\AUA_Forms\StudentFacultyEvaluationForm.pdf";
outputForm = @"C:\Docusign\AUA_Forms\StudentFacultyEvaluationForm_" + s.StudentId + ".pdf";
break;
case 3:
currentForm = @"C:\Docusign\AUA_Forms\MidClerkshipAssessmentForm.pdf";
outputForm = @"C:\Docusign\AUA_Forms\MidClerkshipAssessmentForm_" + s.StudentId + ".pdf";
break;
case 4:
currentForm = @"C:\Docusign\AUA_Forms\StudentPortfolioForm.pdf";
outputForm = @"C:\Docusign\AUA_Forms\StudentPortfolioForm_" + s.StudentId + ".pdf";
break;
case 5:
currentForm = @"C:\Docusign\AUA_Forms\ComprehensiveStudentClerkshipAssessmentForm.pdf";
outputForm = @"C:\Docusign\AUA_Forms\ComprehensiveStudentClerkshipAssessmentForm_" + s.StudentId + ".pdf";
break;
}
//Step 1: Open the PDF form to be sent
using (Stream inputPdfStream = new FileStream(currentForm, FileMode.Open, FileAccess.Read, FileShare.Read))
//Step 2: Identify the Student Image to be inserted
using (Stream inputImageStream = new FileStream(imagePath, FileMode.Open, FileAccess.Read, FileShare.Read))
//Step 3: Create a new instance of the form with the Student's Picture Inserted
using (Stream outputPdfStream = new FileStream(outputForm, FileMode.Create, FileAccess.Write, FileShare.ReadWrite))
{
PdfReader reader = new PdfReader(inputPdfStream);
PdfStamper stamper = new PdfStamper(reader, outputPdfStream);
PdfContentByte pdfContentByte = stamper.GetOverContent(1);
Image image = Image.GetInstance(inputImageStream);
image.ScaleAbsoluteHeight(150);
image.ScaleAbsoluteWidth(150);
image.Border = 1;
image.BorderWidth = 3;
image.BorderWidthRight = 3;
image.BorderWidthLeft = 3;
image.BorderWidthBottom = 3;
image.SetAbsolutePosition(34, 504);
pdfContentByte.AddImage(image);
stamper.Close();
byte[] bytes = File.ReadAllBytes(outputForm);
//delete output form
//outputForm.
string returnPdf = Convert.ToBase64String(bytes);
return returnPdf;
}
}
//Create Standard Signer
private static Signer CreateSigner(string recipientEmail, string recipientName, string templateRoleName, string routingOrder, string recipientId)
{
Signer signer = new Signer
{
Email = recipientEmail,
Name = recipientName,
RoleName = templateRoleName,
RoutingOrder = routingOrder,
RecipientId = recipientId,
Tabs = new Tabs { TextTabs = new List<Text>() }
};
//Only create once for Recipient/Signer
//Each recip gets their own tabs
return signer;
}
//Create an Intermediary
private static Agent CreateAgent(string recipientEmail, string recipientName, string templateRoleName,
string routingOrder, string recipientId)
{
Agent agent = new Agent()
{
Email = recipientEmail,
Name = recipientName,
RoleName = templateRoleName,
RoutingOrder = routingOrder,
RecipientId = recipientId,
};
return agent;
}
//Create a CC
private static CarbonCopy CreateCarbonCopy(string recipientEmail, string recipientName, string templateRoleName, string routingOrder, string recipientId)
{
CarbonCopy carbonCopy = new CarbonCopy()
{
Email = recipientEmail,
Name = recipientName,
RoleName = templateRoleName,
RoutingOrder = routingOrder,
RecipientId = recipientId,
};
//Only create once for Recipient/Signer
//Each recip gets their own tabs
return carbonCopy;
}
//**********************************************************************************************************************
//**********************************************************************************************************************
//* HELPER FUNCTIONS
//**********************************************************************************************************************
//**********************************************************************************************************************
public static void configureApiClient(string basePath)
{
// instantiate a new api client
ApiClient apiClient = new ApiClient(basePath);
// set client in global config so we don't need to pass it to each API object.
DocuSign.eSign.Client.Configuration.Default.ApiClient = apiClient;
}
} // end class
} //end namespace