using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data;
using InfoSoftGlobal;
public partial class SumUserOrderSuccessFail : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.beginDate.Value = this.endDate.Value = DateTime.Now.ToString("yyyy-MM-dd");
this.beginTime.Value = "00:00";
this.endTime.Value = DateTime.Now.ToString("HH:mm");
}
BindData();
}
public Database DB
{
get
{
if (Session["CurrentDataBase"] == null)
this.Session["CurrentDataBase"] = DatabaseFactory.CreateDatabase();
return Session["CurrentDataBase"] as Database;
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindData()
{
DataSet ds = DB.ExecuteDataSet("SP_UserNoBankOrderSummary", string.Format("{0} {1}", this.beginDate.Value, beginTime.Value), string.Format("{0} {1}", endDate.Value, endTime.Value));
if (ds.Tables.Count > 0)
dsUserRegister.DataSource = ds.Tables[0];
dsUserRegister.DataBind();
}
protected void btnSearch_Click(object sender, EventArgs e)
{
BindData();
}
public string CreateChart()
{
DataTable dt = new DataTable();
DataSet ds = DB.ExecuteDataSet("SP_UserNoBankOrderSummary", string.Format("{0} {1}", this.beginDate.Value, beginTime.Value), string.Format("{0} {1}", endDate.Value, endTime.Value));
dt = ds.Tables[0];
string[,] array = new string[dt.Rows.Count, 3];
for (int i = 0; i < dt.Rows.Count; i++)
{
for (int j = 0; j < 3; j++)
{
array[i, j] = dt.Rows[i][j].ToString();
}
}
string strXML, strCategories, strDataRev, strDataQty;
strXML = "<graph caption='订单走势图' PYAxisName='Revenue' SYAxisName='Quantity (in Units)' numberPrefix='笔' formatNumberScale='0' showValues='0' decimalPrecision='0' anchorSides='14' anchorRadius='3' anchorBorderColor='FF8000'>";
strCategories = "<categories>";
strDataRev = "<dataset seriesName='支付模式' color='AFD8F8' >";
strDataQty = "<dataset seriesName='成功单数' parentYAxis='S' color='FF8000' >";
for (int k = 0; k < dt.Rows.Count; k++)
{
strCategories += "<category name='" +AdminPay.PayMode.ReturnPayMode( int.Parse(array[k, 2])) + "' />";
strDataRev += "<set value='" + array[k, 0] + "' />";
strDataQty += "<set value='" + array[k, 1] + "' />";
}
strCategories += "</categories>";
//关闭<dataset>要素
strDataRev += "</dataset>";
strDataQty += "</dataset>";
//组装现在整个的XML
strXML += strCategories + strDataRev + strDataQty + "</graph>";
//创建图表-质谱柱线组合三维图的数据载于strXML
return FusionCharts.RenderChart("FusionCharts/FCF_MSColumn3DLineDY.swf", "", strXML, "", "780", "330", false, false);
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ReportOrder.aspx.cs" Inherits="ReportOrder"
MasterPageFile="~/Admin.master" %>
<asp:Content ContentPlaceHolderID="main" ID="content1" runat="server">
<script type="text/javascript" src="FusionCharts/FusionCharts.js"></script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5" background="img/huishadow.jpg">
</td>
</tr>
<tr>
<td style="padding: 9px;">
<div class="location">
您所在位置: 管理首页 -> <span class="black"><strong>每小时的订单数量</strong></span></div>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="menutd"
style="border: 1px solid #ccc;">
<tr>
<td class="contenttd1">
<table cellpadding="0" cellspacing="0">
<tr>
<td align="left">
开始时间(yyyy-MM-dd) :
</td>
<td align="left">
<input type="text" id="beginDate" runat="server" />
</td>
<td align="left">
</td>
<td align="left">
hh:mm
<input type="text" id="beginTime" style="width: 90px;" runat="server" />
</td>
<td rowspan="2" align="left">
<asp:Button ID="btnSearch" runat="server" Text="查询" Style="width: 60px; height: 30px;" />
</td>
</tr>
<tr>
<td align="left">
结束时间(yyyy-MM-dd) :
</td>
<td align="left">
<input type="text" id="endDate" runat="server" />
</td>
<td align="left">
</td>
<td align="left">
hh:mm
<input type="text" id="endTime" style="width: 90px;" runat="server" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table> <%=CreateChart() %>
</asp:Content>