Example #1
0
 public static void MakeSellerCats(System.Data.DataSet dataSet_0, string prefixRootPath, string seller_ID, string sellerCatsVersion)
 {
     System.Data.DataTable dataTable = dataSet_0.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.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");
     }
 }
Example #2
0
        public void Execute(XmlNode node)
        {
            System.Data.DataTable distributorFeed = FeedGlobals.GetDistributorFeed();
            int count = distributorFeed.Rows.Count;

            for (int i = 0; i < count; i++)
            {
                if (Convert.ToBoolean(distributorFeed.Rows[i]["IsOpenEtao"]) && Convert.ToInt32(distributorFeed.Rows[i]["EtaoStatus"]) == 1)
                {
                    this.seller_ID      = Convert.ToString(distributorFeed.Rows[i]["EtaoID"]);
                    this.webSite        = "http://" + Convert.ToString(distributorFeed.Rows[i]["SiteUrl"]);
                    this.prefixRootPath = Globals.MapPath("/Storage/Root/" + distributorFeed.Rows[i]["UserId"].ToString() + "/");
                    this.storgePath     = "/Storage/Root/" + distributorFeed.Rows[i]["UserId"].ToString() + "/";
                    this.prefixFullPath = "Item_Full";
                    this.prefixIncPath  = "Item_Inc";
                    System.Data.DataSet eTaoFeedProducts = FeedGlobals.GetETaoFeedProducts(Convert.ToInt32(distributorFeed.Rows[i]["UserId"]));
                    this.MakeProductDetail(eTaoFeedProducts);
                    this.MakeFullIndex(eTaoFeedProducts, this.fullVersion, this.prefixFullPath);
                }
            }
        }
Example #3
0
        public void MakeIncrementIndex(DataSet ds, string StrVersion, string StrFileName)
        {
            DataTable table = ds.Tables[0];

            if (((table != null) && (table.Rows.Count > 0)) && !(StrFileName.Trim() == ""))
            {
                string         str      = this.webSite + this.storgePath;
                XmlDocument    doc      = new XmlDocument();
                XmlDeclaration newChild = doc.CreateXmlDeclaration("1.0", "utf-8", null);
                doc.AppendChild(newChild);
                XmlElement element = doc.CreateElement("", "root", "");
                doc.AppendChild(element);
                FeedGlobals.CreateXMlNodeValue(doc, element, "version", StrVersion);
                FeedGlobals.CreateXMlNodeValue(doc, element, "modified", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                FeedGlobals.CreateXMlNodeValue(doc, element, "seller_id", this.seller_ID);
                FeedGlobals.CreateXMlNodeValue(doc, element, "cat_url", str + "SellerCats.xml");
                FeedGlobals.CreateXMlNodeValue(doc, element, "dir", str + this.prefixIncPath + "/");
                XmlElement element2 = doc.CreateElement("item_ids");
                element.AppendChild(element2);
                foreach (DataRow row in table.Rows)
                {
                    if (((row != null) && (row["productId"].ToString().Trim() != "")) && this.productsList.Contains(row["productId"].ToString().Trim()))
                    {
                        XmlElement   element3 = doc.CreateElement("outer_id");
                        XmlAttribute node     = doc.CreateAttribute("action");
                        node.Value = "upload";
                        element3.Attributes.Append(node);
                        XmlText text = doc.CreateTextNode(row["productId"].ToString().Trim());
                        element3.AppendChild(text);
                        element2.AppendChild(element3);
                    }
                }
                if (File.Exists(this.prefixRootPath + "IncrementIndex.xml"))
                {
                    File.Delete(this.prefixRootPath + "IncrementIndex.xml");
                }
                doc.Save(this.prefixRootPath + "IncrementIndex.xml");
            }
        }
Example #4
0
 public void MakeIncrementIndex(System.Data.DataSet dataSet_0, string StrVersion, string StrFileName)
 {
     System.Data.DataTable dataTable = dataSet_0.Tables[0];
     if (dataTable != null && dataTable.Rows.Count > 0 && !(StrFileName.Trim() == ""))
     {
         string         str         = this.webSite + this.storgePath;
         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");
     }
 }
Example #5
0
 public void MakeProductDetail(System.Data.DataSet dataSet_0)
 {
     if (dataSet_0 != null && dataSet_0.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 = dataSet_0.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.webSite + 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
             {
             }
         }
     }
 }
Example #6
0
 public void MakeProductDetail(DataSet ds)
 {
     if ((ds != null) && (ds.Tables.Count > 0))
     {
         string path = this.prefixRootPath + this.prefixIncPath + @"\";
         string str2 = this.prefixRootPath + this.prefixIncPath + @"\";
         if (!Directory.Exists(str2))
         {
             Directory.CreateDirectory(str2);
         }
         DataTable table = ds.Tables[0];
         foreach (DataRow row in table.Rows)
         {
             try
             {
                 XmlElement     element3;
                 XmlText        text;
                 XmlDocument    doc      = new XmlDocument();
                 XmlDeclaration newChild = doc.CreateXmlDeclaration(this.fullVersion, "utf-8", null);
                 doc.AppendChild(newChild);
                 XmlElement element = doc.CreateElement("", "item", "");
                 doc.AppendChild(element);
                 FeedGlobals.CreateXMlNodeValue(doc, element, "seller_id", this.seller_ID);
                 FeedGlobals.CreateXMlNodeValue(doc, element, "outer_id", row["productId"].ToString());
                 FeedGlobals.CreateXMlNodeValue(doc, element, "title", row["ProductName"].ToString());
                 FeedGlobals.CreateXMlNodeValue(doc, element, "type", "fixed");
                 FeedGlobals.CreateXMlNodeValue(doc, element, "price", Math.Round(Convert.ToDecimal(row["SalePrice"]), 2).ToString());
                 FeedGlobals.CreateXMlNodeValue(doc, element, "discount", "");
                 FeedGlobals.CreateXMlNodeValue(doc, element, "desc", ((row["ShortDescription"] == null) || (row["ShortDescription"] == DBNull.Value)) ? "" : row["ShortDescription"].ToString());
                 FeedGlobals.CreateXMlNodeValue(doc, element, "brand", ((row["brandName"] == null) || (row["brandName"] == DBNull.Value)) ? "" : row["brandName"].ToString());
                 FeedGlobals.CreateXMlNodeValue(doc, element, "tags", ((row["Meta_Keywords"] == DBNull.Value) || (row["Meta_Keywords"] == null)) ? "" : row["Meta_Keywords"].ToString());
                 FeedGlobals.CreateXMlNodeValue(doc, element, "image", ((row["ImageUrl1"] == null) || (row["ImageUrl1"] == DBNull.Value)) ? "" : (this.webSite + row["ImageUrl1"].ToString()));
                 XmlElement element2 = doc.CreateElement("more_images");
                 element.AppendChild(element2);
                 if (!string.IsNullOrEmpty(Convert.ToString(row["ImageUrl2"])))
                 {
                     element3 = doc.CreateElement("img");
                     text     = doc.CreateTextNode(this.webSite + row["ImageUrl2"].ToString());
                     element3.AppendChild(text);
                     element2.AppendChild(element3);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(row["ImageUrl3"])))
                 {
                     element3 = doc.CreateElement("img");
                     text     = doc.CreateTextNode(this.webSite + row["ImageUrl3"].ToString());
                     element3.AppendChild(text);
                     element2.AppendChild(element3);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(row["ImageUrl4"])))
                 {
                     element3 = doc.CreateElement("img");
                     text     = doc.CreateTextNode(this.webSite + row["ImageUrl4"].ToString());
                     element3.AppendChild(text);
                     element2.AppendChild(element3);
                 }
                 if (!string.IsNullOrEmpty(Convert.ToString(row["ImageUrl5"])))
                 {
                     element3 = doc.CreateElement("img");
                     text     = doc.CreateTextNode(this.webSite + row["ImageUrl5"].ToString());
                     element3.AppendChild(text);
                     element2.AppendChild(element3);
                 }
                 FeedGlobals.CreateXMlNodeValue(doc, element, "scids", FeedGlobals.GetCategoryIds((string)row["MainCategoryPath"]));
                 FeedGlobals.CreateXMlNodeValue(doc, element, "post_fee", "0");
                 FeedGlobals.CreateXMlNodeValue(doc, element, "props", FeedGlobals.GetEtaoSku((int)row["productId"]));
                 FeedGlobals.CreateXMlNodeValue(doc, element, "showcase", "0");
                 FeedGlobals.CreateXMlNodeValue(doc, element, "href", this.webSite + Globals.GetSiteUrls().UrlData.FormatUrl("productDetails", new object[] { row["productId"] }));
                 path = str2 + row["productId"].ToString().Trim() + ".xml";
                 if (File.Exists(path))
                 {
                     File.Delete(path);
                 }
                 doc.Save(path);
                 this.productsList.Add(row["productId"].ToString().Trim());
             }
             catch
             {
                 continue;
             }
         }
     }
 }