private void DealDataDaRunFaInfo() { try { string content = GetDataDaRunFaInfo(); if (string.IsNullOrEmpty(content)) { Page.ClientScript.RegisterStartupScript(GetType(), "info", " <script>alert('未搜索到!'); </script>"); return; } //string details = GetDaRunFaDetails("P0818050000103781"); //var detailResult = Newtonsoft.Json.JsonConvert.DeserializeObject<Darunfa_SearchResult<Darunfa_ProductInfo_Detail_Body>>(details); var searchResult = Newtonsoft.Json.JsonConvert.DeserializeObject <Darunfa_SearchResult <ScrapyProductInfo.Model.Darunfa.Darunfa_SearchResultBody> >(content); if (searchResult.errorCode == 0) { List <Darunfa_ProductInfo> lstProduct = searchResult.body.MerchandiseList; List <ShowProductInfo> lstShowProduct = new List <ShowProductInfo>(); foreach (var item in lstProduct) { ShowProductInfo showInfo = new ShowProductInfo(); showInfo.name = item.sm_name; showInfo.imgUrl = item.sm_pic; showInfo.goodsNo = item.sku_id; if (string.IsNullOrEmpty(item.subtitle)) { showInfo.descrption = ""; } else { showInfo.descrption = item.subtitle; } showInfo.price = item.sm_price; lstShowProduct.Add(showInfo); } if (lstShowProduct.Count > 0) { rpProduct.DataSource = string.Empty; rpProduct.DataBind(); rpProduct.DataSource = lstShowProduct; rpProduct.DataBind(); } } } catch (Exception ex) { } }
/// <summary> /// 搜索沃尔玛 /// </summary> private void DealDataWoermaInfo() { try { string content = GetDataWoerma(); if (string.IsNullOrEmpty(content)) { Page.ClientScript.RegisterStartupScript(GetType(), "info", " <script>alert('未搜索到!'); </script>"); return; } var searchResult = Newtonsoft.Json.JsonConvert.DeserializeObject <WoermaSearchResult <WoermaSearchResult_result> >(content); if (searchResult.success == true) { List <Woerma_ProductInfo> lstProduct = searchResult.result.searchResultVOList; List <ShowProductInfo> lstShowProduct = new List <ShowProductInfo>(); foreach (var item in lstProduct) { ShowProductInfo showInfo = new ShowProductInfo(); showInfo.name = item.skuName; showInfo.imgUrl = item.imgUrl; showInfo.goodsNo = item.skuId; showInfo.price = item.realTimePrice; showInfo.descrption = string.Empty; lstShowProduct.Add(showInfo); } rpProduct.DataSource = string.Empty; rpProduct.DataBind(); if (lstShowProduct.Count > 0) { rpProduct.DataSource = lstShowProduct; rpProduct.DataBind(); } } } catch (Exception ex) { } }