public DbQueryResult GetCashBackByPager(CashBackQuery query) { string selectFields = "hcb.*,UserName,CellPhone"; string table = "Hishop_CashBack hcb LEFT JOIN aspnet_Members am ON hcb.UserId=am.UserId"; string pk = "CashBackId"; string filter = " 1=1 "; if (query.UserId.HasValue) { filter = filter + string.Format(" AND hcb.UserId={0}", query.UserId.Value); } if (!string.IsNullOrWhiteSpace(query.UserName)) { filter = filter + string.Format(" AND UserName LIKE '%{0}%'", query.UserName); } if (!string.IsNullOrWhiteSpace(query.Cellphone)) { filter = filter + string.Format(" AND Cellphone LIKE '%{0}%'", query.Cellphone); } if (query.CashBackTypes.HasValue) { filter = filter + string.Format(" AND CashBackType = {0}", (int)query.CashBackTypes.Value); } if (query.IsValid.HasValue) { filter = filter + string.Format(" AND IsValid = {0}", query.IsValid.Value ? 1 : 0); } if (query.IsFinished.HasValue) { filter = filter + string.Format(" AND IsFinished = {0}", query.IsFinished.Value ? 1 : 0); } return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, table, pk, filter, selectFields)); }
private void BindCashBackData() { CashBackQuery query = new CashBackQuery { PageIndex = this.pager.PageIndex, PageSize = this.pager.PageSize, Cellphone = this.cellphone, UserName = this.Username }; if (!string.IsNullOrWhiteSpace(this.type)) { query.CashBackTypes = new CashBackTypes?((CashBackTypes)int.Parse(this.type)); } DbQueryResult cashBackByPager = CashBackHelper.GetCashBackByPager(query); this.grdMemberList.DataSource = cashBackByPager.Data; this.grdMemberList.DataBind(); this.pager1.TotalRecords = this.pager.TotalRecords = cashBackByPager.TotalRecords; }
public static DbQueryResult GetCashBackByPager(CashBackQuery query) { return(new CashBackDao().GetCashBackByPager(query)); }