public void LoadGift() { if (!string.IsNullOrEmpty(this.context.Request["PageSize"]) && !string.IsNullOrEmpty(this.context.Request["CurrentPage"])) { int pageSize = int.Parse(this.context.Request["PageSize"]); int pageIndex = int.Parse(this.context.Request["CurrentPage"]); GiftQuery giftQuery = new GiftQuery(); giftQuery.IsOnline = true; giftQuery.Page.PageSize = pageSize; giftQuery.Page.PageIndex = pageIndex; giftQuery.Page.SortBy = "GiftId"; giftQuery.Page.SortOrder = SortAction.Desc; DbQueryResult gifts = GiftHelper.GetGifts(giftQuery); DataTable data = gifts.Data; string str = "{\"totalCount\":\"" + gifts.TotalRecords + "\",\"data\":["; string text = ""; for (int i = 0; i < data.Rows.Count; i++) { if (text != "") { text += ","; } text = text + "{\"GiftId\":\"" + data.Rows[i]["GiftId"] + "\",\"Name\":\"" + data.Rows[i]["Name"] + "\",\"NeedPoint\":\"" + data.Rows[i]["NeedPoint"] + "\",\"ThumbnailUrl180\":\"" + Globals.GetImageServerUrl("http://", data.Rows[i]["ThumbnailUrl180"].ToNullString()) + "\"}"; } str += text; str += "]}"; this.context.Response.Write(str); } }
private DataGridViewModel <Dictionary <string, object> > GetDataList(GiftQuery query) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); if (query != null) { DbQueryResult gifts = GiftHelper.GetGifts(query); dataGridViewModel.rows = DataHelper.DataTableToDictionary(gifts.Data); dataGridViewModel.total = gifts.TotalRecords; foreach (Dictionary <string, object> row in dataGridViewModel.rows) { row["ThumbnailUrl40"] = base.GetImageOrDefaultImage(row["ThumbnailUrl40"], base.CurrentSiteSetting.DefaultProductImage); } } return(dataGridViewModel); }
private void BindData() { GiftQuery query = new GiftQuery { Name = this.giftName, IsPromotion = this.isPromotion }; query.Page.PageSize = this.pager.PageSize; query.Page.PageIndex = this.pager.PageIndex; query.Page.SortBy = this.grdGift.SortOrderBy; if (this.grdGift.SortOrder.ToLower() == "desc") { query.Page.SortOrder = SortAction.Desc; } DbQueryResult gifts = GiftHelper.GetGifts(query); this.grdGift.DataSource = gifts.Data; this.grdGift.DataBind(); this.pager.TotalRecords = gifts.TotalRecords; this.pager1.TotalRecords = gifts.TotalRecords; }
private void BindData() { GiftQuery query = new GiftQuery(); query.Name = giftName; query.Page.PageSize = pager.PageSize; query.Page.PageIndex = pager.PageIndex; query.Page.SortBy = grdGift.SortOrderBy; if (grdGift.SortOrder.ToLower() == "desc") { query.Page.SortOrder = SortAction.Desc; } DbQueryResult gifts = GiftHelper.GetGifts(query); grdGift.DataSource = gifts.Data; grdGift.DataBind(); pager.TotalRecords = gifts.TotalRecords; pager1.TotalRecords = gifts.TotalRecords; }