Example #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //  Label1.Text = "";

        //  SqlDataSource2.SelectCommand = "SELECT facultyname, avgtotal FROM suballoc WHERE subject='" + DropDownList1.SelectedItem.ToString() + "';";


        SqlConnection connection = new SqlConnection("Data Source=universitycollege.database.windows.net;Initial Catalog=feedback;User ID=khalid;Password=99%isnotenough");

        connection.Open();

        string         query   = "select facultycode, avgtotal from suballoc where subject='" + DropDownList3.SelectedValue.ToString().TrimEnd() + "';";
        SqlDataAdapter adapter = new SqlDataAdapter(query, connection);
        DataSet        dataSet = new DataSet();


        adapter.Fill(dataSet);

        if (dataSet != null)
        {
            Chart chart = new ColumnChart();

            chart.Line.Color = Color.CornflowerBlue;

            chart.DataSource      = dataSet.Tables[0].DefaultView;
            chart.DataXValueField = "facultycode";
            chart.DataYValueField = "avgtotal";
            chart.DataBind();

            chart.Fill.Color = Color.CornflowerBlue;


            Chart chart1 = new ColumnChart();
            //chart1.Line.Color = Color.Blue;

            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));

            chart.DataLabels.Visible = true;

            //ChartControl2.Charts.Add(chart1);
            ChartControl2.Charts.Add(chart);
            ChartControl2.RedrawChart();
            ChartControl2.Visible = true;

            DetailsView1.DataSource = chart.Data;
            DetailsView1.DataBind();
        }
        connection.Close();
    }
Example #2
0
    protected void LinkButton3_Click(object sender, EventArgs e)
    {
        //generategraph(3);

        SqlConnection connection = new SqlConnection("Data Source=universitycollege.database.windows.net;Initial Catalog=feedback;User ID=khalid;Password=99%isnotenough");

        connection.Open();
        string         query   = "select subject, avgtotal from suballoc where year=3;";//'" + x + "';";
        SqlDataAdapter adapter = new SqlDataAdapter(query, connection);
        DataSet        dataSet = new DataSet();


        adapter.Fill(dataSet);

        if (dataSet != null)
        {
            Chart chart = new ColumnChart();

            chart.Line.Color = Color.CornflowerBlue;

            chart.DataSource = dataSet.Tables[0].DefaultView;

            chart.DataXValueField = "subject";
            chart.DataYValueField = "avgtotal";
            chart.DataBind();

            chart.Fill.Color = Color.CornflowerBlue;
            // chart.Line.Color = Color.Red;

            Chart chart1 = new ColumnChart();
            chart1.Line.Color = Color.Blue;

            chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));
            //chart1.Data.Add(new ChartPoint("", 0));

            ChartControl2.PlotBackground.ImageUrl = Server.MapPath("~/logo.jpg");
            chart.DataLabels.Visible = true;

            ChartControl2.Charts.Add(chart1);
            ChartControl2.Charts.Add(chart);
            ChartControl2.RedrawChart();
            ChartControl2.Visible = true;
            dataSet.Clear();
        }
        connection.Close();
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            configurarColores(Titulo);
            
            chart = new ColumnChart();
            chart.Fill.Color = Color.FromArgb(50, Color.SteelBlue);
            chart.Line.Color = Color.SteelBlue;
            chart.Line.Width = 4;
            chart.Legend = Leyenda;

            chart.DataBind();
        }
Example #4
0
    private void getRevChartData()
    {
        ClsProjRevChart        pr           = new ClsProjRevChart();
        string                 userRole     = Session["userRole"].ToString().ToLower();
        string                 userLogin    = Session["userName"].ToString();
        List <ClsProjRevChart> revChartData = new List <ClsProjRevChart>();

        if (userRole == "sales")
        {
            revChartData           = pr.getProjectedRevenueSales(userLogin);
            ColumnChart.DataSource = revChartData;
        }
        if (userRole == "salesdm")
        {
            clsDistrictRestriction RestrictedDistricts = new clsDistrictRestriction();
            string district = RestrictedDistricts.GetDistrictRestriction(Session["userName"].ToString(), Session["appName"].ToString());
            revChartData           = pr.getProjectedRevenueDistrict(district);
            ColumnChart.DataSource = revChartData;
        }
        if (userRole == "salesmanager")
        {
            revChartData           = pr.getProjectedRevenueAll();
            ColumnChart.DataSource = revChartData;
        }
        if (userRole == "itba" || userRole == "itadmin" || userRole == "admin")
        {
            revChartData           = pr.getProjectedRevenueITBA(userLogin);
            ColumnChart.DataSource = revChartData;
        }
        if (userRole == "itmanager")
        {
            revChartData           = pr.getProjectedRevenueAll();
            ColumnChart.DataSource = revChartData;
        }
        ColumnChart.DataBind();
    }
Example #5
0
    protected void LoadChart()
    {
        DataTable tblDivision = clsDivision.DSAll();

        foreach (DataRow drw in tblDivision.Rows)
        {
            ColumnChart ccValue  = new ColumnChart();
            Color       clrChart = Color.SkyBlue;
            switch (drw["divicode"].ToString())
            {
            case "ACDMCS":
                clrChart = Color.Green;
                break;

            case "AUDCOM":
                clrChart = Color.Gray;
                break;

            case "CISERV":
                clrChart = Color.Blue;
                break;

            case "CNLMGT":
                clrChart = Color.Yellow;
                break;

            case "COOEVP":
                clrChart = Color.Orange;
                break;

            case "FNANCE":
                clrChart = Color.Fuchsia;
                break;

            case "MKTING":
                clrChart = Color.Red;
                break;

            case "OOCOOP":
                clrChart = Color.SkyBlue;
                break;
            }
            ccValue.Shadow.Visible  = true;
            ccValue.MaxColumnWidth  = 15;
            ccValue.Fill.Color      = Color.FromArgb(90, clrChart);
            ccValue.Legend          = drw["division"].ToString();
            ccValue.DataSource      = clsTimesheet.DSCDTRSummary(drw["divicode"].ToString(), clsDateTime.GetDateOnly(dtpStart.Date), clsDateTime.GetDateOnly(dtpEnd.Date.AddDays(1))).DefaultView;
            ccValue.DataXValueField = "xvalue";
            ccValue.DataYValueField = "yvalue";
            ccValue.DataBind();
            chaDTRSummary.Charts.Add(ccValue);
        }
        chaDTRSummary.RedrawChart();


        //foreach (DataRow drw in tblDivision.Rows)
        //{
        // ColumnChart ccPercentage = new ColumnChart();
        // Color clrChart = Color.SkyBlue;
        // switch (drw["divicode"].ToString())
        // {
        //  case "ACDMCS":
        //   clrChart = Color.Green;
        //   break;
        //  case "AUDCOM":
        //   clrChart = Color.Gray;
        //   break;
        //  case "CISERV":
        //   clrChart = Color.Blue;
        //   break;
        //  case "CNLMGT":
        //   clrChart = Color.Yellow;
        //   break;
        //  case "COOEVP":
        //   clrChart = Color.Orange;
        //   break;
        //  case "FNANCE":
        //   clrChart = Color.Fuchsia;
        //   break;
        //  case "MKTING":
        //   clrChart = Color.Red;
        //   break;
        //  case "OOCOOP":
        //   clrChart = Color.SkyBlue;
        //   break;
        // }
        // ccPercentage.Shadow.Visible = true;
        // ccPercentage.MaxColumnWidth = 15;
        // ccPercentage.Fill.Color = Color.FromArgb(90, clrChart);
        // ccPercentage.Legend = drw["division"].ToString();
        // ccPercentage.DataSource = clsTimesheet.DSCDTRSummaryPercentage(drw["divicode"].ToString(), clsDateTime.GetDateOnly(dtpStart.Date), clsDateTime.GetDateOnly(dtpEnd.Date.AddDays(1))).DefaultView;
        // ccPercentage.DataXValueField = "xvalue";
        // ccPercentage.DataYValueField = "yvalue";
        // ccPercentage.DataBind();
        // chaDTRSummaryPercentage.Charts.Add(ccPercentage);
        //}

        //chaDTRSummary.RedrawChart();
    }
Example #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        clsSpeedo.Authenticate();
        clsCRS.CRSUserType cutUserLevel = clsCRS.GetUserLevel(Request.Cookies["Speedo"]["UserName"].ToString());

        if (!Page.IsPostBack)
        {
            if (cutUserLevel == clsCRS.CRSUserType.ChannelManager)
            {
                ddlSchools.DataSource     = clsSchool.GetSchoolCmDdlDataTable(Request.Cookies["Speedo"]["UserName"].ToString());
                ddlSchools.DataValueField = "pvalue";
                ddlSchools.DataTextField  = "ptext";
                ddlSchools.DataBind();
            }

            if (cutUserLevel == clsCRS.CRSUserType.EliteUsers)
            {
                int         intCtr = 0;
                ColumnChart ccCR;
                DataTable   tblCR = new DataTable();
                tblCR.Columns.Add("month", System.Type.GetType("System.String"));
                tblCR.Columns.Add("tcount", System.Type.GetType("System.Int32"));

                DataRow  rowCR;
                Color[]  clrColor  = new Color[] { Color.Yellow, Color.Purple, Color.DarkGreen, Color.Orange, Color.Red };
                string[] strLabel  = new string[] { "Completed", "Partial Process", "For Processing (Endorsed)", "For Endorsement", "Disapproved" };
                string[] strStatus = new string[] { "C", "P", "E", "F", "D" };
                //cmd.CommandText = "SELECT DATEPART(mm,datereq) AS pmonth,COUNT(crsecode) AS tcrscode FROM CM.CrsDetails INNER JOIN CM.Crs ON Cm.CrsDetails.crscode = CM.Crs.crscode WHERE DATEPART(mm,datereq) BETWEEN " + DateTime.Now.AddMonths(-2).Month + " AND " + DateTime.Now.Month + " AND DATEPART(yy,datereq) = '" + DateTime.Now.Year + "' GROUP BY DATEPART(mm,datereq) ORDER BY DATEPART(mm,datereq)";

                using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["Speedo"].ToString()))
                {
                    SqlCommand cmd = cn.CreateCommand();
                    cn.Open();
                    SqlDataReader dr;

                    for (intCtr = 0; intCtr < 5; intCtr++)
                    {
                        rowCR = tblCR.NewRow();
                        tblCR.Rows.Clear();

                        rowCR["month"]  = DateTime.Now.AddMonths(-2).ToString("MMMM");
                        cmd.CommandText = "SELECT COUNT(crsecode) AS tcrsecode FROM CM.CrsDetails WHERE crscode IN (SELECT crscode FROM CM.Crs WHERE DATEPART(mm,datereq) = " + DateTime.Now.AddMonths(-2).Month + " AND DATEPART(yy,datereq) = '" + DateTime.Now.Year + "') AND pstatus='" + strStatus[intCtr] + "'";
                        dr = cmd.ExecuteReader();
                        if (dr.Read())
                        {
                            rowCR["tcount"] = dr["tcrsecode"].ToString();
                        }
                        else
                        {
                            rowCR["tcount"] = dr["tcrsecode"].ToString();
                        }
                        dr.Close();
                        tblCR.Rows.Add(rowCR);

                        rowCR           = tblCR.NewRow();
                        rowCR["month"]  = DateTime.Now.AddMonths(-1).ToString("MMMM");
                        cmd.CommandText = "SELECT COUNT(crsecode) AS tcrsecode FROM CM.CrsDetails WHERE crscode IN (SELECT crscode FROM CM.Crs WHERE DATEPART(mm,datereq) = " + DateTime.Now.AddMonths(-1).Month + " AND DATEPART(yy,datereq) = '" + DateTime.Now.Year + "') AND pstatus='" + strStatus[intCtr] + "'";
                        dr = cmd.ExecuteReader();
                        if (dr.Read())
                        {
                            rowCR["tcount"] = dr["tcrsecode"].ToString();
                        }
                        else
                        {
                            rowCR["tcount"] = dr["tcrsecode"].ToString();
                        }
                        dr.Close();
                        tblCR.Rows.Add(rowCR);

                        rowCR           = tblCR.NewRow();
                        rowCR["month"]  = DateTime.Now.ToString("MMMM");
                        cmd.CommandText = "SELECT COUNT(crsecode) AS tcrsecode FROM CM.CrsDetails WHERE crscode IN (SELECT crscode FROM CM.Crs WHERE DATEPART(mm,datereq) = " + DateTime.Now.Month + " AND DATEPART(yy,datereq) = '" + DateTime.Now.Year + "') AND pstatus='" + strStatus[intCtr] + "'";
                        dr = cmd.ExecuteReader();
                        if (dr.Read())
                        {
                            rowCR["tcount"] = dr["tcrsecode"].ToString();
                        }
                        else
                        {
                            rowCR["tcount"] = dr["tcrsecode"].ToString();
                        }
                        dr.Close();
                        tblCR.Rows.Add(rowCR);

                        ccCR = new ColumnChart();
                        ccCR.Shadow.Visible              = true;
                        ccCR.MaxColumnWidth              = 15;
                        ccCR.Fill.Color                  = System.Drawing.Color.FromArgb(90, clrColor[intCtr]);
                        ccCR.DataLabels.Visible          = true;
                        ccCR.DataLabels.Background.Color = System.Drawing.Color.White;
                        ccCR.Legend          = strLabel[intCtr];
                        ccCR.DataSource      = tblCR.DefaultView;
                        ccCR.DataXValueField = "month";
                        ccCR.DataYValueField = "tcount";
                        ccCR.DataBind();

                        chaCRSSummary.Charts.Add(ccCR);
                    }
                }

                chaCRSSummary.ChartTitle.Text = "Courseware Request Summary";
                chaCRSSummary.RedrawChart();
            }
        }


        if (cutUserLevel == clsCRS.CRSUserType.ChannelManager)
        {
            lblE.Text = "0";
            lblP.Text = "0";
            using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["Speedo"].ToString()))
            {
                SqlCommand cmd = cn.CreateCommand();
                cmd.CommandText = "SELECT COUNT(crsecode) AS te FROM CM.Crs INNER JOIN CM.CrsDetails ON CM.Crs.crscode = CM.CrsDetails.crscode WHERE cmname='" + Request.Cookies["Speedo"]["UserName"] + "' AND CM.CrsDetails.pstatus='F'";
                cn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    if (!Convert.IsDBNull(dr["te"].ToString()))
                    {
                        lblE.Text = dr["te"].ToString();
                    }
                }
                dr.Close();

                cmd.CommandText = "SELECT COUNT(crsecode) AS tp FROM CM.Crs INNER JOIN CM.CrsDetails ON CM.Crs.crscode = CM.CrsDetails.crscode WHERE cmname='" + Request.Cookies["Speedo"]["UserName"] + "' AND CM.CrsDetails.pstatus='P'";
                dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    if (!Convert.IsDBNull(dr["tp"].ToString()))
                    {
                        lblP.Text = dr["tp"].ToString();
                    }
                }
                dr.Close();
            }
        }
    }
    protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
    {
        // Label2.Text = "RATING GIVEN TO '" + DropDownList3.SelectedItem.ToString() + "' FOR '" + DropDownList2.SelectedItem.ToString() + "' = " + DropDownList2.SelectedValue.ToString();

        Label1.Text = DropDownList3.SelectedItem.ToString();
        SqlConnection connection = new SqlConnection("Data Source=universitycollege.database.windows.net;Initial Catalog=feedback;User ID=khalid;Password=99%isnotenough");

        connection.Open();

        string         query   = "select subject, avgtotal from suballoc where facultycode='" + DropDownList3.SelectedValue.ToString().TrimEnd() + "';";
        SqlDataAdapter adapter = new SqlDataAdapter(query, connection);
        DataSet        dataSet = new DataSet();


        adapter.Fill(dataSet);

        if (dataSet != null)
        {
            Chart chart = new ColumnChart();

            chart.Line.Color = Color.CornflowerBlue;

            chart.DataSource = dataSet.Tables[0].DefaultView;

            chart.DataXValueField = "subject";
            chart.DataYValueField = "avgtotal";
            chart.DataBind();

            chart.Fill.Color = Color.CornflowerBlue;


            Chart chart1 = new ColumnChart();
            chart1.Line.Color = Color.Blue;

            chart1.Data.Add(new ChartPoint("", 0));
            chart1.Data.Add(new ChartPoint("", 0));
            chart1.Data.Add(new ChartPoint("", 0));
            chart1.Data.Add(new ChartPoint("", 0));
            chart1.Data.Add(new ChartPoint("", 0));
            chart1.Data.Add(new ChartPoint("", 0));
            chart1.Data.Add(new ChartPoint("", 0));
            chart1.Data.Add(new ChartPoint("", 0));
            chart1.Data.Add(new ChartPoint("", 0));
            chart1.Data.Add(new ChartPoint("", 0));


            chart.DataLabels.Visible = true;

            ChartControl2.Charts.Add(chart1);
            ChartControl2.Charts.Add(chart);
            ChartControl2.RedrawChart();
            ChartControl2.Visible = true;

            Grid1.DataSource = chart.Data;
            Grid1.DataBind();



            //MapColumnChart cl = new MapColumnChart();
            //cl.Legend = "User A";
            //cl.Fill.Color = Color.Blue;

            //ChartPointCollection data2 = cl.Data;
            //data2.Add(new ChartPoint("", 0));
            //data2.Add(new ChartPoint(st, ft1));
            ////data2.Add(new ChartPoint("Mar", 60));
            ////data2.Add(new ChartPoint("Apr", 40));
            ////data2.Add(new ChartPoint("May", 30));
            ////data2.Add(new ChartPoint("Jun", 10));
            ////data2.Add(new ChartPoint("Jul", 30));
            ////data2.Add(new ChartPoint("Aug", 20));
            ////data2.Add(new ChartPoint("Sep", 60));
            ////data2.Add(new ChartPoint("Oct", 40));
            ////data2.Add(new ChartPoint("Nov", 20));
            ////data2.Add(new ChartPoint("Dec", 30));

            //cl.Rects = new System.Collections.ArrayList();
            //ChartControl1.Charts.Add(cl);

            //MapColumnChart c2 = new MapColumnChart();
            //c2.Legend = "User B";
            //c2.Fill.Color = Color.DarkBlue;

            //data2 = c2.Data;
            //data2.Add(new ChartPoint("", 0));
            //data2.Add(new ChartPoint("", 0));
            //data2.Add(new ChartPoint("", 0));
            //data2.Add(new ChartPoint("", 0));
            //data2.Add(new ChartPoint("", 0));
            //data2.Add(new ChartPoint("", 0));
            //data2.Add(new ChartPoint("", 0));
            //data2.Add(new ChartPoint("", 0));
            ////data2.Add(new ChartPoint("", 0));
            ////data2.Add(new ChartPoint("", 0));
            ////data2.Add(new ChartPoint("", 0));
            ////data2.Add(new ChartPoint("", 0));

            //c2.Rects = cl.Rects;
            //ChartControl1.Charts.Add(c2);

            //ChartControl1.RedrawChart();
            //ChartControl1.YCustomEnd = 6;
            //ChartControl1.Visible = true;
        }
        connection.Close();
    }