SAPbobsCOM.Company sapCompanyConnector = DIConnectorServiceProvider.connect();
if(sapCompanyConnector != null)
{
SAPbobsCOM.Documents salesOrderFactory = (SAPbobsCOM.Documents)sapCompanyConnector.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
salesOrderFactory.CardCode = request.CustomerNumber;
salesOrderFactory.Address = request.BillingAddressId;
salesOrderFactory.AgentCode = request.AssigneeId;
salesOrderFactory.AddressExtension.ShipToAddress2 = request.ShippingAddressId;
salesOrderFactory.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Service;
salesOrderFactory.DocDate = DateTime.Now;
salesOrderFactory.DocDueDate = DateTime.Now;
int i = 0;
while(i < request.Items.Count)
{
salesOrderFactory.Lines.Add();
salesOrderFactory.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items;
salesOrderFactory.Lines.SetCurrentLine(i);
salesOrderFactory.Lines.Price = request.Items[i].Price;
salesOrderFactory.Lines.Quantity = request.Items[i].Quantity;
salesOrderFactory.Lines.ItemCode = request.Items[i].ItemCode;
salesOrderFactory.Lines.ItemDescription = request.Items[i].Description;
i++;
}
int orderAddedStatus = salesOrderFactory.Add();
if(orderAddedStatus == 0)
{
string docEntry = "";
sapCompanyConnector.GetNewObjectCode(out docEntry);
Console.WriteLine("Wild Wild Got Here " + docEntry);
this.writeToTDSalesOrderMapper(request.TdSalesOrderId, docEntry);
return true;
}
else
{
Console.WriteLine("Error Wild: " + sapCompanyConnector.GetLastErrorDescription());
}
}
return false;
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.