XWeb Event Guest Registration

This page provides a case study of Guest Registration in xWeb. This case study is illustrated with fragments of C# code but you can apply these principles to any other programming language. Note that this is not a fully functional case study.

Methods Used

Case Study

Here is what you would need to do when the UseCustomerRecordsForGuestRegistrations system option is set to false (i.e. guests do NOT need to be actual customers in NetForum). This code omits getting fees and adding line items for brevity.

//Get main registrant and event keys:
var oCust = new Guid("");
var oEvent = new Guid("");
//Get shopping cart:
var oCart = service.WEBCentralizedShoppingCartGetNew(oCust);
// Get a main registrant object:
EventsRegistrantType oMainRegistrant = service.WEBCentralizedShoppingCartEventRegistrantGetNew(oCust, oEvent);
// Get a new guest object:
EventsRegistrantType oGuestEventRegistration = service.WEBCentralizedShoppingCartEventRegistrantGetNew(new Guid(oMainRegistrant.Registrant.reg_cst_key), oEvent);
// set the guest flag:
oGuestEventRegistration.Registrant.reg_guest_flag = 1;
oGuestEventRegistration.Registrant.reg_guest_flagSpecified = true;
 
 
//If the Main registrant is already in the database, you will need to obtain its reg_key and set it in the Guest’s reg_reg_key
//In this case, you don’t need to add the main registrant to the cart.
//I don’t recall whether ALL guest registration scenarios require a “main” registrant. If not, then obviously you wouldn’t need to set the reg_reg_key and the insert would succeed
// set the foreign key to that of the main reg:
oGuestEventRegistration.Registrant.reg_reg_key = oMainRegistrant.Registrant.reg_key;
 
// get the registration types for your guest registrant. This will return XML that you must parse
service.WEBCentralizedShoppingCartGetEventGuestRegistrantTypeListByEvent(new Guid(oGuestEventRegistration.Registrant.reg_evt_key));
 
// copy over any appropriate default values from the main registrant:
oGuestEventRegistration.Registrant.reg_src_key = oMainRegistrant.Registrant.reg_src_key;
oGuestEventRegistration.Registrant.reg_badge_name = "Guest1";
oGuestEventRegistration.Registrant.reg_org_name_dn = "noname";
oGuestEventRegistration.Registrant.reg_adr_city = oMainRegistrant.Registrant.reg_adr_city;
oGuestEventRegistration.Registrant.reg_adr_state = oMainRegistrant.Registrant.reg_adr_state;
oGuestEventRegistration.Registrant.reg_adr_country = oMainRegistrant.Registrant.reg_adr_country;
 
 
 
//Check the guest limit as to not exceed it:
var oGuestLimit = oGuestEventRegistration.Event.evt_guest_limit;
//Get fees
XmlNode oNode = service.WEBCentralizedShoppingCartGetEventFees(oGuestEventRegistration, oCart);
//Parse oNode to get price key
var oPrice = new Guid("751578D1-D9B5-4C9D-954A-359C4C644A52");
 
Fee[] _fees = new Fee[] { new Fee() { prc_key = oPrice, action = FeeAction.Add, qty = 1 } };
 
 
 
//In case if main registrant not in db:
//oMainRegistrant = service.WEBCentralizedShoppingCartEventRegistrantSetLineItems(oMainRegistrant, _fees);
oGuestEventRegistration = service.WEBCentralizedShoppingCartEventRegistrantSetLineItems(oGuestEventRegistration,
_fees);
//Same here, we need to add main registrant to cart:
//oCart = service.WEBCentralizedShoppingCartAddEventRegistrant(oCart, oMainRegistrant);
oCart = service.WEBCentralizedShoppingCartAddEventRegistrant(oCart,
oGuestEventRegistration);
 
//Payment info:
string szApmKey = "8D2632B1-83A7-411D-82F5-131E0F0EA2A7";
oCart.Payment_Info.pin_apm_key = szApmKey;
oCart.Payment_Info.pin_cc_number = "4111111111111111";
oCart.Payment_Info.pin_cc_cardholder_name = "tester ab";
oCart.Payment_Info.pin_cc_expire = "2015/12";
 
 
//Insert:
var _result = service.WEBCentralizedShoppingCartInsert(oCart);