Пример #1
0
        protected void BindLog(int pageSize,int pageIndex)
        {   
            string username = txtLoginName.Text.Trim();
            string userId = "";

            if (!string.IsNullOrEmpty(username))
            {
               
                MemberShipManager msm = new MemberShipManager();

                if (msm.IsUserExist(username))
                {
                    User _user = msm.GetUser(username);

                    if (_user != null)
                    {
                        userId = _user.UserId.ToString();
                    }
                }
                else
                {
                    GridView1.EmptyDataText = "没有该用户";
                    this.AspNetPager1.RecordCount = 0;
                    GridView1.DataSource = null;//ds;
                    GridView1.DataBind();
                    return;
                }
            }

            if (t_Date.Text != string.Empty
                && e_Date.Text != string.Empty)
            {
                DateTime begin = Convert.ToDateTime(t_Date.Text);
                DateTime end = Convert.ToDateTime(e_Date.Text).AddDays(1);

                DataSet ds;
                
                Resource obj = new Resource();
                ds = obj.GetResourcesUploadLog(begin, end, pageSize, pageIndex, userId);

                if (ds != null && ds.Tables[1].Rows.Count > 0)
                {
                    this.AspNetPager1.RecordCount = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
                    GridView1.DataSource = ds.Tables[1];
                    GridView1.DataBind();
                }
                else
                {
                    this.AspNetPager1.RecordCount = 0;
                    GridView1.DataSource = null;//ds;
                    GridView1.DataBind();
                }
            }
        }