ASP.NET Page /Admin/ApproveQuestion.aspx.cs (C#)
1: using System;  
2: using System.Data;  
3: using System.Data.SqlClient;  
4: using System.Web;  
5: using System.Collections.Generic;  
6: using System.Web.UI;  
7: using System.Web.UI.WebControls;  
8: using QuiznetOnline.Web.UI.BusinessClasses;  
9: using QuiznetOnline.Data;  
10: using QuizNetOnline.Logic;  
11: using Microsoft.ApplicationBlocks.Data;  
12:   
13: namespace QuiznetOnline.Web.UI.Admin  
14: {  
15:     public partial class ApproveQuestion : System.Web.UI.Page  
16:     {  
17:         List<UserQuestion> userQuestions;  
18:   
19:         protected void Page_Load(object sender, EventArgs e)  
20:         {  
21:             DataFunctions dataFunctions = DataFunctions.GetInstance();  
22:             SqlDataSource1.ConnectionString = dataFunctions.GetConnectionString();  
23:             SqlDataSource2.ConnectionString = dataFunctions.GetConnectionString();  
24:   
25:             if (!Page.IsPostBack)  
26:             {  
27:                 if ((Session["Validated"] == null || (bool) Session["Validated"] == false) &&  
28:                     FormOperations.IsWebServerLocalHost(Request.Url.ToString()) == false)  
29:                 {  
30:                     Response.Redirect("Default.aspx");  
31:                 }  
32:   
33:                 PopulateGridDeleteQuestions();  
34:             }  
35:         }  
36:   
37:         protected void SendEmailOnly_Click(object sender, EventArgs e)  
38:         {  
39:           
40:             UserSetting user = new UserSetting();  
41:             string userName = ((Label)this.FormView1.FindControl("UserNameLabel")).Text;  
42:   
43:   
44:             ((CheckBox)this.FormView1.FindControl("FullAccessGrantedCheckBox")).Checked = true;  
45:             UserQuestion userQuestion = new UserQuestion  
46:                 {  
47:                     FullAccessGranted = true,  
48:                     UserQuestionId =  
49:                         Convert.ToInt32(  
50:                             ((Label) FormView1.FindControl("UserQuestionIDLabel")).Text)  
51:                 };  
52:   
53:             userQuestion.UpdateFullAccessGranted();  
54:             QuizNetSystem quizNetSystem = new QuizNetSystem();  
55:   
56:             if (userName.ToLower() != "guest@quiznetonline.com")  
57:             {  
58:                 user.Load(userName, new SqlWrapper());  
59:   
60:                 string approvalEmailMessage = HttpContext.GetGlobalResourceObject("Messages", "ApprovalEmailMessage").ToString();  
61:                 user.UnlimitedQuestions = true;  
62:                 user.Save(new SqlWrapper());  
63:   
64:                 quizNetSystem.SendEmail(userName, "Full access granted to Quiznet Online", approvalEmailMessage, true, false);  
65:             }  
66:         }  
67:   
68:         protected void DeleteButton_Click(object sender, EventArgs e)  
69:         {  
70:             grdFind.Visible = false;  
71:         }  
72:   
73:         protected void ApproveButton_Click(object sender, EventArgs e)  
74:         {  
75:             string topic=((DropDownList) FormView1.FindControl("cmbTopicCode")).SelectedValue;  
76:   
77:   
78:             Question question = new Question();  
79:             question.Topic = new Topic(topic);  
80:             question.QuestionDesc = ((TextBox)FormView1.FindControl("QuestionTextBox")).Text;  
81:             question.Explaination = ((TextBox)FormView1.FindControl("ExplainationTextBox")).Text;  
82:             question.Link = ((TextBox)FormView1.FindControl("LinkTextBox")).Text;  
83:             question.QuestionCreatedBy=((TextBox)FormView1.FindControl("UserNameTextBox")).Text;  
84:             question.Position = 999999;  
85:             question.Answer = Convert.ToInt32(((TextBox)FormView1.FindControl("AnswerTextBox")).Text);  
86:             question.IsFree = false;  
87:   
88:             List<Answer> answers = new List<Answer>();  
89:             for(int i=1;i<8;i++)  
90:             {  
91:                 if (!string.IsNullOrEmpty(((TextBox)FormView1.FindControl(string.Format("Answer{0}TextBox",i))).Text))  
92:                 {  
93:                     Answer answer = new Answer();  
94:                     answer.AnswerDesc = ((TextBox)FormView1.FindControl(string.Format("Answer{0}TextBox", i))).Text;  
95:                     answer.Value = i;  
96:                     answers.Add(answer);  
97:   
98:                     if (i == Convert.ToInt32(((TextBox)FormView1.FindControl("AnswerTextBox")).Text))  
99:                     {  
100:                         question.AnswerDesc = answer.AnswerDesc;  
101:                     }  
102:                 }  
103:             }  
104:   
105:             question.Answers = answers;  
106:             question.Create();  
107:   
108:             QuestionRating questionRating = new QuestionRating();  
109:             questionRating.QuestionID = question.QuestionId;  
110:             questionRating.UserName = "????????????";  
111:             questionRating.SaveAuthorRating();  
112:   
113:   
114:             UserQuestion userQuestion = new UserQuestion();  
115:             userQuestion.UserQuestionId = Convert.ToInt32(((Label)FormView1.FindControl("UserQuestionIDLabel1")).Text);  
116:             userQuestion.DeleteUserQuestionRating();  
117:   
118:             string userName = ((TextBox)FormView1.FindControl("UserNameTextBox")).Text;  
119:   
120:             UserSetting user = new UserSetting();  
121:             QuizNetSystem quizNetSystem = new QuizNetSystem();  
122:             user.Load(userName, new SqlWrapper());  
123:   
124:             string approvalEmailMessage=HttpContext.GetGlobalResourceObject("Messages", "ApprovalEmailMessage").ToString();  
125:   
126:             if (!user.UnlimitedQuestions)  
127:             {  
128:                 user.UnlimitedQuestions = true;  
129:                 user.Save(new SqlWrapper());  
130:   
131:                 quizNetSystem.SendEmail(userName, "Full access granted to Quiznet Online", approvalEmailMessage, true,false);  
132:             }  
133:   
134:             grdFind.Visible = false;  
135:             FormView1.DataBind();  
136:   
137:         }  
138:         protected void cmdFind_Click(object sender, EventArgs e)  
139:         {  
140:             if (!string.IsNullOrEmpty(txtFind.Text.ToLower().Trim()))  
141:             {  
142:                 DataFunctions dataFunctions = DataFunctions.GetInstance();  
143:   
144:                 var parameters = new SqlParameter[2];  
145:                 parameters[0] = new SqlParameter("@SearchString", txtFind.Text);  
146:                 parameters[1] = new SqlParameter("@MatchType", Convert.ToInt32(lstSearchOption.SelectedValue));  
147:                 DataTable tbl = new DataTable();  
148:   
149:                 if (radSearchType.SelectedValue == "Question")  
150:                 {  
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
295: There is a limit of 150 source code lines in the evaluation version
296: There is a limit of 150 source code lines in the evaluation version
297: There is a limit of 150 source code lines in the evaluation version
298: There is a limit of 150 source code lines in the evaluation version
299: There is a limit of 150 source code lines in the evaluation version
300: There is a limit of 150 source code lines in the evaluation version
301: There is a limit of 150 source code lines in the evaluation version
302: There is a limit of 150 source code lines in the evaluation version
303: There is a limit of 150 source code lines in the evaluation version
304: There is a limit of 150 source code lines in the evaluation version
305: There is a limit of 150 source code lines in the evaluation version
306: There is a limit of 150 source code lines in the evaluation version
307: There is a limit of 150 source code lines in the evaluation version
308: There is a limit of 150 source code lines in the evaluation version
309: There is a limit of 150 source code lines in the evaluation version
310: There is a limit of 150 source code lines in the evaluation version
311: There is a limit of 150 source code lines in the evaluation version
312: There is a limit of 150 source code lines in the evaluation version
313: There is a limit of 150 source code lines in the evaluation version
314: There is a limit of 150 source code lines in the evaluation version
315: There is a limit of 150 source code lines in the evaluation version
316: There is a limit of 150 source code lines in the evaluation version
317: There is a limit of 150 source code lines in the evaluation version
318: There is a limit of 150 source code lines in the evaluation version
319: There is a limit of 150 source code lines in the evaluation version
320: There is a limit of 150 source code lines in the evaluation version
321: There is a limit of 150 source code lines in the evaluation version
322: There is a limit of 150 source code lines in the evaluation version
323: There is a limit of 150 source code lines in the evaluation version
324: There is a limit of 150 source code lines in the evaluation version
325: There is a limit of 150 source code lines in the evaluation version
326: There is a limit of 150 source code lines in the evaluation version
327: There is a limit of 150 source code lines in the evaluation version
328: There is a limit of 150 source code lines in the evaluation version
329: There is a limit of 150 source code lines in the evaluation version
330: There is a limit of 150 source code lines in the evaluation version
331: There is a limit of 150 source code lines in the evaluation version
332: There is a limit of 150 source code lines in the evaluation version
333: There is a limit of 150 source code lines in the evaluation version
334: There is a limit of 150 source code lines in the evaluation version
335: There is a limit of 150 source code lines in the evaluation version
336: There is a limit of 150 source code lines in the evaluation version
337: There is a limit of 150 source code lines in the evaluation version
338: There is a limit of 150 source code lines in the evaluation version
339: There is a limit of 150 source code lines in the evaluation version
340: There is a limit of 150 source code lines in the evaluation version
341: There is a limit of 150 source code lines in the evaluation version
342: There is a limit of 150 source code lines in the evaluation version
343: There is a limit of 150 source code lines in the evaluation version
344: There is a limit of 150 source code lines in the evaluation version
345: There is a limit of 150 source code lines in the evaluation version
346: There is a limit of 150 source code lines in the evaluation version
347: There is a limit of 150 source code lines in the evaluation version
348: There is a limit of 150 source code lines in the evaluation version
349: There is a limit of 150 source code lines in the evaluation version
350: There is a limit of 150 source code lines in the evaluation version
351: There is a limit of 150 source code lines in the evaluation version
352: There is a limit of 150 source code lines in the evaluation version
353: There is a limit of 150 source code lines in the evaluation version
354: There is a limit of 150 source code lines in the evaluation version
355: There is a limit of 150 source code lines in the evaluation version
356: There is a limit of 150 source code lines in the evaluation version
357: There is a limit of 150 source code lines in the evaluation version
358: There is a limit of 150 source code lines in the evaluation version
359: There is a limit of 150 source code lines in the evaluation version
360: There is a limit of 150 source code lines in the evaluation version
361: There is a limit of 150 source code lines in the evaluation version
362: There is a limit of 150 source code lines in the evaluation version
363: There is a limit of 150 source code lines in the evaluation version
364: There is a limit of 150 source code lines in the evaluation version
365: There is a limit of 150 source code lines in the evaluation version
366: There is a limit of 150 source code lines in the evaluation version
367: There is a limit of 150 source code lines in the evaluation version
368: There is a limit of 150 source code lines in the evaluation version
369: There is a limit of 150 source code lines in the evaluation version
370: There is a limit of 150 source code lines in the evaluation version
371: There is a limit of 150 source code lines in the evaluation version
372: There is a limit of 150 source code lines in the evaluation version
373: There is a limit of 150 source code lines in the evaluation version
374: There is a limit of 150 source code lines in the evaluation version
375: There is a limit of 150 source code lines in the evaluation version
376: There is a limit of 150 source code lines in the evaluation version
377: There is a limit of 150 source code lines in the evaluation version
378: There is a limit of 150 source code lines in the evaluation version
379: There is a limit of 150 source code lines in the evaluation version
380: There is a limit of 150 source code lines in the evaluation version
381: There is a limit of 150 source code lines in the evaluation version
382: There is a limit of 150 source code lines in the evaluation version
383: There is a limit of 150 source code lines in the evaluation version
384: There is a limit of 150 source code lines in the evaluation version
385: There is a limit of 150 source code lines in the evaluation version
386: There is a limit of 150 source code lines in the evaluation version
387: There is a limit of 150 source code lines in the evaluation version
388: There is a limit of 150 source code lines in the evaluation version
389: There is a limit of 150 source code lines in the evaluation version
390: There is a limit of 150 source code lines in the evaluation version
391: There is a limit of 150 source code lines in the evaluation version

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