Exemplo n.º 1
0
        protected void BillingChartDataBinding()
        {
            //获取当前年的月底日期
            string firstMothDateTimeStr =
                DateTime.Parse(DateTime.Now.ToString("01/01/yyyy")).AddMonths(1).AddDays(-1).ToShortDateString();
            DateTime firstMothDate = DateTime.Parse(firstMothDateTimeStr);

            //生成Chart的X轴角标
            dt = new DataTable();
            DataColumn transaction = new DataColumn("Amount");

            transaction.DataType = typeof(int);
            dt.Columns.Add(transaction);
            transaction          = new DataColumn("month");
            transaction.DataType = typeof(string);
            dt.Columns.Add(transaction);

            GetInfo bllGetInfo = new GetInfo();

            //decimal usageAmount = bllGetInfo.GetBillingInfo();
            //统计当前月份的前N个月的数据
            for (int i = DateTime.Now.Month - 7; i < DateTime.Now.Month - 1; i++)
            {
                DateTime currentDate = firstMothDate.AddMonths(i);

                dt.Rows.Add(new object[] { bllGetInfo.GetBillingInfo(currentDate), currentDate.ToString("MM/yyyy") });
            }
            RChartCDProBilling.DataSource = dt;
            RChartCDProBilling.DataBind();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 每月交易数据线图绑定
        /// </summary>
        protected void TransactionChartDataBinding()
        {
            int[] array = { 111, 21, 116, 234, 118, 223, 114, 310, 225, 243, 1252, 102, 234 };
            //获取当前年的月底日期
            string firstMothDateTimeStr =
                DateTime.Parse(DateTime.Now.ToString("01/dd/yyyy")).AddMonths(1).AddDays(-1).ToShortDateString();
            DateTime firstMothDate = DateTime.Parse(firstMothDateTimeStr);

            //生成Chart的X轴角标
            dt = new DataTable();
            DataColumn transaction = new DataColumn("Transaction total");

            transaction.DataType = typeof(int);
            dt.Columns.Add(transaction);
            transaction          = new DataColumn("month");
            transaction.DataType = typeof(string);
            dt.Columns.Add(transaction);

            //统计当前月份的前N个月的数据
            for (int i = 0; i < DateTime.Now.Month; i++)
            {
                DateTime currentDate = firstMothDate.AddMonths(i);

                dt.Rows.Add(new object[] { array[i], currentDate.ToString("MM/dd/yyyy") });
            }

            RChartCDProTransaction.DataSource = dt;
            RChartCDProTransaction.DataBind();



            RChartCDProBilling.DataSource = dt;
            RChartCDProBilling.DataBind();
        }
Exemplo n.º 3
0
        protected void BillingChartDataBinding(string company = null, string cycle = null, string accNum = null)
        {
            //获取当前年的月底日期
            string firstMothDateTimeStr =
                DateTime.Parse(DateTime.Now.ToString("01/01/yyyy")).AddMonths(1).AddDays(-1).ToShortDateString();
            DateTime firstMothDate = DateTime.Parse(firstMothDateTimeStr);

            //生成Chart的X轴角标
            DataTable  dt          = new DataTable();
            DataColumn transaction = new DataColumn("Amount");

            transaction.DataType = typeof(int);
            dt.Columns.Add(transaction);
            transaction          = new DataColumn("month");
            transaction.DataType = typeof(string);
            dt.Columns.Add(transaction);

            GetInfo bllGetInfo = new GetInfo();

            //decimal usageAmount = bllGetInfo.GetBillingInfo();
            //统计当前月份的前N个月的数据
            if (string.IsNullOrEmpty(company) && string.IsNullOrEmpty(cycle) && string.IsNullOrEmpty(accNum))
            {
                //默认的查询所有的数据
                for (int i = DateTime.Now.Month - 7; i < DateTime.Now.Month - 1; i++)
                {
                    DateTime currentDate = firstMothDate.AddMonths(i);

                    dt.Rows.Add(new object[] { bllGetInfo.GetBillingInfo(currentDate), currentDate.ToString("MM/dd/yyyy") });
                }
            }
            else if (!string.IsNullOrEmpty(company) && string.IsNullOrEmpty(cycle) && string.IsNullOrEmpty(accNum))
            {
                //查询公司的
                for (int i = DateTime.Now.Month - 7; i < DateTime.Now.Month - 1; i++)
                {
                    DateTime currentDate = firstMothDate.AddMonths(i);

                    dt.Rows.Add(new object[] { bllGetInfo.GetBillingInfo(currentDate, company), currentDate.ToString("MM/dd/yyyy") });
                }
            }
            else if (!string.IsNullOrEmpty(company) && !string.IsNullOrEmpty(cycle) && string.IsNullOrEmpty(accNum))
            {
                //查询公司和相应区域
                for (int i = DateTime.Now.Month - 7; i < DateTime.Now.Month - 1; i++)
                {
                    DateTime currentDate = firstMothDate.AddMonths(i);

                    dt.Rows.Add(new object[] { bllGetInfo.GetBillingInfo(currentDate, company, cycle), currentDate.ToString("MM/dd/yyyy") });
                }
            }
            else if (!string.IsNullOrEmpty(company) && !string.IsNullOrEmpty(cycle) && !string.IsNullOrEmpty(accNum))
            {
                //查询公司和相应区域
                for (int i = DateTime.Now.Month - 7; i < DateTime.Now.Month - 1; i++)
                {
                    DateTime currentDate = firstMothDate.AddMonths(i);

                    dt.Rows.Add(new object[] { bllGetInfo.GetBillingInfo(currentDate, company, cycle, accNum), currentDate.ToString("MM/dd/yyyy") });
                }
            }
            RChartCDProBilling.DataSource = dt;
            RChartCDProBilling.DataBind();
        }