} // CreateAndSendSuccessfulPaymentEvent ()
        //--------------------------------------------

        private Event CreateAndSendFailedPaymentEvent()
        {
            Event l_eventToCreate = new Event(Event.FailedPayment);
            l_eventToCreate.AddData("MERCHANT_REFERENCE", lblOrderNumber.Text);

            try
            {
                Event l_eventCreated = _client.AppendEventToAssessmentSession(GetOrCreateAssessmentSession(), l_eventToCreate);
                return l_eventCreated;
            }
            catch (ClientException ex)
            {
                return null;
            }
        } // CreateAndSendFailedPaymentEvent ()
        } // PrintFraudAssessmentDetails ()
        //----------------------------------

        static void Main(string[] args)
        {
            // parse run-time arguments
            if ( args.Length < 2 || args.Length > 3)
            {
                WrongSyntax();
                return;
            }
            String baseUrl = args[0];
            String apiKey = args[1];
            int webRequestTimeout = 5000;
            if ( args.Length == 3)
            {
                try
                {
                    webRequestTimeout = int.Parse(args[2]);
                    if (webRequestTimeout<0)
                    {
                        WrongSyntax();
                        return;
                    }                        
                }
                catch (Exception ex)
                {
                    WrongSyntax();
                    return;
                }                
            }
            //-----------------------------------

            try
            {
                var client = ClientFactory.Construct(baseUrl, apiKey, webRequestTimeout);

                Console.WriteLine("About to Create an Assessment Session...");
                AssessmentSession assessmentSession = client.CreateAssessmentSession();
                Console.WriteLine("...done. Assessement Session ID: " + assessmentSession.Id);

                //--------- Generic Event --------------------------------
                Console.WriteLine("About to Create a Generic Event...");
                Event l_event = new Event(Event.GenericEvent);

                l_event.AddData("BookingCode", "1234");
                // this is an example on not specifying whether the time is local or utc
                DateTime startDate = new DateTime(2001, 6, 30, 1, 5, 0); 
                l_event.AddData("StartDate", startDate);

                DateTime reservationDate = new DateTime(2001, 3, 21, 8, 0, 0, DateTimeKind.Local);
                l_event.AddData("ReservationDate", reservationDate);
                Console.WriteLine("...done");

                Console.WriteLine("About to Send Event over to Fraudpointer Server...");
                Event l_eventReturned = client.AppendEventToAssessmentSession(assessmentSession, l_event);
                Console.WriteLine("...done. Event");
                //--------------------------------------------------------

                //-------- Failed Payment Event --------------------------
                Console.WriteLine("About to Create a Failed Payment Event...");
                l_event = new Event(Event.FailedPayment);

                DateTime attemptDate = new DateTime(2011, 3, 22, 10, 0, 0, DateTimeKind.Local);
                l_event.AddData("E_TRAVEL_SA_PURCHASE_DATE", attemptDate);

                l_event.AddData("BILLING_ADDRESS_STREET_NAME", "Othonos");
                Console.WriteLine("...done");

                Console.WriteLine("About to Send Event over to Fraudpointer Server...");
                l_eventReturned = client.AppendEventToAssessmentSession(assessmentSession, l_event);
                Console.WriteLine("...done. Event");
                //---------------------------------------------------------

                //--------- Ask for Fraud Assessment ----------------------
                Console.WriteLine("About to ask for Final Fraud Assessment");
                FraudAssessment fa = client.CreateFraudAssessment(assessmentSession, false);
                Console.WriteLine("...done");
                PrintFraudAssessmentDetails(fa);
                //---------------------------------------------------------

                //---- For demo purposed I will now ask for the previously created Fraud Assessment ----
                Console.WriteLine("About to ask for the previously created Fraud Assessment");
                FraudAssessment fa_got = client.GetFraudAssessment(assessmentSession, fa.Id);
                Console.WriteLine("...done");
                PrintFraudAssessmentDetails(fa_got);
                //--------------------------------------------------------------------------------------
                
            } // try
            catch (Fraudpointer.API.ClientException ex)
            {
                // something went really wrong. Let us find out what:
                Console.Error.WriteLine(ex.Message);
                // and the inners of it:
                Console.Error.WriteLine("Inner: {0}", ex.InnerException.Message);

            } // catch  

        } // Main 
        } // SaveToSession ()
        //--------------------

        private Event CreateAndSendCheckoutEvent(Account i_account)
        {
            Event l_eventToCreate = new Event(Event.CheckoutEvent);
            l_eventToCreate.AddData("MERCHANT_REFERENCE", lblOrderNumber.Text);   

            // PURCHASE_AMOUNT is a System Session Attribute
            l_eventToCreate.AddData("PURCHASE_AMOUNT", txtbxAmount.Text);

            // CC_HASH is a System Attribute. You should always use the CreditCardHash to hash your 
            // Credit Card Number and send it to Fraud Pointer Server.
            l_eventToCreate.AddData("CC_HASH", _client.CreditCardHash(txtbxCardNumber.Text));

            // CC_CARD_HOLDER_NAME is a System Attribute.
            l_eventToCreate.AddData("CC_CARD_HOLDER_NAME", txtbxNameOnCard.Text);

            // CC_BANK_NAME is a System Attribute
            l_eventToCreate.AddData("CC_BANK_NAME", txtbxBankNameOfCard.Text);

            // CREDIT_CARD_FIRST_6_DIGITS
            if ( txtbxCardNumber.Text.Length>=6 )
            {
                l_eventToCreate.AddData("CREDIT_CARD_FIRST_6_DIGITS", txtbxCardNumber.Text.Substring(0, 6));    
            }            
            else
            {
                l_eventToCreate.AddData("CREDIT_CARD_FIRST_6_DIGITS", txtbxCardNumber.Text.Substring(0, txtbxCardNumber.Text.Length));    
            }

            // LET US SEND THE USER_E_MAIL 
            l_eventToCreate.AddData("USER_E_MAIL", i_account.Email);

            // LET US SEND THE USERNAME
            l_eventToCreate.AddData("USERNAME", i_account.Username);


            // first name
            l_eventToCreate.AddData("USER_FIRSTNAME", i_account.Firstname);

            // last name
            l_eventToCreate.AddData("USER_LASTNAME", i_account.Surname);

            // country of customer
            Country l_billingCountry = Country.Find(i_account.CountryId);
            if ( l_billingCountry != null )
            {
                l_eventToCreate.AddData("BILLING_COUNTRY", Country.Find(i_account.CountryId).Iso2);    
            }
            
            // address street
            if ( String.IsNullOrEmpty(i_account.AddressStreet) == false )
            {
                l_eventToCreate.AddData("BILLING_ADDRESS_STREET_NAME", i_account.AddressStreet);    
            }

            //BILLING_ADDRESS_STREET_NUMBER
            if (String.IsNullOrEmpty(i_account.AddressNumber) == false)
            {
                l_eventToCreate.AddData("BILLING_ADDRESS_STREET_NUMBER", i_account.AddressNumber);
            }

            //BILLING_ADDRESS_CITY
            if (String.IsNullOrEmpty(i_account.AddressCity) == false)
            {
                l_eventToCreate.AddData("BILLING_ADDRESS_CITY", i_account.AddressCity);
            }

            // BILLING_ADDRESS_POST_CODE
            if (String.IsNullOrEmpty(i_account.AddressPostCode) == false)
            {
                l_eventToCreate.AddData("BILLING_ADDRESS_POST_CODE", i_account.AddressPostCode);
            }
            
            // BILLING_TELEPHONE_NUMBER
            if (String.IsNullOrEmpty(i_account.Telephone) == false)
            {
                l_eventToCreate.AddData("BILLING_TELEPHONE_NUMBER", i_account.Telephone);
            }                   

            int l_iNumberOfDeposits = 0;
            l_iNumberOfDeposits = Transaction.NumberOfDeposits(i_account.Id, DateTime.MinValue);
            l_eventToCreate.AddData("SUPER_SPORTING_BET_NUMBER_OF_USER_S_DEPOSITS_SINCE_INITIAL_REGISTRATION_DATE", l_iNumberOfDeposits);

            int l_iNumberOfDaysSinceInitialRegistrationDate = 0;
            l_iNumberOfDaysSinceInitialRegistrationDate = (DateTime.Now - i_account.DateOfRegistration).Days;
            l_eventToCreate.AddData("SUPER_SPORTING_BET_DAYS_SINCE_INITIAL_REGISTRATION_DATE", l_iNumberOfDaysSinceInitialRegistrationDate);

            // SUPER_SPORTING_BET_LAST_30_DAYS__ACCUMULATED_VALUE_OF_USER_S_DEPOSITS
            decimal l_iLast30DaysAccumulatedValueOfUsersDeposits = 0;
            l_iLast30DaysAccumulatedValueOfUsersDeposits = Transaction.SumDepositsLaterThan(i_account.Id, DateTime.Now.AddDays(-30));
            l_eventToCreate.AddData("SUPER_SPORTING_BET_LAST_30_DAYS__ACCUMULATED_VALUE_OF_USER_S_DEPOSITS", l_iLast30DaysAccumulatedValueOfUsersDeposits);

            // SUPER_SPORTING_BET_LAST_30_DAYS__NUMBER_OF_USER_S_DEPOSITS
            int l_iNumberOfDepositsDuringLast30Days = 0;
            l_iNumberOfDepositsDuringLast30Days = Transaction.NumberOfDeposits(i_account.Id, DateTime.Now.AddDays(-30));
            l_eventToCreate.AddData("SUPER_SPORTING_BET_LAST_30_DAYS__NUMBER_OF_USER_S_DEPOSITS", l_iNumberOfDepositsDuringLast30Days);
            
            // "SUPER_SPORTING_BET_USER_S_IP_ADDRESS_ON_REGISTRATION"
            if ( String.IsNullOrEmpty(i_account.IpAddressOnRegistration) == false )
            {
                l_eventToCreate.AddData("SUPER_SPORTING_BET_USER_S_IP_ADDRESS_ON_REGISTRATION", i_account.IpAddressOnRegistration);                
            }

            // SUPER_SPORTING_BET_USER_HAS_AT_LEAST_ONE_BANK_DEPOSIT
            int l_iNumberOfBankDeposits = Transaction.NumberOfBankDeposits(i_account.Id, DateTime.MinValue);
            l_eventToCreate.AddData("SUPER_SPORTING_BET_USER_HAS_AT_LEAST_ONE_BANK_DEPOSIT", l_iNumberOfBankDeposits >= 1);

            try
            {
                Event l_eventCreated = _client.AppendEventToAssessmentSession(GetOrCreateAssessmentSession(), l_eventToCreate);
                return l_eventCreated;
            }
            catch (ClientException ex)
            {
                return null;
            }

        } // CreateAndSendCheckoutEvent ()
        } // GetCalculatePriceJavascript ()
        //--------------------------------

        private Event CreateAndSendCheckoutEvent()
        {
            Event l_eventToCreate = new Event(Event.CheckoutEvent);
            l_eventToCreate.AddData("MERCHANT_REFERENCE", lblAcmeOrderNumber.Text);

            // ACME_DEPARTURE_CITY is an Account Custom Session Attribute defined in Fraud Pointer Application                        
            l_eventToCreate.AddData("ACME_DEPARTURE_CITY", lstBoxCityFrom.Items[lstBoxCityFrom.SelectedIndex].Text);

            // ACME_ARRIVAL_CITY is an Account Custome Session Attribute defined in Fraud Pointer Application
            l_eventToCreate.AddData("ACME_ARRIVAL_CITY", lstBoxCityTo.Items[lstBoxCityTo.SelectedIndex].Text);

            // PURCHASE_AMOUNT is a System Session Attribute
            l_eventToCreate.AddData("PURCHASE_AMOUNT", CalculatePrice(lstBoxCityFrom.SelectedValue, lstBoxCityTo.SelectedValue));

            // CC_HASH is a System Attribute. You should always use the CreditCardHash to hash your 
            // Credit Card Number and send it to Fraud Pointer Server.
            l_eventToCreate.AddData("CC_HASH",  _client.CreditCardHash(txtbxCreditCardNumber.Text));

            // CC_CARD_HOLDER_NAME is a System Attribute.
            l_eventToCreate.AddData("CC_CARD_HOLDER_NAME", txtbxCardHolderName.Text);

            // CC_BANK_NAME is a System Attribute
            l_eventToCreate.AddData("CC_BANK_NAME", txtbxBankNameOfCard.Text);

            // CREDIT_CARD_FIRST_6_DIGITS
            if (String.IsNullOrEmpty(txtbxCreditCardNumber.Text) == false)
            {
                if (txtbxCreditCardNumber.Text.Length > 6)
                {
                    l_eventToCreate.AddData("CREDIT_CARD_FIRST_6_DIGITS", txtbxCreditCardNumber.Text.Substring(0, 6));
                }
                else
                {
                    l_eventToCreate.AddData("CREDIT_CARD_FIRST_6_DIGITS", txtbxCreditCardNumber.Text.Substring(0, txtbxCreditCardNumber.Text.Length));
                }
            }


            try
            {
                Event l_eventCreated = _client.AppendEventToAssessmentSession(GetOrCreateAssessmentSession(), l_eventToCreate);
                return l_eventCreated;
            }
            catch (ClientException ex)
            {
                return null;
            }

        } // CreateAndSendCheckoutEvent ()