-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
1208 lines (952 loc) · 51.6 KB
/
Program.cs
File metadata and controls
1208 lines (952 loc) · 51.6 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
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
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
{
//Check CC F(x) is ON for PROD. // Form1=Student Clerkship, Form2 = Student Faculty,Form3=Mid-Clerkship,Form4=Portfolio,Form5=Comprehensive
static string formID = "3";
//Form ID change for testing purposes
static int batchRunID = 20180425;
static string ProdID = "PROD";
static string startDate = ""; //is this really needed?
static string formName = "";
static string shortRotaName = "";
static string subjectLine = "";
//*********************** Query for records **********************************//
// static string strSQL = " select * from August7_Starts Where StudentID = 1076832";
//static string strSQL = "SELECT * FROM DSStudentCoursesInformation_tbl with (nolock) WHERE CourseDateStart = '10-09-2017' order by StudentID"; //create a stored procedure?
//static string strSQL = "SELECT * FROM DSStudentCoursesInformation_tbl with (nolock) WHERE CourseDateStart = '09-25-2017' and StudentID = 101291";
static string strSQL = "SELECT * FROM DSStudentCoursesInformation_tbl where studentid = 101074 and CourseUID = 8472";
// Integrator Key (aka API key) is needed to authenticate your API calls. This is an application-wide key
public string Username { get; } = ConfigurationManager.AppSettings["username"];
static readonly string StudentClerkshipEvaluationForm = ConfigurationManager.AppSettings["StudentClerkshipEvaluationForm_TemplateID"]; //Form 1 [Student Only]
static readonly string StudentFacultyEvaluationForm = ConfigurationManager.AppSettings["StudentFacultyEvaluationForm_TemplateID"]; //Form 2 [Student Only]
static readonly string MidClerkshipAssessmentForm = ConfigurationManager.AppSettings["MidClerkshipAssessmentForm_TemplateID"]; //Form 3 [Student & Preceptor]
//static readonly string MidClerkshipAssessmentFormEditable = ConfigurationManager.AppSettings["MidClerkshipAssessmentForm_Editable_TemplateID"]; //Form 3 [Student & Preceptor - Editable]
static readonly string StudentPortfolioForm = ConfigurationManager.AppSettings["StudentPortfolio_TemplateID"]; //Form 4 [Student to Preceptor]
static readonly string StudentPortfolioFormEditable = ConfigurationManager.AppSettings["StudentPortfolio_Editable_TemplateID"]; //Form 4 [Student to Preceptor - Editable]
static readonly string CompStudentClerkshipAssessmentForm = ConfigurationManager.AppSettings["ComprehensiveStudentClerkshipAssessmentForm_TemplateID"]; //Form 5 [Preceptor & DME]
static readonly string CompStudentClerkshipAssessmentFormEditable = ConfigurationManager.AppSettings["ComprehensiveStudentClerkshipAssessmentForm_Editable_TemplateID"]; //Form 5 [Preceptor & DME Editable]
private static string templateNameCSA;
private static string templateNameStudentPF;
//////////////////////////////////////////////////////////
// Main()
//////////////////////////////////////////////////////////
static void Main(string[] args)
{
SetHeader();
//GetBatchRunID();
GetStudentRotationInfo(batchRunID, ProdID);
Console.WriteLine();
Console.WriteLine("***************************************************************");
Console.WriteLine("***************************************************************");
if (formID == "1")
{
formName = " Student Clerkship Evaluation";
}
if (formID == "2")
{
formName = " Student Faculty Evaluation";
}
if (formID == "3")
{
formName = " Mid-Clerkship Formative Student Assessment";
}
if (formID == "4")
{
formName = " Student Portfolio";
}
if (formID == "5")
{
formName = " Comprehensive Student Clerkship Assessment";
}
Console.WriteLine(iCount + formName + " forms sent.");
Console.WriteLine("***************************************************************");
Console.WriteLine("***************************************************************");
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 GetBatchRunID()
//{
// string storedProc = "dbo.sp_GetBatchRunID_Demo";
// using (SqlConnection SQLCon = new SqlConnection(ConfigurationManager.AppSettings["SMSDB_CONNSTRING"]))
// {
// try
// {
// SqlCommand SQLcmd = new SqlCommand(storedProc, SQLCon);
// SQLcmd.CommandType = CommandType.StoredProcedure;
// SQLcmd.Parameters.AddWithValue("@startDate", "05/01/17").Direction = System.Data.ParameterDirection.Input;
// SQLcmd.Parameters.AddWithValue("@sendDate", Convert.ToString(DateTime.Now)).Direction = System.Data.ParameterDirection.Input;
// SQLcmd.Parameters.Add("@runId", SqlDbType.Int).Direction = System.Data.ParameterDirection.Output;
// SQLcmd.Connection = SQLCon;
// SQLCon.Open();
// SQLcmd.ExecuteNonQuery();
// batchRunID = (int)SQLcmd.Parameters["@runId"].Value;
// GetStudentRotationInfo(batchRunID,"PROD");
// }
// finally
// {
// SQLCon.Close();
// SQLCon.Dispose();
// }
// }
//}
private static int iCount = 0;
public static void GetStudentRotationInfo(int batchRunID, string Environment)
{
SqlConnection conn = null;
SqlDataReader rdr = null;
//string sendDatesProcedure = "sp_DocuSignFormSendDates_Demo";
Student student = new Student();
EnvelopeSummary envelopeSumm = new EnvelopeSummary();
//Get all data required for prepopulating DocuSign templates
//The table is created from an Excel spreadsheet
try
{
conn = new SqlConnection(ConfigurationManager.AppSettings["DocuSign_DB_CONNSTRING"]);
conn.Open();
var cmd = new SqlCommand(strSQL, conn)
{
CommandType = CommandType.Text
};
cmd.Parameters.AddWithValue("@StartDate", startDate);
rdr = cmd.ExecuteReader();
if (Environment == ProdID)
{
while (rdr.Read())
{
/////////////////////////////////////////////////////////////////////////////
student.StudentId = rdr["StudentID"].ToString();
student.StudentFirstName = rdr["StudentFirstName"].ToString();
student.StudentFirstName = student.StudentFirstName.Trim();
student.StudentLastName = rdr["StudentLastName"].ToString();
student.StudentLastName = student.StudentLastName.Trim();
student.StudentName = student.StudentFirstName + " " + student.StudentLastName;
//student.StudentName = rdr["StudentName"].ToString();
student.StudentPicturePath = rdr["StudentPicturePath"].ToString();
student.CourseId = rdr["CourseUID"].ToString();
student.StudentEmailSchool = rdr["StudentEmailSchool"].ToString();
// student.StudentEmailSchool = "isherchan@auamed.org"; //For testing
student.ClinicalRotation = rdr["CourseTitle"].ToString();
if (student.ClinicalRotation == "Family Medicine I/Internal Medicine I")
{
shortRotaName = student.ClinicalRotation;
}
else
{
shortRotaName = student.ClinicalRotation.Remove(student.ClinicalRotation.IndexOf('('));
}
student.CreditWeeks = rdr["CourseCreditWeeks"].ToString();
student.ClinicalSite = rdr["HospitalName"].ToString();
student.StartDate = rdr["CourseDateStart"].ToString();
student.EndDate = rdr["CourseDateEnd"].ToString();
student.StartDate = DateTime.Parse(student.StartDate).ToShortDateString();
student.EndDate = DateTime.Parse(student.EndDate).ToShortDateString();
/* Assign Preceptor & DME Info Here*/
//Send to Hospital Contacts if no DME or Preceptor Info is available
//if (formID == "3" || formID == "4" || formID == "5")
if (formID == "4" || formID == "5")
{
//////////////////////////////////////////////////////////////////////////////
if (rdr["Preceptor Email"].ToString() != "")
{
student.StudentPreceptorEmail = rdr["Preceptor Email"].ToString();
//student.StudentPreceptorEmail = "egometi@auamed.org";
student.StudentPreceptorName = rdr["Preceptor Name"].ToString();
}
if (rdr["Preceptor Email"].ToString() == "" || rdr["Preceptor Email"].ToString() == "NULL" )
{
student.StudentPreceptorEmail = rdr["Preceptor Recipient"].ToString();
//student.StudentPreceptorEmail = "egometi@auamed.org";
//***Fill In Name Here***
student.StudentPreceptorName = "***PRECEPTOR: Please Fill In Name Here***";
}
//////////////////////////////////////////////////////////////////////////////
if (rdr["DME Email"].ToString() != "")
{
student.StudentDMEEmail = rdr["DME Email"].ToString();
//student.StudentDMEEmail = "egometi@auamed.org";
student.StudentDMEName = rdr["DME Name"].ToString();
}
if (rdr["DME Email"].ToString() == "" || rdr["DME Email"].ToString() == "NULL")
{
student.StudentDMEEmail = rdr["DME Recipient"].ToString();
//student.StudentDMEEmail = "egometi@auamed.org";
//***Fill In Name Here***
student.StudentDMEName = "***DME: Please Fill In Name Here***";
}
//////////////////////////////////////////////////////////////////////////////
if (rdr["Preceptor Email"].ToString() == "" || rdr["DME Email"].ToString() == "")
{
templateNameCSA = CompStudentClerkshipAssessmentFormEditable;
templateNameStudentPF = StudentPortfolioFormEditable;
}
else
{
templateNameCSA = CompStudentClerkshipAssessmentForm;
templateNameStudentPF = StudentPortfolioForm;
}
}
#region DUMMY DATA
//Dummy Data *************************************************
//templateNameCSA = CompStudentClerkshipAssessmentForm;
//templateNameStudentPF = StudentPortfolioForm;
//templateNameMidClerkship = MidClerkshipAssessmentForm;
//student.StudentId = "123456";
//student.StudentFirstName = "John";
//student.StudentLastName = "Miller";
//student.StudentName = "John Miller";
// student.StudentPicturePath = @"C:\Docusign\doctor.jpg";
//student.CourseId = "7216";
//student.ClinicalRotation = "Critical Care (4w Elective)";
//student.CreditWeeks = "4";
//student.ClinicalSite = "Manhattan General";
//student.StudentPreceptorEmail = "cgrenard@auamed.org";
//student.StudentPreceptorName = "Dr.Preceptor";
//student.StudentDMEEmail = "cgrenard@auamed.org";
//student.StudentDMEName = "Dr. Patel";
//student.StudentEmailSchool = "cgrenard@auamed.org";
#endregion
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 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);
SQLcmd.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", 2);
SQLcmd.Connection = SQLCon;
SQLCon.Open();
SQLcmd.ExecuteNonQuery();
}
finally
{
SQLCon.Close();
SQLCon.Dispose();
}
}
}
public static EnvelopeSummary RequestStudentSignatureFromTemplate(Student student)
{
//DocuSignTemplate dsTemplate = new DocuSignTemplate();
// instantiate api client with appropriate environment (for production change to www.docusign.net/restapi)
configureApiClient(ConfigurationManager.AppSettings["RestAPI_URL"]);
//===========================================================
// Step 1: Login()
//===========================================================
// call the Login() API which sets the user's baseUrl and returns their accountId
//var accountId = loginApi(Username, password);
//===========================================================
// Step 2: Signature Request from Template
//===========================================================
var envDef = new EnvelopeDefinition { CompositeTemplates = new List<CompositeTemplate>() };
//===========================================================
// Step 3: Create a CompositeTemplate, List<ServerTemplate>,List<InlineTemplate>
//===========================================================
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 = "2";
ct.ServerTemplates.Add(st);
Recipients r = new Recipients();
r.Signers = new List<Signer>();
r.Agents = new List<Agent>();
// studentSigner = CreateSigner(student.StudentEmailSchool, student.StudentName, templateRoleName, routingOrder, recipientId);
Signer studentSigner = new Signer();
Signer preceptorSigner = new Signer();
Signer DMESigner = new Signer();
Agent HospContact = new Agent();
Signer signer = new Signer();
//string newReminderDelay = "";
DateTime endDate = Convert.ToDateTime(student.EndDate);
DateTime today = DateTime.Today;
var days = (endDate - today).TotalDays;
days -= 5;
#region reminders
//if (formID == "3")
//{
// days /= 2;
//}
//newReminderDelay = Convert.ToString(days);
// student.EndDate = student.CreditWeeks == "6" ? "01/06/2017" : "02/17/2017";
//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 = "14";
// break;
//}
//Set Dynamic Notifications
envDef.Notification = new Notification
{
UseAccountDefaults = "false",
Reminders = new Reminders
{
ReminderEnabled = "true",
ReminderFrequency = "3",
ReminderDelay = "12" //newReminderDelay
},
Expirations = new Expirations
{
ExpireEnabled = "true",
ExpireWarn = "7",
ExpireAfter = "999"
}
};
#endregion
//string formName = "";
//Assign the correct template
//Adds all controls to List<Recipients>
subjectLine = student.StudentLastName + ", " + student.StudentFirstName + "; " + student.StartDate + "-" + student.EndDate + "; " + shortRotaName;
switch (formID)
{
case "1":
formName = "Student Clerkship Evaluation Form";
st.TemplateId = StudentClerkshipEvaluationForm;
envDef.EmailBlurb = "Please complete your Clerkship Evaluation form: " + subjectLine + "; " + student.ClinicalSite + " at the end of this rotation";
envDef.EmailSubject = subjectLine + "; Student Clerkship Eval.";
// envDef.EmailSubject = "Test" + subjectLine + "; Student Clerkship Eval."; //For testing
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;
envDef.EmailBlurb = "Please complete your Faculty Evaluation form: " + subjectLine + "; " + student.ClinicalSite + " at the end of this rotation";
envDef.EmailSubject = subjectLine + "; Student Faculty Eval.";
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;
envDef.EmailBlurb = "Please make sure both you and your Supervising Physician (Preceptor) complete this Mid-Clerkship Assessment Form: " + subjectLine + "; " + student.ClinicalSite + " at the middle of this rotation";
envDef.EmailSubject = subjectLine + "; Mid-Clerkship Assessment";
//June 2017 - Change to send to Student (1), then Preceptor (2) -------Check Document XML Role ID
studentSigner = CreateSigner(student.StudentEmailSchool, student.StudentName, "Student", "1", "1");
r.Signers.Add(studentSigner);
//preceptorSigner = CreateSigner(student.StudentPreceptorEmail, student.StudentPreceptorName, "Preceptor", "2", "1");
//r.Signers.Add(preceptorSigner);
signer = studentSigner;
break;
case "4":
formName = "Student Portfolio Form";
st.TemplateId = templateNameStudentPF;
envDef.EmailBlurb = "Please complete this Student Portfolio for: " + subjectLine + "; " + student.ClinicalSite;
envDef.EmailSubject = subjectLine + "; Student Portfolio";
studentSigner = CreateSigner(student.StudentEmailSchool, student.StudentName, "Student", "1", "1");
r.Signers.Add(studentSigner);
preceptorSigner = CreateSigner(student.StudentPreceptorEmail, student.StudentPreceptorName, "Preceptor", "2", "2");
r.Signers.Add(preceptorSigner);
signer = studentSigner;
break;
case "5":
formName = "Comprehensive Student Clerkship Assessment Form";
envDef.EmailBlurb = "Please complete this Comprehensive Clerkship Assessment Form - " + subjectLine + "; " + student.ClinicalSite
+ ", " + student.ClinicalSite;
envDef.EmailSubject = subjectLine + "; Comprehensive Assessment";
//envDef.EmailSubject = "Fixed: " + subjectLine + "; Comprehensive Assessment";
st.TemplateId = templateNameCSA;
preceptorSigner = CreateSigner(student.StudentPreceptorEmail, student.StudentPreceptorName, "Preceptor", "1", "1");
r.Signers.Add(preceptorSigner);
//After Preceptor completes and signs it goes to DME for completion.
DMESigner = CreateSigner(student.StudentDMEEmail, student.StudentDMEName, "DME", "2", "2");
r.Signers.Add(DMESigner);
signer = preceptorSigner;
break;
}
//CC Requested Hospital Contacts
CCByHospitalAndForm(student, r);
#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
//if (formID != "3")
//{
// Text DEndDate = new Text
// {
// TabLabel = "DEndDate",
// Value = student.EndDate,
// DocumentId = "2",
// };
// signer.Tabs.TextTabs.Add(DEndDate);
// Text REndDate = new Text
// {
// TabLabel = "REndDate",
// Value = student.EndDate,
// DocumentId = "2",
// };
// signer.Tabs.TextTabs.Add(REndDate);
//}
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,
DocumentId = "2" //DEBUG
};
signer.Tabs.CheckboxTabs.Add(chkCore);
Checkbox chkElective = new Checkbox
{
TabLabel = "chkElective",
Selected = elective,
DocumentId = "2" //DEBUG
};
signer.Tabs.CheckboxTabs.Add(chkElective);
Text StudentName = new Text
{
TabLabel = "StudentName",
Value = student.StudentFirstName + " " + student.StudentLastName,
DocumentId = "2",
};
signer.Tabs.TextTabs.Add(StudentName);
Text ClinicalRotationName = new Text
{
TabLabel = "ClinicalRotationName",
Value = student.ClinicalRotation,
DocumentId = "2"
};
signer.Tabs.TextTabs.Add(ClinicalRotationName);
Text ClinicalRotationSite = new Text
{
TabLabel = "ClinicalRotationSite",
Value = student.ClinicalSite,
DocumentId = "2",
// ConcealValueOnDocument = "true"
};
signer.Tabs.TextTabs.Add(ClinicalRotationSite);
Text StartDate = new Text
{
TabLabel = "StartDate",
Value = student.StartDate,
DocumentId = "2"
};
signer.Tabs.TextTabs.Add(StartDate);
Text EndDate = new Text
{
TabLabel = "EndDate",
Value = student.EndDate,
DocumentId = "2"
};
signer.Tabs.TextTabs.Add(EndDate);
Text txtStudentID = new Text
{
TabLabel = "txtStudentID",
Value = student.StudentId,
DocumentId = "2",
};
signer.Tabs.TextTabs.Add(txtStudentID);
//Text txtMSPEComments = new Text
//{
// TabLabel = "txtMSPEComments",
// MaxLength = 4000,
// DocumentId = "2",
//};
//signer.Tabs.TextTabs.Add(txtMSPEComments);
#endregion FormTabs
it.Recipients = r; //might need to change
it.Sequence = "1";
Document doc = new Document
{
Name = formName,
DocumentBase64 = CreatePersonalizedForm(student, Convert.ToInt32(formID)),
DocumentId = "2"
};
//why #2?
it.Documents.Add(doc);
ct.InlineTemplates.Add(it);
envDef.CompositeTemplates.Add(ct);
//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);
//UPDATE Form_Sent & INSERT EnvelopeHistory
var envId = envelopeSummary.EnvelopeId;
//Console.WriteLine("EnvelopeId: " + envId + "\n");
//
// print the JSON response
iCount++;
Console.WriteLine(iCount + ". EnvelopeSummary:\n{0}", JsonConvert.SerializeObject(envelopeSummary));
//write a log file method or store to DB to show file was sent
return envelopeSummary;
}
// end requestSignatureFromTemplateTest()
private static void CCByHospitalAndForm(Student student, Recipients r)
{
switch (student.ClinicalSite)
{
case "Richmond University Medical Center":
if (formID == "5")
{
var ccRecipient = new CarbonCopy
{
Email = "dmangold@rumsci.org",
Note = "You were CC'd on the completed assessment",
Name = "Carbon Copy Recipient",
RecipientId = "3",
RoutingOrder = "3"
};
var ccRecipient2 = new CarbonCopy
{
Email = "auastudenteval@rumcsi.org",
Note = "You were CC'd on the completed assessment",
Name = "Carbon Copy Recipient",
RecipientId = "3",
RoutingOrder = "3"
};
r.CarbonCopies = new List<CarbonCopy> { ccRecipient, ccRecipient2 };
}
if (formID == "5" && student.ClinicalRotation.Contains("Perioperative"))
{
var ccRecipient = new CarbonCopy
{
Email = "riso.janice@gmail.com",
Note = "You were CC'd",
Name = "Carbon Copy Recipient",
RecipientId = "3",
RoutingOrder = "3"
};
r.CarbonCopies = new List<CarbonCopy> { ccRecipient };
}
break;
case "Interfaith Medical Center":
if (formID == "5")
{
var ccRecipient = new CarbonCopy
{
Email = "ktheodore@interfaithmedical.org",
Note = "You were CC'd",
Name = "Carbon Copy Recipient",
RecipientId = "3",
RoutingOrder = "2"
};
r.CarbonCopies = new List<CarbonCopy> {ccRecipient};
}
break;
case "University of Maryland Medical Center-Midtown Campus":
if (formID == "5")
{
var ccRecipient = new CarbonCopy
{
Email = "PIncoom@umm.edu",
Note = "You were CC'd",
Name = "Carbon Copy Recipient",
RecipientId = "3",
RoutingOrder = "3"
};
r.CarbonCopies = new List<CarbonCopy> { ccRecipient };
}
break;
case "Georgia Regional Hospital- Atlanta":
if (formID == "5")
{
var ccRecipient = new CarbonCopy
{
Email = "BStubbs@mdcsa.net",
Note = "You were CC'd",
Name = "Carbon Copy Recipient",
RecipientId = "3",
RoutingOrder = "3"
};
r.CarbonCopies = new List<CarbonCopy> { ccRecipient };
}
break;
case "Southside Hospital":
if (formID == "5" && student.ClinicalRotation.Contains("Family"))
{
var ccRecipient = new CarbonCopy
{
Email = "mmanzari@northwell.edu",
Note = "You were CC'd",
Name = "Carbon Copy Recipient",
RecipientId = "3",
RoutingOrder = "2"
};
r.CarbonCopies = new List<CarbonCopy> {ccRecipient};
}
if (formID == "5" && student.ClinicalRotation.Contains("Obstetrics"))
{
var ccRecipient = new CarbonCopy
{
Email = "cdolce@mdcsa.net",
Note = "You were CC'd",
Name = "Carbon Copy Recipient",
RecipientId = "3",
RoutingOrder = "3"
};
r.CarbonCopies = new List<CarbonCopy> { ccRecipient };
}
break;
case "Harbor Hospital Center":
if (formID == "4" || formID == "5")
{
var ccRecipient = new CarbonCopy
{
Email = "Terry.Kus@medstar.net",
Note = "You were CC'd",
Name = "Carbon Copy Recipient",
RecipientId = "2",
RoutingOrder = "2"
};
var ccRecipient2 = new CarbonCopy
{
Email = "Denise.McCumbers@medstar.net",
Note = "You were CC'd",
Name = "Carbon Copy Recipient",
RecipientId = "2",
RoutingOrder = "2"
};
r.CarbonCopies = new List<CarbonCopy> { ccRecipient, ccRecipient2 };
}
break;
case "Northside Medical Center":
if (student.ClinicalRotation.Contains("Surgery") && (formID == "4" || formID == "5"))
{
var ccRecipient = new CarbonCopy
{
Email = "MaryAnn.Evanchick@steward.org",
Note = "You were CC'd",
Name = "Carbon Copy Recipient",
RecipientId = "2",
RoutingOrder = "2"
};
r.CarbonCopies = new List<CarbonCopy> { ccRecipient };
}
if (student.ClinicalRotation.Contains("Infectious") && (formID == "4" || formID == "5"))
{
var ccRecipient = new CarbonCopy
{
Email = "Marilyn.Mangino@steward.org",
Note = "You were CC'd",
Name = "Carbon Copy Recipient",
RecipientId = "2",
RoutingOrder = "2"
};
r.CarbonCopies = new List<CarbonCopy> { ccRecipient };
}
if (student.ClinicalRotation.Contains("MICU") && (formID == "4" || formID == "5"))
{
var ccRecipient = new CarbonCopy
{
Email = "Marilyn.Mangino@steward.org",
Note = "You were CC'd",
Name = "Carbon Copy Recipient",
RecipientId = "2",
RoutingOrder = "2"
};
r.CarbonCopies = new List<CarbonCopy> { ccRecipient };
}
if (student.ClinicalRotation.Contains("Internal Medicine (12w Core)") && (formID == "4" || formID == "5"))
{
var ccRecipient = new CarbonCopy
{
Email = "Marilyn.Mangino@steward.org",
Note = "You were CC'd",
Name = "Carbon Copy Recipient",
RecipientId = "2",
RoutingOrder = "2"
};
r.CarbonCopies = new List<CarbonCopy> { ccRecipient };
}
break;
case "Wyckoff Heights Medical Center":
//if (student.ClinicalRotation.Contains("Surgery") && formID == "4")
//{
// var ccRecipient = new CarbonCopy
// {
// Email = "atrzpis@wyckoffhospital.org",
// Note = "You were Carbon Copied on this email, for your record.",
// Name = "Carbon Copy Recipient",
// RecipientId = "3",
// RoutingOrder = "2"
// };
// r.CarbonCopies = new List<CarbonCopy> { ccRecipient };
//}
if (formID == "5")
{
var ccRecipient = new CarbonCopy
{
Email = "CRodriguez@wyckoffhospital.org",
Note = "You were Carbon Copied on this email, for your record.",
Name = "Carbon Copy Recipient",
RecipientId = "3",
RoutingOrder = "3"
};
r.CarbonCopies = new List<CarbonCopy> { ccRecipient };
}
//else
//{
// var ccRecipient = new CarbonCopy
// {
// Email = "CRodriguez@wyckoffhospital.org",
// Note = "You were Carbon Copied on this email, for your record.",
// Name = "Carbon Copy Recipient",
// RecipientId = "3",
// RoutingOrder = "3"
// };
// var ccRecipient2 = new CarbonCopy
// {
// Email = "ACorrea@wyckoffhospital.org",
// Note = "You were Carbon Copied on this email, for your record.",
// Name = "Carbon Copy Recipient",
// RecipientId = "3",
// RoutingOrder = "3"
// };
// r.CarbonCopies = new List<CarbonCopy> { ccRecipient, ccRecipient2 };
//}
break;
case "Sinai Hospital - Baltimore":
if (formID == "5")
{
var ccRecipient = new CarbonCopy
{
Email = "Cdallas@lifebridgehealth.org",
Note = "You were CC'd",
Name = "Carbon Copy Recipient",
RecipientId = "3",
RoutingOrder = "3"
};
r.CarbonCopies = new List<CarbonCopy> { ccRecipient };
}
break;
case "University of Miami":
if (formID == "4" && student.ClinicalRotation.Contains("ECG and Bedside Skills"))