using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using UUN;
using System.Data.SqlClient;
using System.IO;
using System.Text;

public partial class Admin_TongJi_ZongTiGaiKuang : System.Web.UI.Page
{
    private 访问 访问;
    private String SQL = "SELECT * FROM ["+程序.数据表前缀+"其它_访问统计_统计报告] ORDER BY [ID] DESC";
    protected void Page_Load(object sender, EventArgs e)
    {
        访问 = new 访问(this.Context);
        访问.开始处理("查看统计", "网站后台", "查看统计", new 访问.回调委托(ZhiXing));
        访问.关闭连接();
    }
    private void ZhiXing()
    {
        访问.验证管理员();
        设置 设置 = new 设置(File.ReadAllText(Server.MapPath("~/Data/TongJi/ZongTi.xml"), Encoding.UTF8));
        KaiShiTongJiShiJian.Text = Convert.ToString(设置["开始统计时间"]);
        TongJiTianShu.Text = Convert.ToString(设置["统计天数"]);
        ZongDianJiShu.Text = Convert.ToString(设置["总点击数"]);
        ZhouDianJiShu.Text = Convert.ToString(设置["周点击数"]);
        JinDianJiShu.Text = Convert.ToString(设置["今点击数"]);
        ZuoDianJiShu.Text = Convert.ToString(设置["昨点击数"]);
        ZongIPShu.Text = Convert.ToString(设置["总IP数"]);
        ZhouIPShu.Text = Convert.ToString(设置["周IP数"]);
        JinIPShu.Text = Convert.ToString(设置["今IP数"]);
        ZuoIPShu.Text = Convert.ToString(设置["昨IP数"]);
        HuiYuanZaiXianShu.Text = Convert.ToString(Application["UUN_UUN3G_ZaiXianHuiYuanShu"]);
        DangQianZaiXianShu.Text = Convert.ToString(Application["UUN_UUN3G_ZaiXianYongHuShu"]);

        if(!this.IsPostBack)
            生成数据();
    }
    private void 生成数据()
    {
        DataSet 数据 = new DataSet();
        SqlCommand 语句 = new SqlCommand(SQL, 访问.连接);
        SqlDataAdapter 填充 = new SqlDataAdapter(语句);
        填充.Fill(数据, 0, 10, "统计报告");
        GridView1.DataSource = 数据.Tables[0];
        GridView1.DataBind();
    }
    protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
    {
        SQL = "SELECT * FROM ["+程序.数据表前缀+"其它_访问统计_统计报告]";

        SQL += " ORDER BY [" + e.SortExpression + "]";

        if (PaiXuZiDuan.Value == e.SortExpression && (!Convert.ToBoolean(PaiXuFangXiang.Value)))
        {
            SQL += " DESC";
            PaiXuFangXiang.Value = "true";
        }
        else
        {
            SQL += "";
            PaiXuFangXiang.Value = "false";
        }

        PaiXuZiDuan.Value = e.SortExpression;

        生成数据();
    }
}
