<%@ Register TagPrefix="webdiyer" Namespace="Wuqi.Webdiyer" Assembly="AspNetPager" %>
<%@ Page CodeBehind="admin_downcount.aspx.cs" Language="c#" AutoEventWireup="True" Inherits="Webdisk.admin_downcount" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>下载统计</title>
		<% @ Import Namespace="Webdisk" %>
		<script src="../js/calendar.js" type="text/javascript"></script>
		<script language="javascript">
   var CalendarWebControl = new atCalendarControl();
		</script>
		<link href="img/main.css" rel="stylesheet" type="text/css">
			<style type="text/css">.style1 { FONT-WEIGHT: bold; COLOR: #ffffff }
	.style2 { COLOR: #ffffff }
	</style>
	</HEAD>
	<body>
		<form id="Form1" method="post" runat="server">
			<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" id="brb"
				height="27">
				<tr>
					<td colSpan="3" class="td_title">搜索下载
					</td>
				</tr>
				<tr class="tableTd">
					<td>用户名：<input class="tableTdtext" id="username" style="WIDTH: 96px; HEIGHT: 20px" type="text"
							size="10" name="username" runat="server">&nbsp;从
						<asp:textbox id="date1" runat="server" Columns="17" CssClass="tableTdtext"></asp:textbox>至
						<asp:textbox id="date2" runat="server" Columns="17" CssClass="tableTdtext"></asp:textbox>&nbsp;地址来源匹配：<INPUT class="tableTdtext" id="url" style="WIDTH: 112px; HEIGHT: 20px" type="text" size="13"
							name="username" runat="server"><asp:button id="Button2" runat="server" CssClass="formbutton" Text="查找" Width="50px" onclick="Button2_Click"></asp:button></td>
				</tr>
			</table>
			<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" id="brb"
				height="27">
				<tr>
					<td colSpan="2"><div align="center"><font face="宋体">查看方式：</font>
							<asp:DropDownList ID="typesel" runat="server" AutoPostBack="True" onselectedindexchanged="DropDownList1_SelectedIndexChanged">
								<asp:ListItem Value="0" Selected="True">
                                  查看每个下载记录
                                </asp:ListItem>
								<asp:ListItem Value="1">
                                  按每个用户名统计总共流量
                                </asp:ListItem>
								<asp:ListItem Value="2">
                                  查看每天总共流量
                                </asp:ListItem>
								<asp:ListItem Value="3">
                                  按下载来源统计
                                </asp:ListItem>
							</asp:DropDownList>
						</div>
					</td>
				</tr>
				<tr>
					<td class="td_title">下载统计（点击表头可升降排序）
					</td>
					<td colspan="-1" class="td_title1">共计流量：
						<asp:label id="sum" runat="server">Label</asp:label>&nbsp;&nbsp;</td>
				</tr>
			</table>
        <asp:DataGrid ID="DataGrid" runat="server" Width="100%" CssClass="GridBody" GridLines="None"
            AutoGenerateColumns="False" PageSize="20" AllowSorting="True">
            <AlternatingItemStyle CssClass="GridLine"></AlternatingItemStyle>
            <ItemStyle CssClass="GridItem"></ItemStyle>
            <HeaderStyle CssClass="GridHead"></HeaderStyle>
            <Columns>
                <asp:HyperLinkColumn Text="用户名" DataNavigateUrlField="username" DataNavigateUrlFormatString="admin_edituser.aspx?username={0}"
                    DataTextField="username" SortExpression="username" HeaderText="用户名">
                    <HeaderStyle HorizontalAlign="Center" Width="15%"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:HyperLinkColumn>
                <asp:BoundColumn DataField="FileURL" SortExpression="FileURL" HeaderText="文件路径">
                    <HeaderStyle HorizontalAlign="Center" Width="30%"></HeaderStyle>
                </asp:BoundColumn>
                <asp:BoundColumn DataField="DownTime" SortExpression="DownTime" HeaderText="下载时间">
                    <HeaderStyle HorizontalAlign="Center" Width="25%"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:BoundColumn>
                <asp:HyperLinkColumn DataNavigateUrlField="DownUser" DataNavigateUrlFormatString="admin_edituser.aspx?username={0}"
                    DataTextField="DownUser" SortExpression="DownUser" HeaderText="下载用户">
                    <HeaderStyle HorizontalAlign="Center" Width="15%"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:HyperLinkColumn>
                <asp:TemplateColumn SortExpression="DownSize" HeaderText="文件大小">
                    <HeaderStyle HorizontalAlign="Center" Width="10%"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                    <ItemTemplate>
                        <%# ShowSize(DataBinder.Eval(Container.DataItem, "DownSize").ToString()) %>
                        </asp:Label>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:HyperLinkColumn Target="_blank" DataNavigateUrlField="FromUrl" DataNavigateUrlFormatString="{0}"
                    DataTextField="FromUrl" SortExpression="FromUrl" HeaderText="地址来源">
                    <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                </asp:HyperLinkColumn>
                <asp:BoundColumn DataField="ip" HeaderText="IP">
                    <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                        Font-Underline="False" HorizontalAlign="Center" />
                    <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                        Font-Underline="False" HorizontalAlign="Center" />
                </asp:BoundColumn>
            </Columns>
            <PagerStyle PageButtonCount="20" Mode="NumericPages"></PagerStyle>
        </asp:DataGrid><asp:datagrid id="Datagrid1" runat="server" Width="100%" CssClass="GridBody" GridLines="None"
				AutoGenerateColumns="False" PageSize="20" AllowSorting="True">
				<AlternatingItemStyle CssClass="GridLine"></AlternatingItemStyle>
				<ItemStyle CssClass="GridItem"></ItemStyle>
				<HeaderStyle CssClass="GridHead"></HeaderStyle>
				<Columns>
					<asp:HyperLinkColumn Text="用户名" DataNavigateUrlField="username" DataNavigateUrlFormatString="admin_edituser.aspx?username={0}"
						DataTextField="username" SortExpression="username" HeaderText="用户名">
						<HeaderStyle HorizontalAlign="Center" Width="33%"></HeaderStyle>
						<ItemStyle HorizontalAlign="Center"></ItemStyle>
					</asp:HyperLinkColumn>
					<asp:BoundColumn DataField="UserCount" SortExpression="COUNT(id)" HeaderText="总共下载次数">
						<HeaderStyle HorizontalAlign="Center" Width="33%"></HeaderStyle>
						<ItemStyle HorizontalAlign="Center"></ItemStyle>
					</asp:BoundColumn>
					<asp:TemplateColumn SortExpression="SUM(DownSize)" HeaderText="总共下载流量">
						<HeaderStyle HorizontalAlign="Center" Width="33%"></HeaderStyle>
						<ItemStyle HorizontalAlign="Center"></ItemStyle>
						<ItemTemplate>
							<%# ShowSize(DataBinder.Eval(Container.DataItem, "DownSize").ToString()) %>
							</asp:Label>
						</ItemTemplate>
					</asp:TemplateColumn>
				</Columns>
				<PagerStyle PageButtonCount="20" Mode="NumericPages"></PagerStyle>
			</asp:datagrid><asp:datagrid id="Datagrid2" runat="server" Width="100%" CssClass="GridBody" GridLines="None"
				AutoGenerateColumns="False" PageSize="20" AllowSorting="True">
				<AlternatingItemStyle CssClass="GridLine"></AlternatingItemStyle>
				<ItemStyle CssClass="GridItem"></ItemStyle>
				<HeaderStyle CssClass="GridHead"></HeaderStyle>
				<Columns>
					<asp:BoundColumn DataField="DownTime" SortExpression="CONVERT(varchar(10), DownTime, 120)" HeaderText="日期">
						<HeaderStyle HorizontalAlign="Center" Width="33%"></HeaderStyle>
						<ItemStyle HorizontalAlign="Center"></ItemStyle>
					</asp:BoundColumn>
					<asp:BoundColumn DataField="UserCount" SortExpression="COUNT(id)" HeaderText="总共下载次数">
						<HeaderStyle HorizontalAlign="Center" Width="33%"></HeaderStyle>
						<ItemStyle HorizontalAlign="Center"></ItemStyle>
					</asp:BoundColumn>
					<asp:TemplateColumn SortExpression="SUM(DownSize)" HeaderText="总共下载流量">
						<HeaderStyle HorizontalAlign="Center" Width="33%"></HeaderStyle>
						<ItemStyle HorizontalAlign="Center"></ItemStyle>
						<ItemTemplate>
							<%# ShowSize(DataBinder.Eval(Container.DataItem, "DownSize").ToString()) %>
							</asp:Label>
						</ItemTemplate>
					</asp:TemplateColumn>
				</Columns>
				<PagerStyle PageButtonCount="20" Mode="NumericPages"></PagerStyle>
			</asp:datagrid><asp:datagrid id="Datagrid3" runat="server" Width="100%" CssClass="GridBody" GridLines="None"
				AutoGenerateColumns="False" PageSize="20" AllowSorting="True">
				<AlternatingItemStyle CssClass="GridLine"></AlternatingItemStyle>
				<ItemStyle CssClass="GridItem"></ItemStyle>
				<HeaderStyle CssClass="GridHead"></HeaderStyle>
				<Columns>
					<asp:HyperLinkColumn Target="_blank" DataNavigateUrlField="FromUrl" DataNavigateUrlFormatString="{0}"
						DataTextField="FromUrl" SortExpression="FromUrl" HeaderText="地址来源">
						<HeaderStyle HorizontalAlign="Center" Width="33%"></HeaderStyle>
						<ItemStyle HorizontalAlign="Center"></ItemStyle>
					</asp:HyperLinkColumn>
					<asp:BoundColumn DataField="UserCount" SortExpression="COUNT(id)" HeaderText="总共下载次数">
						<HeaderStyle HorizontalAlign="Center" Width="33%"></HeaderStyle>
						<ItemStyle HorizontalAlign="Center"></ItemStyle>
					</asp:BoundColumn>
					<asp:TemplateColumn SortExpression="SUM(DownSize)" HeaderText="总共下载流量">
						<HeaderStyle HorizontalAlign="Center" Width="33%"></HeaderStyle>
						<ItemStyle HorizontalAlign="Center"></ItemStyle>
						<ItemTemplate>
							<%# ShowSize(DataBinder.Eval(Container.DataItem, "DownSize").ToString()) %>
							</asp:Label>
						</ItemTemplate>
					</asp:TemplateColumn>
				</Columns>
				<PagerStyle PageButtonCount="20" Mode="NumericPages"></PagerStyle>
			</asp:datagrid>
			<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
				<tr>
					<td height="25"><webdiyer:AspNetPager id="Pager" runat="server" PageSize="20" AlwaysShow="True" ShowCustomInfoSection="Left"
							NumericButtonCount="15" HorizontalAlign="Right" ShowBoxThreshold="21" FirstPageText="<font face=webdings>9</font>"
							PrevPageText="<font face=webdings>3</font>" NextPageText="<font face=webdings>4</font>" LastPageText="<font face=webdings>:</font>"
							Height="20px" CssClass="page" onpagechanged="Pager_PageChanged"></webdiyer:AspNetPager></td>
				</tr>
			</table>
		</form>
	</body>
</HTML>
