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(); }
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(); }
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(); }