-
Notifications
You must be signed in to change notification settings - Fork 0
/
FocusExperience8.aspx.cs
328 lines (231 loc) · 11.2 KB
/
FocusExperience8.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
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
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;
namespace BESTPATH
{
public partial class _FocusExperience8 : 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 (Request.Cookies[FormsAuthentication.FormsCookieName] != null)
{
HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
if (ticket.Expiration <= DateTime.Now)
{
Response.Redirect("~/PL/Membership/Login.aspx");
}//end if
else
{
Session sessionObject = new Session();
FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, DateTime.Now, DateTime.Now.AddMinutes(sessionObject.getSessionTimeLimit()), ticket.IsPersistent, ticket.UserData);
string encryptedTicket = FormsAuthentication.Encrypt(newTicket);
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
cookie.Expires = newTicket.Expiration;
Response.Cookies.Add(cookie);
}//end else
}//end if
else
{
Response.Redirect("~/PL/Membership/Login.aspx");
}//end else
HttpCookie _authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
FormsAuthenticationTicket _ticket = FormsAuthentication.Decrypt(_authCookie.Value);
string username = _ticket.Name;
bool recordExists2;
string errorMessage3;
Select selectObject3 = new Select();
recordExists2 = Select.Select_Focus_Demonstration_Worksheet(username);
errorMessage3 = selectObject3.getErrorMessage();
if (errorMessage3 != null)
{
lblError.Text = errorMessage3;
lblError.Visible = true;
ErrorMessage message = new ErrorMessage();
MsgBox(message.SQLServerErrorMessage);
}//end if
else
{
if (recordExists2 == true)
{
if (!Page.IsPostBack)
{
string errorMessage4;
ArrayList record2 = new ArrayList();
Select selectObject4 = new Select();
record2 = Select.Select_Focus_Demonstration_Worksheet_Record(username);
errorMessage4 = selectObject4.getErrorMessage();
if (errorMessage4 != null)
{
lblError.Text = errorMessage4;
lblError.Visible = true;
ErrorMessage message = new ErrorMessage();
MsgBox(message.SQLServerErrorMessage);
}//end if
else
{
lblExperienceTitle.Text = record2[7].ToString();
}//end else
}//end if
}//end if
}//end else
bool recordExists3;
string errorMessage5;
Select selectObject5 = new Select();
recordExists3 = Select.Select_Focus_Experience8(username);
errorMessage5 = selectObject5.getErrorMessage();
if (errorMessage5 != null)
{
lblError.Text = errorMessage5;
lblError.Visible = true;
ErrorMessage message = new ErrorMessage();
MsgBox(message.SQLServerErrorMessage);
}//end if
else
{
if (recordExists3 == true)
{
if (!Page.IsPostBack)
{
btnSubmit.Visible = false;
btnContinue.Visible = true;
string errorMessage6;
ArrayList record3 = new ArrayList();
Select selectObject6 = new Select();
record3 = Select.Select_Focus_Experience8_Record(username);
errorMessage6 = selectObject6.getErrorMessage();
if (errorMessage6 != null)
{
lblError.Text = errorMessage6;
lblError.Visible = true;
ErrorMessage message = new ErrorMessage();
MsgBox(message.SQLServerErrorMessage);
}//end if
else
{
txtQ1.InnerText = record3[0].ToString();
txtQ2.InnerText = record3[1].ToString();
txtQ3.InnerText = record3[2].ToString();
txtQ4.InnerText = record3[3].ToString();
txtQ5.InnerText = record3[4].ToString();
txtQ6.InnerText = record3[5].ToString();
txtQ7.InnerText = record3[6].ToString();
txtQ8.InnerText = record3[7].ToString();
txtQ9.InnerText = record3[8].ToString();
txtQ10.InnerText = record3[9].ToString();
txtQ11.InnerText = record3[10].ToString();
txtQ12.InnerText = record3[11].ToString();
txtQ13.InnerText = record3[12].ToString();
}//end else
}//end if
}//end if
}//end else
}//end event
protected void btnSubmit_Click(object sender, EventArgs e)
{
HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
Session sessionObject = new Session();
FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, DateTime.Now, DateTime.Now.AddMinutes(sessionObject.getSessionTimeLimit()), ticket.IsPersistent, ticket.UserData);
string encryptedTicket = FormsAuthentication.Encrypt(newTicket);
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
cookie.Expires = newTicket.Expiration;
Response.Cookies.Add(cookie);
string username = ticket.Name;
string Q1 = txtQ1.InnerText;
string Q2 = txtQ2.InnerText;
string Q3 = txtQ3.InnerText;
string Q4 = txtQ4.InnerText;
string Q5 = txtQ5.InnerText;
string Q6 = txtQ6.InnerText;
string Q7 = txtQ7.InnerText;
string Q8 = txtQ8.InnerText;
string Q9 = txtQ9.InnerText;
string Q10 = txtQ10.InnerText;
string Q11 = txtQ11.InnerText;
string Q12 = txtQ12.InnerText;
string Q13 = txtQ13.InnerText;
Validate validationObject = new Validate();
Q1 = validationObject.Truncate(Q1, 900);
Q2 = validationObject.Truncate(Q2, 900);
Q3 = validationObject.Truncate(Q3, 900);
Q4 = validationObject.Truncate(Q4, 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);
bool recordExists;
string errorMessage;
Select selectObject = new Select();
recordExists = Select.Select_Focus_Experience8(username);
errorMessage = selectObject.getErrorMessage();
if (errorMessage != null)
{
lblError.Text = errorMessage;
lblError.Visible = true;
ErrorMessage message = new ErrorMessage();
MsgBox(message.SQLServerErrorMessage);
}//end if
else
{
if (recordExists == true)
{
}//end if
else if (recordExists == false)
{
string errorMessage2;
errorMessage2 = Insert.Insert_Focus_Experience8(username, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, Q10, Q11, Q12, Q13);
if (errorMessage2 != null)
{
lblError.Text = errorMessage2;
lblError.Visible = true;
ErrorMessage message = new ErrorMessage();
MsgBox(message.SQLServerErrorMessage);
}//end if
else
{
string errorMessage3;
errorMessage3 = Update.Update_Focus_Experience8_Status(username);
if (errorMessage3 != null)
{
lblError.Text = errorMessage3;
lblError.Visible = true;
ErrorMessage message = new ErrorMessage();
MsgBox(message.SQLServerErrorMessage);
}//end if
else
{
Response.Redirect("~/PL/FOP/FOP_ProgressMenu.aspx");
}//end else
}//end else
}//end else if
}//end else
}//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