private ITopRequest GetTopRequest(string query, bool?discount, bool?showCase, string type, string filter, int pageIndex, int pageSize) { if (type.Equals("onsale", StringComparison.OrdinalIgnoreCase)) { ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest(); req.Fields = TopFieldsHelper.GetItemFields_InList();// "iid,title,nick,type,cid,num,props,price"; req.Query = query; req.HasDiscount = discount; req.HasShowcase = showCase; req.PageNo = pageIndex; req.PageSize = pageSize; if (!string.IsNullOrEmpty(filter) && !filter.Trim().Equals("all", StringComparison.OrdinalIgnoreCase)) { req.SellerCids = filter; } return(req); } else if (type.Equals("inventory", StringComparison.OrdinalIgnoreCase)) { ItemsInventoryGetRequest req = new ItemsInventoryGetRequest(); req.Fields = TopFieldsHelper.GetItemFields_InList();// "iid,title,nick,type,cid,num,props,price"; req.Query = query; if (!string.IsNullOrEmpty(filter) && !filter.Trim().Equals("all", StringComparison.OrdinalIgnoreCase)) { req.Banner = filter; } req.PageNo = pageIndex; req.PageSize = pageSize; return(req); } else { return(null); } }
private List <Item> GetItemList(string nick, int pageIndex, int pageSize) { ITopClient client = GetProductTopClient(); ItemsGetRequest reqItems = new ItemsGetRequest(); reqItems.Fields = TopFieldsHelper.GetItemFields_InList(); reqItems.Nicks = nick; reqItems.PageNo = pageIndex; reqItems.PageSize = pageSize; ResponseList <Item> rsp = client.Execute(reqItems, new ItemListJsonParser()); return(rsp.Content); }
protected void Page_Load(object sender, EventArgs e) { //if (string.IsNullOrEmpty(TOP_SessionKey)) //{ // ucCtrlSessionGetter.Parameters.Add("ReturnUrl", Request.Url.AbsoluteUri); // ucCtrlSessionGetter.Visible = true; // ucCtrlSearchItemsMulti.Visible = false; // ucCtrlShopCategoryTree.Visible = false; // hlnkOk.Enabled = false; // hlnkCancel.Enabled = false; //} //else //{ // ucCtrlSessionGetter.Visible = false; // ucCtrlSearchItemsMulti.Visible = true; // ucCtrlShopCategoryTree.Visible = true; // hlnkOk.Enabled = true; // hlnkCancel.Enabled = true; // ucCtrlShopCategoryTree.Nick = SellerNick; // ITopClient client = GetProductTopClient(); // ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest(); // req.Fields = TopFieldsHelper.GetItemFields_InList();// "iid,title,nick,type,cid,num,props,price"; // req.PageNo = ucCtrlPager.PageIndex + 1; // req.PageSize = ucCtrlPager.PageSize; // ITopRequest proxy = new TopSessionRequestProxy(req, TOP_SessionKey); // ResponseList<Item> rsp = client.Execute(proxy, new ItemListJsonParser()); // ucCtrlPager.TotalCount = (int)rsp.TotalResults; // ucCtrlSearchItemsMulti.ItemSource = rsp.Content; //} ITopClient client = GetProductTopClient(); ItemsGetRequest req = new ItemsGetRequest(); req.Fields = TopFieldsHelper.GetItemFields_InList();// "iid,title,nick,type,cid,num,props,price"; req.Nicks = "zhongjy001"; req.PageNo = ucCtrlPager.PageIndex + 1; req.PageSize = ucCtrlPager.PageSize; ResponseList <Item> rsp = client.Execute(req, new ItemListJsonParser()); ucCtrlPager.TotalCount = (int)rsp.TotalResults; ucCtrlSearchItemsMulti.ItemSource = rsp.Content; }
private void DisplayShop(Shop shop) { lblTitle.Text = "导入店铺 - " + shop.Title; if (!string.IsNullOrEmpty(shop.LogoUrl)) { imgShop.Visible = true; imgShop.ImageUrl = string.Format(ShopLogUrlFormat, shop.LogoUrl); } else { imgShop.Visible = false; } lblNick.Text = shop.SellerNick; lblShopTitle.Text = shop.Title; lblCreateDate.Text = shop.Created; lblUpdateDate.Text = shop.Modified; ITopClient client = GetProductTopClient(); UserGetRequest req = new UserGetRequest(); req.Fields = TopFieldsHelper.GetUserFields_All(); req.Nick = shop.SellerNick; User user = client.Execute(req, new UserJsonParser()); if (user != null) { ucCtrlCreditBuyer.CreditNum = user.BuyerCredit.GoodNum; ucCtrlCreditSeller.CreditNum = user.SellerCredit.GoodNum; } ItemsGetRequest reqItems = new ItemsGetRequest(); reqItems.Fields = TopFieldsHelper.GetItemFields_InList(); reqItems.Nicks = shop.SellerNick; reqItems.PageNo = ucCtrlPager.PageIndex + 1; reqItems.PageSize = ucCtrlPager.PageSize; ResponseList <Item> rsp = client.Execute(reqItems, new ItemListJsonParser()); ucCtrlPager.TotalCount = (int)rsp.TotalResults; rptItems.DataSource = rsp.Content; rptItems.DataBind(); lblItemCount.Text = rsp.TotalResults.ToString(); }
protected void Page_Load(object sender, EventArgs e) { string key = Request["v"]; string type = Request["t"]; int? page_no = null; int? page_size = null; if (!string.IsNullOrEmpty(Request["page_no"])) { page_no = int.Parse(Request["page_no"]); } if (!string.IsNullOrEmpty(Request["page_size"])) { page_size = int.Parse(Request["page_size"]); } if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(type)) { ITopClient client = GetProductTopClient(); switch (type.ToLower()) { case "item": ItemsSearchRequest req = new ItemsSearchRequest(); req.Fields = TopFieldsHelper.GetItemFields_InList(); req.Query = key; req.PageNo = page_no; req.PageSize = page_size; DataSource_Item = client.Execute(req, new ItemSearchListJsonParser()); Server.Transfer("ImportItem_Step1_SelectItems_Item.aspx"); break; //case "shop": // ShopFacade shopFacade = new ShopFacade(AppKey, AppSecret); // DataSource_Shop = shopFacade.GetShopByNick(key); // Server.Transfer("QueryResult_Shop.aspx"); // break; default: throw new ArgumentException("参数类型不支持 - " + type); } } }