ASP.NET Page /PracticeTestStatus.aspx.cs (C#)
1: using System;  
2: using System.Collections.Generic;  
3: using System.Configuration;  
4: using System.Net;  
5: using System.Web.UI.WebControls;  
6: using QuizNetOnline.Logic;  
7: using Microsoft.ApplicationBlocks.Data;  
8:   
9: namespace QuiznetOnline.Web.UI  
10: {  
11:     public partial class Status : basePageSessionExpire  
12:     {  
13:         private Result _result;  
14:   
15:         protected void Page_Load(object sender, EventArgs e)  
16:         {  
17:             Result result;  
18:             if (!Page.IsPostBack)  
19:             {  
20:                 if (Page.PreviousPage == null)  
21:                     Response.Redirect("Default.aspx");  
22:   
23:                 hiddenUserName.Value = ((UserWeb)Session["userWeb"]).UserName;  
24:   
25:                 if (ConfigurationManager.AppSettings["IsFaceBookLoginVisible"] == null ||  
26:                     Convert.ToBoolean(ConfigurationManager.AppSettings["IsFaceBookLoginVisible"]) == true)  
27:                 {  
28:                     //ucFaceBookEntry.Visible = true;  
29:                 }  
30:   
31:                 if (Convert.ToInt32(ConfigurationManager.AppSettings["NumberOfFreeQuestions"]) != 0)  
32:                 {  
33:                     PopulateFreeAccessFields();  
34:                 }  
35:   
36:                 if (((UserWeb)Session["userWeb"]).UserName != "guest@quiznetonline.com")  
37:                 {  
38:                     panelIsGuest.Visible = false;  
39:                 }  
40:   
41:                 result=SaveResult();  
42:                 SaveUserSetting();  
43:                 SaveLog();  
44:   
45:                 ViewState["ArrayListCorrect"] = PreviousPage.ArrayListCorrect;  
46:                 ViewState["ArrayListIncorrect"] = PreviousPage.ArrayListIncorrect;  
47:   
48:                 lblTestType.Text = PreviousPage.TestType;  
49:   
50:                 lblCorrect.Text = PreviousPage.Correct.ToString();  
51:                 lblIncorrect.Text = PreviousPage.Incorrect.ToString();  
52:                   
53:                 int rank = result.GetRank(_result.Weight, _result.Topic.TopicCode,new SqlWrapper());  
54:   
55:                 if (rank >= 1 && PreviousPage.TopicCode != "fav")  
56:                 {  
57:                     PopulateWeightLabel(rank);  
58:                 }  
59:   
60:                 PopulateFaceBookLabel(result);  
61:                   
62:             }  
63:   
64:             BuildTableResults();  
65:   
66:         }  
67:   
68:         public void PopulateFaceBookLabel(Result result)  
69:         {  
70:             var TotalQuestions = string.Empty;  
71:             var QuestionsCorrect = string.Empty;  
72:   
73:             TotalQuestions = result.TotalQuestions == 1 ? "question" : "questions";  
74:             QuestionsCorrect = result.QuestionsCorrect == 1 ? "question" : "questions";  
75:   
76:             //ucFaceBookEntry.LabelMessage = "I completed " + result.TotalQuestions + " " + TotalQuestions + " and I got " + result.QuestionsCorrect + " " + QuestionsCorrect + " correct on www.QuiznetOnline.com";  
77:         }  
78:   
79:         public void PopulateWeightLabel(int rank)  
80:         {  
81:             string strrank = rank.ToString();  
82:             if (rank == 1)  
83:                 strrank = string.Format("{0}st", strrank);  
84:             else if (rank == 2)  
85:                 strrank = string.Format("{0}nd", strrank);  
86:             else if (rank == 3)  
87:                 strrank = string.Format("{0}rd", strrank);  
88:             else  
89:                 strrank = string.Format("{0}th", strrank);  
90:   
91:             tblWeight.Visible = true;  
92:             if (rank < 10)  
93:                 lblWeight.Text =  
94:                     string.Format("Congratulations!!! You have been ranked {0} for this month with {1} points",  
95:                                   strrank, _result.Weight);  
96:         }  
97:   
98:         public void PopulateFreeAccessFields()  
99:         {  
100:             var tableInformation = new TableInformation();  
101:             var question=new Question();  
102:             if (((UserWeb)Session["userWeb"]).UserName != "guest@quiznetonline.com")  
103:             {  
104:                 if (Convert.ToBoolean(ConfigurationManager.AppSettings["FreeForAll"]))  
105:                 {  
106:                     lblRestrictedUser.Text =  
107:                         string.Format(  
108:                             "Get access to {0} questions by just registering",  
109:                             question.GetTotalQuestionsCount(tableInformation));  
110:                     lblRestrictedUser.NavigateUrl = "~/CreateUser.aspx";  
111:                 }  
112:                 else  
113:                 {  
114:                     lblRestrictedUser.Text =  
115:                         string.Format(  
116:                             "Get access to {0} questions by submitting at least one .Net related question to Quiznet Online",  
117:                             question.GetTotalQuestionsCount(tableInformation));  
118:                     lblRestrictedUser.NavigateUrl = "~/AddPracticeQuestion.aspx";  
119:                 }  
120:             }  
121:             else  
122:             {  
123:                 if (Convert.ToBoolean(ConfigurationManager.AppSettings["FreeForAll"]))  
124:                 {  
125:                     lblRestrictedUser.Text =  
126:                         string.Format(  
127:                             "Get access to {0} questions by just registering",  
128:                             question.GetTotalQuestionsCount(tableInformation));  
129:                     lblRestrictedUser.NavigateUrl = "~/UserLogin/CreateUser.aspx";  
130:                 }  
131:                 else  
132:                 {  
133:                     lblRestrictedUser.Text =  
134:                         string.Format(  
135:                             "Get access to {0} questions by registering and submitting at least one .Net related question",  
136:                             question.GetTotalQuestionsCount(tableInformation));  
137:                     lblRestrictedUser.NavigateUrl = "~/UserLogin/CreateUser.aspx";  
138:                 }  
139:             }  
140:   
141:             lblFeatures.Text = lblFeatures.Text + "As a registered user you can:<ul>";  
142:             lblFeatures.Text = lblFeatures.Text + "<li>Setup your own quizzes";  
143:             lblFeatures.Text = lblFeatures.Text + "<li>View history of all the quizzes you have taken";  
144:             lblFeatures.Text = lblFeatures.Text + "<li>Take the quiz in a random order";  
145:             lblFeatures.Text = lblFeatures.Text + "<li>Take the quiz in order of difficulty (easy to hard OR hard to easy)";  
146:             lblFeatures.Text = lblFeatures.Text + "<li>Progress of your test can be saved and continued at another time";  
147:             lblFeatures.Text = lblFeatures.Text + "<li>More features to come...</ul>";  
148:         }  
149:   
150:         private void SaveLog()  
151: There is a limit of 150 source code lines in the evaluation version
152: There is a limit of 150 source code lines in the evaluation version
153: There is a limit of 150 source code lines in the evaluation version
154: There is a limit of 150 source code lines in the evaluation version
155: There is a limit of 150 source code lines in the evaluation version
156: There is a limit of 150 source code lines in the evaluation version
157: There is a limit of 150 source code lines in the evaluation version
158: There is a limit of 150 source code lines in the evaluation version
159: There is a limit of 150 source code lines in the evaluation version
160: There is a limit of 150 source code lines in the evaluation version
161: There is a limit of 150 source code lines in the evaluation version
162: There is a limit of 150 source code lines in the evaluation version
163: There is a limit of 150 source code lines in the evaluation version
164: There is a limit of 150 source code lines in the evaluation version
165: There is a limit of 150 source code lines in the evaluation version
166: There is a limit of 150 source code lines in the evaluation version
167: There is a limit of 150 source code lines in the evaluation version
168: There is a limit of 150 source code lines in the evaluation version
169: There is a limit of 150 source code lines in the evaluation version
170: There is a limit of 150 source code lines in the evaluation version
171: There is a limit of 150 source code lines in the evaluation version
172: There is a limit of 150 source code lines in the evaluation version
173: There is a limit of 150 source code lines in the evaluation version
174: There is a limit of 150 source code lines in the evaluation version
175: There is a limit of 150 source code lines in the evaluation version
176: There is a limit of 150 source code lines in the evaluation version
177: There is a limit of 150 source code lines in the evaluation version
178: There is a limit of 150 source code lines in the evaluation version
179: There is a limit of 150 source code lines in the evaluation version
180: There is a limit of 150 source code lines in the evaluation version
181: There is a limit of 150 source code lines in the evaluation version
182: There is a limit of 150 source code lines in the evaluation version
183: There is a limit of 150 source code lines in the evaluation version
184: There is a limit of 150 source code lines in the evaluation version
185: There is a limit of 150 source code lines in the evaluation version
186: There is a limit of 150 source code lines in the evaluation version
187: There is a limit of 150 source code lines in the evaluation version
188: There is a limit of 150 source code lines in the evaluation version
189: There is a limit of 150 source code lines in the evaluation version
190: There is a limit of 150 source code lines in the evaluation version
191: There is a limit of 150 source code lines in the evaluation version
192: There is a limit of 150 source code lines in the evaluation version
193: There is a limit of 150 source code lines in the evaluation version
194: There is a limit of 150 source code lines in the evaluation version
195: There is a limit of 150 source code lines in the evaluation version
196: There is a limit of 150 source code lines in the evaluation version
197: There is a limit of 150 source code lines in the evaluation version
198: There is a limit of 150 source code lines in the evaluation version
199: There is a limit of 150 source code lines in the evaluation version
200: There is a limit of 150 source code lines in the evaluation version
201: There is a limit of 150 source code lines in the evaluation version
202: There is a limit of 150 source code lines in the evaluation version
203: There is a limit of 150 source code lines in the evaluation version
204: There is a limit of 150 source code lines in the evaluation version
205: There is a limit of 150 source code lines in the evaluation version
206: There is a limit of 150 source code lines in the evaluation version
207: There is a limit of 150 source code lines in the evaluation version
208: There is a limit of 150 source code lines in the evaluation version
209: There is a limit of 150 source code lines in the evaluation version
210: There is a limit of 150 source code lines in the evaluation version
211: There is a limit of 150 source code lines in the evaluation version
212: There is a limit of 150 source code lines in the evaluation version
213: There is a limit of 150 source code lines in the evaluation version
214: There is a limit of 150 source code lines in the evaluation version
215: There is a limit of 150 source code lines in the evaluation version
216: There is a limit of 150 source code lines in the evaluation version
217: There is a limit of 150 source code lines in the evaluation version
218: There is a limit of 150 source code lines in the evaluation version
219: There is a limit of 150 source code lines in the evaluation version
220: There is a limit of 150 source code lines in the evaluation version
221: There is a limit of 150 source code lines in the evaluation version
222: There is a limit of 150 source code lines in the evaluation version
223: There is a limit of 150 source code lines in the evaluation version
224: There is a limit of 150 source code lines in the evaluation version
225: There is a limit of 150 source code lines in the evaluation version
226: There is a limit of 150 source code lines in the evaluation version
227: There is a limit of 150 source code lines in the evaluation version
228: There is a limit of 150 source code lines in the evaluation version
229: There is a limit of 150 source code lines in the evaluation version
230: There is a limit of 150 source code lines in the evaluation version
231: There is a limit of 150 source code lines in the evaluation version
232: There is a limit of 150 source code lines in the evaluation version
233: There is a limit of 150 source code lines in the evaluation version
234: There is a limit of 150 source code lines in the evaluation version
235: There is a limit of 150 source code lines in the evaluation version
236: There is a limit of 150 source code lines in the evaluation version
237: There is a limit of 150 source code lines in the evaluation version
238: There is a limit of 150 source code lines in the evaluation version
239: There is a limit of 150 source code lines in the evaluation version
240: There is a limit of 150 source code lines in the evaluation version
241: There is a limit of 150 source code lines in the evaluation version
242: There is a limit of 150 source code lines in the evaluation version
243: There is a limit of 150 source code lines in the evaluation version
244: There is a limit of 150 source code lines in the evaluation version
245: There is a limit of 150 source code lines in the evaluation version
246: There is a limit of 150 source code lines in the evaluation version
247: There is a limit of 150 source code lines in the evaluation version
248: There is a limit of 150 source code lines in the evaluation version
249: There is a limit of 150 source code lines in the evaluation version
250: There is a limit of 150 source code lines in the evaluation version
251: There is a limit of 150 source code lines in the evaluation version
252: There is a limit of 150 source code lines in the evaluation version
253: There is a limit of 150 source code lines in the evaluation version
254: There is a limit of 150 source code lines in the evaluation version
255: There is a limit of 150 source code lines in the evaluation version
256: There is a limit of 150 source code lines in the evaluation version
257: There is a limit of 150 source code lines in the evaluation version
258: There is a limit of 150 source code lines in the evaluation version
259: There is a limit of 150 source code lines in the evaluation version
260: There is a limit of 150 source code lines in the evaluation version
261: There is a limit of 150 source code lines in the evaluation version
262: There is a limit of 150 source code lines in the evaluation version
263: There is a limit of 150 source code lines in the evaluation version
264: There is a limit of 150 source code lines in the evaluation version
265: There is a limit of 150 source code lines in the evaluation version
266: There is a limit of 150 source code lines in the evaluation version
267: There is a limit of 150 source code lines in the evaluation version
268: There is a limit of 150 source code lines in the evaluation version
269: There is a limit of 150 source code lines in the evaluation version
270: There is a limit of 150 source code lines in the evaluation version
271: There is a limit of 150 source code lines in the evaluation version
272: There is a limit of 150 source code lines in the evaluation version
273: There is a limit of 150 source code lines in the evaluation version
274: There is a limit of 150 source code lines in the evaluation version
275: There is a limit of 150 source code lines in the evaluation version
276: There is a limit of 150 source code lines in the evaluation version
277: There is a limit of 150 source code lines in the evaluation version
278: There is a limit of 150 source code lines in the evaluation version
279: There is a limit of 150 source code lines in the evaluation version
280: There is a limit of 150 source code lines in the evaluation version
281: There is a limit of 150 source code lines in the evaluation version
282: There is a limit of 150 source code lines in the evaluation version
283: There is a limit of 150 source code lines in the evaluation version
284: There is a limit of 150 source code lines in the evaluation version
285: There is a limit of 150 source code lines in the evaluation version
286: There is a limit of 150 source code lines in the evaluation version
287: There is a limit of 150 source code lines in the evaluation version
288: There is a limit of 150 source code lines in the evaluation version
289: There is a limit of 150 source code lines in the evaluation version
290: There is a limit of 150 source code lines in the evaluation version
291: There is a limit of 150 source code lines in the evaluation version
292: There is a limit of 150 source code lines in the evaluation version
293: There is a limit of 150 source code lines in the evaluation version
294: There is a limit of 150 source code lines in the evaluation version

.NET Documentation Tool is © 2002 - 2009 Winnersh Triangle Web Solutions Limited.