我正在使用 eConnect 将我的 .NET 应用程序连接到 Dynamics GP。这是我在 Dynamics GP 上创建/更新项目的 C# eConnect 代码。
taUpdateCreateItemRcd GpLineItem = new taUpdateCreateItemRcd();
GpLineItem.ITEMNMBR = "iPartNumber";
GpLineItem.ITEMDESC = "iDescription";
GpLineItem.CURRCOST = 50.65;
GpLineItem.ITMCLSCD = "classID";
GpLineItem.ITEMTYPE = 1;
GpLineItem.Purchase_Tax_Options = 2;
GpLineItem.UOMSCHDL = "EACH";
GpLineItem.UpdateIfExists = 1;
IVItemMasterType ivMasterType = new IVItemMasterType();
ivMasterType.taUpdateCreateItemRcd = GpLineItem;
IVItemMasterType[] ivMasterTypeArray = { ivMasterType };
eConnectType eConnect = new eConnectType();
eConnect.IVItemMasterType = ivMasterTypeArray;
// Serialize the master vendor type in memory.
MemoryStream memoryStream = new MemoryStream();
XmlSerializer xmlSerializer = new XmlSerializer(eConnect.GetType());
// Serialize the eConnectType.
xmlSerializer.Serialize(memoryStream, eConnect);
// Reset the position of the memory stream to the start.
memoryStream.Position = 0;
// Create an XmlDocument from the serialized eConnectType in memory.
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(memoryStream);
memoryStream.Close();
// Call eConnect to process the XmlDocument.
eConnectMethods.CreateEntity(connectionString, xmlDocument.OuterXml);
当我检查 xmlDocument 时,我只有以下这些字段。
<?xml version="1.0"?><eConnect xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema">
<IVItemMasterType>
<eConnectProcessInfo xsi:nil="true" />
<taRequesterTrxDisabler_Items xsi:nil="true" />
<taUpdateCreateItemRcd>
<ITEMNMBR>iPartNumber</ITEMNMBR>
<ITEMDESC>iDescription</ITEMDESC>
<ITMCLSCD>RETAIL</ITMCLSCD>
<UOMSCHDL>EACH</UOMSCHDL>
</taUpdateCreateItemRcd>
<taUpdateCreateItemCurrencyRcd_Items xsi:nil="true" />
<taIVCreateItemPriceListLine_Items xsi:nil="true" />
<taIVCreateItemPriceListHeader xsi:nil="true" />
<taItemSite_Items xsi:nil="true" />
<taCreateItemVendors_Items xsi:nil="true" />
<taCreateKitItemRcd_Items xsi:nil="true" />
<taCreateInternetAddresses_Items xsi:nil="true" />
</IVItemMasterType>
</eConnect>
我不知道,我的代码有什么问题。请帮助我。非常感谢您的所有帮助。谢谢。