XWeb Event Registration Add New Session Registration

Overview

This page outlines how you can add one or more session registrations to an existing event registrant in xWeb. This might occur if a person has already registered and they come back later to a website to add more sessions. In the #Code section is a Visual Studio .NET C# code sample illustrating the flow. Please be aware that although this code sample worked successfully, in a production application you should have error handling, etc.

The sequence of methods you will call is almost identical to the flow described in XWeb Event Registration. The major differences are:

Note that at this time, xWeb does not have the ability to remove or cancel session registrations.

Code

// properties object containing settings for xWeb Username and Password// this is for illustrative purposes; you might have a different way for storing these settings.var props = Properties.Settings.Default; // instantiate web referencevar xWeb = new netForumXML(); // AuthenticatexWeb.Authenticate(props.username, props.pwd); // Create a new shopping cart objectCentralizedOrderEntryType cart = new CentralizedOrderEntryType(); // Load a blank shopping cart by passing the Customer key of the shopper (typically the registrant): cart = xWeb.WEBCentralizedShoppingCartGetNew(new Guid("21F1093B-FD6A-4D7F-9DC2-86CDACCE3171")); EventsRegistrantType reg = new EventsRegistrantType(); // Load the registrant by passing the exising reg_keyreg = xWeb.WEBCentralizedShoppingCartEventRegistrantGet(new Guid("a3ffb9d7-621e-4752-99b6-6365302dca99")); // Add any new Session Fees. The GUIDs relate are the prc_key for a particular Session FeeList<Guid> feeGuids = new List<Guid>();feeGuids.Add(new Guid("922DF215-9448-45F7-82BF-D988999FEC2E")); // first sessionfeeGuids.Add(new Guid("248EF7EA-CB21-4F07-8E0B-830D27EC946D")); // second session; you could keep adding more... // Fees CollectionFee[] fees = new Fee[feeGuids.Count];for (int i = 0; i < feeGuids.Count; i++){    Fee eventFee = new Fee();    eventFee.prc_key = feeGuids[i];    eventFee.action = FeeAction.Add;    eventFee.qty = 1;    eventFee.overrideamount = 0;    fees[i] = eventFee;} // Set the line items. Do not worry about what the registrant already paid for in the past,// you just need the NEW fees for the sessions to be addedreg = xWeb.WEBCentralizedShoppingCartEventRegistrantSetLineItems(reg, fees); // The next lines illustrate that you need to set the rgs_cancel_qty to "0" for any // registrant session(s) in your collection. for (int i = 0; i < reg.Registrant_SessionCollection.Count(); i++){    var ses = reg.Registrant_SessionCollection[i];    ses.ev_registration_session.rgs_cancel_qty = "0";    reg.Registrant_SessionCollection[i] = ses;} // Add the Registrant object to the Cartcart = xWeb.WEBCentralizedShoppingCartAddEventRegistrant(cart, reg); // Set payment informationcart.Payment_Info.pin_cc_cardholder_name = "First M. Last";cart.Payment_Info.pin_cc_number = "4111111111111111";cart.Payment_Info.pin_cc_expire = "2011/12"; // Correct format is yyyy/mm cart.Payment_Info.pin_apm_key = "E3065977-EA16-44B9-9B4F-407150B5C2C1"; // AMEX, Visa, etc.cart.Payment_Info.pin_check_amount = cart.Invoice.inv_nettotal;cart.Payment_Info.pin_check_amountSpecified = true;cart.Invoice.inv_autoapply = 1;cart.Invoice.inv_autoapplypayment = 1; // Insert the Cart and paymentcart = xWeb.WEBCentralizedShoppingCartInsert(cart);

Request

See XWeb Event Registration Add New Session Registration Request for the request that is generated by the #Code for the final WEBCentralizedShoppingCartInsert method.

See Also