private string GetItemTags(BaiduCategoryEntity category) { string result = string.Empty; if (!StringHelper.IsNullOrEmpty(category.CategoryName)) { result = ReplaceSlash(C1Name) + @"\" + ReplaceSlash(C2Name) + @"\" + ReplaceSlash(category.CategoryName); } while (result.Length > 15) { int index = result.LastIndexOf('\\'); if (index > -1) { result = result.Substring(0, index); } else { result = JobHelper.bSubstring(result, 15); } } if (StringHelper.IsNullOrEmpty(result)) { result = "新蛋"; } return(result); }
private void WriteCategoryDisplay(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("display"); xmlWriter.WriteElementString("store", "新蛋商城"); xmlWriter.WriteElementString("store_pic", StorePic); BaiduCategoryEntity category = BaiduBP.GetBaiduCategory(CategoryId); if (category != null) { xmlWriter.WriteElementString("tags", JobHelper.bSubstring(category.CategoryName, 30)); } else { xmlWriter.WriteElementString("tags", JobHelper.bSubstring("其它", 30)); } xmlWriter.WriteElementString("services", @"正规发票\全国联保\七天退换货"); xmlWriter.WriteElementString("brand", ""); xmlWriter.WriteElementString("number", JobHelper.bSubstring(ProductCount.ToString(), 20)); xmlWriter.WriteElementString("price", JobHelper.bSubstring(ProductPrice.ToString("0.00"), 20)); xmlWriter.WriteEndElement(); }
private void WriteItemDisplay(XmlWriter xmlWriter) { xmlWriter.WriteStartElement("display"); xmlWriter.WriteElementString("title", JobHelper.bSubstring(ProductTitle + NoHtml(PromotionTitle), 150)); xmlWriter.WriteElementString("realtitle", JobHelper.bSubstring(ProductTitle, 150)); xmlWriter.WriteElementString("price", JobHelper.bSubstring(CurrentPrice.ToString("0.00"), 40)); xmlWriter.WriteElementString("brand", GetBrand()); BaiduCategoryEntity category = BaiduBP.GetBaiduCategory(C3SysNo); xmlWriter.WriteElementString("tags", GetItemTags(category)); xmlWriter.WriteElementString("services", @"正规发票\全国联保\七天退换货"); xmlWriter.WriteElementString("image", JobHelper.bSubstring(PicUrl, 256)); xmlWriter.WriteElementString("store", "新蛋商城"); xmlWriter.WriteElementString("stock", OnlineQty > 0 ? "0" : "1"); xmlWriter.WriteElementString("description", JobHelper.CleanInvalidXmlChars(JobHelper.bSubstring(NoHtml(ProductDescLong), 2000))); xmlWriter.WriteElementString("city", "全国"); xmlWriter.WriteElementString("comments", ReviewCount.ToString()); xmlWriter.WriteElementString("commentsurl", JobHelper.bSubstring(string.Format( ReviewUrl, C3SysNo, HttpUtility.UrlEncode(Brand, System.Text.Encoding.GetEncoding("gb2312")), ProductID), 256)); xmlWriter.WriteElementString("firstclass", JobHelper.bSubstring(C1Name, 80)); xmlWriter.WriteElementString("secondclass", JobHelper.bSubstring(C2Name, 80)); xmlWriter.WriteElementString("thirdclass", JobHelper.bSubstring(C3Name, 80)); xmlWriter.WriteElementString("score", BaiduDA.GetProductScore(ProductSysNo, AppConfig.CompanyCode).ScoreString); xmlWriter.WriteEndElement(); }