C# 使用WSI将类别映射到ASPDNSF中的制造商
我正在使用WSI服务将数据导入到ASPDNSF,我有以下几点C# 使用WSI将类别映射到ASPDNSF中的制造商,c#,xml,C#,Xml,我正在使用WSI服务将数据导入到ASPDNSF,我有以下几点 sb.AppendLine("<Mappings AutoCleanUp=\"true\">"); sb.AppendLine("<Entity EntityType=\"Manufacturer\" ID=\"" + ManufacturerID + "\" />"); if (Category != null) sb.Appe
sb.AppendLine("<Mappings AutoCleanUp=\"true\">");
sb.AppendLine("<Entity EntityType=\"Manufacturer\" ID=\"" + ManufacturerID + "\" />");
if (Category != null)
sb.AppendLine("<Entity EntityType=\"Category\" ID=\"" + Category.CategoryID + "\" />");
sb.AppendLine("")
sb.AppendLine("</Mappings>");
sb.AppendLine(“”);
某人加上一行(“”);
如果(类别!=null)
某人加上一行(“”);
某人加上一行(“”)
某人加上一行(“”);
目前,所有产品都添加到了制造商中,但在产品/类别下没有显示任何内容,我希望有人能够为我指出我认为需要利用的正确方向
<Mappings AutoCleanup="boolean">
<Entity EntityType="Manufacturer|Distributor|Category|Section|Genre|Vector" Name="string" XPath="string" ID="integer" GUID="uniqueidentifier" DisplayOrder="integer"/>
哪种是xml格式
这是完整的字符串生成器
public string ToXML()
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("<AspDotNetStorefrontImport SetImportFlag=\"true\" Verbose=\"true\" AutoLazyAdd=\"true\">");
sb.AppendLine("<Product Action=\"" + Action.ToString() + "\" EnsureDefaultVariant=\"true\" SKU=\"" + SKU + "\"" + (GUID != null ? " GUID=\"" + GUID + "\"" : "") + " Name=\"" + System.Web.HttpUtility.HtmlEncode(Name) + "\">");
sb.AppendLine("<Name>" + System.Web.HttpUtility.HtmlEncode(Name) + "</Name>");
sb.AppendLine("<Summary>" + System.Web.HttpUtility.HtmlEncode(Name) + "</Summary>");
sb.AppendLine("<SeAltText>" + System.Web.HttpUtility.HtmlEncode(Name) + "</SeAltText>");
sb.AppendLine("<ProductType ID=\"" + ProductTypeID + "\" />");
sb.AppendLine("<Price>" + Price + "</Price>");
sb.AppendLine("<Display>");
sb.AppendLine("<XmlPackage>" + ConfigurationManager.AppSettings["XMLPackage"] + "</XmlPackage>");
sb.AppendLine("</Display>");
sb.AppendLine("<SKU>" + SKU + "</SKU>");
sb.AppendLine("<Description>" + System.Web.HttpUtility.HtmlEncode(Description) + "</Description>");
sb.AppendLine("<Published>" + InStock.ToString() + "</Published>");
sb.AppendLine("<Images>");
sb.AppendLine("<ImageFilenameOverride>" + ImageName + "</ImageFilenameOverride>");
sb.AppendLine("</Images>");
sb.AppendLine("<Mappings AutoCleanUp=\"true\">");
sb.AppendLine("<Entity EntityType=\"Manufacturer\" ID=\"" + ManufacturerID + "\" />");
if (Category != null)
sb.AppendLine("<Entity EntityType=\"Category\" ID=\"" + Category.CategoryID + "\" />");
sb.AppendLine("")
sb.AppendLine("</Mappings>");
sb.AppendLine("<Variants AutoCleanup=\"true\">");
sb.AppendLine("<Variant Action=\"Add\" Name=\"" + System.Web.HttpUtility.HtmlEncode(Name) + "\">");
sb.AppendLine("<IsDefault>true</IsDefault>");
sb.AppendLine("<Name>" + System.Web.HttpUtility.HtmlEncode(Name) + "</Name>");
sb.AppendLine("<Description>" + System.Web.HttpUtility.HtmlEncode(Description) + "</Description>");
sb.AppendLine("<Price>" + Price + "</Price> ");
sb.AppendLine("<Images>");
sb.AppendLine("<ImageFilenameOverride>" + ImageName + "</ImageFilenameOverride>");
sb.AppendLine("</Images>");
sb.AppendLine("<MSRP>" + (SalesListPrice ?? OrigListPrice) + "</MSRP>");
sb.AppendLine("<Cost>" + Cost + "</Cost>");
sb.AppendLine("</Variant>");
sb.AppendLine("</Variants>");
sb.AppendLine("</Product>");
sb.AppendLine("</AspDotNetStorefrontImport>");
return sb.ToString();
}
}
公共字符串ToXML()
{
StringBuilder sb=新的StringBuilder();
某人加上一行(“”);
某人加上一行(“”);
sb.AppendLine(“+System.Web.HttpUtility.HtmlEncode(Name)+”);
sb.AppendLine(“+System.Web.HttpUtility.HtmlEncode(Name)+”);
sb.AppendLine(“+System.Web.HttpUtility.HtmlEncode(Name)+”);
某人加上一行(“”);
某人加上一行(“+价格+”);
某人加上一行(“”);
sb.AppendLine(“+ConfigurationManager.AppSettings[“XMLPackage”]+”);
某人加上一行(“”);
sb.追加行(“+SKU+”);
sb.AppendLine(“+System.Web.HttpUtility.HtmlEncode(Description)+”);
sb.AppendLine(“+InStock.ToString()+”);
某人加上一行(“”);
sb.AppendLine(“+ImageName+”);
某人加上一行(“”);
某人加上一行(“”);
某人加上一行(“”);
如果(类别!=null)
某人加上一行(“”);
某人加上一行(“”)
某人加上一行(“”);
某人加上一行(“”);
某人加上一行(“”);
某人附文(“真实”);
sb.AppendLine(“+System.Web.HttpUtility.HtmlEncode(Name)+”);
sb.AppendLine(“+System.Web.HttpUtility.HtmlEncode(Description)+”);
某人加上一行(“+价格+”);
某人加上一行(“”);
sb.AppendLine(“+ImageName+”);
某人加上一行(“”);
sb.AppendLine(“+(SalesListPrice??OrigListPrice)+”);
某人追加(“+成本+”);
某人加上一行(“”);
某人加上一行(“”);
某人加上一行(“”);
某人加上一行(“”);
使某人返回字符串();
}
}
}
谢谢你的帮助
迈克迈克
您指定的类别是否存在?我没有使用id来指定映射的经验,但在使用XPath属性方面取得了很多成功
<Entity EntityType="Category" Name="" XPath="/Products/NewCategoryName/" />
你能解决这个问题吗