ASP.NET Page /Reports/MyResults.aspx.cs (C#)
1: using System;  
2: using System.Collections;  
3: using System.ComponentModel;  
4: using System.Data;  
5: using System.Drawing;  
6: using System.Web;  
7: using System.Web.SessionState;  
8: using System.Web.UI;  
9: using System.Web.UI.WebControls;  
10: using System.Web.UI.HtmlControls;  
11: using System.Web.UI.DataVisualization.Charting;  
12: using QuizNetOnline.Logic;  
13: using System.Data.SqlClient;  
14: using Microsoft.ApplicationBlocks.Data;  
15:   
16: namespace QuiznetOnline.Web.UI.Reports  
17: {  
18:     public partial class MyResults : QuiznetOnline.Web.UI.BusinessClasses.BasePage  
19:     {  
20:         Tools tools = new Tools();  
21:   
22:   
23:         protected System.Web.UI.WebControls.Label Label2;  
24:         protected System.Web.UI.WebControls.Label Label1;  
25:   
26:   
27:         protected override void Page_Load(object sender, System.EventArgs e)  
28:         {  
29:             if (!Page.IsPostBack)  
30:             {  
31:                 base.Page_Load(sender, e);  
32:   
33:                 Topics topics = new Topics();  
34:                 topics.LoadTopics(new SqlWrapper());  
35:                 lstTopics.DataSource = topics.Topiclist;  
36:                 lstTopics.DataTextField = "TopicDesc";  
37:                 lstTopics.DataValueField = "TopicCode";  
38:                 lstTopics.DataBind();  
39:   
40:                 ProcessChart();  
41:   
42:             }  
43:         }  
44:   
45:         protected void cmdSubmit_Click(object sender, EventArgs e)  
46:         {  
47:   
48:             ProcessChart();  
49:   
50:         }  
51:   
52:         private void ProcessChart()  
53:         {  
54:             txtStartDate.Value = txtStartDate.Value == "" ? DateTime.Now.AddMonths(-3).ToString("d") : txtStartDate.Value;  
55:             txtEndDate.Value = txtEndDate.Value == "" ? DateTime.Now.ToString("d") : txtEndDate.Value;  
56:   
57:             DataTable tbl = tools.MyResultsByDate(Convert.ToDateTime(txtStartDate.Value), Convert.ToDateTime(txtEndDate.Value), ((UserWeb)Session["userWeb"]).UserName, lstTopics.SelectedItem.Value);  
58:             //DataTable tbl = tools.MyResultsByDate(Convert.ToDateTime(txtStartDate.Value), Convert.ToDateTime(txtEndDate.Value), "??????????????????????", lstTopics.SelectedItem.Value);  
59:   
60:             foreach (DataRow row in tbl.Rows)  
61:             {  
62:                 Chart1.Series["Series1"].Points.AddY(row["QuestionsCorrect"]);  
63:                 Chart1.Series["Series2"].Points.AddXY(row["ResultDate"], row["QuestionsIncorrect"]);  
64:             }  
65:   
66:             Chart1.Series["Series1"].ToolTip = "#VALY";  
67:             Chart1.Series["Series2"].ToolTip = "#VALY";  
68:   
69:             // Set X axis margin  
70:             Chart1.ChartAreas["ChartArea1"].AxisX.IsMarginVisible = true;  
71:             Chart1.ChartAreas["ChartArea1"].AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;  
72:   
73:             Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = false;  
74:             Chart1.Series["Series1"].BorderWidth = 3;  
75:         }  
76:     }  
77: }

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