コード例 #1
0
 public void Execute(XmlNode node)
 {
     this.InitData();
     if (this.siteSettings.IsCreateFeed && !string.IsNullOrEmpty(this.seller_ID))
     {
         System.Data.DataSet eTaoFeedProducts = FeedGlobals.GetETaoFeedProducts();
         this.MakeProductDetail(eTaoFeedProducts);
         this.MakeFullIndex(eTaoFeedProducts, this.fullVersion, this.prefixFullPath);
     }
 }
コード例 #2
0
 public void Execute(XmlNode node)
 {
     this.InitData();
     if (this.siteSettings.IsCreateFeed && !string.IsNullOrEmpty(this.seller_ID))
     {
         System.Data.DataSet eTaoFeedProducts = FeedGlobals.GetETaoFeedProducts();
         FeedGlobals.MakeSellerCats(eTaoFeedProducts, this.sellerCatsVersion, this.prefixRootPath, this.seller_ID, this.sellerCatsVersion);
         this.MakeProductDetail(eTaoFeedProducts);
         this.MakeIncrementIndex(eTaoFeedProducts, this.incVersion, this.prefixIncPath);
     }
 }
コード例 #3
0
 public static void MakeSellerCats(System.Data.DataSet ds, string StrVersion, string prefixRootPath, string seller_ID, string sellerCatsVersion)
 {
     System.Data.DataTable dataTable = ds.Tables[1];
     if (dataTable != null && dataTable.Rows.Count > 0 && !(prefixRootPath.Trim() == ""))
     {
         XmlDocument    xmlDocument = new XmlDocument();
         XmlDeclaration newChild    = xmlDocument.CreateXmlDeclaration("1.0", "utf-8", null);
         xmlDocument.AppendChild(newChild);
         XmlElement xmlElement = xmlDocument.CreateElement("", "root", "");
         xmlDocument.AppendChild(xmlElement);
         FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "version", sellerCatsVersion);
         FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "modified", DateTime.Now.AddMinutes(40.0).ToString("yyyy-MM-dd HH:mm:ss"));
         FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "seller_id", seller_ID);
         XmlElement            xmlElement2 = FeedGlobals.CreateXMlNode(xmlDocument, xmlElement, "seller_cats");
         System.Data.DataRow[] array       = dataTable.Select("depth=1");
         System.Data.DataRow[] array2      = array;
         for (int i = 0; i < array2.Length; i++)
         {
             System.Data.DataRow dataRow     = array2[i];
             XmlElement          xmlElement3 = xmlDocument.CreateElement("cat");
             xmlElement2.AppendChild(xmlElement3);
             FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement3, "scid", dataRow["CategoryId"].ToString());
             FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement3, "name", dataRow["Name"].ToString());
             System.Data.DataRow[] array3 = dataTable.Select("ParentCategoryId=" + dataRow["categoryId"]);
             if (array3 != null && array3.Length > 0)
             {
                 XmlElement            xmlElement4 = FeedGlobals.CreateXMlNode(xmlDocument, xmlElement3, "cats");
                 System.Data.DataRow[] array4      = array3;
                 for (int j = 0; j < array4.Length; j++)
                 {
                     System.Data.DataRow dataRow2    = array4[j];
                     XmlElement          xmlElement5 = xmlDocument.CreateElement("cat");
                     xmlElement4.AppendChild(xmlElement5);
                     FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement5, "scid", dataRow2["CategoryId"].ToString());
                     FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement5, "name", dataRow2["Name"].ToString());
                 }
             }
         }
         if (File.Exists(prefixRootPath + "SellerCats.xml"))
         {
             File.Delete(prefixRootPath + "SellerCats.xml");
         }
         xmlDocument.Save(prefixRootPath + "SellerCats.xml");
     }
 }
コード例 #4
0
 public void MakeIncrementIndex(System.Data.DataSet ds, string StrVersion, string StrFileName)
 {
     System.Data.DataTable dataTable = ds.Tables[0];
     if (dataTable != null && dataTable.Rows.Count > 0 && !(StrFileName.Trim() == ""))
     {
         string         str         = this.webSite + "/Storage/Root/";
         XmlDocument    xmlDocument = new XmlDocument();
         XmlDeclaration newChild    = xmlDocument.CreateXmlDeclaration("1.0", "utf-8", null);
         xmlDocument.AppendChild(newChild);
         XmlElement xmlElement = xmlDocument.CreateElement("", "root", "");
         xmlDocument.AppendChild(xmlElement);
         FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "version", StrVersion);
         FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "modified", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
         FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "seller_id", this.seller_ID);
         FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "cat_url", str + "SellerCats.xml");
         FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "dir", str + this.prefixIncPath + "/");
         XmlElement xmlElement2 = xmlDocument.CreateElement("item_ids");
         xmlElement.AppendChild(xmlElement2);
         foreach (System.Data.DataRow dataRow in dataTable.Rows)
         {
             if (dataRow != null && dataRow["productId"].ToString().Trim() != "" && this.productsList.Contains(dataRow["productId"].ToString().Trim()))
             {
                 XmlElement   xmlElement3  = xmlDocument.CreateElement("outer_id");
                 XmlAttribute xmlAttribute = xmlDocument.CreateAttribute("action");
                 xmlAttribute.Value = "upload";
                 xmlElement3.Attributes.Append(xmlAttribute);
                 XmlText newChild2 = xmlDocument.CreateTextNode(dataRow["productId"].ToString().Trim());
                 xmlElement3.AppendChild(newChild2);
                 xmlElement2.AppendChild(xmlElement3);
             }
         }
         if (File.Exists(this.prefixRootPath + "IncrementIndex.xml"))
         {
             File.Delete(this.prefixRootPath + "IncrementIndex.xml");
         }
         xmlDocument.Save(this.prefixRootPath + "IncrementIndex.xml");
     }
 }
コード例 #5
0
 public void MakeProductDetail(System.Data.DataSet ds)
 {
     if (ds != null && ds.Tables.Count > 0)
     {
         string text  = this.prefixRootPath + this.prefixIncPath + "\\";
         string text2 = this.prefixRootPath + this.prefixIncPath + "\\";
         if (!Directory.Exists(text2))
         {
             Directory.CreateDirectory(text2);
         }
         System.Data.DataTable dataTable = ds.Tables[0];
         foreach (System.Data.DataRow dataRow in dataTable.Rows)
         {
             try
             {
                 XmlDocument    xmlDocument = new XmlDocument();
                 XmlDeclaration newChild    = xmlDocument.CreateXmlDeclaration(this.fullVersion, "utf-8", null);
                 xmlDocument.AppendChild(newChild);
                 XmlElement xmlElement = xmlDocument.CreateElement("", "item", "");
                 xmlDocument.AppendChild(xmlElement);
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "seller_id", this.seller_ID);
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "outer_id", dataRow["productId"].ToString());
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "title", dataRow["ProductName"].ToString());
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "type", "fixed");
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "price", Math.Round(Convert.ToDecimal(dataRow["SalePrice"]), 2).ToString());
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "discount", "");
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "desc", (dataRow["ShortDescription"] == null || dataRow["ShortDescription"] == DBNull.Value) ? "" : dataRow["ShortDescription"].ToString());
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "brand", (dataRow["brandName"] == null || dataRow["brandName"] == DBNull.Value) ? "" : dataRow["brandName"].ToString());
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "tags", (dataRow["Meta_Keywords"] == DBNull.Value || dataRow["Meta_Keywords"] == null) ? "" : dataRow["Meta_Keywords"].ToString());
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "image", (dataRow["ImageUrl1"] == null || dataRow["ImageUrl1"] == DBNull.Value) ? "" : (this.webSite + dataRow["ImageUrl1"].ToString()));
                 XmlElement xmlElement2 = xmlDocument.CreateElement("more_images");
                 xmlElement.AppendChild(xmlElement2);
                 if (!string.IsNullOrEmpty(Convert.ToString(dataRow["ImageUrl2"])))
                 {
                     XmlElement xmlElement3 = xmlDocument.CreateElement("img");
                     XmlText    newChild2   = xmlDocument.CreateTextNode(this.webSite + dataRow["ImageUrl2"].ToString());
                     xmlElement3.AppendChild(newChild2);
                     xmlElement2.AppendChild(xmlElement3);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(dataRow["ImageUrl3"])))
                 {
                     XmlElement xmlElement3 = xmlDocument.CreateElement("img");
                     XmlText    newChild2   = xmlDocument.CreateTextNode(this.webSite + dataRow["ImageUrl3"].ToString());
                     xmlElement3.AppendChild(newChild2);
                     xmlElement2.AppendChild(xmlElement3);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(dataRow["ImageUrl4"])))
                 {
                     XmlElement xmlElement3 = xmlDocument.CreateElement("img");
                     XmlText    newChild2   = xmlDocument.CreateTextNode(this.webSite + dataRow["ImageUrl4"].ToString());
                     xmlElement3.AppendChild(newChild2);
                     xmlElement2.AppendChild(xmlElement3);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(dataRow["ImageUrl5"])))
                 {
                     XmlElement xmlElement3 = xmlDocument.CreateElement("img");
                     XmlText    newChild2   = xmlDocument.CreateTextNode(this.webSite + dataRow["ImageUrl5"].ToString());
                     xmlElement3.AppendChild(newChild2);
                     xmlElement2.AppendChild(xmlElement3);
                 }
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "scids", FeedGlobals.GetCategoryIds((string)dataRow["MainCategoryPath"]));
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "post_fee", "0");
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "props", FeedGlobals.GetEtaoSku((int)dataRow["productId"]));
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "showcase", "0");
                 FeedGlobals.CreateXMlNodeValue(xmlDocument, xmlElement, "href", this.productPath + Globals.GetSiteUrls().UrlData.FormatUrl("productDetails", new object[]
                 {
                     dataRow["productId"]
                 }));
                 text = text2 + dataRow["productId"].ToString().Trim() + ".xml";
                 if (File.Exists(text))
                 {
                     File.Delete(text);
                 }
                 xmlDocument.Save(text);
                 this.productsList.Add(dataRow["productId"].ToString().Trim());
             }
             catch
             {
             }
         }
     }
 }