Avectra.netForum.Components.EV.Registration

Static Facade Class
Avectra.netForum.Components.EV.Registration
Namespace: Avectra.netForum.Components
assembly:
Group Item: Registrant


Contents

[edit] Features

The Avectra.netForum.Components.EV.Registration class is the Static Facade Object for an events Registrant.

[edit] Properties


[edit] Methods

  • AddRegistrationDetails - Adds session registrations for the Registrant. Each session registration is represented by the RegistrationDetail class.


[edit] Usage and Examples

In this C# code sample, we create the following:

  1. A Registrant, which includes an InvoiceDetail
  2. A Session Registration for the Registrant, which includes an InvoiceDetail
  3. A credit cart payment

Note that this simplified code was extracted from a functional project but this exact code has not been compiled or tested. The guid values will of course need to be replaced with real values.

// OleDbConnection and OleDbTransaction
OleDbConnection oConn = DataUtils.GetConnection();
OleDbTransaction oTrx = oConn.BeginTransaction();
 
// Instantiate Registrant object
FacadeClass oRegistrant = (Registration)DataUtils.InstantiateFacadeObject("EventsRegistrant");
 
// Set primary key:
Guid oGuid = Guid.NewGuid();
oRegistrant.SetValue("reg_key",oGuid.ToString());
oRegistrant.CurrentKey = oGuid.ToString();
 
// SetValue on customer key and event key:
oRegistrant.SetValue("reg_cst_key", "DDE950DC-9849-488E-B3B4-6C3C212A2C2");
oRegistrant.SetValue("reg_evt_key", "9CBDA199-D650-4FFC-A641-A5EF97D0EF43");
 
// Additional fields to set, you may set to different values if needed:
 
// Relationship key and related fields:
oRegistrant.SetValue("reg_ixo_key", oRegistrant.GetValue("cst_ixo_key"));
oRegistrant.SetValue("reg_org_name_dn",oRegistrant.GetValue("org_name"));
oRegistrant.SetValue("reg_ixo_title_dn",oRegistrant.GetValue("ixo_title"));
 
// Set the the price key (prc_key) of the main registration fee, and batch key
oRegistrant.SetValue("prc_key", "00a987e5-a730-4bfb-8be6-c723c8bc0941");
oRegistrant.SetValue("inv_bat_key", "BA2C5173-4B5A-4693-B5A7-D6C0E7219ED7");
 
// InvoiceDetail for main registration:
if( ! UtilityFunctions.EmptyString(oRegistrant.GetValue("prc_key")) )
{
FacadeClass oInvoiceDetail = (InvoiceDetail)DataUtils.InstantiateFacadeObject("InvoiceDetail");
//oInvoiceDetail.SetValue("ivd_formkey", oRegistrant.GetValue("reg_formkey"));
oInvoiceDetail.SetValue("ivd_prc_key", oRegistrant.GetValue("prc_key"));
oInvoiceDetail.SetValue("ivd_disable_quantity", "1");
oInvoiceDetail.SetDefaults();
oInvoiceDetail.SetValue("ivd_reg_key", oRegistrant.GetValue("reg_key"));
oInvoiceDetail.SetValue("ivd_cst_key",oRegistrant.GetValue("reg_cst_key").ToString());
oInvoiceDetail.LoadRelatedData();
oInvoiceDetail.SetValue("ivd_cst_ship_key",oRegistrant.GetValue("reg_cst_key").ToString());
oInvoiceDetail.LoadRelatedData();
 
oInvoiceDetail.SetValue("ivd_cxa_key",oRegistrant.GetValue("reg_cxa_key").ToString());
 
// Add invoice detail to collection
oRegistrant.oInvoice.AddInvoiceDetailLine(oInvoiceDetail);
 
// SetValue or reg_ivd_key to the Registrant
oRegistrant.SetValue("reg_ivd_key",oInvoiceDetail.GetValue("ivd_key"));
}
 
// If there is a payment with a credit card, then SetValue on the following:
 
// PaymentMethod, eg Visa, MasterCard, etc.:
oRegistrant.SetValue("pin_apm_key", "FC6B3D4C-C5AB-434D-B640-106E8FA0BD06");
 
// SetValue of Credit Card number, in clear text:
oRegistrant.SetValue("pin_cc_number", "4111-1111-1111-1111");
oRegistrant.SetValue("pin_cc_expire", "2010/08");
 
// SetValue for the total amount of the payment, for all line item(s):
oRegistrant.SetValue("pin_check_amount", 1000.00);
 
// LoadRelatedData:
oRegistrant.LoadRelatedData(oConn,oTran);
 
// Next, add any SessionRegistrations, if any.
// Convert this code into sub-function if implemented for real
// EventsRegistrantSession - for each Session the registrant is attending,
// add one of these
// Avectra.netForum.Components.EV.RegistrationDetail
FacadeClass oRegDetail = (RegistrationDetail)DataUtils.InstantiateFacadeObject("EventsRegistrantSession");
 
// SetValue on Session Key and Price Key of Session Fee:
oRegDetail.SetValue("rgs_ses_key", "3F1E5018-F306-4C20-9D70-41E6B332C8C7");
oRegDetail.SetValue("rgs_prc_key", "DA272222-C312-4BEE-A5EB-86C19CE45B6B");
 
/// Instantiate InvoiceDetail to be associated with the EventsRegistrantSession
FacadeClass oInvoiceDetail = (InvoiceDetail)DataUtils.InstantiateFacadeObject("InvoiceDetail");
 
oInvoiceDetail.SetValue("inv_cst_billing_key", oRegistrant.oInvoice.GetValue("inv_cst_billing_key"));
oInvoiceDetail.SetValue("ivd_prc_key",oRegDetail.GetValue("rgs_prc_key"));
oInvoiceDetail.LoadRelatedData();
oInvoiceDetail.SetValue("ivd_disable_quantity", oRegDetail.GetValue("ses_ticketed")=="0"?"1":"0");
oInvoiceDetail.SetDefaults();
// override default when have time or needed... e.g. quantity, price, etc..
oInvoiceDetail.SetValue("ivd_cst_ship_key",oRegistrant.GetValue("reg_cst_key").ToString());
oInvoiceDetail.SetValue("ivd_cxa_key",oRegistrant.GetValue("reg_cxa_key").ToString());
oInvoiceDetail.SetValue("ivd_ivd_key", oRegistrant.GetValue("reg_ivd_key"));
 
// Add the InvoiceDetail the the InvoiceDetails collection:
// in the Invoice of the Registrant
oRegistrant.oInvoice.AddInvoiceDetailLine(oInvoiceDetail);
 
// Set additional values:
oRegDetail.SetValue("rgs_ivd_key",oInvoiceDetail.GetValue("ivd_key"));
oRegDetail.SetValue("rgs_on_wait_list",oRegDetail.GetValue("ses_wait_list_flag"));
 
// Add the EventsRegistrantSessionto the RegistrationDetails collection of the Registrant:
oRegistrant.AddRegistrationDetails(oRegDetail);
 
// Payment:
oRegistrant.bCreateInvoice = true;
 
// Final insert:
ErrorClass oEr = new ErrorClass();
oEr = oRegistrant.Insert(oConn,oTran);
 
// Error management:
if(oEr.Number == (int)ErrorClass.ErrorNumber.NoError)
{
// good, no error
// commit transaction:
oTrx.Commit();
}
else
{
// inspect error message:
string szError = oEr.Message
if( oTrx != null )
oTrx.Rollback();
}