-
Notifications
You must be signed in to change notification settings - Fork 0
/
PreliminaryNeedsAssessment.aspx.cs
282 lines (223 loc) · 10.9 KB
/
PreliminaryNeedsAssessment.aspx.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Web.Security;
using System.Data;
using System.Collections;
using System.IO;
namespace BESTPATH
{
public partial class _PreliminaryNeedsAssessment : Page
{
protected void Page_Load(object sender, EventArgs e)
{
HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(false);
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoStore();
Response.Cache.SetExpires(DateTime.Now);
Response.Cache.SetValidUntilExpires(true);
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.Cache.SetNoStore();
if (ddlReferralSource.AutoPostBack)
{
string referralSource = ddlReferralSource.SelectedValue;
if (referralSource == "Referred by a past client who is a RUG Authorized Personal Counselor (APC)")
{
rfvReferralName.Enabled = true;
rfvRUGAPCEmailAddress.Enabled = true;
}//end if
else if (referralSource == "Referred by a past client who made no mention of being a RUG APC")
{
rfvReferralName.Enabled = true;
rfvRUGAPCEmailAddress.Enabled = false;
}//end else if
else if (referralSource == "Church outreach")
{
rfvReferralName.Enabled = true;
rfvRUGAPCEmailAddress.Enabled = false;
}//else if
else if (referralSource == "Other")
{
rfvReferralName.Enabled = true;
rfvRUGAPCEmailAddress.Enabled = false;
}//else if
else
{
rfvReferralName.Enabled = false;
rfvRUGAPCEmailAddress.Enabled = false;
}//end else
txtRUGAPCEmailAddress.Focus();
}//end if
if (IsPostBack == false)
{
txtFirstName.Focus();
}//end if
}//end event
protected void btnSubmit_Click(object sender, EventArgs e)
{
DateTime today = DateTime.Today;
string firstName = txtFirstName.Text;
string lastName = txtLastName.Text;
string emailAddress = txtEmailAddress.Text;
string phoneNumber = txtPhoneNumber.Text;
string Q5 = rblQ5.SelectedValue;
string Q6 = txtQ6.InnerText;
string Q7 = txtQ7.InnerText;
string Q8 = txtQ8.InnerText;
string Q9 = rblQ9.SelectedValue;
string Q10 = txtQ10.InnerText;
string Q11 = rblQ11.SelectedValue;
string Q12 = rblQ12.SelectedValue;
string Q13 = txtQ13.InnerText;
string Q14 = txtQ14.InnerText;
string Q15 = txtQ15.InnerText;
string Q16 = txtQ16.InnerText;
string Q17 = txtQ17.InnerText;
string Q18 = txtQ18.InnerText;
string Q19 = txtQ19.InnerText;
string Q20 = txtQ20.InnerText;
string Q21 = txtQ21.InnerText;
string Q22 = txtQ22.InnerText;
string Q23 = txtQ23.InnerText;
string Q24 = txtQ24.InnerText;
string Q25 = txtQ25.InnerText;
string Q26 = txtQ26.InnerText;
string Q27 = txtQ27.InnerText;
string Q28 = txtQ28.InnerText;
string Q29 = txtQ29.InnerText;
string Q30 = txtQ30.InnerText;
string Q31 = txtQ31.InnerText;
string Q32 = txtQ32.InnerText;
string Q33 = txtQ33.InnerText;
string Q34 = txtQ34.InnerText;
string Q35 = txtQ35.InnerText;
string Q36 = rblQ36.SelectedValue;
string Q37 = txtQ37.InnerText;
string Q38 = txtQ38.InnerText;
string Q39 = txtQ39.InnerText;
string Q40 = txtQ40.InnerText;
string Q41 = txtQ41.InnerText;
string Q42 = txtQ42.InnerText;
string Q43 = txtQ43.InnerText;
string Q44 = txtQ44.InnerText;
string Q45 = txtQ45.InnerText;
string Q46 = txtQ46.InnerText;
string referralSource = ddlReferralSource.SelectedValue;
string referralName = txtReferralName.Text;
string RUGAPCEmailAddress = txtRUGAPCEmailAddress.Text;
Validate validationObject = new Validate();
firstName = validationObject.Truncate(firstName, 900);
lastName = validationObject.Truncate(lastName, 900);
emailAddress = validationObject.Truncate(emailAddress, 900);
phoneNumber = validationObject.Truncate(phoneNumber, 900);
Q5 = validationObject.Truncate(Q5, 900);
Q6 = validationObject.Truncate(Q6, 900);
Q7 = validationObject.Truncate(Q7, 900);
Q8 = validationObject.Truncate(Q8, 900);
Q9 = validationObject.Truncate(Q9, 900);
Q10 = validationObject.Truncate(Q10, 900);
Q11 = validationObject.Truncate(Q11, 900);
Q12 = validationObject.Truncate(Q12, 900);
Q13 = validationObject.Truncate(Q13, 900);
Q14 = validationObject.Truncate(Q14, 900);
Q15 = validationObject.Truncate(Q15, 900);
Q16 = validationObject.Truncate(Q16, 900);
Q17 = validationObject.Truncate(Q17, 900);
Q18 = validationObject.Truncate(Q18, 900);
Q19 = validationObject.Truncate(Q19, 900);
Q20 = validationObject.Truncate(Q20, 900);
Q21 = validationObject.Truncate(Q21, 900);
Q22 = validationObject.Truncate(Q22, 900);
Q23 = validationObject.Truncate(Q23, 900);
Q24 = validationObject.Truncate(Q24, 900);
Q25 = validationObject.Truncate(Q25, 900);
Q26 = validationObject.Truncate(Q26, 900);
Q27 = validationObject.Truncate(Q27, 900);
Q28 = validationObject.Truncate(Q28, 900);
Q29 = validationObject.Truncate(Q29, 900);
Q30 = validationObject.Truncate(Q30, 900);
Q31 = validationObject.Truncate(Q31, 900);
Q32 = validationObject.Truncate(Q32, 900);
Q33 = validationObject.Truncate(Q33, 900);
Q34 = validationObject.Truncate(Q34, 900);
Q35 = validationObject.Truncate(Q35, 900);
Q36 = validationObject.Truncate(Q36, 900);
Q37 = validationObject.Truncate(Q37, 900);
Q38 = validationObject.Truncate(Q38, 900);
Q39 = validationObject.Truncate(Q39, 900);
Q40 = validationObject.Truncate(Q40, 900);
Q41 = validationObject.Truncate(Q41, 900);
Q42 = validationObject.Truncate(Q42, 900);
Q43 = validationObject.Truncate(Q43, 900);
Q44 = validationObject.Truncate(Q44, 900);
Q45 = validationObject.Truncate(Q45, 900);
Q46 = validationObject.Truncate(Q46, 900);
referralSource = validationObject.Truncate(referralSource, 900);
referralName = validationObject.Truncate(referralName, 900);
RUGAPCEmailAddress = validationObject.Truncate(RUGAPCEmailAddress, 900);
string errorMessage;
Select selectObject = new Select();
bool preliminaryNeedsAssessmentExists;
preliminaryNeedsAssessmentExists = Select.Preliminary_Needs_Assessment_Exists(emailAddress);
errorMessage = selectObject.getErrorMessage();
if (errorMessage != null)
{
lblError.Text = errorMessage;
lblError.Visible = true;
ErrorMessage message = new ErrorMessage();
MsgBox(message.GenericErrorMessage);
}//end if
else if (preliminaryNeedsAssessmentExists == true)
{
MsgBox("Invalid. This assessment has already been submitted.");
}//end else if
else if (preliminaryNeedsAssessmentExists == false)
{
if (RUGAPCEmailAddress != "")
{
bool isRUGAPC;
string errorMessage30;
Select selectObject30 = new Select();
isRUGAPC = Select.Is_User_RUG_APC(RUGAPCEmailAddress);
errorMessage30 = selectObject30.getErrorMessage();
if (errorMessage30 != null)
{
lblError.Text = errorMessage30;
lblError.Visible = true;
ErrorMessage message = new ErrorMessage();
MsgBox(message.SQLServerErrorMessage);
}//end if
else if (isRUGAPC == false)
{
MsgBox("Invalid. User specified for RUG APC is not a RUG APC in the system. Please confer with Jim Davis, founder.");
return;
}//end else if
}//end if
string errorMessage2;
errorMessage2 = Insert.Insert_Preliminary_Needs_Assessment(today, emailAddress, firstName, lastName, phoneNumber, Q5, Q6, Q7, Q8, Q9, Q10, Q11, Q12, Q13, Q14, Q15, Q16, Q17, Q18, Q19, Q20, Q21, Q22, Q23, Q24, Q25, Q26, Q27, Q28, Q29, Q30, Q31, Q32, Q33, Q34, Q35, Q36, Q37, Q38, Q39, Q40, Q41, Q42, Q43, Q44, Q45, Q46, referralSource, referralName, RUGAPCEmailAddress);
if (errorMessage2 != null)
{
lblError.Text = errorMessage2;
lblError.Visible = true;
ErrorMessage message = new ErrorMessage();
MsgBox(message.GenericErrorMessage);
}//end if
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Thank you very much for taking the time to share this information with us. Now, the next step for you is to complete the Career Marketability Assessment. May God richly bless you and your life path endeavors!');window.location ='../../Home.aspx';", true);
}//end else
}//end else if
}//end event
private void MsgBox(string sMessage)
{
string msg = "<script language=\"javascript\">";
msg += "alert('" + sMessage + "');";
msg += "</script>";
Response.Write(msg);
}//end method
}//end class
}//end namespace