Registration
Register for an event
Register a individual for an event and submit the cart.
using Asi.Soa.ClientServices;
using Asi.Soa.Commerce.DataContracts;
using Asi.Soa.Core.DataContracts;
EntityManager entityManager = new EntityManager();
var partyId = "216";
//Annual conference event registration
var eventManager = new EventManager(entityManager, "ANNCONF");
eventManager.Register(partyId);
eventManager.RegisterRegistrationOption(partyId, partyId, eventManager.Event.RegistrationOptions[0].EventFunctionId);
eventManager.RegisterFunction(partyId, "ANNCONF/GOLF");
//Create a new cart for the event registration
var cartManager = new CartManager(entityManager, partyId);
cartManager.Cart.ComboOrder.Payments.Add(new RemittanceData
{
PaymentMethod = new PaymentMethodData { PaymentMethodId = "BillMe" },
ReferenceNumber = "1001",
Amount = new MonetaryAmountData(cartManager.Cart.ComboOrder.Order.OrderTotal.GetValueOrDefault().Amount, cartManager.Cart.ComboOrder.Order.Currency)
});
//Submit the cart and check the validation results
var results = cartManager.SubmitCart();
if (results.IsValid)
{
var orderData = results.Entity.ComboOrder.Order;
Console.WriteLine("Order Number: {0}", orderData.OrderNumber);
}
else
{
Console.WriteLine(results.ValidationResults.Summary);
}
using Asi.Soa.ClientServices;
using Asi.Soa.Commerce.DataContracts;
using Asi.Soa.Core.DataContracts;
EntityManager entityManager = new EntityManager();
var partyId = "216";
//Annual conference event registration
var eventManager = new EventManager(entityManager, "ANNCONF");
eventManager.Register(partyId);
eventManager.RegisterRegistrationOption(partyId, partyId, eventManager.Event.RegistrationOptions[0].EventFunctionId);
eventManager.RegisterFunction(partyId, "ANNCONF/GOLF");
//Create a new cart for the event registration
var cartManager = new CartManager(entityManager, partyId);
cartManager.Cart.ComboOrder.Payments.Add(new RemittanceData
{
PaymentMethod = new PaymentMethodData { PaymentMethodId = "Cash" },
Amount = new MonetaryAmountData(cartManager.Cart.ComboOrder.Order.OrderTotal.GetValueOrDefault().Amount, cartManager.Cart.ComboOrder.Order.Currency)
});
//Submit the cart and check the validation results
var results = cartManager.SubmitCart();
if (results.IsValid)
{
var orderData = results.Entity.ComboOrder.Order;
Console.WriteLine("Order Number: {0}", orderData.OrderNumber);
}
else
{
Console.WriteLine(results.ValidationResults.Summary);
}
Modify event registration
Register a individual for an event and submit the cart then request the event registration and make a modification.
using Asi.Soa.ClientServices;
using Asi.Soa.Commerce.DataContracts;
using Asi.Soa.Core.DataContracts;
EntityManager entityManager = new EntityManager();
var partyId = "216";
//Annual conference event registration
var eventManager = new EventManager(entityManager, "ANNCONF");
eventManager.Register(partyId);
eventManager.RegisterRegistrationOption(partyId, partyId, eventManager.Event.RegistrationOptions[0].EventFunctionId);
eventManager.RegisterFunction(partyId, "ANNCONF/GOLF");
//Create a new cart for the event registration
var cartManager = new CartManager(entityManager, partyId);
cartManager.Cart.ComboOrder.Payments.Add(new RemittanceData
{
PaymentMethod = new PaymentMethodData { PaymentMethodId = "BillMe" },
ReferenceNumber = "1001",
Amount = new MonetaryAmountData(cartManager.Cart.ComboOrder.Order.OrderTotal.GetValueOrDefault().Amount, cartManager.Cart.ComboOrder.Order.Currency)
});
//Submit the cart and check the validation results
var results = cartManager.SubmitCart();
if (!results.IsValid)
{
Console.WriteLine(results.ValidationResults.Summary);
return;
}
//Get the registration
eventManager.GetRegistrationData(partyId);
//Un-register from existing function
eventManager.UnregisterFunction(partyId, "ANNCONF/GOLF");
//Register for a different function
eventManager.RegisterFunction(partyId, "ANNCONF/HOSP");
//Check that cart lines count
if (cartManager.Cart.ComboOrder.Order.Lines.Count > 0)
{
cartManager.Cart.ComboOrder.Payments.Add(new RemittanceData
{
Amount = new MonetaryAmountData(cartManager.Cart.ComboOrder.Order.OrderTotal.GetValueOrDefault().Amount, cartManager.Cart.ComboOrder.Order.Currency),
PaymentMethod = new PaymentMethodData { PaymentMethodId = "BillMe" },
ReferenceNumber = "1001"
});
//Submit the cart and check the validation results
results = cartManager.SubmitCart();
if (results.IsValid)
{
var orderData = results.Entity.ComboOrder.Order;
Console.WriteLine("Order Number: {0}", orderData.OrderNumber);
}
else
{
Console.WriteLine(results.ValidationResults.Summary);
}
}
Updated over 5 years ago