using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
TestWebService2
{
class Program
{
private
const string
Username = "username";
private
const string
Password = "password";
static private dclcorp.DCLWebService myService = new dclcorp.DCLWebService();
static private string
SessionID = "";
//
-------------------------------------
static void
{
if
(string.IsNullOrEmpty(Username) || string.IsNullOrEmpty(Password))
{
Console.WriteLine("Please set Username and Password");
return;
}
SessionID =
myService.Login(Username, Password);
if
(string.IsNullOrEmpty(SessionID))
{
Console.WriteLine("Wrong Username/Password");
return;
}
dclcorp.BatchType01Object Batch = new dclcorp.BatchType01Object();
Batch.Location = "FR"; // or
"LA"
// In
this sample we add just one order to the batch
Batch.OrderArray = new dclcorp.OrderType01Object[1];
for(int i = 0; i < Batch.OrderArray.Length; i++)
{
Batch.OrderArray[i] = new dclcorp.OrderType01Object();
}
// Let's
get the first order
dclcorp.OrderType01Object Order =
Batch.OrderArray[0];
Order.AccountNumber = "01234";
Order.OrderNumber = "";
Order.ShipTo = new dclcorp.AddressType01Object();
Order.ShipTo.Attention = "Mr. Smith";
Order.ShipTo.Address1 = "
Order.ShipTo.City = "
Order.ShipTo.Country = "";
Order.ShipTo.PostalCode = "94538";
Order.ShipTo.StateProvince = "CA";
Order.FreightAccount = "00500";
Order.ShippingCarrier = "UPS";
Order.ShippingService = "GROUND";
Order.OrderStatus =
dclcorp.OrderStatusObject.HoldOrder;
// In
this sample we add just one detail to the order
Order.DetailArray = new dclcorp.DetailType01Object[1];
for
(int i = 0; i < Order.DetailArray.Length;
i++)
{
Order.DetailArray[i] = new dclcorp.DetailType01Object();
}
// Let's
get the first detail
dclcorp.DetailType01Object Detail =
Order.DetailArray[0];
Detail.ItemNumber = "ITEM0001";
Detail.Quantity = 1;
// Let's
submit the order
dclcorp.BatchType01Result Result =
myService.SubmitBatchOrder(SessionID, Batch);
if
(Result.ResultStatus.Error == 0)
{
//
Update SessionID for next calls (in case needed)
SessionID =
Result.ResultStatus.SessionID;
Console.WriteLine("Success!");
Console.WriteLine(string.Format("Batch
Name: {0}", Result.BatchName));
}
else
{
Console.WriteLine(Result.ResultStatus.ErrorStr);
}
return;
}
}
}