Пример #1
0
    public void Piechart()
    {
        int    A     = 0;
        int    B     = 0;
        int    C     = 0;
        int    D     = 0;
        int    E     = 0;
        int    count = 0;
        AbcDAL MyDAL = new AbcDAL("");

        DataTable ResultTable      = MyDAL.SelectStudentByAuthID(1);
        string    StudentID        = ResultTable.Rows[0]["StudentID"].ToString().Trim();
        DataTable ResultTableClass = MyDAL.PopulateClassByStudentID(StudentID);

        RadChart radChart = new RadChart();

        radChart.ChartTitle.TextBlock.Text = "My RadChart";
        ChartSeries chartSeries = new ChartSeries();

        chartSeries.Name = "Overall Grade";
        chartSeries.Type = ChartSeriesType.Bar;
        // add new items to the series,
        // passing a value and a label string

        foreach (DataRow row in ResultTableClass.Rows)
        {
            if (ResultTableClass.Rows[count]["Grade"].ToString().Trim() == "A")
            {
                A++;
            }
            else if (ResultTableClass.Rows[count]["Grade"].ToString().Trim() == "B")
            {
                B++;
            }
            else if (ResultTableClass.Rows[count]["Grade"].ToString().Trim() == "C")
            {
                C++;
            }
            else if (ResultTableClass.Rows[count]["Grade"].ToString().Trim() == "D")
            {
                D++;
            }
            else if (ResultTableClass.Rows[count]["Grade"].ToString().Trim() == "E")
            {
                E++;
            }
            count++;
        }
        chartSeries.AddItem(A, "A");
        chartSeries.AddItem(B, "B");
        chartSeries.AddItem(C, "C");
        chartSeries.AddItem(D, "D");
        chartSeries.AddItem(E, "E");

        RCStudent.AddChartSeries(chartSeries);
    }
        private void RenderChartBar()
        {
            this.Chart.Chart.Series.Clear();
            ChartSeries series = new ChartSeries("ANSWER", ChartSeriesType.Bar);

            series.Appearance.Border.Width = 2;
            Chart.Series.Add(series);
            int maxValue   = GetMaxValue();
            int totalValue = GetTotalValue();

            pollQuestion.Answers.Sort(new DataObjectPollQuestion.TotalSorterPollAnswer());
            foreach (DataObjectPollQuestion.PollAnswer answer in pollQuestion.Answers)
            {
                this.Chart.PlotArea.XAxis.AddItem(answer.Answer);
                if (pollQuestion.ShowAnswerCount == DataObjectPollQuestion.QuestionShowAnswerCount.Percent)
                {
                    series.AddItem(answer.Total, string.Format("{0} ({1:0}%)", answer.Answer, 100.0 / totalValue * answer.Total));
                }
                else if (pollQuestion.ShowAnswerCount == DataObjectPollQuestion.QuestionShowAnswerCount.Number)
                {
                    series.AddItem(answer.Total, string.Format("{0} ({1:0})", answer.Answer, answer.Total));
                }
                else
                {
                    series.AddItem(answer.Total, answer.Answer);
                }
            }

            maxValue++;
            Chart.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between;
            Chart.PlotArea.YAxis.AutoScale  = false;
            Chart.PlotArea.YAxis.MinValue   = 0;
            Chart.PlotArea.YAxis.MaxValue   = maxValue;


            if (maxValue <= 10)
            {
                Chart.PlotArea.XAxis.Step = 1;
            }
            else if (maxValue <= 100)
            {
                Chart.PlotArea.XAxis.Step = 10;
            }
            else if (maxValue <= 1000)
            {
                Chart.PlotArea.XAxis.Step = 100;
            }
            else
            {
                Chart.PlotArea.XAxis.Step = 200;
            }
        }
Пример #3
0
    protected void BolgelereGoreSertifikaSayisiCizdir()
    {
        int DataCount = 0;

        using (Service1Client proxy = new Service1Client())
        {
            List <kal_sfBolgelereGoreSertifikaSayisi_Result> Sonuc = proxy.kal_sfBolgelereGoreSertifikaSayisi_ResultDon(clnBaslangicTarihi.SelectedDate.Value, clnBitisTarihi.SelectedDate.Value).ToList();
            gvBolgeSertifikaSayisi.DataSource = Sonuc;
            gvBolgeSertifikaSayisi.DataBind();
            DataCount = Sonuc.Count;
            chtBolgelerSertifikaSayisi.Clear();
            chtBolgelerSertifikaSayisi.ChartTitle.TextBlock.Text = "Sertifika sayısına göre bölgeler";
            ChartSeries salesSeries = chtBolgelerSertifikaSayisi.CreateSeries("SertifikaSayisi", defaultColors[0], defaultColors[1], ChartSeriesType.Bar);
            int         k           = 0;
            foreach (var result in Sonuc)
            {
                string bak = result.ToplamSertifikaSayisi.Value.ToString();
                lblBolgelereGoreToplamSertifikaSayisi.Text = "Toplam sertifika sayısı=" + bak.ToString();
                if (bak != "")
                {
                    //salesSeries.AddItem(Convert.ToDouble(dr["SertifikaSayisi"]), dr["BolgeAdi"].ToString(), defaultColors[k + 1], false);
                    salesSeries.AddItem(Convert.ToDouble(result.sayi.Value.ToString()), result.BolgeAdi, defaultColors[k + 1], false);
                }
                k++;
            }
            chtBolgelerSertifikaSayisi.Legend.Visible = false;
        }
    }
Пример #4
0
    protected void LabSertifikaSayisiCizdir()
    {
        int      DataCount = 0;
        DateTime Bastar    = clnBaslangicTarihi.SelectedDate.Value;
        DateTime Bittar    = clnBitisTarihi.SelectedDate.Value;

        BolgeKodu = BolgeKoduBelirle();
        using (Service1Client proxy = new Service1Client())
        {
            List <kal_sfLabSertifikaSayisiAnaliz_Result> Sonuc = proxy.kal_sfLabSertifikaSayisiAnaliz_ResultDon((short)BolgeKodu, Bastar, Bittar).ToList();
            grvLabSertifikaSayisi.DataSource = Sonuc;
            grvLabSertifikaSayisi.DataBind();
            DataCount = Sonuc.Count;
            chtLabSertifikaSayisi.Clear();
            chtLabSertifikaSayisi.ChartTitle.TextBlock.Text = "Laboratuvar sertifika sayısına göre durum";
            ChartSeries salesSeries = chtLabSertifikaSayisi.CreateSeries("SertifikaSayisi", defaultColors[0], defaultColors[1], ChartSeriesType.Bar);
            int         k           = 0;
            foreach (var result in Sonuc)
            {
                lblLabSertifikaSayisi.Text = "Toplam sertifika sayısı=" + result.ToplamSertifikaSayisi.Value.ToString();
                string bak = result.SertifikaSayisi.ToString();
                if (bak != "")
                {
                    salesSeries.AddItem(Convert.ToDouble(result.SertifikaSayisi.Value), result.ILGLAB, defaultColors[k + 1], false);
                }
                k++;
            }
        }
    }
Пример #5
0
    protected void PersonelBazliSertifikaSayisiCizdir()//Personel sertika sayısı ama
    {
        DateTime Bastar = clnBaslangicTarihi.SelectedDate.Value;
        DateTime Bittar = clnBitisTarihi.SelectedDate.Value;

        BolgeKodu = BolgeKoduBelirle();
        using (Service1Client proxy = new Service1Client())
        {
            int DataCount = 0;
            List <kal_sfPersSertifikaSayisiAnaliz_Result> Sonuc = proxy.kal_sfPersSertifikaSayisiAnaliz_ResultDon((short)BolgeKodu, Bastar, Bittar).ToList();
            grvPersBazliSertifikaSayisi.DataSource = Sonuc;
            grvPersBazliSertifikaSayisi.DataBind();
            grvPersBazliSertifikaSayisi.Visible = true;

            DataCount = Sonuc.Count;
            chtSertifikaSayisi.Clear();

            chtSertifikaSayisi.ChartTitle.TextBlock.Text = "Personel sertifika sayısına göre durum";
            ChartSeries salesSeries = chtSertifikaSayisi.CreateSeries("Personel bazında sertifika sayısı ", defaultColors[0], defaultColors[1], ChartSeriesType.Bar);   //(chtGetiri.CreateSeries("Getiri", defaultColors[0], ChartSeriesType.Bar));
            int         k           = 0;
            foreach (var result in Sonuc)
            {
                string bak = result.SertifikaSayisi.Value.ToString();
                if (bak != "")
                {
                    salesSeries.AddItem(Convert.ToDouble(result.SertifikaSayisi.Value), result.Sorumlu, defaultColors[k + 1], false);
                }
                chtSertifikaSayisi.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Ariel", 6);
                chtSertifikaSayisi.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Ariel", 6);
                k++;
            }
        }
    }
Пример #6
0
        private void AddNewSeries(UniversalEntity ue)
        {
            ChartSeries cs = new ChartSeries(radWP.SelectedText, ChartSeriesType.Spline);

            RadChart1.Series.Add(cs);
            int i = 0;
            List <ChartSeriesItem> csc = new List <ChartSeriesItem>();

            foreach (ArrayList al in ue)
            {
                ChartSeriesItem csi = new ChartSeriesItem();

                csi.YValue = (Convert.ToDouble(al[0]));
                csi.XValue = (i);
                //csi.XValue=(Convert.ToDateTime(al[1]).Ticks);

                //cs.AddItem((Convert.ToDouble(al[0]));
                i++;

                csc.Add(csi);
            }

            cs.AddItem(csc);

            RadChart1.DataBind();
            RadChart1.PlotArea.XAxis.LayoutMode = Telerik.Charting.Styles.ChartAxisLayoutMode.Normal;
        }
Пример #7
0
        //---------------------------------------------------------------------------------------------------//

        protected void btnSinglePageRefresh_Click(object sender, EventArgs e)
        {
            DataSet graph = this.GetSinglePageDataTable(false);

            this.radSinglePageChart.ChartSeriesCollection.Clear();

            this.radSinglePageChart.Title1.Text = String.Format("Performance of {0}" + Environment.NewLine + "between {1} and {2}", this.cboPage.Text.Trim(),
                                                                this.dteSinglePageStartDate.Date.ToString("dd/MM/yyyy"), this.dteSinglePageEndDate.Date.ToString("dd/MM/yyyy"));

            ChartSeries chartSeries = this.radSinglePageChart.CreateSeries("Page Processing Time", System.Drawing.Color.Orange, ChartSeriesType.Line);

            chartSeries.LabelAppearance.Visible = false;
            chartSeries.LineWidth = 3;

            this.radSinglePageChart.XAxis.ShowLabels         = true;
            this.radSinglePageChart.XAxis.AutoScale          = false;
            this.radSinglePageChart.XAxis.ShowMarks          = false;
            this.radSinglePageChart.XAxis.AxisStyle          = ChartYAxisStyle.Normal;
            this.radSinglePageChart.XAxis.Label.Text         = "";
            this.radSinglePageChart.XAxis.LabelRotationAngle = 40;
            this.radSinglePageChart.XAxis.Items.Clear();

            this.radSinglePageChart.YAxis.AxisStyle  = ChartYAxisStyle.Extended;
            this.radSinglePageChart.YAxis.Label.Text = "Average processing time in seconds";

            foreach (DataRow row in graph.Tables[0].Rows)
            {
                chartSeries.AddItem(Convert.ToDouble(row["AverageProcessingTime"]), row["Date"].ToString(), System.Drawing.Color.Orange);
                ChartAxisItem item = new ChartAxisItem(row["Date"].ToString(), System.Drawing.Color.Black);
                item.Visible = true;
                this.radSinglePageChart.XAxis.Items.AddItem(item);
            }

            this.radSinglePageChart.Visible = true;
        }
Пример #8
0
        //---------------------------------------------------------------------------------------------------//

        protected void btnAllPagesRefresh_Click(object sender, EventArgs e)
        {
            DataSet graph = this.GetAllPageDataTable(false);

            this.radAllPagesChart.ChartSeriesCollection.Clear();
            this.radAllPagesChart.Title1.Text = String.Format("Performance of all pages" + Environment.NewLine + "between {0} and {1}"
                                                              , this.dteAllPagesStartDate.Date.ToString("dd/MM/yyyy"), this.dteAllPagesEndDate.Date.ToString("dd/MM/yyyy"));

            ChartSeries chartSeries = this.radAllPagesChart.CreateSeries("Page Processing Time", System.Drawing.Color.Orange, ChartSeriesType.Bar);

            chartSeries.LabelAppearance.RotationAngle = 90;
            chartSeries.LabelAppearance.TextFont      = new System.Drawing.Font("Arial", 12, System.Drawing.FontStyle.Bold);
            this.radAllPagesChart.XAxis.AxisStyle     = ChartYAxisStyle.Extended;

            this.radAllPagesChart.YAxis.AxisStyle  = ChartYAxisStyle.Extended;
            this.radAllPagesChart.YAxis.Label.Text = "Average processing time in seconds";

            foreach (DataRow row in graph.Tables[0].Rows)
            {
                string[] parts = row["VirtualPathString"].ToString().Split(new char[] { '/' });
                chartSeries.AddItem(Convert.ToDouble(row["AverageProcessingTime"]), parts[parts.Length - 1], System.Drawing.Color.Orange);
            }

            this.radAllPagesChart.Visible = true;
        }
    protected void BindHistoryChart(object sender, EventArgs e)
    {
        if (dd_book_history.Items.Count > 0 && dd_book_history.SelectedItem != null && dd_book_history.SelectedItem.Text != String.Empty)
        {
            btn_clear_history.Enabled = true;
            String    history            = String.Empty;
            String    qry                = "SELECT RevenueHistory FROM db_salesbookhead WHERE SalesBookID=@sb_id";
            DataTable dt_revenue_history = SQL.SelectDataTable(qry, new String[] { "@sb_id" }, new Object[] { dd_book_history.SelectedItem.Value });

            if (dt_revenue_history.Rows.Count > 0 && dt_revenue_history.Rows[0]["RevenueHistory"] != DBNull.Value)
            {
                history = dt_revenue_history.Rows[0]["RevenueHistory"].ToString();

                // Define chart series
                ChartSeries series = new ChartSeries(dd_book_history.SelectedItem.Value, ChartSeriesType.Line);
                series.Appearance.TextAppearance.TextProperties.Color = Color.White;

                // Turn off intelligent labels if more than one series - slowdown bug
                //if (rc_bar_history.Series.Count > 0)
                //{
                rc_bar_history.IntelligentLabelsEnabled  = false;
                series.Appearance.TextAppearance.Visible = false;
                //}

                // Construct series from string
                String day_total = String.Empty;
                int    day       = 0;
                for (int i = 0; i < history.Length; i++)
                {
                    if (history[i] != ',')
                    {
                        day_total += history[i];
                    }
                    else
                    {
                        double price = Convert.ToDouble(day_total);
                        series.AddItem(price);
                        series.Items[day].Label.TextBlock.Text = Util.TextToCurrency(price.ToString(), "usd");
                        day_total = String.Empty;
                        day++;
                    }
                }
                series.Appearance.TextAppearance.TextProperties.Font = new Font("Verdana", 8, FontStyle.Bold);
                series.Name = dd_office_history.Text + " : " + dd_book_history.SelectedItem.Text + " (USD)";
                rc_bar_history.Series.Add(series);
                rc_bar_history.ChartTitle.TextBlock.Text = dd_office_history.Text + "'s History";
            }
        }
    }
Пример #10
0
        private void iniChartWeekProfessional(AriClinicContext ctx1)
        {
            ctx1 = new AriClinicContext("AriClinicContext");
            IList <Ticket> tickets = CntAriCli.GetTickets(fromDate, toDate, ctx1);

            chart1.PlotArea.XAxis.Items.Clear();
            //chart1.PlotArea.XAxis.Appearance.TextAppearance.
            chart1.Legend.Visible = true;
            //chart1.PlotArea.XAxis.AddRange(0, 1, 1);
            chart1.PlotArea.XAxis.AutoScale   = false;
            chart1.PlotArea.XAxis.LayoutMode  = Telerik.Reporting.Charting.Styles.ChartAxisLayoutMode.Inside;
            chart1.Appearance.BarWidthPercent = (decimal)5.00;
            chart1.AutoLayout = true;
            chart1.ChartTitle.TextBlock.Visible           = false;
            chart1.PlotArea.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid;
            //chart1.PlotArea.Appearance.FillStyle.MainColor = Color.Transparent;
            ChartSeries chartSeries1 = new ChartSeries();

            chartSeries1.Type = ChartSeriesType.StackedBar;
            chartSeries1.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;

            var rs = from tick in (List <Ticket>)tickets
                     where tick.TicketDate >= fromDate && tick.TicketDate <= toDate && tick.GetType().ToString().Equals("AriCliModel.AnestheticTicket")
                     group tick by new { tick.TicketDate.Year, WeekNumber = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(tick.TicketDate, CalendarWeekRule.FirstDay, DayOfWeek.Monday), tick.Professional.FullName } into g
                select new { Datos = g.Key, Total = g.Sum(tick => tick.Amount) };

            ChartSeriesItem serieItem;

            foreach (var item in rs)
            {
                serieItem        = new ChartSeriesItem();
                serieItem.YValue = (double)item.Total;
                chart1.PlotArea.XAxis.AddItem(new ChartAxisItem(item.Datos.WeekNumber + "/" + item.Datos.Year));
                chart1.PlotArea.YAxis.AddItem(new ChartAxisItem(String.Format("{0:#.##}", item.Total)));
                serieItem.Label.TextBlock.Text = String.Format("{0:#.##}", item.Total);
                serieItem.Appearance.Exploded  = true;
                //serieItem.Name = item.Datos.FullName;
                chartSeries1.AddItem(serieItem);
            }

            chart1.Series.Clear();
            chart1.Series.Add(chartSeries1);
        }
Пример #11
0
        private void iniChartMonth(AriClinicContext ctx1)
        {
            ctx1 = new AriClinicContext("AriClinicContext");
            IList <Ticket> tickets = CntAriCli.GetTickets(fromDate, toDate, ctx1);

            chart1.PlotArea.XAxis.Items.Clear();
            chart1.PlotArea.XAxis.AutoScale = false;

            chart1.PlotArea.XAxis.AutoScale   = false;
            chart1.PlotArea.XAxis.LayoutMode  = Telerik.Reporting.Charting.Styles.ChartAxisLayoutMode.Inside;
            chart1.Appearance.BarWidthPercent = (decimal)5.00;

            chart1.AutoLayout = true;
            chart1.ChartTitle.TextBlock.Visible           = false;
            chart1.PlotArea.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid;
            //chart1.PlotArea.Appearance.FillStyle.MainColor = Color.Transparent;
            ChartSeries chartSeries1 = new ChartSeries();

            chartSeries1.Type = ChartSeriesType.StackedArea;
            chartSeries1.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;

            var rs = from tick in (List <Ticket>)tickets
                     where tick.TicketDate >= fromDate && tick.TicketDate <= toDate && tick.GetType().ToString().Equals("AriCliModel.AnestheticTicket")
                     group tick by new { tick.TicketDate.Year, tick.TicketDate.Month } into g
                select new { Datos = g.Key, Total = g.Sum(tick => tick.Amount) };

            ChartSeriesItem serieItem;

            foreach (var item in rs)
            {
                serieItem        = new ChartSeriesItem();
                serieItem.YValue = (double)item.Total;
                serieItem.Name   = item.Datos.Month + "/" + item.Datos.Year;
                serieItem.Label.TextBlock.Text = item.Total.ToString();
                serieItem.Appearance.Exploded  = true;
                chartSeries1.AddItem(serieItem);
            }

            chart1.Series.Clear();
            chart1.Series.Add(chartSeries1);
        }
Пример #12
0
        private void BindReportGrid()
        {
            DataTable reportData = ReportProvider.GetReportByAccounts(SessionManager.CurrentUser.Id);

            DataTable xAxisItems = DataTableUtility.SelectDistinct(reportData, "Date");
            rcReport.XAxis.Clear();
            foreach (DataRow row in xAxisItems.Rows)
            {
                DateTime date = (DateTime) row["Date"];
                rcReport.XAxis.AddItem(date.ToString("MM/dd/yyyy"));
            }

            DataTable accounts = DataTableUtility.SelectDistinct(reportData, "AccountId");
            foreach (DataRow accountRow in accounts.Rows)
            {
                int accountId = (int) accountRow["AccountId"];
                Account account = AccountProvider.Get<Account>(accountId);

                ChartSeries series = new ChartSeries(account.Name, _currentColor, ChartSeriesType.Line);
                series.PointMark = ChartPointMark.None;
                series.ShowLabels = false;

                DataTable dates = DataTableUtility.SelectDistinct(reportData, "Date");
                foreach (DataRow dateRow in dates.Rows)
                {
                    DateTime date = (DateTime) dateRow["Date"];
                    double balance = 0;
                    string expression = string.Format("AccountId='{0}' and Date='{1}'", accountId, date);
                    DataRow[] founded = reportData.Select(expression);
                    if (founded.Length > 0)
                    {
                        balance = Convert.ToDouble(founded[0]["Balance"]);
                    }
                    series.AddItem(balance);
                }

                rcReport.AddChartSeries(series);
                SetNextColor();
            }
        }
        private void rptChartInboxMonthly_NeedDataSource(object sender, EventArgs e)
        {
            //Get Month and Year of all surat masuk
            //SuratkeluarQuery skq = new SuratkeluarQuery();
            //skq.Select(skq.Tanggal);
            //skq.es.Distinct = true;
            SuratkeluarQuery skQ = new SuratkeluarQuery("a");
            NomorQuery nQ = new NomorQuery("b");
            skQ.Select(nQ.Keterangan,skQ.Nomorid, skQ.Nomor.Count().As("jumlahsurat"));
            skQ.InnerJoin(nQ).On(skQ.Nomorid == nQ.Format);
            skQ.GroupBy(skQ.Nomorid);
            SuratkeluarCollection skC = new SuratkeluarCollection();
            skC.Load(skQ);
            if (skC.Count > 0)
            {
                foreach (Suratkeluar sk in skC)
                {
                    try
                    {
                        string jumlahSurat = sk.GetColumn("jumlahsurat").ToString();
                        //string Keterangan = sk.GetColumn(NomorMetadata.ColumnNames.Keterangan).ToString();
                        double JumlahSurat = 0;
                        if (!double.TryParse(jumlahSurat, out JumlahSurat))
                            JumlahSurat = 0;

                        ChartSeries cs = new ChartSeries();
                        cs.Name = "Surat Keluar";
                        cs.Type = ChartSeriesType.Bar;
                        cs.AddItem(JumlahSurat, sk.Nomorid);
                        this.chartSuratMasuk.Series.Add(cs);
                    }
                    catch (Exception ex)
                    { Ext.Net.X.Msg.Alert("error",ex.Message).Show(); }
                }
            }
        }
Пример #14
0
    protected void BolgelereGoreGetiriCizdir()
    {
        int DataCount = 0;

        using (Service1Client proxy = new Service1Client())
        {
            List <kal_sfBolgelereGoreGetiri_Result> Sonuc = proxy.kal_sfBolgelereGoreGetiri_ResultDon(clnBaslangicTarihi.SelectedDate.Value, clnBitisTarihi.SelectedDate.Value).ToList();
            gvBolgeGetiri.DataSource = Sonuc;
            gvBolgeGetiri.DataBind();


            DataCount = Sonuc.Count;
            chtBolgelerGetiri.Clear();
            chtBolgelerGetiri.ChartTitle.TextBlock.Text = "Getirilerine göre bölgeler";
            ChartSeries salesSeries = chtBolgelerGetiri.CreateSeries("Getiri", defaultColors[0], defaultColors[1], ChartSeriesType.Bar);

            int k = 0;
            foreach (var result in Sonuc)
            {
                //string bak = dr["Getiri"].ToString();
                string bak = result.Getiri.ToString();
                lblBolgeGetiriToplamYaz.Text = "Toplam Getiri=" + result.ToplamGetiri.ToString() + " TL";
                if (bak != "")
                {
                    double Getiri = double.Parse(result.Getiri.ToString());
                    salesSeries.AddItem(Convert.ToDouble(result.Getiri.Value), result.BolgeAdi, defaultColors[k + 1], false);
                    //salesSeries.AddItem(Convert.ToDouble(dr["Getiri"]), dr["BolgeAdi"].ToString(), defaultColors[k + 1], false);
                }
                chtBolgelerGetiri.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Ariel", 6);
                chtBolgelerGetiri.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Ariel", 6);
                k++;
            }

            chtBolgelerGetiri.Legend.Visible = false;
        }
    }
        protected new void Page_Init(object sender, EventArgs e)
        {
            base.Page_Init(sender, e);

            if (Request.QueryString["sort"] == null || Request.QueryString["level"] == null)
            {
                RedirectToPortalSelectionScreenWithCustomMessage("Invalid Request.");
            }

            _sort = Standpoint.Core.Utilities.DataIntegrity.ConvertToInt(Request.QueryString["sort"]);
            
            if (_sort == 0)
            {
                RedirectToPortalSelectionScreenWithCustomMessage("Invalid sort provided.");
                
            }
            _level = Request.QueryString["level"];
            _levelID = GetDecryptedEntityId("levelID").ToString();
            _critOrides = String.IsNullOrEmpty(Request.QueryString["critOrides"]) ? GetCriteriaOverrides(_level) : Request.QueryString["critOrides"];
            _testID = (String.IsNullOrEmpty(Request.QueryString["testID"]) ? String.Empty : Request.QueryString["testID"]);
            _formID = (String.IsNullOrEmpty(Request.QueryString["formID"]) ? String.Empty : Request.QueryString["formID"]);
            _parent = (String.IsNullOrEmpty(Request.QueryString["parent"]) ? String.Empty : Request.QueryString["parent"]);
            _parentID = (String.IsNullOrEmpty(Request.QueryString["parentID"]) ? String.Empty : Request.QueryString["parentID"]);
            _schoolID = String.Empty;

            if (_parent == "School")
            {
                _schoolID = _parentID;
            }
            else if (_level == "School")
            {
                _schoolID = _levelID;
            }

            var rationaleData = Thinkgate.Base.Classes.TestQuestion.GetTestQuestionRationale(0, _sort, SessionObject.LoggedInUser.Page, _level, _levelID, "", _critOrides, _testID, _formID, _level, _schoolID);
            if (rationaleData == null || rationaleData.Rows.Count == 0) return;
            var rationaleRow = rationaleData.Rows[0];

            testQuestionPieChart.Series.Clear();
            var nSeries = new ChartSeries();
            nSeries.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;

            nSeries.Type = ChartSeriesType.Pie;

            if (rationaleRow["QuestionType"].ToString().Contains("MC"))
            {
                if (rationaleRow["QuestionType"].ToString() == "MC3")
                {
                    nSeries.AddItem(GetChartSeriesItem("A", DataIntegrity.ConvertToDouble(rationaleRow["answerA"])));
                    nSeries.AddItem(GetChartSeriesItem("B", DataIntegrity.ConvertToDouble(rationaleRow["answerB"])));
                    nSeries.AddItem(GetChartSeriesItem("C", DataIntegrity.ConvertToDouble(rationaleRow["answerC"])));

                    lblAPercent.Text = String.Concat(rationaleRow["answerA"].ToString(), "%");
                    lblBPercent.Text = String.Concat(rationaleRow["answerB"].ToString(), "%");
                    lblCPercent.Text = String.Concat(rationaleRow["answerC"].ToString(), "%");

                    lblADescription.Text = rationaleRow["rationaleA"].ToString();
                    lblBDescription.Text = rationaleRow["rationaleB"].ToString();
                    lblCDescription.Text = rationaleRow["rationaleC"].ToString();

                    RationaleD.Visible = false;
                    RationaleE.Visible = false;
                }

                if (rationaleRow["QuestionType"].ToString() == "MC4")
                {
                    nSeries.AddItem(GetChartSeriesItem("A", DataIntegrity.ConvertToDouble(rationaleRow["answerA"])));
                    nSeries.AddItem(GetChartSeriesItem("B", DataIntegrity.ConvertToDouble(rationaleRow["answerB"])));
                    nSeries.AddItem(GetChartSeriesItem("C", DataIntegrity.ConvertToDouble(rationaleRow["answerC"])));
                    nSeries.AddItem(GetChartSeriesItem("D", DataIntegrity.ConvertToDouble(rationaleRow["answerD"])));

                    lblAPercent.Text = String.Concat(rationaleRow["answerA"].ToString(), "%");
                    lblBPercent.Text = String.Concat(rationaleRow["answerB"].ToString(), "%");
                    lblCPercent.Text = String.Concat(rationaleRow["answerC"].ToString(), "%");
                    lblDPercent.Text = String.Concat(rationaleRow["answerD"].ToString(), "%");

                    lblADescription.Text = rationaleRow["rationaleA"].ToString();
                    lblBDescription.Text = rationaleRow["rationaleB"].ToString();
                    lblCDescription.Text = rationaleRow["rationaleC"].ToString();
                    lblDDescription.Text = rationaleRow["rationaleD"].ToString();

                    RationaleE.Visible = false;
                }

                if (rationaleRow["QuestionType"].ToString() == "MC5")
                {
                    nSeries.AddItem(GetChartSeriesItem("A", DataIntegrity.ConvertToDouble(rationaleRow["answerA"])));
                    nSeries.AddItem(GetChartSeriesItem("B", DataIntegrity.ConvertToDouble(rationaleRow["answerB"])));
                    nSeries.AddItem(GetChartSeriesItem("C", DataIntegrity.ConvertToDouble(rationaleRow["answerC"])));
                    nSeries.AddItem(GetChartSeriesItem("D", DataIntegrity.ConvertToDouble(rationaleRow["answerD"])));
                    nSeries.AddItem(GetChartSeriesItem("E", DataIntegrity.ConvertToDouble(rationaleRow["answerE"])));

                    lblAPercent.Text = String.Concat(rationaleRow["answerA"].ToString(), "%");
                    lblBPercent.Text = String.Concat(rationaleRow["answerB"].ToString(), "%");
                    lblCPercent.Text = String.Concat(rationaleRow["answerC"].ToString(), "%");
                    lblDPercent.Text = String.Concat(rationaleRow["answerD"].ToString(), "%");
                    lblEPercent.Text = String.Concat(rationaleRow["answerE"].ToString(), "%");

                    lblADescription.Text = rationaleRow["rationaleA"].ToString();
                    lblBDescription.Text = rationaleRow["rationaleB"].ToString();
                    lblCDescription.Text = rationaleRow["rationaleC"].ToString();
                    lblDDescription.Text = rationaleRow["rationaleD"].ToString();
                    lblEDescription.Text = rationaleRow["rationaleE"].ToString();
                }
            }

            if (rationaleRow["QuestionType"].ToString().Trim() == "T")
            {
                RationaleA.Cells[0].InnerHtml = "T";
                RationaleB.Cells[0].InnerHtml = "F";

                nSeries.AddItem(GetChartSeriesItem("T", DataIntegrity.ConvertToDouble(rationaleRow["answerA"])));
                nSeries.AddItem(GetChartSeriesItem("F", DataIntegrity.ConvertToDouble(rationaleRow["answerB"])));

                lblAPercent.Text = String.Concat(rationaleRow["answerA"].ToString(), "%");
                lblBPercent.Text = String.Concat(rationaleRow["answerB"].ToString(), "%");

                lblADescription.Text = rationaleRow["rationaleA"].ToString();
                lblBDescription.Text = rationaleRow["rationaleB"].ToString();

                RationaleC.Visible = false;
                RationaleD.Visible = false;
                RationaleE.Visible = false;
            }



            testQuestionPieChart.Series.Add(nSeries);
            testQuestionPieChart.ChartTitle.TextBlock.Text = String.Concat("Item ", _sort);

        }
    private void BuildInscriptionDayChart()
    {
        radChartInscriptionDay.ChartTitle.TextBlock.Text = ResourceManager.GetString("lblEvolutionByDay");
        radChartInscriptionDay.Chart.Series.Clear();

        radChartInscriptionDay.PlotArea.Appearance.Dimensions.Margins.Left = 80;
        radChartInscriptionDay.PlotArea.Appearance.Dimensions.Margins.Right = 80;
        radChartInscriptionDay.PlotArea.Appearance.Dimensions.Margins.Top = 60;
        radChartInscriptionDay.PlotArea.Appearance.Dimensions.Margins.Bottom = 60;
        radChartInscriptionDay.PlotArea.YAxis.AxisLabel.TextBlock.Text = ResourceManager.GetString("lblStatisticsNbrOfCandidates");
        radChartInscriptionDay.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Font = new Font("Arial", 12, FontStyle.Bold);
        radChartInscriptionDay.PlotArea.YAxis.AxisLabel.Visible = true;
        radChartInscriptionDay.PlotArea.YAxis.VisibleValues = ChartAxisVisibleValues.Positive;

        radChartInscriptionDay.PlotArea.XAxis.AxisLabel.TextBlock.Text = ResourceManager.GetString("dayText");
        radChartInscriptionDay.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Font = new Font("Arial", 12, FontStyle.Bold);
        radChartInscriptionDay.PlotArea.XAxis.AxisLabel.Visible = true;

        radChartInscriptionDay.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new Font("Arial", 10);
        radChartInscriptionDay.PlotArea.XAxis.AutoScale = false;
        radChartInscriptionDay.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between;

        ChartSeries daySeries = new ChartSeries("Day", ChartSeriesType.Bar);
        daySeries.Appearance.FillStyle.MainColor = Color.LightBlue;
        daySeries.Appearance.FillStyle.FillType = FillType.Solid;
        daySeries.Appearance.TextAppearance.Visible = true;
        radChartInscriptionDay.AddChartSeries(daySeries);

        radChartInscriptionDay.PlotArea.XAxis.AddItem("D - 4");
        radChartInscriptionDay.PlotArea.XAxis.AddItem("D - 3");
        radChartInscriptionDay.PlotArea.XAxis.AddItem("D - 2");
        radChartInscriptionDay.PlotArea.XAxis.AddItem("D - 1");
        radChartInscriptionDay.PlotArea.XAxis.AddItem("Today");

        DateTime currentDay = DateTime.Today;
        //currentDay = currentDay.AddYears(-3);
        int day4No = NeosDAO.GetNumberOfCandiatesInscription(
            currentDay.AddDays(-4), currentDay.AddDays(-3).AddSeconds(-1));
        int day3No = NeosDAO.GetNumberOfCandiatesInscription(
            currentDay.AddDays(-3), currentDay.AddDays(-2).AddSeconds(-1));
        int day2No = NeosDAO.GetNumberOfCandiatesInscription(
            currentDay.AddDays(-2), currentDay.AddDays(-1).AddSeconds(-1));
        int day1No = NeosDAO.GetNumberOfCandiatesInscription(
            currentDay.AddDays(-1), currentDay.AddSeconds(-1));
        int dayNo = NeosDAO.GetNumberOfCandiatesInscription(
            currentDay, DateTime.Now);

        daySeries.AddItem(day4No);
        daySeries.AddItem(day3No);
        daySeries.AddItem(day2No);
        daySeries.AddItem(day1No);
        daySeries.AddItem(dayNo);
    }
Пример #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /****************************************************************
             * if user does not have Tab_Search_Staff permissions, then hide
             * the search tab and the radPageView associated with it.
             * *************************************************************/
            if (!UserHasPermission(Permission.Tab_Search_Staff))
            {
                radPageViewStaffSearch.Visible = false;
                foreach (Telerik.Web.UI.RadTab tab in RadTabStrip2.Tabs)
                {
                    if (tab.Text == "Search")
                    {
                        tab.Visible = false;
                        break;
                    }
                }
            }

            /*******************************************************************
             * If user does not have Icon_Expanded_Staff permissions, then hide
             * the "Advanced Search" link via its surrounding div tag.
             * ****************************************************************/
            StaffSearch_DivAdvancedSearch.Visible = (UserHasPermission(Permission.Icon_ExpandedSearch_Staff));

            _level = SessionObject.LCOrole;
            _levelID = DataIntegrity.ConvertToInt(Tile.TileParms.GetParm("levelID"));

            staffSearch_HiddenLevel.Value = _level.ToString();
            staffSearch_HiddenLevelID.Value = Standpoint.Core.Classes.Encryption.EncryptInt(_levelID);
            staffPieChartXmlHttpPanel.Value = string.Empty;

            DataTable countData;
            string chartSeriesItemName = string.Empty;
            switch (_level)
            {
                case Base.Enums.EntityTypes.LCOAdministrator:
                    countData = Base.Classes.LCO.GetStaffCounts();
                    chartSeriesItemName = "PortalName";
                    break;
                case Base.Enums.EntityTypes.District:
                    countData = Base.Classes.Staff.GetStateStaffCounts();
                    chartSeriesItemName = "loweredrolename";
                    break;
                default:
                    return;
            }

            staffCountChart.DataSource = countData;
            staffCountChart.ChartTitle.Visible = false;
            staffCountChart.DataBind();

            // Handle Legend Labels
            staffCountChart.Series.Clear();
            var nSeries = new ChartSeries();
            nSeries.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;

            foreach (DataRow dr in countData.Rows)
            {
                var value = DataIntegrity.ConvertToDouble(dr["StaffCount"]);
                var myItem = new ChartSeriesItem(value) { Name = dr[chartSeriesItemName].ToString() };
                if (value <= 0) myItem.Label.Visible = false;
                nSeries.Type = ChartSeriesType.Pie;
                nSeries.AddItem(myItem);
            }

            staffCountChart.Series.Add(nSeries);

            if (IsPostBack)
            {
                // Reloads previous search results if session object search text has a value
                if (staffSearchText_smallTile.Value == "Search by last name..." && SessionObject.TeacherSearchTxtPostBack_smallTile != null
                        && SessionObject.TeacherSearchTxtPostBack_smallTile.Length > 0)
                {
                    SearchStaffByLastName_Click(null, null);
                }

                return;
            }

            staffSearchMoreLink.Visible = false;
            staffSearchTileGrid.Visible = false;
            addNewStaff.Visible = UserHasPermission(Base.Enums.Permission.Create_Staff);
        }
    private void BuildInscriptionWeekChart()
    {
        radChartInscriptionWeek.ChartTitle.TextBlock.Text = ResourceManager.GetString("lblEvolutionByWeek");
        radChartInscriptionWeek.Chart.Series.Clear();

        radChartInscriptionWeek.PlotArea.Appearance.Dimensions.Margins.Left = 80;
        radChartInscriptionWeek.PlotArea.Appearance.Dimensions.Margins.Right = 80;
        radChartInscriptionWeek.PlotArea.Appearance.Dimensions.Margins.Top = 60;
        radChartInscriptionWeek.PlotArea.Appearance.Dimensions.Margins.Bottom = 60;
        radChartInscriptionWeek.PlotArea.YAxis.AxisLabel.TextBlock.Text = ResourceManager.GetString("lblStatisticsNbrOfCandidates");
        radChartInscriptionWeek.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Font = new Font("Arial", 12, FontStyle.Bold);
        radChartInscriptionWeek.PlotArea.YAxis.AxisLabel.Visible = true;
        radChartInscriptionWeek.PlotArea.YAxis.VisibleValues = ChartAxisVisibleValues.Positive;

        radChartInscriptionWeek.PlotArea.XAxis.AxisLabel.TextBlock.Text = ResourceManager.GetString("weekText");
        radChartInscriptionWeek.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Font = new Font("Arial", 12, FontStyle.Bold);
        radChartInscriptionWeek.PlotArea.XAxis.AxisLabel.Visible = true;

        radChartInscriptionWeek.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new Font("Arial", 10);
        radChartInscriptionWeek.PlotArea.XAxis.AutoScale = false;
        radChartInscriptionWeek.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between;

        ChartSeries weekSeries = new ChartSeries("Week", ChartSeriesType.Bar);
        weekSeries.Appearance.FillStyle.MainColor = Color.LightSteelBlue;
        weekSeries.Appearance.FillStyle.FillType = FillType.Solid;
        weekSeries.Appearance.TextAppearance.Visible = true;
        radChartInscriptionWeek.AddChartSeries(weekSeries);

        radChartInscriptionWeek.PlotArea.XAxis.AddItem("W - 4");
        radChartInscriptionWeek.PlotArea.XAxis.AddItem("W - 3");
        radChartInscriptionWeek.PlotArea.XAxis.AddItem("W - 2");
        radChartInscriptionWeek.PlotArea.XAxis.AddItem("W - 1");
        radChartInscriptionWeek.PlotArea.XAxis.AddItem("This week");

        DateTime beginWeek = Common.GetBeginDayOfWeek(DateTime.Today);
        //beginWeek = beginWeek.AddYears(-3);
        int week4No = NeosDAO.GetNumberOfCandiatesInscription(
            beginWeek.AddDays(-28), beginWeek.AddDays(-21).AddSeconds(-1));
        int week3No = NeosDAO.GetNumberOfCandiatesInscription(
            beginWeek.AddDays(-21), beginWeek.AddDays(-14).AddSeconds(-1));
        int week2No = NeosDAO.GetNumberOfCandiatesInscription(
            beginWeek.AddDays(-14), beginWeek.AddDays(-7).AddSeconds(-1));
        int week1No = NeosDAO.GetNumberOfCandiatesInscription(
            beginWeek.AddDays(-7), beginWeek.AddSeconds(-1));
        int weekNo = NeosDAO.GetNumberOfCandiatesInscription(
            beginWeek, DateTime.Now);

        weekSeries.AddItem(week4No);
        weekSeries.AddItem(week3No);
        weekSeries.AddItem(week2No);
        weekSeries.AddItem(week1No);
        weekSeries.AddItem(weekNo);
    }
    private void BuildInscriptionYearChart()
    {
        radChartInscriptionYear.ChartTitle.TextBlock.Text = ResourceManager.GetString("lblEvolutionByYear");
        radChartInscriptionYear.Chart.Series.Clear();

        radChartInscriptionYear.PlotArea.Appearance.Dimensions.Margins.Left = 80;
        radChartInscriptionYear.PlotArea.Appearance.Dimensions.Margins.Right = 80;
        radChartInscriptionYear.PlotArea.Appearance.Dimensions.Margins.Top = 60;
        radChartInscriptionYear.PlotArea.Appearance.Dimensions.Margins.Bottom = 60;
        radChartInscriptionYear.PlotArea.YAxis.AxisLabel.TextBlock.Text = ResourceManager.GetString("lblStatisticsNbrOfCandidates");
        radChartInscriptionYear.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Font = new Font("Arial", 12, FontStyle.Bold);
        radChartInscriptionYear.PlotArea.YAxis.AxisLabel.Visible = true;
        radChartInscriptionYear.PlotArea.YAxis.VisibleValues = ChartAxisVisibleValues.Positive;

        radChartInscriptionYear.PlotArea.XAxis.AxisLabel.TextBlock.Text = ResourceManager.GetString("yearText");
        radChartInscriptionYear.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Font = new Font("Arial", 12, FontStyle.Bold);
        radChartInscriptionYear.PlotArea.XAxis.AxisLabel.Visible = true;

        radChartInscriptionYear.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new Font("Arial", 10);
        radChartInscriptionYear.PlotArea.XAxis.AutoScale = false;
        radChartInscriptionYear.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between;

        ChartSeries yearSeries = new ChartSeries("Year", ChartSeriesType.Bar);
        yearSeries.Appearance.FillStyle.MainColor = Color.Pink;
        yearSeries.Appearance.FillStyle.FillType = FillType.Solid;
        yearSeries.Appearance.TextAppearance.Visible = true;
        radChartInscriptionYear.AddChartSeries(yearSeries);

        int currentYear = DateTime.Today.Year;
        radChartInscriptionYear.PlotArea.XAxis.AddItem((currentYear - 4).ToString());
        radChartInscriptionYear.PlotArea.XAxis.AddItem((currentYear - 3).ToString());
        radChartInscriptionYear.PlotArea.XAxis.AddItem((currentYear - 2).ToString());
        radChartInscriptionYear.PlotArea.XAxis.AddItem((currentYear - 1).ToString());
        radChartInscriptionYear.PlotArea.XAxis.AddItem((currentYear).ToString());

        int year4No = NeosDAO.GetNumberOfCandiatesInscription(new DateTime(currentYear - 4, 1, 1, 0, 0, 0),
            new DateTime(currentYear - 4, 12, 31, 23, 59, 59));
        int year3No = NeosDAO.GetNumberOfCandiatesInscription(new DateTime(currentYear - 3, 1, 1, 0, 0, 0),
            new DateTime(currentYear - 3, 12, 31, 23, 59, 59));
        int year2No = NeosDAO.GetNumberOfCandiatesInscription(new DateTime(currentYear - 2, 1, 1, 0, 0, 0),
            new DateTime(currentYear - 2, 12, 31, 23, 59, 59));
        int year1No = NeosDAO.GetNumberOfCandiatesInscription(new DateTime(currentYear - 1, 1, 1, 0, 0, 0),
            new DateTime(currentYear - 1, 12, 31, 23, 59, 59));
        int yearNo = NeosDAO.GetNumberOfCandiatesInscription(new DateTime(currentYear, 1, 1, 0, 0, 0),
            DateTime.Now);

        yearSeries.AddItem(year4No);
        yearSeries.AddItem(year3No);
        yearSeries.AddItem(year2No);
        yearSeries.AddItem(year1No);
        yearSeries.AddItem(yearNo);
    }
    // Graphs
    protected void BindChart(RadChart chart, ChartSeriesType chartType, String chartTimeScale)
    {
        // Clear chart and reset total_usd
        double total_usd = 0;

        chart.Clear();
        chart.PlotArea.XAxis.Items.Clear();

        // Define parent chart series and format
        ChartSeries parent_series = new ChartSeries("parent_series", chartType);

        parent_series.Appearance.LegendDisplayMode = Telerik.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
        parent_series.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange;
        chart.Series.Add(parent_series);

        // Iterate offices
        double highest_price = 0;
        double lowest_price  = 999999;

        for (int i = 0; i < offices.Rows.Count; i++)
        {
            String territory = (String)offices.Rows[i]["Office"];
            String shortname = (String)offices.Rows[i]["ShortName"];
            Color  colour    = Util.ColourTryParse((String)offices.Rows[i]["Colour"]);

            // Toggle latest/annual data
            String timeScaleExpr = String.Empty;
            if (chartTimeScale == "latest")
            {
                timeScaleExpr = "=(SELECT SalesBookID FROM db_salesbookhead WHERE Office=@office ORDER BY StartDate DESC LIMIT 1) ";
            }
            else if (chartTimeScale == "annual")
            {
                timeScaleExpr = "IN (SELECT SalesBookID FROM db_salesbookhead WHERE Office=@office AND YEAR(StartDate)=@year) ";
            }

            // For each office..
            String qry = "SELECT ROUND(IFNULL(CONVERT(SUM(Price*Conversion), SIGNED),0)- " +
                         "IFNULL((SELECT CONVERT(SUM(rl_price*Conversion), SIGNED) " +
                         "FROM db_salesbook sb, db_salesbookhead sbh " +
                         "WHERE sb.rl_sb_id = sbh.SalesBookID " +
                         "AND sbh.SalesBookID " + timeScaleExpr +
                         "AND red_lined=1 AND IsDeleted=0 AND Office=@office),0)) as total_price " +
                         "FROM db_salesbook sb, db_salesbookhead sbh " +
                         "WHERE sb.sb_id = sbh.SalesBookID " +
                         "AND sbh.SalesBookID " + timeScaleExpr +
                         "AND deleted=0 AND IsDeleted=0";
            String[]  pn         = { "@office", "@year" };
            Object[]  pv         = { territory, dd_annual_year.Text };
            DataTable totalprice = SQL.SelectDataTable(qry, pn, pv);

            if (totalprice.Rows.Count > 0 && totalprice.Rows[0]["total_price"] != DBNull.Value)
            {
                double price             = Convert.ToDouble(totalprice.Rows[0]["total_price"]);
                String currency_terrtory = territory;

                total_usd += price;

                // Get max and min for chart padding
                highest_price = Math.Max(highest_price, price);
                lowest_price  = Math.Min(lowest_price, price);

                ChartSeriesItem csi_item = new ChartSeriesItem(
                    price,
                    Util.TextToCurrency(price.ToString(), "usd"),
                    colour,
                    false);

                csi_item.Name   = territory;
                csi_item.Parent = parent_series;
                parent_series.AddItem(csi_item);

                if (chart.ID.Contains("bar"))
                {
                    chart.PlotArea.XAxis.Items.Add(new ChartAxisItem(shortname));
                }
                else
                {
                    csi_item.Appearance.FillStyle.MainColor   = colour;
                    csi_item.Appearance.FillStyle.SecondColor = colour;
                }
            }
        }

        // Individual chart formatting
        if (chart.ID.Contains("rc_pie"))
        {
            parent_series.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange;
            lbl_drill_down.Text      = "Click a pie section to drill down";
            chart.ChartTitle.Visible = false;
            chart.Height             = 300;
        }
        else if (chart.ID.Contains("rc_bar"))
        {
            if (chart.ID.Contains("latest"))
            {
                parent_series.ActiveRegionToolTip = "Click to view the latest book for this territory.";
            }
            parent_series.Appearance.TextAppearance.TextProperties.Font = new Font("Verdana", 8, FontStyle.Regular);

            if (lowest_price != 0)
            {
                lowest_price = (lowest_price + (lowest_price / 100) * 40);
            }
            double step = highest_price / 10;
            if (step == 0)
            {
                step = 1;
            }
            rc_bar_latest.PlotArea.YAxis.AddRange(0, (highest_price + (highest_price / 100) * 20), step);
        }

        // Set total USD label
        lbl_total_usd.Text = "Total USD: " + Util.TextToCurrency(total_usd.ToString(), "us");
    }
    private void BuildInscriptionMonthChart()
    {
        radChartInscriptionMonth.ChartTitle.TextBlock.Text = ResourceManager.GetString("lblEvolutionByMonth");
        radChartInscriptionMonth.Chart.Series.Clear();

        radChartInscriptionMonth.PlotArea.Appearance.Dimensions.Margins.Left = 80;
        radChartInscriptionMonth.PlotArea.Appearance.Dimensions.Margins.Right = 80;
        radChartInscriptionMonth.PlotArea.Appearance.Dimensions.Margins.Top = 60;
        radChartInscriptionMonth.PlotArea.Appearance.Dimensions.Margins.Bottom = 60;
        radChartInscriptionMonth.PlotArea.YAxis.AxisLabel.TextBlock.Text = ResourceManager.GetString("lblStatisticsNbrOfCandidates");
        radChartInscriptionMonth.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Font = new Font("Arial", 12, FontStyle.Bold);
        radChartInscriptionMonth.PlotArea.YAxis.AxisLabel.Visible = true;
        radChartInscriptionMonth.PlotArea.YAxis.VisibleValues = ChartAxisVisibleValues.Positive;

        radChartInscriptionMonth.PlotArea.XAxis.AxisLabel.TextBlock.Text = ResourceManager.GetString("monthText");
        radChartInscriptionMonth.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Font = new Font("Arial", 12, FontStyle.Bold);
        radChartInscriptionMonth.PlotArea.XAxis.AxisLabel.Visible = true;

        radChartInscriptionMonth.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new Font("Arial", 10);
        radChartInscriptionMonth.PlotArea.XAxis.AutoScale = false;
        radChartInscriptionMonth.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between;

        ChartSeries monthSeries = new ChartSeries("Month", ChartSeriesType.Bar);
        monthSeries.Appearance.FillStyle.MainColor = Color.Orange;
        monthSeries.Appearance.FillStyle.FillType = FillType.Solid;
        monthSeries.Appearance.TextAppearance.Visible = true;
        radChartInscriptionMonth.AddChartSeries(monthSeries);

        int currentMonth = DateTime.Today.Month;

        radChartInscriptionMonth.PlotArea.XAxis.AddItem("M - 4");
        radChartInscriptionMonth.PlotArea.XAxis.AddItem("M - 3");
        radChartInscriptionMonth.PlotArea.XAxis.AddItem("M - 2");
        radChartInscriptionMonth.PlotArea.XAxis.AddItem("M - 1");
        radChartInscriptionMonth.PlotArea.XAxis.AddItem("This month");

        DateTime beginMonth = new DateTime(DateTime.Today.Year, currentMonth, 1, 0, 0, 0);
        int month4No = NeosDAO.GetNumberOfCandiatesInscription(
            beginMonth.AddMonths(-4), beginMonth.AddMonths(-3).AddSeconds(-1));
        int month3No = NeosDAO.GetNumberOfCandiatesInscription(
            beginMonth.AddMonths(-3), beginMonth.AddMonths(-2).AddSeconds(-1));
        int month2No = NeosDAO.GetNumberOfCandiatesInscription(
            beginMonth.AddMonths(-2), beginMonth.AddMonths(-1).AddSeconds(-1));
        int month1No = NeosDAO.GetNumberOfCandiatesInscription(
            beginMonth.AddMonths(-1), beginMonth.AddSeconds(-1));
        int monthNo = NeosDAO.GetNumberOfCandiatesInscription(
            beginMonth, DateTime.Now);

        monthSeries.AddItem(month4No);
        monthSeries.AddItem(month3No);
        monthSeries.AddItem(month2No);
        monthSeries.AddItem(month1No);
        monthSeries.AddItem(monthNo);
    }
    protected void BindBetweenChart(object sender, EventArgs e)
    {
        // Clear
        rc_bar_between.Clear();
        rc_bar_between.PlotArea.XAxis.Items.Clear();

        // Get dates from calander boxes.
        DateTime start_date = Convert.ToDateTime(rdp_between_start.SelectedDate);
        DateTime end_date   = Convert.ToDateTime(rdp_between_end.SelectedDate);

        bool anyTerritoriesChecked = false;

        for (int i = 0; i < rtv_offices.Nodes[0].Nodes.Count; i++)
        {
            if (rtv_offices.Nodes[0].Nodes[i].Checked == true)
            {
                anyTerritoriesChecked = true;
                break;
            }
        }

        if (start_date > end_date)
        {
            Util.PageMessage(this, "Start date cannot be after the end date!");
        }
        else if (rdp_between_start.SelectedDate == null || rdp_between_end.SelectedDate == null)
        {
            Util.PageMessage(this, "Please ensure you specify a start and an end date.");
        }
        else if (!anyTerritoriesChecked)
        {
            Util.PageMessage(this, "Must have at least one territory selected.");
        }
        else
        {
            // Define parent chart series
            ChartSeries parent_series = new ChartSeries("parent_series", ChartSeriesType.Bar);
            parent_series.Appearance.TextAppearance.TextProperties.Font = new Font("Verdana", 8, FontStyle.Regular);
            parent_series.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
            parent_series.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange;
            rc_bar_between.Series.Add(parent_series);

            for (int i = 0; i < rtv_offices.Nodes[0].Nodes.Count; i++)
            {
                if (rtv_offices.Nodes[0].Nodes[i].Checked)
                {
                    String territory = rtv_offices.Nodes[0].Nodes[i].Text;
                    String qry       = "SELECT IFNULL(CONVERT(SUM(Price*Conversion),SIGNED),0) as total_price " +
                                       "FROM db_salesbook sb, db_salesbookhead sbh " +
                                       "WHERE sb.sb_id = sbh.SalesBookID " +
                                       "AND Office=@office " +
                                       "AND ent_date BETWEEN @start_date AND @end_date " +
                                       "AND deleted=0 AND IsDeleted=0 AND red_lined=0";
                    String[]  pn         = { "@start_date", "@end_date", "@office" };
                    Object[]  pv         = { start_date.ToString("yyyy/MM/dd"), end_date.ToString("yyyy/MM/dd"), territory };
                    DataTable totalprice = SQL.SelectDataTable(qry, pn, pv);

                    if (totalprice.Rows.Count > 0 && totalprice.Rows[0]["total_price"] != DBNull.Value)
                    {
                        double          price    = Convert.ToDouble(totalprice.Rows[0]["total_price"]);
                        ChartSeriesItem csi_item = new ChartSeriesItem(
                            price,
                            Util.TextToCurrency(price.ToString(), "usd"),
                            Util.ColourTryParse(rtv_offices.Nodes[0].Nodes[i].Value),
                            false);

                        csi_item.Name   = territory;
                        csi_item.Parent = parent_series;
                        parent_series.AddItem(csi_item);
                        rc_bar_between.PlotArea.XAxis.Items.Add(new ChartAxisItem(territory));
                    }
                }
            }
        }
    }
Пример #23
0
    protected RadChart GenerateVersusChart(String office)
    {
        RadChart rc = new RadChart();

        rc.Clear();
        rc.PlotArea.XAxis.Items.Clear();

        rc.Width  = 450;
        rc.Height = 300;
        rc.Skin   = "Black";
        rc.ChartTitle.TextBlock.Text = office + ": Weekly SPA Overview (Target to Actual)";
        rc.ChartTitle.TextBlock.Appearance.TextProperties.Font = new Font("Verdana", 10, FontStyle.Regular);
        rc.PlotArea.EmptySeriesMessage.TextBlock.Text          = "Error, database connection could not be establised.";
        //rc.PlotArea.SeriesOrientation = ChartSeriesOrientation.Horizontal;
        rc.Legend.Appearance.Visible = false;
        rc.PlotArea.YAxis.Appearance.TextAppearance.Visible = false;
        rc.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange;
        rc.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange;
        rc.PlotArea.XAxis.AutoScale = false;
        rc.PlotArea.YAxis.AutoScale = false;
        rc.AutoLayout = true;

        // Define chart target series
        ChartSeries SPATargetSeries = new ChartSeries("revTarget", ChartSeriesType.Bar);

        SPATargetSeries.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
        SPATargetSeries.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange;;
        SPATargetSeries.Appearance.TextAppearance.TextProperties.Font  = new Font("Verdana", 7, FontStyle.Regular);
        rc.Series.Add(SPATargetSeries);

        // Define chart values series
        ChartSeries SPASeries = new ChartSeries("rev", ChartSeriesType.Bar);

        SPASeries.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
        SPASeries.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange;;
        SPASeries.Appearance.TextAppearance.TextProperties.Font  = new Font("Verdana", 7, FontStyle.Regular);
        rc.Series.Add(SPASeries);

        int s       = 0;
        int p       = 0;
        int a       = 0;
        int tr      = 0;
        int pr      = 0;
        int no_ccas = 0;

        // Grab SPA
        String qry = "SELECT prh.ProgressReportID," +
                     "SUM((mS+tS+wS+thS+fS+xS)) as Suspects, " +
                     "SUM((mP+tP+wP+thP+fP+xP)) as Prospects, " +
                     "SUM((mA+tA+wA+thA+fA+xA)) as Approvals, " +
                     "SUM((mTotalRev+tTotalRev+wTotalRev+thTotalRev+fTotalRev+xTotalRev)) as TR, " +
                     "SUM(PersonalRevenue) as PR, " +
                     "COUNT(*) as CCAs, " +
                     "0 as RD, " +
                     "0 as PD " +
                     "FROM db_progressreport pr, db_progressreporthead prh " +
                     "WHERE prh.ProgressReportID = pr.ProgressReportID " +
                     "AND Office=@office " +
                     "GROUP BY prh.ProgressReportID " +
                     "ORDER BY StartDate DESC LIMIT 1";
        DataTable dt_report_info = SQL.SelectDataTable(qry, "@office", office);

        if (dt_report_info.Rows.Count > 0)
        {
            // Grab Target SPA
            int no_631 = 0;
            int no_321 = 0;
            qry = "SELECT CCAType, COUNT(*) as no FROM db_progressreport WHERE ProgressReportID=@ProgressReportID GROUP BY CCAType";
            DataTable ccas_types = SQL.SelectDataTable(qry, "@ProgressReportID", dt_report_info.Rows[0]["ProgressReportID"]);
            if (ccas_types.Rows.Count > 0)
            {
                for (int j = 0; j < ccas_types.Rows.Count; j++)
                {
                    switch (ccas_types.Rows[j]["CCAType"].ToString())
                    {
                    case "-1":
                        no_631 += Convert.ToInt32(ccas_types.Rows[j]["no"]);
                        break;

                    case "1":
                        no_631 += Convert.ToInt32(ccas_types.Rows[j]["no"]);
                        break;

                    case "2":
                        no_321 = Convert.ToInt32(ccas_types.Rows[j]["no"]);
                        break;
                    }
                }
            }
            int target_s = (no_631 * 3) + (no_321 * 6);
            int target_p = (no_631 * 2) + (no_321 * 3);
            int target_a = no_631 + no_321;

            s       = Convert.ToInt32(dt_report_info.Rows[0]["Suspects"]);
            p       = Convert.ToInt32(dt_report_info.Rows[0]["Prospects"]);
            a       = Convert.ToInt32(dt_report_info.Rows[0]["Approvals"]);
            tr      = Convert.ToInt32(dt_report_info.Rows[0]["TR"]);
            pr      = Convert.ToInt32(dt_report_info.Rows[0]["PR"]);
            no_ccas = Convert.ToInt32(dt_report_info.Rows[0]["CCAs"]);

            int greatest = s;
            greatest = Math.Max(p, greatest);
            greatest = Math.Max(a, greatest);
            greatest = Math.Max(a, greatest);
            greatest = Math.Max(target_s, greatest);
            greatest = Math.Max(target_p, greatest);
            greatest = Math.Max(target_a, greatest);
            greatest = Convert.ToInt32((((float)greatest / 100) * 108));

            double max_value = Convert.ToDouble(greatest) + 0.5;
            double step      = 1;
            rc.PlotArea.YAxis.AddRange(0, max_value, step);

            // Actual SPA
            ChartSeriesItem csi_a = new ChartSeriesItem(a, a.ToString(), Color.DodgerBlue, false);
            ChartSeriesItem csi_p = new ChartSeriesItem(p, p.ToString(), Color.Magenta, false);
            ChartSeriesItem csi_s = new ChartSeriesItem(s, s.ToString(), Color.Lime, false);
            // Target SPA
            ChartSeriesItem csi_ta = new ChartSeriesItem(target_a, target_a.ToString(), Color.DarkOrange, false);
            ChartSeriesItem csi_tp = new ChartSeriesItem(target_p, target_p.ToString(), Color.DarkOrange, false);
            ChartSeriesItem csi_ts = new ChartSeriesItem(target_s, target_s.ToString(), Color.DarkOrange, false);

            SPASeries.AddItem(csi_a);
            SPASeries.AddItem(csi_p);
            SPASeries.AddItem(csi_s);
            SPATargetSeries.AddItem(csi_ta);
            SPATargetSeries.AddItem(csi_tp);
            SPATargetSeries.AddItem(csi_ts);

            rc.PlotArea.XAxis.Items.Add(new ChartAxisItem("Ap"));
            rc.PlotArea.XAxis.Items.Add(new ChartAxisItem("Pr"));
            rc.PlotArea.XAxis.Items.Add(new ChartAxisItem("Su"));
            //rc.PlotArea.XAxis.Items.Add(new ChartAxisItem("T" + Environment.NewLine + Environment.NewLine + "A"));
            SPASeries.Appearance.Border.PenStyle = System.Drawing.Drawing2D.DashStyle.Dot;
            SPASeries.Appearance.Border.Visible  = true;
        }
        else
        {
            rc = null;
        }

        return(rc);
    }
        protected void Page_Load(object sender, EventArgs e)
        {            
            if (_levelID <= 0) return;


            List<AsyncPageTask> taskList = new List<AsyncPageTask>();
            taskList.Add(new AsyncPageTask(GetStudentCounts));
            taskList.Add(new AsyncPageTask(LoadDistrictParms));

            foreach (AsyncPageTask page in taskList)
            {
                PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "StudentSearch", true);
                Page.RegisterAsyncTask(newTask);
            }
            taskList = null;
            Page.ExecuteRegisteredAsyncTasks();

            studentCountChart.DataSource = countData;
            studentCountChart.ChartTitle.Visible = false;
            studentCountChart.DataBind();

            studentPieChartXmlHttpPanel.Value = "";

            //Handle Legend Labels
            studentCountChart.Series.Clear();
            var nSeries = new ChartSeries();

            studentCountChart.PlotArea.Appearance.FillStyle.MainColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
            studentCountChart.PlotArea.Appearance.FillStyle.FillType = FillType.Solid;
            studentCountChart.PlotArea.Appearance.Border.Color = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
           
            studentCountChart.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 8);
            studentCountChart.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 8);
            studentCountChart.PlotArea.XAxis.Appearance.LabelAppearance.Position.AlignedPosition = AlignedPositions.TopRight;
            nSeries.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.Black;
            nSeries.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 8);
            nSeries.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
            
            var count = 0;

            //change to foreach for easier reading
            var gradeList = new List<string>();
            foreach (DataRow dr in countData.Rows)
            {
                var value = DataIntegrity.ConvertToDouble(dr["StudentCount"]);
                var xValue = 0;
                switch (_level)
                {
                    case EntityTypes.Teacher:
                        xValue = dr.Table.Columns.Contains("ClassID") ? DataIntegrity.ConvertToInt(dr["ClassID"]) : 0;
                        break;
                    case EntityTypes.School:
                        gradeList.Add(dr.Table.Columns.Contains("GradeNumber") ? dr["GradeNumber"].ToString() : string.Empty);
                        xValue = gradeList.Count - 1;
                        break;
                }

                var myItem = new ChartSeriesItem(value) { Name = dr["Grade"].ToString(), XValue = xValue };
                myItem.Appearance.FillStyle.MainColor = System.Drawing.ColorTranslator.FromHtml(StyleController.GetPieChartColor(dr["Grade"].ToString(), count++)); ;
                myItem.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;
                
                if (value <= 0) myItem.Label.Visible = false;

                nSeries.Type = ChartSeriesType.Pie;
                nSeries.AddItem(myItem);
                /*
                var classIDValue = DataIntegrity.ConvertToDouble(dr["ClassID"]);
                var classItem = new ChartSeriesItem(classIDValue) { XValue = DataIntegrity.ConvertToDouble(dr["ClassID"]) };
                classItem.Label.Visible = false;*/


                /****************************************************************
                 * if user does not have Tab_Search_Staff permissions, then hide
                 * the search tab and the radPageView associated with it.
                 * *************************************************************/
                if (!UserHasPermission(Permission.Tab_Search_Students))
                {
                    RadPageView2.Visible = false;
                    foreach (Telerik.Web.UI.RadTab tab in RadTabStrip2.Tabs)
                    {
                        if (tab.Text == "Search")
                        {
                            tab.Visible = false;
                            break;
                        }
                    }
                }

                /*******************************************************************
                 * If user does not have Icon_ExpandedSearch_Students permissions, 
                 * then hide the "Advanced Search" link via its surrounding div tag.
                 * ****************************************************************/

                StudentSearch_DivAdvancedSearch.Visible = (UserHasPermission(Permission.Icon_ExpandedSearch_Students));

            }

            SessionObject.StudentSearchParms.AddParm("GradeListFilter", gradeList);

            studentCountChart.Series.Add(nSeries);

            if (IsPostBack)
            {
                //Reloads previous search results if session object search text has a value
                if (studentsSearchText_smallTile.Value == "Search by last name..." && SessionObject.StudentSearchTxtPostBack_smallTile != null
                    && SessionObject.StudentSearchTxtPostBack_smallTile.Length > 0)
                    SearchStudentsByLastName_Click(null, null);

                return;
            }

            studentSearchMoreLink.Visible = false;
            studentsSearchTileGrid.Visible = false;
            enrollStudent.Visible = UserHasPermission(Base.Enums.Permission.Enroll_Student);
            addNewStudent.Visible = UserHasPermission(Base.Enums.Permission.Create_Student);
        }
Пример #25
0
    // Generate
    protected void Bind()
    {
        String betweenExpr = "";
        String limitExpr   = "";

        if (dp_start.SelectedDate != null && dp_end.SelectedDate != null)
        {
            betweenExpr = " WHERE date BETWEEN @start_date AND @end_date ";
        }
        else
        {
            limitExpr = " LIMIT 50";
        }

        // Reportb reakdown data
        String qry = "SELECT * FROM dh_datahubmastercount " + betweenExpr + " ORDER BY date " + limitExpr;

        String[] pn = null;
        Object[] pv = null;
        if (betweenExpr != "")
        {
            pn = new String[] { "@start_date", "@end_date" };
            pv = new Object[] { Convert.ToDateTime(dp_start.SelectedDate).ToString("yyyy/MM/dd"),
                                Convert.ToDateTime(dp_end.SelectedDate).ToString("yyyy/MM/dd") };
        }
        DataTable totals = SQL.SelectDataTable(qry, pn, pv);

        qry = "SELECT * FROM dh_datahubmastercount ORDER BY date DESC LIMIT 1";
        DataTable latest = SQL.SelectDataTable(qry, null, null);

        qry = "SELECT IFNULL(MAX(companies),0) as maxcomp, IFNULL(MIN(companies),0) as mincomp, IFNULL(MAX(contacts),0) as maxcon, IFNULL(MIN(contacts),0) as mincon, " +
              "IFNULL(MAX(emails),0) as maxe, IFNULL(MIN(emails),0) as mine " +
              "FROM dh_datahubmastercount " + betweenExpr;
        pn = null;
        pv = null;
        if (betweenExpr != "")
        {
            pn = new String[] { "@start_date", "@end_date" };
            pv = new Object[] { Convert.ToDateTime(dp_start.SelectedDate).ToString("yyyy/MM/dd"),
                                Convert.ToDateTime(dp_end.SelectedDate).ToString("yyyy/MM/dd") };
        }
        DataTable maxvals = SQL.SelectDataTable(qry, pn, pv);

        qry = "SELECT date, notes FROM dh_datahubmastercount " +
              "WHERE notes != '' AND notes IS NOT NULL " + betweenExpr.Replace("WHERE", "AND");
        pn = null;
        pv = null;
        if (betweenExpr != "")
        {
            pn = new String[] { "@start_date", "@end_date" };
            pv = new Object[] { Convert.ToDateTime(dp_start.SelectedDate).ToString("yyyy/MM/dd"),
                                Convert.ToDateTime(dp_end.SelectedDate).ToString("yyyy/MM/dd") };
        }
        DataTable notes = SQL.SelectDataTable(qry, pn, pv);

        gv_notes.DataSource = notes;
        gv_notes.DataBind();

        ////////////////////// Graphs //////////////////////////
        rc_companies.Clear();
        rc_companies.PlotArea.XAxis.RemoveAllItems();
        rc_contacts.Clear();
        rc_contacts.PlotArea.XAxis.RemoveAllItems();
        rc_emails.Clear();
        rc_emails.PlotArea.XAxis.RemoveAllItems();

        rc_companies.Legend.Appearance.Visible = false;
        rc_companies.PlotArea.YAxis.AutoScale  = false;
        rc_companies.PlotArea.XAxis.AutoScale  = false;
        rc_companies.PlotArea.EmptySeriesMessage.TextBlock.Text = "There is no history series for this timescale.";
        rc_companies.PlotArea.XAxis.AxisLabel.TextBlock.Text    = "Date";
        rc_companies.PlotArea.XAxis.Appearance.ValueFormat      = Telerik.Charting.Styles.ChartValueFormat.ShortDate;
        rc_companies.PlotArea.XAxis.Appearance.CustomFormat     = "dd/MM/yy";
        rc_companies.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 270;
        rc_companies.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Companies";
        rc_companies.ChartTitle.TextBlock.Text = "DataHub Company History (Currently " + Convert.ToInt32(latest.Rows[0]["companies"]).ToString("#,##0") + ")";

        rc_contacts.Legend.Appearance.Visible = false;
        rc_contacts.PlotArea.YAxis.AutoScale  = false;
        rc_contacts.PlotArea.XAxis.AutoScale  = false;
        rc_contacts.PlotArea.EmptySeriesMessage.TextBlock.Text = "There is no history series for this timescale.";
        rc_contacts.PlotArea.XAxis.AxisLabel.TextBlock.Text    = "Date";
        rc_contacts.PlotArea.XAxis.Appearance.ValueFormat      = Telerik.Charting.Styles.ChartValueFormat.ShortDate;
        rc_contacts.PlotArea.XAxis.Appearance.CustomFormat     = "dd/MM/yy";
        rc_contacts.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 270;
        rc_contacts.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Contacts";
        rc_contacts.ChartTitle.TextBlock.Text = "DataHub Contact History (Currently " + Convert.ToInt32(latest.Rows[0]["contacts"]).ToString("#,##0") + ")";

        rc_emails.Legend.Appearance.Visible = false;
        rc_emails.PlotArea.YAxis.AutoScale  = false;
        rc_emails.PlotArea.XAxis.AutoScale  = false;
        rc_emails.PlotArea.EmptySeriesMessage.TextBlock.Text = "There is no history series for this timescale.";
        rc_emails.PlotArea.XAxis.AxisLabel.TextBlock.Text    = "Date";
        rc_emails.PlotArea.XAxis.Appearance.ValueFormat      = Telerik.Charting.Styles.ChartValueFormat.ShortDate;
        rc_emails.PlotArea.XAxis.Appearance.CustomFormat     = "dd/MM/yy";
        rc_emails.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 270;
        rc_emails.PlotArea.YAxis.AxisLabel.TextBlock.Text = "E-Mails";
        rc_emails.ChartTitle.TextBlock.Text = "DataHub E-Mail History (Currently " + Convert.ToInt32(latest.Rows[0]["emails"]).ToString("#,##0") + ")";

        // Define chart series
        ChartSeries companies = new ChartSeries("Companies", ChartSeriesType.Line);
        ChartSeries contacts  = new ChartSeries("Contacts", ChartSeriesType.Line);
        ChartSeries emails    = new ChartSeries("E-mails", ChartSeriesType.Line);

        companies.Appearance.FillStyle.MainColor    = System.Drawing.Color.Green;
        companies.Appearance.TextAppearance.Visible = false;
        contacts.Appearance.FillStyle.MainColor     = System.Drawing.Color.Blue;
        contacts.Appearance.TextAppearance.Visible  = false;
        emails.Appearance.FillStyle.MainColor       = System.Drawing.Color.Red;
        emails.Appearance.TextAppearance.Visible    = false;

        for (int i = 0; i < totals.Rows.Count; i++)
        {
            DateTime      date = Convert.ToDateTime(totals.Rows[i]["date"].ToString().Substring(0, 10));
            ChartAxisItem item = new ChartAxisItem();
            item.Value = (decimal)date.ToOADate();
            rc_companies.PlotArea.XAxis.AddItem(item);
            rc_contacts.PlotArea.XAxis.AddItem(item);
            rc_emails.PlotArea.XAxis.AddItem(item);
            companies.AddItem(Convert.ToInt32(totals.Rows[i]["companies"]));
            contacts.AddItem(Convert.ToInt32(totals.Rows[i]["contacts"]));
            emails.AddItem(Convert.ToInt32(totals.Rows[i]["emails"]));
        }

        rc_companies.Series.Add(companies);
        rc_contacts.Series.Add(contacts);
        rc_emails.Series.Add(emails);

        if (maxvals.Rows.Count > 0)
        {
            int t         = 5;
            int cpymax    = Convert.ToInt32(maxvals.Rows[0]["maxcomp"]);
            int ctcmax    = Convert.ToInt32(maxvals.Rows[0]["maxcon"]);
            int emailmax  = Convert.ToInt32(maxvals.Rows[0]["maxe"]);
            int cpymin    = Convert.ToInt32(maxvals.Rows[0]["mincomp"]);
            int ctcmin    = Convert.ToInt32(maxvals.Rows[0]["mincon"]);
            int emailmin  = Convert.ToInt32(maxvals.Rows[0]["mine"]);
            int cpyhigh   = cpymax + ((cpymax / 1000) * t);
            int cpylow    = cpymin - ((cpymin / 1000) * t);
            int ctchigh   = ctcmax + ((ctcmax / 1000) * t);
            int ctclow    = ctcmin - ((ctcmin / 1000) * t);
            int emailhigh = emailmax + ((emailmax / 100) * t);
            int emaillow  = emailmin - ((emailmin / 100) * t);

            if (cpyhigh != 0)
            {
                double cpy_step = ((cpyhigh - cpylow) / 5);
                if (cpy_step == 0)
                {
                    cpy_step = 1;
                }
                double ctc_step = ((ctchigh - ctclow) / 5);
                if (ctc_step == 0)
                {
                    ctc_step = 1;
                }
                double email_step = ((emailhigh - emaillow) / 5);
                if (email_step == 0)
                {
                    email_step = 1;
                }

                rc_companies.PlotArea.YAxis.AddRange(cpylow, cpyhigh, cpy_step);
                rc_contacts.PlotArea.YAxis.AddRange(ctclow, ctchigh, ctc_step);
                rc_emails.PlotArea.YAxis.AddRange(emaillow, emailhigh, email_step);
            }
            else
            {
                rc_companies.PlotArea.YAxis.AddRange(0, 1, 1);
                rc_contacts.PlotArea.YAxis.AddRange(0, 1, 1);
                rc_emails.PlotArea.YAxis.AddRange(0, 1, 1);
                Util.PageMessage(this, "No data found for this date range.");
            }
        }
    }
        protected void LoadPieCharts()
        {
            if (_levelID <= 0) return;


            var taskList = new List<AsyncPageTask>
            {
                new AsyncPageTask(GetStudentCounts),
                new AsyncPageTask(LoadDistrictParms)
            };

            foreach (AsyncPageTask page in taskList)
            {
                PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "StudentSearch", true);
                Page.RegisterAsyncTask(newTask);
            }
            taskList = null;
            Page.ExecuteRegisteredAsyncTasks();

            studentCountChart.DataSource = countData;
            studentCountChart.ChartTitle.Visible = false;
            studentCountChart.DataBind();

            //studentPieChartXmlHttpPanel.Value = "";   Don't need this particularly at the moment

            //Handle Legend Labels
            studentCountChart.Series.Clear();
            var nSeries = new ChartSeries();

            studentCountChart.PlotArea.Appearance.FillStyle.MainColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
            studentCountChart.PlotArea.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;
            studentCountChart.PlotArea.Appearance.Border.Color = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");

            studentCountChart.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 6);
            studentCountChart.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 6);
            studentCountChart.PlotArea.XAxis.Appearance.LabelAppearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.TopRight;
            nSeries.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.Black;
            nSeries.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 6);
            nSeries.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;

            var count = 0;

            //change to foreach for easier reading
            var gradeList = new List<string>();
            foreach (DataRow dr in countData.Rows)
            {
                var value = DataIntegrity.ConvertToDouble(dr["StudentCount"]);
                var xValue = 0;
                switch (_level)
                {
                    case EntityTypes.Teacher:
                        xValue = dr.Table.Columns.Contains("ClassID") ? DataIntegrity.ConvertToInt(dr["ClassID"]) : 0;
                        break;
                    case EntityTypes.School:
                        gradeList.Add(dr.Table.Columns.Contains("GradeNumber") ? dr["GradeNumber"].ToString() : string.Empty);
                        xValue = gradeList.Count - 1;
                        break;
                }

                var myItem = new ChartSeriesItem(value) { Name = dr["Grade"].ToString(), XValue = xValue };
                myItem.Appearance.FillStyle.MainColor = System.Drawing.ColorTranslator.FromHtml(StyleController.GetPieChartColor(dr["Grade"].ToString(), count++)); ;
                myItem.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;

                if (value <= 0) myItem.Label.Visible = false;

                nSeries.Type = ChartSeriesType.Pie;
                nSeries.AddItem(myItem);
                studentCountChart.Series.Add(nSeries);

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            /*******************************************************************
             * If user does not have Icon_Expanded_Staff permissions, then hide
             * the "Advanced Search" link via its surrounding div tag.
             * ****************************************************************/
            _level = (Thinkgate.Base.Enums.EntityTypes)Tile.TileParms.GetParm("level");
            _levelID = DataIntegrity.ConvertToInt(Tile.TileParms.GetParm("levelID"));

            List<AsyncPageTask> taskList = new List<AsyncPageTask>();
            taskList.Add(new AsyncPageTask(GetAttendRateForSchool));

            foreach (AsyncPageTask page in taskList)
            {
                PageAsyncTask newTask = new PageAsyncTask(page.OnBegin, page.OnEnd, page.OnTimeout, "SchoolAttendance", true);
                Page.RegisterAsyncTask(newTask);
            }
            taskList = null;
            Page.ExecuteRegisteredAsyncTasks();

            // Handle Legend Labels
            teacherCountChart.Series.Clear();
            var nSeries = new ChartSeries();
            var nSeries2 = new ChartSeries();

            nSeries.Name = "School %";
            nSeries2.Name = "District %";
            
            //double minval = 100;
            //double maxval = 0;

            ChartAxisItemsCollection caic = new ChartAxisItemsCollection();

            var year_list = new List<String>();

            foreach (DataRow dr in countData.Rows)
            {
                var myItem = new ChartSeriesItem(DataIntegrity.ConvertToDouble(dr["AttendanceRate"]), dr["LevelLabel"].ToString()) { Name = dr["SchoolYear"].ToString() };
                if (String.IsNullOrEmpty(dr["AttendanceRate"].ToString())) myItem.Appearance.Visible = false;   // hide bar and text if the value is null (no data)
                if (dr["Level"].Equals("District"))
                {
                    nSeries2.AddItem(myItem);
                }
                else
                {
                    nSeries.AddItem(myItem);
                }
                year_list.Add(dr["SchoolYear"].ToString());

                //if (minval > DataIntegrity.ConvertToDouble(dr["AttendanceRate"])) minval = DataIntegrity.ConvertToDouble(dr["AttendanceRate"]);
                //if (maxval < DataIntegrity.ConvertToDouble(dr["AttendanceRate"])) maxval = DataIntegrity.ConvertToDouble(dr["AttendanceRate"]);
            }
            foreach (var yl in year_list.Distinct())
            {
                ChartAxisItem ai = new ChartAxisItem();
                ai.TextBlock.Text = yl;
                caic.Add(ai);
            }
            teacherCountChart.PlotArea.XAxis.AddItem(caic);

            teacherCountChart.PlotArea.YAxis.MinValue = 0;
            teacherCountChart.PlotArea.YAxis.Step = 5;
            teacherCountChart.PlotArea.YAxis.MaxValue = 1;

            teacherCountChart.Series.Add(nSeries);
            teacherCountChart.Series.Add(nSeries2);

            teacherCountChart.ChartTitle.Visible = false;

            teacherCountChart.SetSkin("SchoolAttendanceRates");
        }
Пример #28
0
        /// <summary>
        /// Gets the charts.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="settingsString">The settings string.</param>
        /// <param name="valueLocation">The value location.</param>
        /// <param name="valueSize">Size of the value.</param>
        /// <returns>List{Chart}.</returns>
        private List<Chart> GetCharts(PropertyInfo field, string settingsString, PointU valueLocation, SizeU valueSize)
        {
            //TODO start and finish
            var chartsList = new List<Chart>();
            var sampleSettings = string.Empty;

            if (!string.IsNullOrEmpty(settingsString))
            {
                var spcSettings = XElement.Parse(settingsString);

                if (spcSettings.HasAttributes)
                {
                    var sampleFieldName = spcSettings.Attribute("SampleFieldName").Value;
                    if (!string.IsNullOrEmpty(sampleFieldName))
                    {
                        sampleSettings =
                            _item.GetValueByPropertyName(string.Format("{0}_SampleSettings", sampleFieldName)) as string;
                    }
                }
            }

            var spcFieldValue = field.GetValue(_item, null);
            ChartPanel chartPanel = null;
            var getSampleDataCommand = TheDynamicTypeManager.GetTypeByName(_item.ProcessName,
                                                                           string.Format(
                                                                               "Dynamic{0}.GetSampleDataCommand",
                                                                               _item.ProcessName));

            var inf = getSampleDataCommand.GetMethod("Execute",
                                                            BindingFlags.Static | BindingFlags.Public |
                                                            BindingFlags.FlattenHierarchy);
            chartPanel =
                (ChartPanel)
                inf.Invoke(getSampleDataCommand,
                           new object[] {field.Name, spcFieldValue, _item, sampleSettings, 0, chartPanel});

            valueSize = new SizeU(valueSize.Width, valueSize.Height*2);

            foreach (var chartBase in chartPanel.Charts)
            {
                var chart = new Chart
                                {
                                    BitmapResolution = 96F,
                                    ImageFormat = ImageFormat.Emf,
                                    Location = valueLocation,
                                    Size = valueSize,
                                };
                chart.ChartTitle.Visible = false;

                // Create a ChartSeries and assign its name and chart type
                var chartSeries = new ChartSeries();
                chartSeries.Name = chartBase.ChartType.Description();
                chartSeries.Type = fromChartBaseChartType(chartBase.ChartType);
                chartSeries.Appearance.LabelAppearance.LabelLocation = StyleSeriesItemLabel.ItemLabelLocation.Outside;
                foreach (var unit in chartBase.DataSource)
                {
                    chartSeries.AddItem((double) unit.SampleValue, unit.CategoryValue.LabelValue.ToString());
                }
                chart.Series.Add(chartSeries);

                valueLocation.Y += chart.Size.Height;
                chartsList.Add(chart);
            }

            return chartsList;
        }
Пример #29
0
    protected void grid_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        String ter = ((GridView)sender).ToolTip;

        if (e.Row.RowIndex == 3)
        {
            e.Row.BackColor               = Color.LightSteelBlue;
            e.Row.Cells[13].Text          = "Annual";
            e.Row.Cells[0].Font.Underline = true;
        }

        // Total rows
        if (e.Row.RowIndex == 4 || e.Row.RowIndex == 5 || e.Row.RowIndex == 6 || e.Row.RowIndex == 7)
        {
            int total = 0;
            for (int i = 1; i < e.Row.Cells.Count - 1; i++)
            {
                int this_val = 0;
                Int32.TryParse(e.Row.Cells[i].Text, out this_val);
                total += this_val;

                if (!ter.Contains("_break"))
                {
                    // If book value
                    if (e.Row.RowIndex == 4)
                    {
                        group_bookvalue[(i - 1)] = Convert.ToInt32(group_bookvalue[(i - 1)]) + this_val;
                        group_bookvalue[12]     += this_val;
                    }
                    // If outstanding
                    else if (e.Row.RowIndex == 5)
                    {
                        group_outstanding[(i - 1)] = Convert.ToInt32(group_outstanding[(i - 1)]) + this_val;
                        group_outstanding[12]     += this_val;
                    }
                    // If litigation
                    else if (e.Row.RowIndex == 6)
                    {
                        group_litigation[(i - 1)] = Convert.ToInt32(group_litigation[(i - 1)]) + this_val;
                        group_litigation[12]     += this_val;
                    }
                    // If red line
                    else
                    {
                        group_red_line[(i - 1)] = Convert.ToInt32(group_red_line[(i - 1)]) + this_val;
                        group_red_line[12]     += this_val;
                    }
                }
                e.Row.Cells[i].Text = Util.TextToCurrency(this_val.ToString(), "usd");
            }
            e.Row.Cells[13].Text = Util.TextToCurrency(total.ToString(), "usd");
        }
        else if (e.Row.RowIndex == 8 && ter != "Group") // ADP
        {
            ChartSeries cs = new ChartSeries(ter, ChartSeriesType.Line);
            if (!ter.Contains("_break"))
            {
                cs.Appearance.LegendDisplayMode = Telerik.Charting.ChartSeriesLegendDisplayMode.SeriesName;
                for (int i = 0; i < offices.Rows.Count; i++)
                {
                    if (ter == offices.Rows[i]["Office"].ToString())
                    {
                        cs.Appearance.FillStyle.MainColor = Util.ColourTryParse(offices.Rows[i]["Colour"].ToString());
                        break;
                    }
                }
                rc_line_adp.Series.Add(cs);
            }

            for (int i = 1; i < e.Row.Cells.Count - 1; i++)
            {
                double adp = 0.0;
                if (e.Row.Cells[i].Text == "&nbsp;" || e.Row.Cells[i].Text == "0")
                {
                    e.Row.Cells[i].Text = "-";
                }
                else
                {
                    String qry = "SELECT FORMAT(AVG(DATEDIFF(date_paid, ent_date)),1) as 'ADP' " +
                                 "FROM db_salesbook sb, db_salesbookhead sbh " +
                                 "WHERE sb.sb_id = sbh.SalesBookID " +
                                 "AND date_paid >= ent_date " +
                                 "AND date_paid <= NOW() " +
                                 "AND date_paid IS NOT NULL " +
                                 "AND deleted=0 AND IsDeleted=0 AND red_lined=0 " +
                                 "AND sbh.SalesBookID=@sb_id";
                    DataTable dt_adp = SQL.SelectDataTable(qry, "@sb_id", e.Row.Cells[i].Text);

                    if (dt_adp.Rows.Count > 0 && dt_adp.Rows[0]["ADP"] != DBNull.Value)
                    {
                        e.Row.Cells[i].Text = dt_adp.Rows[0]["ADP"].ToString();
                        adp = Convert.ToDouble(dt_adp.Rows[0]["ADP"]);
                        group_adp[i - 1]  += adp;
                        region_adp[i - 1] += adp;
                    }
                    else
                    {
                        e.Row.Cells[i].Text = "-";
                    }
                }

                if (!ter.Contains("_break"))
                {
                    // cap adp to 100
                    if (adp > 100)
                    {
                        adp = 100;
                    }
                    ChartSeriesItem csi_item = new ChartSeriesItem(adp, " ");
                    cs.AddItem(csi_item);
                }
            }

            if (cb_region.Checked)
            {
                if (!ter.Contains("_break"))
                {
                    region_adp[12]++; // use 12th index as number of offices per region
                }
                else
                {
                    for (int i = 1; i < e.Row.Cells.Count - 1; i++)
                    {
                        e.Row.Cells[i].Text = (region_adp[i - 1] / region_adp[12]).ToString("N1");
                        region_adp[i - 1]   = 0;
                    }
                    region_adp[12] = 0;
                }
            }
        }
        else if (e.Row.RowIndex == 9) // PAID %
        {
            decimal sum     = 0;
            decimal val     = 0;
            int     numnums = 0;
            for (int i = 1; i < e.Row.Cells.Count - 1; i++)
            {
                // Fix _break header names when grouping by region
                if (cb_region.Checked)
                {
                    if (((GridView)sender).Rows[3].Cells[i].Text.Contains("_break"))
                    {
                        ((GridView)sender).Rows[3].Cells[i].Text = Server.HtmlEncode(months[(i - 1)] + " " + dd_year.SelectedItem.Text);
                    }
                }

                Decimal.TryParse(e.Row.Cells[i].Text, out val);
                if (!ter.Contains("_break"))
                {
                    group_paid[(i - 1)] += val;
                }
                if (val != 0)
                {
                    numnums++;
                }
                sum += val;

                if (ter != "Group")
                {
                    // Grab paid% history from previous day
                    String    qry     = "SELECT Paid FROM db_cashreporthistory WHERE Date=@date AND Office=@office AND Year=@year AND CalendarMonth=@cal_month";
                    DataTable history = SQL.SelectDataTable(qry,
                                                            new String[] { "@date", "@office", "@year", "@cal_month" },
                                                            new Object[] {
                        DateTime.Now.Date.Subtract(new TimeSpan(24, 0, 0)).ToString("yyyy/MM/dd").Substring(0, 10),
                        ter,
                        dd_year.SelectedItem.Text,
                        ((GridView)sender).Columns[i].HeaderText
                    });

                    // Add coloured labels for today/yesterday
                    Label lbl_paid_cur = new Label();
                    lbl_paid_cur.Text = Server.HtmlEncode(e.Row.Cells[i].Text + "%");

                    ImageButton arrow = new ImageButton();
                    arrow.Enabled = false;
                    arrow.Height  = arrow.Width = 10;
                    arrow.Attributes.Add("style", "position:relative; top:1px; left:3px;");
                    if (history.Rows.Count > 0)
                    {
                        if (Convert.ToDouble(e.Row.Cells[i].Text) > Convert.ToDouble(history.Rows[0]["Paid"]))
                        {
                            lbl_paid_cur.ForeColor = Color.Green;
                            arrow.ImageUrl         = "~/Images/Icons/qr_Up.png";
                        }
                        else if (Convert.ToDouble(history.Rows[0]["Paid"]) > Convert.ToDouble(e.Row.Cells[i].Text))
                        {
                            lbl_paid_cur.ForeColor = Color.Red;
                            arrow.ImageUrl         = "~/Images/Icons/qr_Down.png";
                        }
                        else if (Convert.ToDouble(history.Rows[0]["Paid"]) == Convert.ToDouble(e.Row.Cells[i].Text))
                        {
                            //lbl_paid_cur.ForeColor = Color.Orange;
                            arrow.Height   = 8;
                            arrow.ImageUrl = "~/Images/Icons/qr_Equal.png";
                        }
                        arrow.ToolTip = "Yesterday's value: " + history.Rows[0]["Paid"].ToString() + "%";
                    }
                    else
                    {
                        arrow.Height   = arrow.Width = 12;
                        arrow.ImageUrl = "~/Images/Icons/qr_Unknown.png";
                        arrow.ToolTip  = "No history found";
                        arrow.Attributes.Add("style", "position:relative; top:2px; left:3px;");
                    }
                    e.Row.Cells[i].Controls.Add(lbl_paid_cur);
                    e.Row.Cells[i].Controls.Add(arrow);
                }
            }

            decimal avg = 0;
            if (sum != 0 && numnums != 0)
            {
                if (!ter.Contains("_break"))
                {
                    group_paid[13] += 1;
                }
                avg = sum / numnums;
            }
            if (!ter.Contains("_break"))
            {
                group_paid[12] += avg;
            }
            e.Row.Cells[13].Text = avg.ToString("N2") + "% (avg.)";

            // LAST ROW, DO GROUP
            if (ter == "Group")
            {
                GridView    gv_group    = (GridView)sender;
                GridViewRow bookval     = gv_group.Rows[4];
                GridViewRow outstanding = gv_group.Rows[5];
                GridViewRow litigation  = gv_group.Rows[6];
                GridViewRow redline     = gv_group.Rows[7];
                GridViewRow adp         = gv_group.Rows[8];

                // Add series to group chart
                rc_line_gadp.Clear();
                ChartSeries cs = new ChartSeries("Group Avg", ChartSeriesType.Line);
                cs.Appearance.LegendDisplayMode = Telerik.Charting.ChartSeriesLegendDisplayMode.SeriesName;
                rc_line_gadp.Series.Add(cs);

                double total_g_avg_value = 0;
                int    total_g_avg_moths = 0;
                for (int j = 1; j < bookval.Cells.Count; j++)
                {
                    // GROUP BOOKVAL
                    bookval.Cells[j].Text = Util.TextToCurrency(group_bookvalue[(j - 1)].ToString(), "USD");
                    // GROUP OUTSTANDING
                    outstanding.Cells[j].Text = Util.TextToCurrency(group_outstanding[(j - 1)].ToString(), "USD");
                    // GROUP LITIGATION
                    litigation.Cells[j].Text = Util.TextToCurrency(group_litigation[(j - 1)].ToString(), "USD");
                    // GROUP RED LINE
                    redline.Cells[j].Text = Util.TextToCurrency(group_red_line[(j - 1)].ToString(), "USD");
                    // GROUP ADP
                    if (group_adp[(j - 1)] == 0)
                    {
                        e.Row.Cells[j].Text = "0 (avg.)";
                    }
                    else
                    {
                        double avg_adp = (((double)group_adp[(j - 1)]) / offices.Rows.Count);
                        total_g_avg_value += avg_adp;
                        total_g_avg_moths++;
                        adp.Cells[j].Text = avg_adp.ToString("N2") + " (avg.)";

                        // Add to group chart
                        ChartSeriesItem csi_item = new ChartSeriesItem(avg_adp, " ");
                        cs.AddItem(csi_item);
                    }
                    // GROUP PAID
                    if (group_paid[13] == 0)
                    {
                        e.Row.Cells[j].Text = "0.0% (avg.)";
                    }
                    else
                    {
                        e.Row.Cells[j].Text = ((group_paid[(j - 1)]) / group_paid[13]).ToString("N2") + "% (avg.)";
                    }
                }

                // Add month names to line chart
                rc_line_adp.PlotArea.XAxis.Items.Clear();
                rc_line_gadp.PlotArea.XAxis.Items.Clear();
                for (int i = 1; i < e.Row.Cells.Count - 1; i++)
                {
                    String issue_name = ((GridView)sender).HeaderRow.Cells[i].Text;
                    rc_line_adp.PlotArea.XAxis.Items.Add(new ChartAxisItem(issue_name));
                    rc_line_gadp.PlotArea.XAxis.Items.Add(new ChartAxisItem(issue_name));
                }

                // Add group average line
                rc_line_gadp.PlotArea.MarkedZones.Clear();
                ChartMarkedZone g_avg = new ChartMarkedZone();
                g_avg.Appearance.FillStyle.MainColor = Color.Orange;
                double g_avg_value = total_g_avg_value / total_g_avg_moths;
                g_avg.ValueStartY = g_avg_value;
                g_avg.ValueEndY   = g_avg_value + (g_avg_value / 100) * 2;
                rc_line_gadp.PlotArea.MarkedZones.Add(g_avg);
                rc_line_gadp.ChartTitle.TextBlock.Text = "Group Average Days to Pay (" + g_avg_value.ToString("N1") + " avg.)"; // set chart title
            }
        }
    }
Пример #30
0
    protected RadChart GenerateGroupVersusChart()
    {
        RadChart rc = new RadChart();

        // Customise
        rc.Width  = 465;
        rc.Height = 300;
        rc.Skin   = "Black";
        rc.ChartTitle.TextBlock.Text = "Group: Weekly SPA Overview";
        rc.PlotArea.EmptySeriesMessage.TextBlock.Text = "There are no reports for this week.";
        rc.Legend.Appearance.Visible = false;
        rc.PlotArea.XAxis.AutoScale  = false;
        rc.PlotArea.YAxis.AutoScale  = false;
        rc.AutoLayout = true;
        rc.ChartTitle.TextBlock.Appearance.TextProperties.Font           = new Font("Verdana", 10, FontStyle.Regular);
        rc.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange;
        rc.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange;

        double highest_count = 0;
        // Get current SPAs for area
        // S series
        ChartSeries SSeries = new ChartSeries("SSeries", ChartSeriesType.Bar);

        SSeries.Appearance.LegendDisplayMode = Telerik.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
        SSeries.Appearance.TextAppearance.TextProperties.Color = Color.White;
        SSeries.Appearance.TextAppearance.TextProperties.Font  = new System.Drawing.Font("Verdana", 8, FontStyle.Bold);
        SSeries.Appearance.Border.PenStyle = System.Drawing.Drawing2D.DashStyle.Dot;
        SSeries.Appearance.Border.Visible  = true;

        // P series
        ChartSeries PSeries = new ChartSeries("PSeries", ChartSeriesType.Bar);

        PSeries.Appearance.LegendDisplayMode = Telerik.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
        PSeries.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.White;
        PSeries.Appearance.TextAppearance.TextProperties.Font  = new Font("Verdana", 8, FontStyle.Bold);
        PSeries.Appearance.Border.PenStyle = System.Drawing.Drawing2D.DashStyle.Dot;
        PSeries.Appearance.Border.Visible  = true;

        // A series
        ChartSeries ASeries = new ChartSeries("ASeries", ChartSeriesType.Bar);

        ASeries.Appearance.LegendDisplayMode = Telerik.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
        ASeries.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.White;
        ASeries.Appearance.TextAppearance.TextProperties.Font  = new Font("Verdana", 8, FontStyle.Bold);
        ASeries.Appearance.Border.PenStyle = System.Drawing.Drawing2D.DashStyle.Dot;
        ASeries.Appearance.Border.Visible  = true;

        // Add series to chart
        rc.Series.Add(SSeries);
        rc.Series.Add(PSeries);
        rc.Series.Add(ASeries);

        for (int i = 0; i < offices.Rows.Count; i++)
        {
            String office    = (String)offices.Rows[i]["Office"];
            String shortname = (String)offices.Rows[i]["ShortName"];

            String qry = "SELECT " +
                         "SUM((mS+tS+wS+thS+fS+xS)) as Suspects,  " +
                         "SUM((mP+tP+wP+thP+fP+xP)) as Prospects,  " +
                         "SUM((mA+tA+wA+thA+fA+xA)) as Approvals,  " +
                         "SUM((mTotalRev+tTotalRev+wTotalRev+thTotalRev+fTotalRev+xTotalRev)) as TR,  " +
                         "SUM(PersonalRevenue) as PR, " +
                         "COUNT(*) as CCAs " +
                         "FROM db_progressreport pr, db_progressreporthead prh " +
                         "WHERE prh.ProgressReportID = pr.ProgressReportID " +
                         "AND Office=@office " +
                         "GROUP BY prh.ProgressReportID " +
                         "ORDER BY StartDate DESC LIMIT 1";
            DataTable dt_pr_info = SQL.SelectDataTable(qry, "@office", office);

            if (dt_pr_info.Rows.Count > 0)
            {
                int s = Convert.ToInt32(dt_pr_info.Rows[0]["Suspects"]);
                int p = Convert.ToInt32(dt_pr_info.Rows[0]["Prospects"]);
                int a = Convert.ToInt32(dt_pr_info.Rows[0]["Approvals"]);
                SSeries.AddItem(s);
                PSeries.AddItem(p);
                ASeries.AddItem(a);

                highest_count = Math.Max(highest_count, s);

                rc.PlotArea.XAxis.Items.Add(new ChartAxisItem(shortname));
            }
        }
        double max_value = Math.Floor(highest_count + (highest_count / 100) * 20);
        double step      = Math.Floor(highest_count / 5);

        if (step == 0)
        {
            step = 1;
        }
        rc.PlotArea.YAxis.AddRange(0, max_value, step);
        return(rc);
    }
        private void SetupChart(double prideScore, string growthScoreText, double finalScore)
        {
            evaluationChart.Series.Clear();

            var series = new ChartSeries("EvaluationData", ChartSeriesType.Bar);
            double growthScore = Math.Round(DataIntegrity.ConvertToDouble(growthScoreText), 2);

            series.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.Nothing;
            series.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.White;
            series.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font(evaluationChart.ChartTitle.TextBlock.Appearance.TextProperties.Font.Name,
                            12, evaluationChart.ChartTitle.TextBlock.Appearance.TextProperties.Font.Unit);
            series.Appearance.LabelAppearance.LabelLocation = StyleSeriesItemLabel.ItemLabelLocation.Inside;

            evaluationChart.AddChartSeries(series);

            series.AddItem(GetChartSeriesItem(prideScore, System.Drawing.Color.FromArgb(153, 255, 51), System.Drawing.Color.FromArgb(0, 0, 0)));
            series.AddItem(GetChartSeriesItem(growthScore, System.Drawing.Color.FromArgb(0, 0, 255), System.Drawing.Color.FromArgb(255, 255, 255)));
            if (!string.IsNullOrEmpty(growthScoreText) || _isPrideGroup) series.AddItem(GetChartSeriesItem(finalScore, System.Drawing.Color.FromArgb(228, 108, 10), System.Drawing.Color.FromArgb(255, 255, 255)));

            //Chart Styles
            evaluationChart.PlotArea.XAxis.Visible = Telerik.Charting.Styles.ChartAxisVisibility.False;
            evaluationChart.PlotArea.YAxis.MaxValue = 4.0;
            evaluationChart.PlotArea.YAxis.AutoScale = false;

            BuildChartLegend((!string.IsNullOrEmpty(growthScoreText) || _isPrideGroup));
        }
    protected void rc_pie_annual_Click(object sender, ChartClickEventArgs args)
    {
        if (args.SeriesItem != null)
        {
            if (args.SeriesItem.Parent.Name == "parent_series")
            {
                lbl_drill_down.Text = "Click a pie section to load the book";
                String territory = args.SeriesItem.Name;
                btn_back.Enabled = true;

                // Format chart for drill
                rc_pie_annual.Clear();
                rc_pie_annual.PlotArea.XAxis.Items.Clear();
                rc_pie_annual.ChartTitle.Visible        = true;
                rc_pie_annual.ChartTitle.TextBlock.Text = territory + "'s " + dd_annual_year.Text + " Books";
                rc_pie_annual.PlotArea.YAxis.AxisMode   = ChartYAxisMode.Extended;


                // Define and add territory chart series
                ChartSeries territory_series = new ChartSeries(territory, ChartSeriesType.Pie);
                territory_series.Appearance.LegendDisplayMode = Telerik.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
                territory_series.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange;
                rc_pie_annual.Series.Add(territory_series);

                // Get top two books
                String qry = "SELECT x.IssueName, ROUND(x.originalprice-IFNULL(CONVERT(SUM(db_salesbook.rl_price*Conversion),SIGNED),0)) as total_price, x.StartDate " +
                             "FROM " +
                             "( " +
                             "    SELECT sbh.SalesBookID, IssueName, CONVERT(SUM(Price*Conversion),SIGNED) as originalprice, StartDate " +
                             "    FROM db_salesbook sb, db_salesbookhead sbh " +
                             "    WHERE sb.sb_id = sbh.SalesBookID " +
                             "    AND YEAR(StartDate)=@year " +
                             "    AND deleted=0 AND IsDeleted=0 " +
                             "    AND Office=@office " +
                             "    GROUP BY sbh.SalesBookID " +
                             "    ORDER BY StartDate " +
                             ") as x " +
                             "LEFT JOIN db_salesbook ON " +
                             "x.SalesBookID = db_salesbook.rl_sb_id " +
                             "GROUP BY x.IssueName " +
                             "ORDER BY x.StartDate";
                String[]  pn           = { "@office", "@year" };
                Object[]  pv           = { territory, dd_annual_year.Text };
                DataTable dt_book_data = SQL.SelectDataTable(qry, pn, pv);

                if (dt_book_data.Rows.Count > 0)
                {
                    for (int i = 0; i < dt_book_data.Rows.Count; i++)
                    {
                        if (dt_book_data.Rows[i]["total_price"] != DBNull.Value)
                        {
                            String          bookName = dt_book_data.Rows[i]["IssueName"].ToString();
                            double          price    = Convert.ToDouble(dt_book_data.Rows[i]["total_price"]);
                            Color           colour   = Color.FromArgb(r.Next(256), r.Next(256), r.Next(256));
                            ChartSeriesItem csi_item = new ChartSeriesItem(
                                price,
                                Util.TextToCurrency(price.ToString(), "usd"),
                                colour,
                                false);

                            csi_item.Appearance.FillStyle.SecondColor = colour;
                            csi_item.Name   = bookName;
                            csi_item.Parent = territory_series;
                            territory_series.AddItem(csi_item);

                            if (i == dt_book_data.Rows.Count - 1)
                            {
                                csi_item.Appearance.Exploded = true;
                            }
                        }
                    }
                }

                if (dt_book_data.Rows.Count > 11)
                {
                    rc_pie_annual.Height = 400;
                }
                else
                {
                    rc_pie_annual.Height = 300;
                }
            }
            else
            {
                // Just re-use bar chart transfer
                rc_bar_latest_Click(sender, args);
            }
        }
    }
        protected void LoadPieChart()
        {
            teacherCountChart.DataSource = _countData;
            teacherCountChart.DataBind();

            // Handle Legend Labels
            teacherCountChart.Series.Clear();
            var nSeries = new ChartSeries();

            teacherCountChart.PlotArea.Appearance.FillStyle.MainColor = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");
            teacherCountChart.PlotArea.Appearance.FillStyle.FillType = FillType.Solid;
            teacherCountChart.PlotArea.Appearance.Border.Color = System.Drawing.ColorTranslator.FromHtml("#FFFFFF");

            teacherCountChart.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 8);
            teacherCountChart.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 8);

            nSeries.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.Black;
            nSeries.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 8);     

           

            nSeries.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
            var count = 0;

            foreach (DataRow dr in _countData.Rows)
            {
                var value = DataIntegrity.ConvertToDouble(dr["TeacherCount"]);
                var myItem = new ChartSeriesItem(value) { Name = dr["Label"].ToString() };
                myItem.Appearance.FillStyle.MainColor = System.Drawing.ColorTranslator.FromHtml(StyleController.GetPieChartColor(dr["Label"].ToString(), count++));
                myItem.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;

                if (value <= 0) myItem.Label.Visible = false;
                nSeries.Type = ChartSeriesType.Pie;
                nSeries.AddItem(myItem);
            }

            teacherCountChart.Series.Add(nSeries);
        }
    protected void GenerateGraph(String between)
    {
        rc_actionhistory.Clear();
        rc_actionhistory.PlotArea.XAxis.RemoveAllItems();

        String[] types = { "INSERT", "UPDATE" }; //"DELETE","MERGE"

        for (int i = 0; i < types.Length; i++)
        {
            String qry = "SELECT DATE_FORMAT(eventtime,'%d/%m/%Y'), COUNT(*) " +
                         "FROM dh_datahubinputlog " +
                         "WHERE username=@username " + between + " AND actionType=@at " +
                         "GROUP BY DATE_FORMAT(eventtime,'%d/%m/%Y') " +
                         "ORDER BY DATE_FORMAT(eventtime,'%d/%m/%Y')";
            DataTable dt = SQL.SelectDataTable(qry,
                                               new String[] { "@username", "@at" },
                                               new Object[] { dd_user.SelectedItem.Value, types[i] });

            if (dt.Rows.Count > 0)
            {
                ChartSeries series = new ChartSeries(types[i], ChartSeriesType.Line);
                if (rc_actionhistory.Series.Count > 0)
                {
                    rc_actionhistory.IntelligentLabelsEnabled = false;
                    series.Appearance.TextAppearance.Visible  = false;
                }
                else
                {
                    series.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.Red;
                }

                DateTime prevDate = Convert.ToDateTime(dt.Rows[0][0].ToString().Substring(0, 10));
                TimeSpan day      = new TimeSpan(24, 0, 0);

                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    DateTime date = Convert.ToDateTime(dt.Rows[j][0].ToString().Substring(0, 10));
                    // Removed as adding too many zeros to plot
                    //if (date.Subtract(prevDate) == day || j == 0)
                    //{
                    series.AddItem(Convert.ToInt32(dt.Rows[j][1]));
                    prevDate = date;
                    //}
                    //else
                    //{
                    //    series.AddItem(0);
                    //    prevDate += day;
                    //    j--;
                    //}
                    if (rc_actionhistory.Series.Count == 0)
                    {
                        ChartAxisItem item = new ChartAxisItem();
                        item.Value = (decimal)prevDate.ToOADate();
                        rc_actionhistory.PlotArea.XAxis.AddItem(item);
                    }
                }
                rc_actionhistory.Series.Add(series);
            }
        }

        rc_actionhistory.Visible = true;
        rc_actionhistory.ChartTitle.TextBlock.Text              = "Daily Actions";
        rc_actionhistory.PlotArea.XAxis.AutoScale               = false;
        rc_actionhistory.PlotArea.XAxis.Appearance.ValueFormat  = Telerik.Charting.Styles.ChartValueFormat.ShortDate;
        rc_actionhistory.PlotArea.XAxis.Appearance.CustomFormat = "dd/MM/yy";
        rc_actionhistory.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle       = 270;
        rc_actionhistory.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.LimeGreen;
        rc_actionhistory.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = System.Drawing.Color.LimeGreen;
        rc_actionhistory.PlotArea.EmptySeriesMessage.TextBlock.Text = "No data for this user/time period.";
    }
Пример #35
0
    public void PersonelBazliGetiriCizdir()//Personel Getirisi ama
    {
        if ((this.Parent.FindControl("clnBaslangicTarihi") as RadDatePicker).SelectedDate != null &&
            (this.Parent.FindControl("clnBitisTarihi") as RadDatePicker).SelectedDate != null)
        {
            DateTime baslangic = (this.Parent.FindControl("clnBaslangicTarihi") as RadDatePicker).SelectedDate.Value;
            DateTime bitis     = (this.Parent.FindControl("clnBitisTarihi") as RadDatePicker).SelectedDate.Value;

            //DateTime Bastar = clnBaslangicTarihi.SelectedDate.Value;
            //DateTime Bittar = clnBitisTarihi.SelectedDate.Value;
            BolgeKodu = BolgeKoduBelirle();
            int DataCount = 0;

            EFDal   ed = new EFDal();
            DataSet ds = ed.spkal_sfPersGetiriAnaliz(BolgeKodu, baslangic, bitis);
            grvPersonelBazliGetiri.DataSource = ds;
            grvPersonelBazliGetiri.DataBind();
            grvPersonelBazliGetiri.Visible = true;

            Label1.Text = "Toplam Getiri=" + ed.ParaFormatinaCevir(ds.Tables[0].Rows[0]["ToplamGetiri"].ToString());


            DataCount = ds.Tables[0].Rows.Count;
            chtGetiri.Clear();

            chtGetiri.ChartTitle.TextBlock.Text = "Getiriye göre durum";
            ChartSeries salesSeries = chtGetiri.CreateSeries("Getiri", defaultColors[0], defaultColors[1],
                                                             ChartSeriesType.Bar);
            int k = 0;

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                string bak = row["Getiri"].ToString();
                if (bak != "")
                {
                    salesSeries.AddItem(Convert.ToDouble(bak), row["Sorumlu"].ToString(), defaultColors[k + 1],
                                        false);
                }
                chtGetiri.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font =
                    new System.Drawing.Font("Ariel", 6);
                chtGetiri.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Font =
                    new System.Drawing.Font("Ariel", 6);
                k++;
            }


            //foreach (var result in Sonuc)
            //{
            //    string bak = result.Getiri.Value.ToString();
            //    if (bak != "")
            //    {
            //        salesSeries.AddItem(Convert.ToDouble(result.Getiri.Value), result.Sorumlu, defaultColors[k + 1],
            //            false);
            //    }
            //    chtGetiri.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font =
            //        new System.Drawing.Font("Ariel", 6);
            //    chtGetiri.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Font =
            //        new System.Drawing.Font("Ariel", 6);
            //    k++;
            //}


            /*
             * sfKalDataEntities ent = new sfKalDataEntities();
             * using (Service1Client proxy = new Service1Client())
             * {
             *  int DataCount = 0;
             *  List<kal_sfPersGetiriAnaliz_Result> Sonuc =
             *      proxy.kal_sfPersGetiriAnaliz_ResultDon((short)BolgeKodu, baslangic, bitis).ToList();
             *  grvPersonelBazliGetiri.DataSource = Sonuc;
             *  grvPersonelBazliGetiri.DataBind();
             *  grvPersonelBazliGetiri.Visible = true;
             *
             *  DataCount = Sonuc.Count;
             *  chtGetiri.Clear();
             *
             *  chtGetiri.ChartTitle.TextBlock.Text = "Getiriye göre durum";
             *  ChartSeries salesSeries = chtGetiri.CreateSeries("Getiri", defaultColors[0], defaultColors[1],
             *      ChartSeriesType.Bar);
             *  int k = 0;
             *  foreach (var result in Sonuc)
             *  {
             *      string bak = result.Getiri.Value.ToString();
             *      if (bak != "")
             *      {
             *          salesSeries.AddItem(Convert.ToDouble(result.Getiri.Value), result.Sorumlu, defaultColors[k + 1],
             *              false);
             *      }
             *      chtGetiri.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font =
             *          new System.Drawing.Font("Ariel", 6);
             *      chtGetiri.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Font =
             *          new System.Drawing.Font("Ariel", 6);
             *      k++;
             *  }
             * }
             */
        }
        else
        {
            lblPersGetiri.Text = "Tarih aralığı seçmelisiniz";
        }
    }
Пример #36
0
    protected void BindGraphs(DataTable dt)
    {
        ////////////////////// Bar Graph ///////////////////////////

        rc_bar.Clear();
        rc_bar.PlotArea.XAxis.RemoveAllItems();
        rc_bar.PlotArea.MarkedZones.Clear();

        // Stylise
        rc_bar.AutoLayout = true;
        rc_bar.Legend.Appearance.Visible                  = false;
        rc_bar.PlotArea.YAxis.AxisLabel.Visible           = true;
        rc_bar.PlotArea.XAxis.AxisLabel.Visible           = true;
        rc_bar.PlotArea.YAxis.AutoScale                   = false;
        rc_bar.PlotArea.XAxis.AutoScale                   = false;
        rc_bar.PlotArea.EmptySeriesMessage.TextBlock.Text = "There is no history series for the selected timescale.";
        rc_bar.PlotArea.XAxis.AxisLabel.TextBlock.Text    = "Report Week";
        rc_bar.PlotArea.XAxis.Appearance.ValueFormat      = Telerik.Charting.Styles.ChartValueFormat.ShortDate;
        rc_bar.PlotArea.XAxis.Appearance.CustomFormat     = "dd/MM/yy";
        rc_bar.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 315;
        rc_bar.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Revenue";
        rc_bar.ChartTitle.TextBlock.Text = "Revenue History";

        // Define chart series
        ChartSeries bar_series = new ChartSeries("Revenue", ChartSeriesType.Bar);

        bar_series.Appearance.FillStyle.MainColor = Color.DarkSlateBlue;

        int bar_height = 0;
        int bar_total  = 0;

        for (int i = (gv.Rows.Count - 3); i > -1; i--)
        {
            bar_total += (Convert.ToInt32(Util.CurrencyToText(gv.Rows[i].Cells[gv.Rows[i].Cells.Count - 1].Text)));
            if ((Convert.ToInt32(Util.CurrencyToText(gv.Rows[i].Cells[gv.Rows[i].Cells.Count - 1].Text))) > bar_height)
            {
                bar_height = (Convert.ToInt32(Util.CurrencyToText(gv.Rows[i].Cells[gv.Rows[i].Cells.Count - 1].Text)));
            }
            bar_series.AddItem(Convert.ToInt32(Util.CurrencyToText(gv.Rows[i].Cells[gv.Rows[i].Cells.Count - 1].Text)));
            bar_series.Items[bar_series.Items.Count - 1].Label.TextBlock.Text = gv.Rows[i].Cells[gv.Rows[i].Cells.Count - 1].Text;
            DateTime      date = Convert.ToDateTime(dt.Rows[i]["WeekStart"].ToString().Substring(0, 10));
            ChartAxisItem item = new ChartAxisItem();
            item.Value = (decimal)date.ToOADate();
            rc_bar.PlotArea.XAxis.AddItem(item);
            bar_series.Appearance.TextAppearance.TextProperties.Color = Color.Black;
        }
        ChartMarkedZone bar_avg = new ChartMarkedZone();

        bar_avg.Appearance.FillStyle.FillType    = Telerik.Charting.Styles.FillType.Gradient;
        bar_avg.Appearance.FillStyle.MainColor   = Color.Orange;
        bar_avg.Appearance.FillStyle.SecondColor = Color.OrangeRed;
        if (bar_total != 0)
        {
            bar_avg.ValueStartY = (bar_total / (gv.Rows.Count - 2)) - (((bar_total / (gv.Rows.Count - 2)) / 100) * 2);
            bar_avg.ValueEndY   = (bar_total / (gv.Rows.Count - 2));
        }
        rc_bar.PlotArea.MarkedZones.Add(bar_avg);
        if (rbl_bartype.SelectedIndex == 0)
        {
            bar_series.Type = ChartSeriesType.Bar;
        }
        else if (rbl_bartype.SelectedIndex == 1)
        {
            bar_series.Type = ChartSeriesType.Area;
        }
        else if (rbl_bartype.SelectedIndex == 2)
        {
            bar_series.Type = ChartSeriesType.SplineArea;
        }
        else if (rbl_bartype.SelectedIndex == 3)
        {
            bar_series.Type = ChartSeriesType.Bubble;
        }
        rc_bar.Series.Add(bar_series);

        double max_value = bar_height + Convert.ToInt32((bar_height / 100) * 15);
        double step      = 10000;

        rc_bar.PlotArea.YAxis.AddRange(0, max_value, step);

        ////////////////////// Line Graph //////////////////////////

        rc_line.Clear();
        rc_line.PlotArea.XAxis.RemoveAllItems();
        rc_line.PlotArea.MarkedZones.Clear();

        // Stylise
        rc_line.Legend.Appearance.Visible                  = false;
        rc_line.PlotArea.YAxis.AxisLabel.Visible           = true;
        rc_line.PlotArea.XAxis.AxisLabel.Visible           = true;
        rc_line.PlotArea.YAxis.AutoScale                   = false;
        rc_line.PlotArea.XAxis.AutoScale                   = false;
        rc_line.PlotArea.EmptySeriesMessage.TextBlock.Text = "There is no history series for the selected timescale.";
        rc_line.PlotArea.XAxis.AxisLabel.TextBlock.Text    = "Report Week";
        rc_line.PlotArea.XAxis.Appearance.ValueFormat      = Telerik.Charting.Styles.ChartValueFormat.ShortDate;
        rc_line.PlotArea.XAxis.Appearance.CustomFormat     = "dd/MM/yy";
        rc_line.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 315;
        rc_line.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Approvals";
        rc_line.ChartTitle.TextBlock.Text = "Approvals History";

        // Define chart series
        ChartSeries line_series = new ChartSeries("Approvals", ChartSeriesType.Line);

        line_series.Appearance.FillStyle.MainColor = Color.DarkSlateBlue;

        int line_total  = 0;
        int line_height = 0;

        for (int i = gv.Rows.Count - 3; i > -1; i--)
        {
            line_series.AddItem(Convert.ToInt32(dt.Rows[i]["Approvals"]));
            line_total += Convert.ToInt32(dt.Rows[i]["Approvals"]);
            if (Convert.ToInt32(dt.Rows[i]["Approvals"]) > line_height)
            {
                line_height = Convert.ToInt32(dt.Rows[i]["Approvals"]);
            }
            DateTime      date = Convert.ToDateTime(dt.Rows[i]["WeekStart"].ToString().Substring(0, 10));
            ChartAxisItem item = new ChartAxisItem();
            item.Value = (decimal)date.ToOADate();
            rc_line.PlotArea.XAxis.AddItem(item);
            line_series.Appearance.TextAppearance.TextProperties.Color = Color.Black;
        }

        ChartMarkedZone line_avg = new ChartMarkedZone();

        line_avg.Appearance.FillStyle.FillType    = Telerik.Charting.Styles.FillType.Gradient;
        line_avg.Appearance.FillStyle.MainColor   = Color.Orange;
        line_avg.Appearance.FillStyle.SecondColor = Color.OrangeRed;
        if (line_total != 0)
        {
            line_avg.ValueStartY = (line_total / (gv.Rows.Count - 2)) - 0.2;
            line_avg.ValueEndY   = (line_total / (gv.Rows.Count - 2));
        }
        rc_line.PlotArea.MarkedZones.Add(line_avg);
        if (rbl_linetype.SelectedIndex == 0)
        {
            line_series.Type = ChartSeriesType.Line;
        }
        else if (rbl_linetype.SelectedIndex == 1)
        {
            line_series.Type = ChartSeriesType.Spline;
        }
        rc_line.Series.Add(line_series);

        double pa_max_value = line_height + 5;
        double pa_step      = 5;

        rc_line.PlotArea.YAxis.AddRange(0, pa_max_value, pa_step);
    }
        private void BuildChart(RadChart chart, DataTable seriesData)
        {
            // Handle Legend Labels
            chart.Series.Clear();
            var nSeries = new ChartSeries();
            var nSeries2 = new ChartSeries();
            
            nSeries.Name = "School %";
            nSeries2.Name = "District %";
            chart.Legend.Appearance.ItemTextAppearance.AutoTextWrap = AutoTextWrap.False;

            //double minval = 100;
            //double maxval = 0;

            ChartAxisItemsCollection caic = new ChartAxisItemsCollection();

            var year_list = new List<String>();
            // Begin Experience tab
            foreach (DataRow dr in seriesData.Rows)
            {
                var myItem = new ChartSeriesItem(DataIntegrity.ConvertToDouble(dr["SuspensionRate"]), dr["LevelLabel"].ToString()) { Name = dr["SchoolYear"].ToString() };
                if (String.IsNullOrEmpty(dr["SuspensionRate"].ToString())) myItem.Appearance.Visible = false;   // hide bar and text if the value is null (no data)
                //myItem.Label.Appearance.LabelLocation = StyleSeriesItemLabel.ItemLabelLocation.Auto;
                if (dr["Level"].Equals("District"))
                {
                    nSeries2.AddItem(myItem);
                }
                else
                {
                    nSeries.AddItem(myItem);
                }
                
                year_list.Add(dr["SchoolYear"].ToString());
                
                //if (minval > DataIntegrity.ConvertToDouble(dr["SuspensionRate"])) minval = DataIntegrity.ConvertToDouble(dr["SuspensionRate"]);
                //if (maxval < DataIntegrity.ConvertToDouble(dr["SuspensionRate"])) maxval = DataIntegrity.ConvertToDouble(dr["SuspensionRate"]);
            }
            foreach (var yl in year_list.Distinct())
            {
                ChartAxisItem ai = new ChartAxisItem();
                ai.TextBlock.Text = yl;
                caic.Add(ai);    
            }
            
            chart.PlotArea.XAxis.AddItem(caic);

            chart.PlotArea.YAxis.MinValue = 0;
            //chart.PlotArea.YAxis.Step = (maxval - (minval - 5)) / 2;
            chart.PlotArea.YAxis.Step = 5;
            chart.PlotArea.YAxis.AutoScale = true;
            //chart.PlotArea.YAxis.MaxValue = maxval == 100 ? maxval : maxval + 5;
            //chart.PlotArea.YAxis.a = maxval == 100 ? maxval : maxval + 5;

            chart.Series.Add(nSeries);
            chart.Series.Add(nSeries2);

            chart.ChartTitle.Visible = false;

            chart.SetSkin("SuspensionRate");
        }
Пример #38
0
        void InitRadChart()
        {
            #region pregunta 1

            RadChart1.Clear();
            SetXAxis("1.- ¿Te Gustan Los VideoJuegos??", 3500, RadChart1);
            RadChart1.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between;

            RadChart1.PlotArea.YAxis.AutoScale = false;
            SetYAxis(500);

            ChartSeries series1 = new ChartSeries("Si", ChartSeriesType.Bar);
            series1.ActiveRegionUrl = "#P2";
            SetSeriesAppearance(series1);
            RadChart1.Series.Add(series1);

            ChartSeries series2 = new ChartSeries("No", ChartSeriesType.Bar);
            series2.ActiveRegionUrl = "#P3";
            SetSeriesAppearance(series2);
            RadChart1.Series.Add(series2);

            ChartSeries series3 = new ChartSeries("Un poco", ChartSeriesType.Bar);
            series3.ActiveRegionUrl = "#P4";
            SetSeriesAppearance(series3);
            RadChart1.Series.Add(series3);

            series1.AddItem(1300);
            series2.AddItem(1200);
            series3.AddItem(1000);

            #endregion


            #region pregunta 2

            RadChart2.Clear();
            SetXAxis(" 2.- ¿Que tiempo te la pasas jugando al día?", 3500, RadChart2);
            RadChart2.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between;

            RadChart2.PlotArea.YAxis.AutoScale = false;
            SetYAxis(500);

            ChartSeries series1G2 = new ChartSeries("2 hrs al día", ChartSeriesType.Bar);
            SetSeriesAppearance(series1G2);
            RadChart2.Series.Add(series1G2);

            ChartSeries series2G2 = new ChartSeries("Entre 4 y 6 horas", ChartSeriesType.Bar);
            SetSeriesAppearance(series2G2);
            RadChart2.Series.Add(series2G2);

            ChartSeries series3G2 = new ChartSeries("Todo el día", ChartSeriesType.Bar);
            SetSeriesAppearance(series3G2);
            RadChart2.Series.Add(series3G2);

            series1G2.AddItem(1100);
            series2G2.AddItem(1300);
            series3G2.AddItem(1100);

            #endregion



            #region pregunta 2

            RadChart3.Clear();
            SetXAxis("3.- ¿Por que no te gustan?", 3500, RadChart3);
            RadChart3.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between;

            RadChart3.PlotArea.YAxis.AutoScale = false;
            SetYAxis(500);

            ChartSeries series1G3 = new ChartSeries("Es una perdida de tiempo", ChartSeriesType.Bar);
            SetSeriesAppearance(series1G3);
            RadChart3.Series.Add(series1G3);

            ChartSeries series2G3 = new ChartSeries("No tengo una consola", ChartSeriesType.Bar);
            SetSeriesAppearance(series2G3);
            RadChart3.Series.Add(series2G3);

            ChartSeries series3G3 = new ChartSeries("No me gustan", ChartSeriesType.Bar);
            SetSeriesAppearance(series3G3);
            RadChart3.Series.Add(series3G3);

            series1G3.AddItem(700);
            series2G3.AddItem(800);
            series3G3.AddItem(2000);

            #endregion


            #region pregunta 2

            RadChart4.Clear();
            SetXAxis(" 4.- ¿Que Juego te gusta mas?", 3500, RadChart4);
            RadChart4.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between;

            RadChart4.PlotArea.YAxis.AutoScale = false;
            SetYAxis(500);

            series1G4 = new ChartSeries("Mario", ChartSeriesType.Bar);
            SetSeriesAppearance(series1G4);
            RadChart4.Series.Add(series1G4);

            ChartSeries series2G4 = new ChartSeries("Fifa 11", ChartSeriesType.Bar);
            SetSeriesAppearance(series2G4);
            RadChart4.Series.Add(series2G4);

            ChartSeries series3G4 = new ChartSeries("Stars wars", ChartSeriesType.Bar);
            SetSeriesAppearance(series3G4);
            RadChart4.Series.Add(series3G4);

            series1G4.AddItem(600);
            series2G4.AddItem(800);
            series3G4.AddItem(2100);

            #endregion
        }
Пример #39
0
    protected void PopulateCurrentGraph()
    {
        double total_usd = 0;

        rc_bar_latest.Clear();
        rc_bar_latest.PlotArea.XAxis.Items.Clear();

        // Define parent chart series and format
        ChartSeries parent_series = new ChartSeries("parent_series", ChartSeriesType.Bar);

        parent_series.Appearance.LegendDisplayMode = Telerik.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
        parent_series.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange;
        parent_series.Appearance.TextAppearance.TextProperties.Font  = new Font("Verdana", 7, FontStyle.Regular);
        parent_series.ActiveRegionToolTip = "Click to view this book.";
        rc_bar_latest.Series.Add(parent_series);

        // Iterate offices
        double highest_price = 0;
        double lowest_price  = 999999;

        for (int i = 0; i < offices.Rows.Count; i++)
        {
            String territory = (String)offices.Rows[i]["Office"];
            String shortname = (String)offices.Rows[i]["ShortName"];
            Color  colour    = Util.ColourTryParse((String)offices.Rows[i]["Colour"]);

            // For each office..
            String qry = "SELECT ROUND(IFNULL(CONVERT(SUM(Price*Conversion), SIGNED),0)- " +
                         "IFNULL((SELECT CONVERT(SUM(rl_price*Conversion), SIGNED) " +
                         "FROM db_salesbook WHERE rl_sb_id=(SELECT SalesBookID FROM db_salesbookhead WHERE Office=@office ORDER BY StartDate DESC LIMIT 1) " +
                         "AND red_lined=1),0)) as total_price " +
                         "FROM db_salesbook sb, db_salesbookhead sbh " +
                         "WHERE sb.sb_id = (SELECT SalesBookID FROM db_salesbookhead WHERE Office=@office ORDER BY StartDate DESC LIMIT 1) " +
                         "AND sbh.SalesBookID = (SELECT SalesBookID FROM db_salesbookhead WHERE Office=@office ORDER BY StartDate DESC LIMIT 1) " +
                         "AND deleted=0 AND IsDeleted=0";
            double price = 0;
            if (Double.TryParse(SQL.SelectString(qry, "total_price", "@office", territory), out price))
            {
                total_usd += price;

                // Get max and min for chart padding
                highest_price = Math.Max(highest_price, price);
                lowest_price  = Math.Min(lowest_price, price);

                ChartSeriesItem csi_item = new ChartSeriesItem(
                    price,
                    Util.TextToCurrency(price.ToString(), "usd"),
                    colour,
                    false);

                csi_item.Name   = territory;
                csi_item.Parent = parent_series;
                parent_series.AddItem(csi_item);
                rc_bar_latest.PlotArea.XAxis.Items.Add(new ChartAxisItem(shortname));
            }
        }

        if (lowest_price != 0)
        {
            lowest_price = (lowest_price + (lowest_price / 100) * 40);
        }

        double max_value = (highest_price + (highest_price / 100) * 20);
        double step      = highest_price / 10;

        if (step == 0)
        {
            step = 1;
        }
        rc_bar_latest.PlotArea.YAxis.AddRange(0, max_value, step);

        // Set total USD label
        lbl_total_usd.Text = "Total USD: " + Util.TextToCurrency(total_usd.ToString(), "usd");
    }
Пример #40
0
    protected void PopulatePie()
    {
        rc_pie.Legend.Clear();

        // Define and customise chart series
        ChartSeries cs = new ChartSeries("cs_offices", ChartSeriesType.Pie);

        cs.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
        cs.Appearance.TextAppearance.TextProperties.Color = Color.DarkOrange;
        cs.Appearance.TextAppearance.TextProperties.Font  = new Font("Verdana", 7, FontStyle.Regular);
        rc_pie.PlotArea.XAxis.AddRange(1, 4, 1);
        rc_pie.PlotArea.XAxis.IsZeroBased = false;
        rc_pie.PlotArea.YAxis.AxisMode    = ChartYAxisMode.Extended;
        rc_pie.Series.Add(cs);
        rc_pie.Legend.Appearance.Position.Auto            = true;
        rc_pie.Legend.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.TopRight;

        for (int i = 0; i < offices.Rows.Count; i++)
        {
            // Office vars
            String office         = (String)offices.Rows[i]["Office"];
            Color  colour         = Util.ColourTryParse((String)offices.Rows[i]["Colour"]);
            String StartDate      = "";
            String EndDate        = "";
            double target         = 0;
            String UniqueFeatures = "0";
            double avg_yield      = 0;
            String PageRate       = "0";
            String TopSalesman    = "";
            String BiggestFeature = "";
            String TopGenerator   = "";
            String BookName       = "";
            double daily_target   = 0;
            int    DaysLeft       = 0;

            int    latest_book_id     = 0;
            int    office_time_offset = Util.GetOfficeTimeOffset(office);
            String daysLeft           = "(DATEDIFF(EndDate, DATE_ADD(DATE_ADD(NOW(), INTERVAL -1 DAY),INTERVAL @offset HOUR)) - " +
                                        "((DATEDIFF(EndDate, DATE_ADD(DATE_ADD(NOW(), INTERVAL -1 DAY),INTERVAL @offset HOUR))/7) * 2)) as calculatedDaysLeft "; ///7) * 2))+1

            String qry = "SELECT SalesBookID, IssueName, StartDate, EndDate, Target, DaysLeft, " + daysLeft +
                         "FROM db_salesbookhead " +
                         "WHERE Office=@office " +
                         "ORDER BY StartDate DESC LIMIT 1";
            DataTable book_head_info = SQL.SelectDataTable(qry,
                                                           new String[] { "@office", "@offset" },
                                                           new Object[] { office, office_time_offset });

            if (book_head_info.Rows.Count > 0)
            {
                latest_book_id = Convert.ToInt32(book_head_info.Rows[0]["SalesBookID"]);
                qry            = "SELECT ROUND(IFNULL(CONVERT(SUM(Price*Conversion), SIGNED),0)- " +
                                 "IFNULL((SELECT CONVERT(SUM(rl_price*Conversion), SIGNED) FROM db_salesbook WHERE rl_sb_id=@sb_id AND red_lined=1),0)) as total_price " +
                                 "FROM db_salesbook sb, db_salesbookhead sbh " +
                                 "WHERE sb.sb_id=@sb_id " +
                                 "AND sbh.SalesBookID=@sb_id " +
                                 "AND deleted=0 AND IsDeleted=0";
                DataTable dt_total_price = SQL.SelectDataTable(qry, "@sb_id", latest_book_id);

                if (dt_total_price.Rows.Count > 0 && dt_total_price.Rows[0]["total_price"] != DBNull.Value)
                {
                    double price = Convert.ToDouble(dt_total_price.Rows[0]["total_price"]);

                    String[] top = new String[3] {
                        "rep", "list_gen", "feature"
                    };
                    for (int j = 0; j < top.Length; j++)
                    {
                        qry = "SELECT " + top[j] + " as val, CONVERT(SUM(price*conversion), SIGNED) as s FROM db_salesbook WHERE sb_id=@sb_id AND deleted=0 AND IsDeleted=0 GROUP BY " + top[j] + " ORDER BY CONVERT(SUM(price*conversion), SIGNED) DESC LIMIT 1";
                        DataTable tmp = SQL.SelectDataTable(qry, "@sb_id", latest_book_id);
                        if (tmp.Rows.Count > 0)
                        {
                            if (j == 0)
                            {
                                TopSalesman = tmp.Rows[0]["val"] + " (" + Util.TextToCurrency((Convert.ToDouble(tmp.Rows[0]["s"])).ToString(), "usd") + ")";
                            }
                            else if (j == 1)
                            {
                                TopGenerator = tmp.Rows[0]["val"] + " (" + Util.TextToCurrency((Convert.ToDouble(tmp.Rows[0]["s"])).ToString(), "usd") + ")";
                            }
                            else if (j == 2)
                            {
                                BiggestFeature = tmp.Rows[0]["val"] + " (" + Util.TextToCurrency((Convert.ToDouble(tmp.Rows[0]["s"])).ToString(), "usd") + ")";
                            }
                        }
                    }

                    // Book head details
                    BookName  = book_head_info.Rows[0]["IssueName"].ToString();
                    StartDate = book_head_info.Rows[0]["StartDate"].ToString().Substring(0, 10);
                    EndDate   = book_head_info.Rows[0]["EndDate"].ToString().Substring(0, 10);
                    target    = Convert.ToDouble(book_head_info.Rows[0]["Target"]);

                    if (book_head_info.Rows[0]["DaysLeft"].ToString() != "0")
                    {
                        DaysLeft = Convert.ToInt32(book_head_info.Rows[0]["DaysLeft"]);
                    }
                    else
                    {
                        DaysLeft = Convert.ToInt32(book_head_info.Rows[0]["calculatedDaysLeft"]);
                    }

                    if (DaysLeft == 0)
                    {
                        daily_target = (target - price);
                    }
                    else
                    {
                        daily_target = (target - price) / DaysLeft;
                    }

                    // Book data details
                    qry = "SELECT " +
                          "COUNT(DISTINCT feature) AS UniqueFeatures, " +
                          "(CONVERT(SUM(price*conversion), SIGNED)/COUNT(DISTINCT feature)) AS AvgYield, " +
                          "(SELECT page_rate FROM db_salesbook WHERE page_rate != 1 AND deleted = 0 AND sb_id=@sb_id ORDER BY ent_date DESC LIMIT 1) AS PageRate " +
                          "FROM db_salesbook  " +
                          "WHERE deleted=0 AND IsDeleted=0 AND sb_id=@sb_id";
                    DataTable book_info = SQL.SelectDataTable(qry, "@sb_id", latest_book_id);

                    if (book_info.Rows.Count > 0)
                    {
                        UniqueFeatures = book_info.Rows[0]["UniqueFeatures"].ToString();
                        if (book_info.Rows[0]["AvgYield"] != DBNull.Value)
                        {
                            avg_yield = Convert.ToDouble(book_info.Rows[0]["AvgYield"]);
                        }

                        PageRate = book_info.Rows[0]["PageRate"].ToString();
                    }

                    ChartSeriesItem csi_item = new ChartSeriesItem(
                        price,
                        Util.TextToCurrency(price.ToString(), "usd"),
                        colour);

                    csi_item.ActiveRegion.Attributes = "onmouseover=\"this.parentNode.parentNode.style.cursor='pointer'; this.parentNode.parentNode.style.cursor='hand';\" " +
                                                       "onmouseout=\"this.parentNode.parentNode.style.cursor='default'\"; " +
                                                       "onclick=\"alert('Hover over this segment to see detailed book stats.');\" return true;\"";
                    csi_item.Appearance.FillStyle.SecondColor = Color.Transparent;
                    csi_item.Name = office;
                    csi_item.ActiveRegion.Tooltip = "<b><font color=\"#00008B\">" + office + "</font><font color=\"Black\"><br/>Latest Book</b><br/><br/></font>"
                                                    + " <font color=\"Green\">Latest</font> book <font color=\"Black\"><b>(" + StartDate + " - " + EndDate + ")</b></font><br/>"
                                                    + " <font color=\"#1E90FF\">Target :  </font><font color=\"Black\">" + Util.TextToCurrency(target.ToString(), "usd") + "<br/><br/></font>"
                                                    + " <font color=\"#CD5C5C\">Total Revenue :  </font><font color=\"Black\">" + Util.TextToCurrency(price.ToString(), "usd") + " </font><br/>"
                                                    + " <font color=\"#008B8B\">Days Left :  </font><font color=\"Black\">" + DaysLeft + "</font><br/>"
                                                    + " <font color=\"#32CD32\">Daily Target :  </font><font color=\"Black\">" + Util.TextToCurrency(daily_target.ToString(), "usd") + "</font><br/>"
                                                    + " ----------------------------------<br/>"
                                                    + " <font color=\"#FF7F50\">Unique Features :  </font><font color=\"Black\">" + UniqueFeatures + "</font><br/>"
                                                    + " <font color=\"#FF0000\">Avg. Yield :  </font><font color=\"Black\">" + Util.TextToCurrency(avg_yield.ToString(), "usd") + "</font><br/>"
                                                    + " <font color=\"#00BFFF\">Page Rate :  </font><font color=\"Black\">" + PageRate + "</font><br/>"
                                                    + " ----------------------------------<br/>"
                                                    + " <font color=\"#B22222\">Top Salesman :  </font><font color=\"Black\">" + TopSalesman + "</font><br/>"
                                                    + " <font color=\"#4B0082\">Top Generator :  </font><font color=\"Black\">" + TopGenerator + "</font><br/>"
                                                    + " <font color=\"#008080\">Biggest Feature :  </font><font color=\"Black\">" + BiggestFeature + "</font><br/>"
                                                    + "</font><br/></font>Navigate to this book using the Budget Hub.<br/>For more information use the Sales Book Output page.";
                    cs.AddItem(csi_item);
                }
            }
        }
    }
    private void BuildCandidateLocationChart()
    {
        radChartCandidateLocation.ChartTitle.TextBlock.Text = ResourceManager.GetString("hypCandidateLocation");
        radChartCandidateLocation.Chart.Series.Clear();

        radChartCandidateLocation.PlotArea.Appearance.Dimensions.Margins.Left = 80;
        radChartCandidateLocation.PlotArea.Appearance.Dimensions.Margins.Right = 100;
        radChartCandidateLocation.PlotArea.Appearance.Dimensions.Margins.Top = 60;
        radChartCandidateLocation.PlotArea.Appearance.Dimensions.Margins.Bottom = 200;
        radChartCandidateLocation.PlotArea.YAxis.AxisLabel.TextBlock.Text = ResourceManager.GetString("lblStatisticsNbrOfCandidates");
        radChartCandidateLocation.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Font = new Font("Arial", 12, FontStyle.Bold);
        radChartCandidateLocation.PlotArea.YAxis.AxisLabel.Visible = true;
        radChartCandidateLocation.PlotArea.YAxis.VisibleValues = ChartAxisVisibleValues.Positive;

        radChartCandidateLocation.PlotArea.XAxis.AxisLabel.TextBlock.Text = ResourceManager.GetString("lblStatisticsLocation");
        radChartCandidateLocation.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Font = new Font("Arial", 12, FontStyle.Bold);
        radChartCandidateLocation.PlotArea.XAxis.AxisLabel.Visible = true;

        radChartCandidateLocation.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new Font("Arial", 10);
        radChartCandidateLocation.PlotArea.XAxis.AutoScale = false;
        radChartCandidateLocation.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between;

        radChartCandidateLocation.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 90;
        radChartCandidateLocation.PlotArea.XAxis.Appearance.LabelAppearance.Position.AlignedPosition = AlignedPositions.Top;
        radChartCandidateLocation.PlotArea.XAxis.Appearance.LabelAppearance.Position.Auto = false;
        radChartCandidateLocation.PlotArea.XAxis.Appearance.LabelAppearance.Position.X = 0;
        radChartCandidateLocation.PlotArea.XAxis.Appearance.LabelAppearance.Position.Y = 0;
        ChartSeries locationSeries = new ChartSeries("Location", ChartSeriesType.Bar);
        locationSeries.Appearance.FillStyle.MainColor = Color.LightSteelBlue;
        locationSeries.Appearance.FillStyle.FillType = FillType.Solid;
        locationSeries.Appearance.TextAppearance.Visible = true;
        radChartCandidateLocation.AddChartSeries(locationSeries);

        IList<ParamLocations> locationList = new ParamLocationsRepository().GetAllLocations();
        foreach (ParamLocations location in locationList)
        {
            radChartCandidateLocation.PlotArea.XAxis.AddItem(location.Location.Trim());
            int number = NeosDAO.GetNumberOfCandiateByLocation(location.Location.Trim(),
                location.LocationUk.Trim(), location.LocationNL.Trim());
            locationSeries.AddItem(number);
        }
    }
Пример #42
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (SessionManager.CurrentUser == null)
        {
            Common.RedirectToLoginPage(this);
            return;
        }
        else if (!IsPostBack)
        {
            FillLabelLanguage();

            //set properties for the labels of each column
            RadChartGeneralStatistics.PlotArea.Appearance.Dimensions.Margins.Left = 150;
            RadChartGeneralStatistics.PlotArea.Appearance.Dimensions.Margins.Right = 50;

            RadChartGeneralStatistics.PlotArea.XAxis.Appearance.TextAppearance.MaxLength = 1000;
            RadChartGeneralStatistics.PlotArea.XAxis.Appearance.TextAppearance.AutoTextWrap = AutoTextWrap.Auto;
            RadChartGeneralStatistics.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new Font("Arial", 10);
            RadChartGeneralStatistics.PlotArea.XAxis.AutoScale = false;
            RadChartGeneralStatistics.PlotArea.XAxis.LayoutMode = ChartAxisLayoutMode.Between;

            //set the value for the columns
            ChartSeries generalSeries = new ChartSeries();// ("General", ChartSeriesType.a);
            generalSeries.Appearance.FillStyle.MainColor = Color.LightGreen;
            generalSeries.Appearance.FillStyle.FillType = FillType.Solid;
            generalSeries.Appearance.TextAppearance.Visible = true;
            RadChartGeneralStatistics.Chart.Series.Clear();

            RadChartGeneralStatistics.AddChartSeries(generalSeries);

            List<int> generalStatisticList = new List<int>();

            CandidateSearchCriteria criteria = new CandidateSearchCriteria();
            //Number of active candidates.
            criteria.Active = "Yes";
            RadChartGeneralStatistics.PlotArea.XAxis.AddItem(ResourceManager.GetString("lblNbrActiveCandidateText"));
            generalSeries.AddItem(NeosDAO.CountAdvancedSearchCandidates(criteria));
            //Total number of candidates.
            criteria.Active = null;
            RadChartGeneralStatistics.PlotArea.XAxis.AddItem(ResourceManager.GetString("lblTotalCandidateText"));
            generalSeries.AddItem(NeosDAO.CountAdvancedSearchCandidates(criteria));

            //Number of active candidates related to the currently logged Néos user (based on [tblCandidat].[Interviewer])
            criteria.Active = "Yes";
            criteria.Interviewer = SessionManager.CurrentUser.UserID.Trim();
            RadChartGeneralStatistics.PlotArea.XAxis.AddItem(ResourceManager.GetString("lblNbrActCanOfCurUserText"));
            generalSeries.AddItem(NeosDAO.CountAdvancedSearchCandidates(criteria));
            //Total number of candidates related to the currently logged Néos user
            criteria.Active = null;
            RadChartGeneralStatistics.PlotArea.XAxis.AddItem(ResourceManager.GetString("lblTotalCanOfCurUserText"));
            generalSeries.AddItem(NeosDAO.CountAdvancedSearchCandidates(criteria));
            CompanyRepository comRepo = new CompanyRepository();
            //Number of companies.
            RadChartGeneralStatistics.PlotArea.XAxis.AddItem(ResourceManager.GetString("lblNbrCompanyText"));
            generalSeries.AddItem(comRepo.CountAllCompanies());
            //Number of Active Customers
            RadChartGeneralStatistics.PlotArea.XAxis.AddItem(ResourceManager.GetString("lblNbrActiveCustomerText"));
            generalSeries.AddItem(comRepo.CountCustomerCompanies());

            //Number of Prospects
            RadChartGeneralStatistics.PlotArea.XAxis.AddItem(ResourceManager.GetString("lblNbrProspectsText"));
            generalSeries.AddItem(comRepo.CountPropectCompanies());
        }
    }