public String getRakutenCategories(int CategoryId) { string appId = "1095695100824025173"; List <String> lst = new List <String>(); try { string url = "https://app.rakuten.co.jp/services/api/IchibaGenre/Search/20140222?format=xml&genreId=" + CategoryId + "&applicationId=" + appId; XDocument xdoc = OhayooLib.getXDocument(url); return(WebUtility.HtmlEncode(xdoc.Element("root").Element("current").Element("genreName").Value)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public void getRakutenProductsDetail(string ItemCode, int SearchQuantity = 1, Guid?StoregeJPId = null) { string appId = "1095695100824025173"; SearchProductInfo item = new SearchProductInfo(); try { string url = "https://app.rakuten.co.jp/services/api/IchibaItem/Search/20140222?format=xml&applicationId=" + appId + "&itemCode=" + ItemCode; XDocument xdoc = OhayooLib.getXDocument(url); foreach (XElement element in xdoc.Elements("root").Elements("Items").Elements("Item")) { string img = ""; foreach (var ig in element.Element("smallImageUrls").Elements("imageUrl")) { img = ig.Value; break; } item = new SearchProductInfo() { JanCode = getJanCode(element.Element("itemUrl").Value), Image = img, LinkWeb = element.Element("itemUrl").Value, NameJP = WebUtility.HtmlEncode(element.Element("itemName").Value), NameEN = TranslateUtils.TranslateGoogleTextEN(WebUtility.HtmlEncode(element.Element("itemName").Value)), PriceTax = Convert.ToDouble(element.Element("itemPrice").Value), Quantity = SearchQuantity, Amount = Convert.ToDouble(element.Element("itemPrice").Value) * SearchQuantity, ProductCode = WebUtility.HtmlEncode(element.Element("itemCode").Value), Notes = WebUtility.HtmlEncode(element.Element("itemCaption").Value), Material = WebUtility.HtmlEncode(element.Element("catchcopy").Value), CategoryId = Convert.ToInt32(element.Element("genreId").Value), CategoryName = getRakutenCategories(Convert.ToInt32(element.Element("genreId").Value)), MadeIn = "Japan", }; SearchAndSave(item, ItemCode, SearchQuantity, StoregeJPId); break; } } catch (Exception ex) { throw new Exception(ex.Message, ex); } }