protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (this.Session["InsDate"] == null)
         {
             dpEndDate.SelectedDate   = DateTime.Now.Date.AddDays(-1);
             dpStartDate.SelectedDate = DateTime.Now.AddYears(-1).AddDays(-1).Date;
             this.Session["InsDate"]  = "IsSetDate";
         }
         else
         {
             dpStartDate.SelectedDate    = DateTime.Parse(this.Session["StartDate"].ToString()).Date;
             dpEndDate.SelectedDate      = DateTime.Parse(this.Session["EndDate"].ToString()).Date;
             ddlreadertype.SelectedValue = this.Session["SelectReaderType"].ToString();
             ddllogtype.SelectedValue    = this.Session["SelectLogType"].ToString();
         }
         if (this.Session["GridData"] != null)
         {
             TopListGrid.DataSource = this.Session["GridData"] as DataView;
             TopListGrid.DataBind();
             //this.Session.Remove("GridData");
         }
         if (this.Session["Data_progress"] != null)
         {
             Response.Write(this.Session["Data_progress"].ToString());
             if (this.Session["Data_progress"].ToString() == "(4/4)查询完成,感谢您的耐心等待!")
             {
                 this.Session.Remove("Data_progress");
             }
             Response.End();
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// 数据绑定
        /// </summary>
        private void BindGrid()
        {
            DataTable table = new DataTable();

            this.Session["StartDate"]        = dpStartDate.SelectedDate.Value;
            this.Session["EndDate"]          = dpEndDate.SelectedDate.Value;
            this.Session["SelectReaderType"] = ddlreadertype.SelectedValue;
            this.Session["SelectLogType"]    = ddllogtype.SelectedValue;
            TopListGrid.Title = ddllogtype.SelectedText + "(" + ddlreadertype.SelectedText + ")";
            switch ((Code.ReadingRoomStatistics.TopReaderType) int.Parse(ddlreadertype.SelectedValue))
            {
            case Code.ReadingRoomStatistics.TopReaderType.OnlyReader:
                TopListGrid.Columns[1].Hidden = false;
                TopListGrid.Columns[2].Hidden = false;
                TopListGrid.Columns[3].Hidden = false;
                TopListGrid.Columns[4].Hidden = false;
                break;

            case Code.ReadingRoomStatistics.TopReaderType.ReaderDept:
                TopListGrid.Columns[1].Hidden = true;
                TopListGrid.Columns[2].Hidden = true;
                TopListGrid.Columns[3].Hidden = true;
                TopListGrid.Columns[4].Hidden = false;
                break;

            case Code.ReadingRoomStatistics.TopReaderType.ReaderType:
                TopListGrid.Columns[1].Hidden = true;
                TopListGrid.Columns[2].Hidden = true;
                TopListGrid.Columns[3].Hidden = false;
                TopListGrid.Columns[4].Hidden = true;
                break;
            }
            switch ((Code.ReadingRoomStatistics.TopLogType) int.Parse(ddllogtype.SelectedValue))
            {
            case ReadingRoomStatistics.TopLogType.SeatTime:
                table = Code.LogTopQuery.GetSeatTimeTop(dpStartDate.SelectedDate.Value, dpEndDate.SelectedDate.Value, int.Parse(ddlreadertype.SelectedValue), int.Parse(ddltopnum.SelectedValue));
                break;

            case ReadingRoomStatistics.TopLogType.EnterOutLog:
                table = Code.LogTopQuery.GetSeatCountTop(dpStartDate.SelectedDate.Value, dpEndDate.SelectedDate.Value, int.Parse(ddlreadertype.SelectedValue), int.Parse(ddltopnum.SelectedValue));
                break;

            case ReadingRoomStatistics.TopLogType.Blastlist:
                table = Code.LogTopQuery.GetBlacklistTop(dpStartDate.SelectedDate.Value, dpEndDate.SelectedDate.Value, int.Parse(ddlreadertype.SelectedValue), int.Parse(ddltopnum.SelectedValue));
                break;

            case ReadingRoomStatistics.TopLogType.ViolateDiscipline:
                table = Code.LogTopQuery.GetViolateDisciplineTop(dpStartDate.SelectedDate.Value, dpEndDate.SelectedDate.Value, int.Parse(ddlreadertype.SelectedValue), int.Parse(ddltopnum.SelectedValue));
                break;
            }
            string   sortField     = TopListGrid.Columns[TopListGrid.SortColumnIndex].SortField;
            string   sortDirection = TopListGrid.SortDirection;
            DataView TableView     = table.DefaultView;

            TableView.Sort = String.Format("{0} {1}", sortField, sortDirection);
            Dictionary <string, DataTable> ddt = new Dictionary <string, DataTable>();

            ddt.Add("排行榜", table);
            this.Session["DataTables"] = ddt;
            TopListGrid.DataSource     = TableView;
            TopListGrid.DataBind();
        }