-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefault.aspx.cs
More file actions
288 lines (255 loc) · 10.3 KB
/
Default.aspx.cs
File metadata and controls
288 lines (255 loc) · 10.3 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using EmTrac2SF.Salesforce;
using EmTrac2SF.EMSC2SF;
using Metaphone;
using GenericLibrary;
using System.Text;
using System.IO;
namespace EmTrac2SF
{
public partial class Default : System.Web.UI.Page
{
DataLoader objDL;
string strInstance = "";
DateTime dtBegin, dtEnd;
protected void Page_Load(object sender, EventArgs e)
{
objDL = new DataLoader( Request.PhysicalApplicationPath, tbStatus, lblError, OpenCSVList );
if (Session["ApiService"] != null)
objDL.API = (ApiService) Session[ "ApiService" ];
else
{
objDL.API = new ApiService();
Session[ "ApiService" ] = objDL.API;
}
// auto configure API according to the setting in the web.config
strInstance = System.Configuration.ConfigurationManager.AppSettings[ "Instance" ].ToLower();
switch( strInstance )
{
case "dev1":
Title = "EmTrac2SF - DEV1";
break;
case "test1":
Title = "EmTrac2SF - TEST1";
break;
case "prod":
if(Properties.Settings.Default.EmTrac2SF_EMSC_SF_SforceService.StartsWith( "https://login.salesforce.com" ))
Title = "EmTrac2SF - PRODUCTION";
else
lblError.Text = "ERROR: In order to connect to Production, please switch the Salesforce URL to https://login.salesforce.com in the web.config.";
break;
}
}
protected void btnRefreshProviders_Click(object sender, EventArgs e)
{
dtBegin = DateTime.Now;
objDL.RefreshProviders( bImportNotes: true, bDisplayOnly: cbxDisplayOnly.Checked );
dtEnd = DateTime.Now;
TimeSpan tsDuration = dtEnd.Subtract( dtBegin );
tbStatus.Text = string.Concat( tbStatus.Text, "\r\n\r\n** Provider load completed in ", tsDuration.Hours, " hours "
, tsDuration.Minutes, " minutes. **\r\n" );
}
protected void btnRefreshFacilities_Click(object sender, EventArgs e)
{
dtBegin = DateTime.Now;
objDL.RefreshFacilities( bDisplayOnly: cbxDisplayOnly.Checked );
dtEnd = DateTime.Now;
TimeSpan tsDuration = dtEnd.Subtract( dtBegin );
tbStatus.Text = string.Concat( tbStatus.Text, "\r\n\r\n** Facility load completed in ", tsDuration.Hours, " hours "
, tsDuration.Minutes, " minutes. **\r\n" );
}
protected void btnRefreshCredentials_Click(object sender, EventArgs e)
{
dtBegin = DateTime.Now;
if (cbxAllRecords.Checked)
objDL.RefreshCredentials( null, null, null, cbxDisplayOnly.Checked );
else
{
List<Contact> objProviders = objDL.RefreshProviders( false );
objDL.RefreshCredentials( objProviders, objDL.RefreshAgencies( objProviders ), objDL.RefreshSubtypes(), cbxDisplayOnly.Checked );
}
dtEnd = DateTime.Now;
TimeSpan tsDuration = dtEnd.Subtract( dtBegin );
tbStatus.Text = string.Concat( tbStatus.Text, "\r\n\r\n** Credentials load completed in ", tsDuration.Hours, " hours "
, tsDuration.Minutes, " minutes. **\r\n" );
}
protected void btnRefreshEducationExperience_Click(object sender, EventArgs e)
{
dtBegin = DateTime.Now;
if (cbxAllRecords.Checked)
objDL.RefreshEducationExperience( bDisplayOnly: cbxDisplayOnly.Checked );
else
{
List<Contact> objProviders = EmTrac2SFUtils.GetProvidersFromSF( objDL.API, lblError );
objDL.RefreshEducationExperience( objProviders
, objDL.RefreshInstitutions( objProviders, bDisplayOnly: cbxDisplayOnly.Checked ), bDisplayOnly: cbxDisplayOnly.Checked );
}
dtEnd = DateTime.Now;
TimeSpan tsDuration = dtEnd.Subtract( dtBegin );
tbStatus.Text = string.Concat( tbStatus.Text, "\r\n\r\n** Education/Experience load completed in ", tsDuration.Hours, " hours "
, tsDuration.Minutes, " minutes. **\r\n" );
}
protected void btnAddEmCareAccount_Click(object sender, EventArgs e)
{
objDL.InitializeAccountAndSettings();
}
protected void btnRefreshCandidate_Click(object sender, EventArgs e)
{
dtBegin = DateTime.Now;
if (cbxAllRecords.Checked)
objDL.RefreshCandidates( bDisplayOnly: cbxDisplayOnly.Checked );
else
{
List<Contact> objProviders = objDL.RefreshProviders( false, bDisplayOnly: cbxDisplayOnly.Checked );
//List<Facility__c> objFacilities = objDL.RefreshFacilities();
objDL.RefreshCandidates( objProviders, bDisplayOnly: cbxDisplayOnly.Checked );
}
dtEnd = DateTime.Now;
TimeSpan tsDuration = dtEnd.Subtract( dtBegin );
tbStatus.Text = string.Concat( tbStatus.Text, "\r\n\r\n** Candidate load completed in ", tsDuration.Hours, " hours "
, tsDuration.Minutes, " minutes. **\r\n" );
}
protected void btnRefreshAgencies_Click(object sender, EventArgs e)
{
dtBegin = DateTime.Now;
if (cbxAllRecords.Checked)
{
objDL.RefreshAgencies( bDisplayOnly: cbxDisplayOnly.Checked );
objDL.RefreshInstitutions( bDisplayOnly: cbxDisplayOnly.Checked );
}
else
{
List<Contact> objProviders = objDL.RefreshProviders( false, bDisplayOnly: cbxDisplayOnly.Checked );
objDL.RefreshAgencies( objProviders, bDisplayOnly: cbxDisplayOnly.Checked );
objDL.RefreshInstitutions( objProviders, bDisplayOnly: cbxDisplayOnly.Checked );
}
dtEnd = DateTime.Now;
TimeSpan tsDuration = dtEnd.Subtract( dtBegin );
tbStatus.Text = string.Concat( tbStatus.Text, "\r\n\r\n** Agencies/Institutions load completed in ", tsDuration.Hours, " hours "
, tsDuration.Minutes, " minutes. **\r\n" );
}
protected void btnRefreshSubTypes_Click(object sender, EventArgs e)
{
objDL.RefreshSubtypes( bDisplayOnly: cbxDisplayOnly.Checked );
}
protected void btnRefreshInterviews_Click(object sender, EventArgs e)
{
//RefreshInterviews();
}
protected void btnRefreshUsers_Click(object sender, EventArgs e)
{
objDL.RefreshUsers( bDisplayOnly: cbxDisplayOnly.Checked );
}
protected void btnUpdateUsers_Click( object sender, EventArgs e )
{
objDL.UpdateUsersEmail();
}
protected void btnReportDuplicateAgencies_Click( object sender, EventArgs e )
{
objDL.ReportDuplicateAgencies();
}
protected void btnReportDuplicateInstitutions_Click( object sender, EventArgs e )
{
objDL.ReportDuplicateInstitutions();
}
protected void btnRefreshResidency_Click( object sender, EventArgs e )
{
dtBegin = DateTime.Now;
objDL.RefreshResidencyPrograms( bDisplayOnly: cbxDisplayOnly.Checked );
dtEnd = DateTime.Now;
TimeSpan tsDuration = dtEnd.Subtract( dtBegin );
tbStatus.Text = string.Concat( tbStatus.Text, "\r\n\r\n** Residency Programs load completed in ", tsDuration.Hours, " hours "
, tsDuration.Minutes, " minutes. **\r\n" );
}
protected void btnRefreshResidents_Click( object sender, EventArgs e )
{
dtBegin = DateTime.Now;
objDL.RefreshResidents( bDisplayOnly: cbxDisplayOnly.Checked );
dtEnd = DateTime.Now;
TimeSpan tsDuration = dtEnd.Subtract( dtBegin );
tbStatus.Text = string.Concat( tbStatus.Text, "\r\n\r\n** Residents load completed in ", tsDuration.Hours, " hours "
, tsDuration.Minutes, " minutes. **\r\n" );
}
protected void btnRefreshReferences_Click( object sender, EventArgs e )
{
dtBegin = DateTime.Now;
objDL.RefreshReferences( bDisplayOnly: cbxDisplayOnly.Checked );
dtEnd = DateTime.Now;
TimeSpan tsDuration = dtEnd.Subtract( dtBegin );
tbStatus.Text = string.Concat( tbStatus.Text, "\r\n\r\n** References load completed in ", tsDuration.Hours, " hours "
, tsDuration.Minutes, " minutes. **\r\n" );
}
protected void btnDelete_Click( object sender, EventArgs e )
{
if( ddlTable.SelectedValue == null || ddlTable.SelectedValue.Equals( "" ) )
return;
dtBegin = DateTime.Now;
string strTable = ddlTable.SelectedValue;
int iCount = EmTrac2SFUtils.DeleteTable( objDL.API, strTable, tbStatus );
dtEnd = DateTime.Now;
TimeSpan tsDuration = dtEnd.Subtract( dtBegin );
tbStatus.Text = string.Concat( tbStatus.Text, "\r\n\r\n** ", iCount, " ", strTable, " records deleted in ", tsDuration.Hours, " hours "
, tsDuration.Minutes, " minutes. **\r\n" );
}
protected void btnMassDataLoad_Click( object sender, EventArgs e )
{
dtBegin = DateTime.Now;
objDL.MassDataLoad();
dtEnd = DateTime.Now;
TimeSpan tsDuration = dtEnd.Subtract( dtBegin );
tbStatus.Text = string.Concat( tbStatus.Text, "\r\n\r\n** ", " All records updated in ", tsDuration.Hours, " hours "
, tsDuration.Minutes, " minutes. **\r\n" );
}
protected void btnRefreshNotes_Click( object sender, EventArgs e )
{
objDL.RefreshProviderNotes( bDisplayOnly: cbxDisplayOnly.Checked );
}
protected void btnRefreshProvidersOnly_Click( object sender, EventArgs e )
{
objDL.RefreshProviders( bImportNotes: false, bDisplayOnly: cbxDisplayOnly.Checked );
}
protected void btnRefreshAMAProviders_Click( object sender, EventArgs e )
{
dtBegin = DateTime.Now;
objDL.RefreshAMAProviders( bDisplayOnly: cbxDisplayOnly.Checked );
dtEnd = DateTime.Now;
TimeSpan tsDuration = dtEnd.Subtract( dtBegin );
tbStatus.Text = string.Concat( tbStatus.Text, "\r\n\r\n** AMA Providers load completed in "
, tsDuration.Hours, " hours "
, tsDuration.Minutes, " minutes. **\r\n" );
}
protected void btnRefreshAMACredentials_Click( object sender, EventArgs e )
{
dtBegin = DateTime.Now;
objDL.RefreshAMAProviderCredentials( bDisplayOnly: cbxDisplayOnly.Checked );
dtEnd = DateTime.Now;
TimeSpan tsDuration = dtEnd.Subtract( dtBegin );
tbStatus.Text = string.Concat( tbStatus.Text, "\r\n\r\n** AMA Credentials load completed in "
, tsDuration.Hours, " hours "
, tsDuration.Minutes, " minutes. **\r\n" );
}
protected void btnBulkLoad_Click( object sender, EventArgs e )
{
objDL.RemoveAMADuplicates();
//objDL.LoadCredentialsReportedWithErrors();
//objDL.LoadMissingCredentials();
//objDL.CleanJobAppsByRecrID();
//objDL.RefreshAgencies( null, false );
//objDL.RemoveDuplicateNotes();
//objDL.CleanCandidates();
//objDL.RefreshCandidates( null, null, false );
//objDL.BulkLoadMissingEmTracNotes();
//objDL.BulkLoadJobAppFromEmTrac();
//objDL.BulkLoadJobAppFromAMA();
//objDL.BulkLoadProviderFromEmTrac();
//objDL.BulkLoadProviderNotesFromEmTrac();
//objDL.CleanJobAppsByMENbr();
}
}
}