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(); }
private void GenerateItemFile(string fileName, XmlWriterSettings setting) { List <ItemEntity> itemList = BaiduDA.GetProductList(AppConfig.CompanyCode); List <List <ItemEntity> > itemListArray = GetItemListArray(itemList); for (int i = 0; i < itemListArray.Count; i++) { GenerateEachItemFile(GetItemFileName(fileName, i), setting, itemListArray[i]); } }
private void InitManufacturerList() { this.ManufacturerEntityList = new List <BaiduPlatformManufacturerEntity>(); manufacturerList = BaiduDA.GetBrandList(AppConfig.CompanyCode); if (manufacturerList != null) { foreach (var brand in manufacturerList) { BaiduPlatformManufacturerEntity brandEntity = new BaiduPlatformManufacturerEntity(brand); this.ManufacturerEntityList.Add(brandEntity); } } }
//public void Init() //{ // try // { // IndexFileName = AppConfig.IndexFileName; // ItemFileName = AppConfig.ItemFileName; // ItemCountPerFile = AppConfig.ItemCountPerFile; // BaiduCategoryList = BaiduDA.GetBaiduCategoryList(); // CategoryList = BaiduDA.GetCategoryList(AppConfig.CompanyCode); // } // catch // { // throw new BusinessException(@"配置出错,请修改配置文件!"); // } //} public BaiduBP() { try { IndexFileName = AppConfig.IndexFileName; ItemFileName = AppConfig.ItemFileName; ItemCountPerFile = AppConfig.ItemCountPerFile; BaiduCategoryList = BaiduDA.GetBaiduCategoryList(); CategoryList = BaiduDA.GetCategoryList(AppConfig.CompanyCode); } catch { throw new BusinessException(@"配置出错,请修改配置文件!"); } }
private void InitC3List() { this.C3EngityList = new List <BaiduPlatformCategory3Entity>(); category3List = BaiduDA.GetCategory2or3List("L", AppConfig.CompanyCode); if (category3List != null) { foreach (var c3 in category3List) { ProductNumberAndMinPriceEntity productCountEntity = BaiduDA.GetProductCountByFrontEndCategory3SysNo(c3.CategorySysNo, AppConfig.CompanyCode); BaiduPlatformCategory3Entity c3Entity = new BaiduPlatformCategory3Entity(c3.CategorySysNo, c3.CategoryName, productCountEntity.ProductCount, productCountEntity.MinPrice); this.C3EngityList.Add(c3Entity); } } }
private void InitC2List() { this.C2EngityList = new List <BaiduPlatformCategory2Entity>(); List <Category2or3ConfigurationEntity> category2List = BaiduDA.GetCategory2or3List("M", AppConfig.CompanyCode); if (category2List != null) { foreach (var c2 in category2List) { ProductNumberAndMinPriceEntity productCountEntity = BaiduDA.GetProductCountByFrontEndCategory2SysNo(c2.CategorySysNo, AppConfig.CompanyCode); BaiduPlatformCategory2Entity c2Entity = new BaiduPlatformCategory2Entity(c2.CategorySysNo, c2.CategoryName, productCountEntity.ProductCount, productCountEntity.MinPrice); this.C2EngityList.Add(c2Entity); } } }
private void InitC1List() { this.C1EngityList = new List <BaiduPlatformCategory1Entity>(); List <Category1ConfigurationEntity> category1ConfigList = BaiduDA.GetCategory1ConfigList(); if (category1ConfigList != null) { foreach (var c1 in category1ConfigList) { ProductNumberAndMinPriceEntity productCountEntity = BaiduDA.GetProductCountByFrontEndCategory1SysNo(c1.CategorySysNo, AppConfig.CompanyCode); BaiduPlatformCategory1Entity c1Entity = new BaiduPlatformCategory1Entity(c1.CategorySysNo, c1.CategoryName, c1.CategoryAddress, productCountEntity.ProductCount, productCountEntity.MinPrice); this.C1EngityList.Add(c1Entity); } } }
private void InitCategoryManufacturerList() { this.CategoryManufacturerEntityList = new List <BaiduPlatformCategoryManufacturerEntity>(); foreach (Category2or3ConfigurationEntity category in category3List) { foreach (BaiduManufacturerEntity manufacturerEntity in manufacturerList) { CategoryManufacturerPathEntity path = BaiduDA.GetCategoryManufacturerPath(manufacturerEntity.ManufacturerSysNo, category.CategorySysNo); ProductNumberAndMinPriceEntity productCountEntity = BaiduDA.GetProductCountByFrontEndCategory3SysNoAndManufacturerSysNo(category.CategorySysNo, manufacturerEntity.ManufacturerSysNo, AppConfig.CompanyCode); if (path != null) { BaiduPlatformCategoryManufacturerEntity categoryBrandEntity = new BaiduPlatformCategoryManufacturerEntity(category.CategorySysNo, category.CategoryName, path.PathSegment, path.ManufacturerSegment, manufacturerEntity.ManufacturerName, productCountEntity.ProductCount, productCountEntity.MinPrice); this.CategoryManufacturerEntityList.Add(categoryBrandEntity); } } } }