コード例 #1
0
        public ActionResult RoughRiders(RoughRiderRegistration eventRegVm, FormCollection collection)
        {
            _logger.Trace("/Events/RoughRiders (post) called");

            // get encrypted card information
            eventRegVm.BillingInformation.CreditCardNumber      = collection["number"];
            eventRegVm.BillingInformation.CreditCardExpireMonth = collection["month"];
            eventRegVm.BillingInformation.CreditCardExpireYear  = collection["year"];
            eventRegVm.BillingInformation.CreditCardCvv         = collection["cvv"];

            try
            {
                var result = _roughRiderRegistrationHandler.Create(ref eventRegVm);
                if (result == ServiceResultEnum.Failure)
                {
                    _logger.Warning("Rough Rider Tournament Failure: " + string.Join <string>(Environment.NewLine, _roughRiderRegistrationHandler.Messages));
                    return(RedirectToAction("RoughRiders").Error(_roughRiderRegistrationHandler.Messages));
                }
            }
            catch (Exception ex)
            {
                _logger.Error("Rough Rider Registration Error", ex);
                _roughRiderRegistrationHandler.Messages.Add(ex.Message);
                return(RedirectToAction("RoughRiders").Error(_roughRiderRegistrationHandler.Messages));
            }

            return(RedirectToAction("RoughRidersThankYou").Success("Registration and payment submitted successfully"));
        }
コード例 #2
0
        public ActionResult RoughRiders()
        {
            _logger.Trace("/Events/RoughRiders (get) called");

            var roughRidersReg = new RoughRiderRegistration();

            try
            {
                var roughRiderEventId = new Guid(_miscHandler.ReadOne("roughriderevent").Value);
                var roughRiderEvent   = _eventHandler.ReadOne(roughRiderEventId);

                roughRidersReg.EventRegistration =
                    new EventRegistration
                {
                    EventId       = roughRiderEventId,
                    Event         = roughRiderEvent,
                    PaymentMethod = 6
                };
                roughRidersReg.SetupAttendees(true);

                // Pass the client key for encrypting credit card information
                ViewBag.ClientKey = Properties.Settings.Default.BrainTreeClientKey;
            }
            catch (Exception ex)
            {
                _logger.Trace("Error loading RoughRiders (get)", ex);
                return(View(roughRidersReg).Error(ex.Message));
            }

            return(View(roughRidersReg));
        }