예제 #1
0
        protected void DurationCostChartStore_Load(object sender, EventArgs e)
        {
            if (!Ext.Net.X.IsAjaxRequest)
            {
                DateTime fromDate = new DateTime(DateTime.Now.Year - 1, DateTime.Now.Month, 1);
                DateTime toDate   = DateTime.Now;

                var chartData = GetDurationChartData(fromDate, toDate);

                // Bind the "report" to to the Chart's store.
                DurationCostChart.GetStore().DataSource = chartData;
                DurationCostChart.GetStore().DataBind();
            }
        }
예제 #2
0
        protected void SubmitCustomizeStatisticsBtn_Click(object sender, DirectEventArgs e)
        {
            //Submitted from the view
            int filterYear, filterQuater;

            //For DateTime handling
            DateTime startingDate, endingDate;
            string   titleText = string.Empty;


            if (CustomizeStats_Years.SelectedItem.Index > -1 && CustomizeStats_Quarters.SelectedItem.Index > -1)
            {
                filterYear   = Convert.ToInt32(CustomizeStats_Years.SelectedItem.Value);
                filterQuater = Convert.ToInt32(CustomizeStats_Quarters.SelectedItem.Value);

                //Construct the Date Range
                titleText = SpecialDateTime.ConstructDateRange(filterYear, filterQuater, out startingDate, out endingDate);

                //Re-bind DurationCostChart to match the filter dates criteria
                DurationCostChart.GetStore().LoadData(this.GetDurationChartData(startingDate, endingDate));
                DurationCostChartPanel.Title = String.Format("Business/Personal Calls - {0}", titleText);

                var chartData = Global.DATABASE.ChartsReports.GetByUser(sipAccount, startingDate, endingDate);

                if (chartData.Count > 0)
                {
                    //Re-bind PhoneCallsDuartionChart to match the filter dates criteria
                    PhoneCallsDuartionChart.GetStore().LoadData(chartData);
                    PhoneCallsDuartionChartPanel.Title = String.Format("Calls Duration - {0}", titleText);

                    //Re-bind PhoneCallsCostChart to match the filter dates criteria
                    PhoneCallsCostChart.GetStore().LoadData(chartData);
                    PhoneCallsCostChartPanel.Title = String.Format("Calls Costs - {0}", titleText);
                }
                else
                {
                    PhoneCallsDuartionChart.GetStore().RemoveAll();
                    PhoneCallsCostChart.GetStore().RemoveAll();
                }
            } //End-if
        }     //End-Function