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 { } } } }
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; } } } }