private void BindingPage(int pageIndex) { QueryRoleParams param = new QueryRoleParams(); if (pageIndex == 0) pageIndex++; param.PageControl.PageIndex = pageIndex; param.sRoleName = this.txtRoleName.Text.Trim(); var list = saRole.Current.GetPageList(param); this.Repeater1.DataSource = list; this.Repeater1.DataBind(); this.MyPageControl.TotalPages = param.PageControl.TotalPageCount; this.MyPageControl.TotalRows = param.PageControl.TotalRecordCount; this.MyPageControl.CurrentPage = pageIndex; this.MyPageControl.DataBind(); }
public IList<saRoleInfo> GetPageList(QueryRoleParams param) { return dal.GetPageList(param); }
/// <summary> /// /// </summary> /// <param name="param"></param> /// <returns></returns> public IList<saRoleInfo> GetPageList(QueryRoleParams param) { string fields = @" * "; string table = @" saRole A with(nolock) "; StringBuilder where = new StringBuilder(); where.Append(" 1=1 "); if (!param.sRoleName.IsNullOrWhiteSpace()) { where.Append(" and A.sName like '%{0}%'".FormatEx(param.sRoleName.Trim())); } string order = "A.iSort Asc "; int pages = 0; int records = 0; DataTable dt = new DbServer().PageQuery(table, fields.ToString(), order.ToString(), where.ToString(), string.Empty, string.Empty, param.PageControl.PageSize, param.PageControl.PageIndex, 0, out pages, out records); param.PageControl.TotalPageCount = pages; param.PageControl.TotalRecordCount = records; IList<saRoleInfo> list = new List<saRoleInfo>(); foreach (DataRow row in dt.Rows) { list.Add(DataRowBind(row)); } return list; }