ASP.NET Page /Admin/QuestionsAnswers.aspx.cs (C#)
1: using System;
2: using System.Web.UI;
3: using QuiznetOnline.Data;
4: using QuizNetOnline.Logic;
5: using System.Web.UI.WebControls;
6: using System.Data.SqlClient;
7: using System.Data;
8: using Microsoft.ApplicationBlocks.Data;
9:
10: namespace QuiznetOnline.Web.UI.Admin
11: {
12: public partial class AdminQuestionsAnswers : Page
13: {
14: protected void Page_Load(object sender, EventArgs e)
15: {
16: DataFunctions dataFunctions = DataFunctions.GetInstance();
17: //SqlDataSource1.ConnectionString = dataFunctions.GetConnectionString();
18:
19: SqlDataTag.ConnectionString = dataFunctions.GetConnectionString();
20: if (Session["Validated"] == null || (bool)Session["Validated"] == false)
21: Response.Redirect("Default.aspx");
22:
23: if (string.IsNullOrEmpty(txtFind.Text) && !string.IsNullOrEmpty(Request.QueryString["QuestionID"]))
24: {
25: GetQuestionByID(Convert.ToInt32(Request.QueryString["QuestionID"]));
26: }
27:
28: if (!Page.IsPostBack)
29: {
30: cmbTopics.DataSource = Topic.LoadTopics(null, false, new SqlWrapper());
31: cmbTopics.DataTextField = "TopicCode";
32: cmbTopics.DataValueField = "TopicCode";
33: cmbTopics.DataBind();
34: }
35: }
36:
37: protected void cmdGetID_Click(object sender, EventArgs e)
38: {
39: GetQuestionByID(Convert.ToInt32(this.txtFind.Text));
40: }
41:
42: protected void grdTag_RowDataBound(Object sender, GridViewRowEventArgs e)
43: {
44: DropDownList cmbTags;
45: cmbTags = (DropDownList)e.Row.FindControl("cmbTags");
46: if (e.Row.RowType == DataControlRowType.DataRow)
47: {
48: cmbTags.SelectedValue = ((HiddenField)e.Row.FindControl("hiddenTagID")).Value.ToString();
49: }
50: if (e.Row.RowType == DataControlRowType.Footer)
51: {
52: cmbTags.Items.Insert(0, new ListItem(""));
53: }
54: }
55:
56: private void GetQuestionByID(int QuestionID)
57: {
58: QuizNetSystem quizNetSystem = new QuizNetSystem();
59: txtFind.Text = QuestionID.ToString();
60: FormView1.DataSource = ViewState["DataSource"] = quizNetSystem.LoadQuestions(QuestionID, new SqlWrapper());
61: FormView1.DataBind();
62: }
63:
64: protected void cmdGetQuestion_Click(object sender, EventArgs e)
65: {
66: QuizNetSystem quizNetSystem = new QuizNetSystem();
67:
68: FormView1.DataSource = ViewState["DataSource"] = quizNetSystem.LoadQuestions(this.txtFind.Text,null, new SqlWrapper());
69: FormView1.DataBind();
70: }
71: protected void cmdClear_Click(object sender, EventArgs e)
72: {
73: FormView1.DataBind();
74: cmbTopics.ClearSelection();
75: }
76:
77: protected void cmdAddImage_Click(object sender, EventArgs e)
78: {
79: Response.Redirect(string.Format("QuestionImage.aspx?QuestionID={0}", txtFind.Text));
80: }
81:
82:
83: protected void cmdFree_Click(object sender, EventArgs e)
84: {
85: QuizNetSystem quizNetSystem = new QuizNetSystem();
86: FormView1.DataSource = ViewState["DataSource"] = quizNetSystem.LoadQuestions(cmbTopics.SelectedValue,true, new SqlWrapper());
87: FormView1.DataBind();
88: }
89:
90: protected void FormView1_PageIndexChanging(object sender, FormViewPageEventArgs e)
91: {
92: QuizNetSystem quizNetSystem = new QuizNetSystem();
93: if (ViewState["FilterExpression"]!=null)
94: {
95: //SqlDataSource1.FilterExpression = ViewState["FilterExpression"].ToString();
96: }
97: FormView1.PageIndex = e.NewPageIndex;
98: FormView1.DataSource = ViewState["DataSource"];
99: FormView1.DataBind();
100: }
101:
102: protected void FormView1_OnDataBound(object sender, EventArgs e)
103: {
104: DataBindgrdAnswer();
105: }
106:
107:
108: protected void SaveButton_Click(object sender, EventArgs e)
109: {
110: Control ctrl = FormView1.FindControl("QuestionIDLabel");
111: int QuestionID = Convert.ToInt32(((Label)ctrl).Text);
112: if (QuestionID != 0)
113: {
114: int position = string.IsNullOrEmpty((((TextBox)(FormView1.FindControl("txtPosition"))).Text)) ? 0 : Convert.ToInt32(((TextBox)(FormView1.FindControl("txtPosition"))).Text);
115:
116: Topic topic = new Topic(((TextBox)(FormView1.FindControl("TopicCodeLabel"))).Text);
117: Question question = new Question();
118: question.LoadQuestion(QuestionID, new SqlWrapper());
119:
120: question.Topic = topic;
121: question.QuestionDesc = ((TextBox)(FormView1.FindControl("QuestionLabel"))).Text;
122: question.Answer = Convert.ToInt32(((TextBox)(FormView1.FindControl("AnswerLabel"))).Text);
123: question.Explaination = ((TextBox)(FormView1.FindControl("ExplainationLabel"))).Text;
124: question.Link = ((TextBox)(FormView1.FindControl("LinkLabel"))).Text;
125: question.IsFree = ((CheckBox)(FormView1.FindControl("chkIsFree"))).Checked;
126: question.Position = Convert.ToInt32(position);
127: question.Save();
128:
129: TextBox txtAuthorRating = ((TextBox)(FormView1.FindControl("txtAuthorRating")));
130: if (!string.IsNullOrEmpty(txtAuthorRating.Text))
131: {
132: QuestionRating questionRating = new QuestionRating();
133: questionRating.UserName = "????????????";
134: questionRating.Rating = Convert.ToInt32(txtAuthorRating.Text);
135: questionRating.QuestionID = question.QuestionId;
136:
137: questionRating.SaveAuthorRating();
138: }
139: }
140: }
141:
142:
143: protected void cmdGetHard_Click(object sender, EventArgs e)
144: {
145: string topicCode;
146: if (!string.IsNullOrEmpty(cmbTopics.SelectedValue) && cmbTopics.SelectedValue.ToLower() != "all")
147: topicCode = cmbTopics.SelectedValue;
148: else
149: topicCode = null;
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
.NET Documentation Tool is © 2002 - 2009 Winnersh Triangle Web Solutions Limited.