using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ConsumeSalesOrderService.SalesOrder;
// Add a using statement for the service reference.
using System.Collections;
namespace ConsumeSalesOrderService
{
class Program
{
static void Main(string[] args)
{
// Instantiate an instance of the service client class.
SalesOrderService proxy = new SalesOrderService();
// Create an instance of the document class.
AxdSalesOrder salesOrder = new AxdSalesOrder();
// Create instances of the entities that are used in the service and
// set the needed fields on those entities.
AxdEntity_SalesTable salesTable = new AxdEntity_SalesTable();
salesTable.CurrencyCode = "USD";
salesTable.CustAccount = "1101";
salesTable.DeliveryDate = Convert.ToDateTime("2/14/2010");
salesTable.Payment = "N060";
salesTable.PurchOrderFormNum = "PO";
AxdEntity_SalesLine salesLine = new AxdEntity_SalesLine();
salesLine.ItemId = "1001";
salesLine.SalesQty = 88;
salesLine.SalesUnit = "ea";
AxdEntity_InventDim inventDim = new AxdEntity_InventDim();
inventDim.configId = "HD";
inventDim.InventColorId = "01";
inventDim.InventSizeId = "42";
// Add the sub-entity instances to their parent entities as an array
// of the sub-entity type.
salesLine.InventDim = new AxdEntity_InventDim[1] { inventDim };
salesTable.SalesLine = new AxdEntity_SalesLine[1] { salesLine };
salesOrder.SalesTable = new AxdEntity_SalesTable[1] { salesTable };
try
{
// Call the create method on the service passing in the document.
EntityKey[] returnedSalesOrderEntityKey = proxy.create(salesOrder);
// The create method returns an EntityKey which contains the ID of the sales order.
EntityKey returnedSalesOrder = (EntityKey)returnedSalesOrderEntityKey.GetValue(0);
Console.WriteLine("The sales order created has a Sales ID of " + returnedSalesOrder.KeyData[0].Value);
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
Console.ReadLine();
}
}
}
}
No comments:
Post a Comment