private void BindingPage(int pageIndex) { QueryUserParams param = new QueryUserParams(); if (pageIndex == 0) pageIndex++; param.PageControl.PageIndex = pageIndex; param.sUserNo = this.txtUserNo.Text.Trim(); param.sUserName = this.txtUserName.Text.Trim(); var list = saUser.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(); }
/// <summary> /// /// </summary> /// <param name="param"></param> /// <returns></returns> public DataTable GetPageList(QueryUserParams param) { string fields = @" * "; string table = @" saUser A with(nolock) "; StringBuilder where = new StringBuilder(); where.Append(" 1=1 "); if (!param.sUserNo.IsNullOrWhiteSpace()) { where.Append(" and A.sUserNo like '%{0}%'".FormatEx(param.sUserNo.Trim())); } if (!param.sUserName.IsNullOrWhiteSpace()) { where.Append(" and A.sUserName like '%{0}%'".FormatEx(param.sUserName.Trim())); } string order = "A.sUserNo 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; return dt; }
/// <summary> /// /// </summary> /// <param name="param"></param> /// <returns></returns> public DataTable GetPageList(QueryUserParams param) { return dal.GetPageList(param); }