Here I have pasted the sample code for creating purchasing receiving transaction entry. Have a look on this.
// Create the eConnect document and store it in a file
SerializeReceivingOrderObject("ReceivingOrder.xml");
// Load the eConnect XML document from the file into
// and XML document object
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("ReceivingOrder.xml");
// Create an XML string from the document object
string receivingOrderDocument = xmldoc.OuterXml;
// Create a connection string
// Integrated Security is required. Integrated security=SSPI
// Update the data source and initial catalog to use the names of
// data server and company database
string sConnectionString = "data source=localhost;initial catalog=TWO;integrated security=SSPI;persist security info=False;packet size=4096";
string receivingOrder = eConCall.CreateTransactionEntity(sConnectionString, receivingOrderDocument);
private void SerializeReceivingOrderObject(string filename)
{
// Here you need to get the input values from your table to assign to the DataRow and DataTable
// Line_Count= pass the row count values to this variable
integer Line_Count = dt.rows.count;
taPopRcptLineInsert_ItemsTaPopRcptLineInsert[] LineItems = taPopRcptLineInsert_ItemsTaPopRcptLineInsert[Line_Count];
int Linerecord = 0;
// Loop through the records in the grid
foreach (DataRow dr in dt.Rows)
{
lineNo++;
taPopRcptLineInsert_ItemsTaPopRcptLineInsert PL1 = new taPopRcptLineInsert_ItemsTaPopRcptLineInsert();
// Values for PO Line
// here pass your line parameters
PL1.
PL1.
LineItems[Linerecord] = PL1;
Linerecord++;
}
taPopRcptHdrInsert PHdr = new taPopRcptHdrInsert();
// Header Line data
// here pass your header parameters
PHdr.
PHdr.
POPReceivingsType ReceivingOrder = new POPReceivingsType();
ReceivingOrder.taPopRcptLineInsert_Items = LineItems;
ReceivingOrder.taPopRcptHdrInsert = PHdr;
POPReceivingsType[] MyPopTransactionType = { ReceivingOrder };
eConnectType eConnect = new eConnectType();
eConnect.POPReceivingsType = MyPopTransactionType;
// Create a file to hold the serialized eConnect XML document
FileStream fs = new FileStream(filename, FileMode.Create);
XmlTextWriter writer = new XmlTextWriter(fs, new UTF8Encoding());
// Serialize the eConnect document object to the file using the XmlTextWriter
XmlSerializer serializer = new XmlSerializer(eConnect.GetType());
serializer.Serialize(writer, eConnect);
writer.Close();
}
Note: This is not a full code for receiving transaction entry. You should go through this code and create your own coding based on this sample code.
Hope this helps!!!