private void DataPlay(int PageNo) { //判断当前用户是否有新建删除权限 HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString())) { this.isrole.Value = "1"; this.tdnewdoc.Visible = true; //新建 this.tddeldoc.Visible = true; //删除 } else { this.isrole.Value = "0"; this.tdnewdoc.Visible = false; //新建 this.tddeldoc.Visible = false; //删除 } //如果depid等于空,则返回按钮隐藏 if (this.Request.QueryString["deptid"] == null || this.Request.QueryString["deptid"] == "") { this.btnreturnback.Visible = false; } //得到当前页号 this.curpage.Text = PageNo.ToString(); HyoaClass.Hyoa_dept Hyoa_dept = new HyoaClass.Hyoa_dept(); DataTable dt; if (this.hy_deptname.Value != "") { //先判断是不是查询的,如果是查询的话,就不用管是哪一级了。全部列出来 Hyoa_dept.hy_deptname = this.hy_deptname.Value; dt = Hyoa_dept.GetdeptsBydeptname(); } else { if (this.txtdeptid.Value == "") { dt = Hyoa_dept.GetFirstlevdepts(); } else { dt = Hyoa_dept.GetSubDeptsOrderbysort(this.txtdeptid.Value); } } DataTable tempTable = dt.Clone(); for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++) { if (i > dt.Rows.Count - 1) break; DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[dt.Columns[j].ColumnName] = dt.Rows[i][j]; } tempTable.Rows.Add(dr); } int TotalRecord = dt.Rows.Count; this.sumts.Text = TotalRecord.ToString(); this.sumts2.Text = TotalRecord.ToString(); this.ShowTotalRecord.Text = TotalRecord.ToString(); //计算及显示总页数 int TotalPage; if (TotalRecord < System.Int32.Parse(PageSize.Text)) { TotalPage = 1; } else { if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0) { TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1; } else { TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text); } } this.ShowTotalPage.Text = TotalPage.ToString(); this.rptlist.DataSource = tempTable; this.rptlist.DataBind(); dt.Clear(); }