Exemplo n.º 1
0
        public ActionResult GolfTournamentRegister(GolfRegistration golfReg, FormCollection collection)
        {
            _logger.Trace("/Events/GolfTournamentRegister (post) called");

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

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

            return(RedirectToAction("GolfTournamentThankYou", new { @amount = golfReg.EventRegistration.AmountDue }).Success("Registration and payment submitted successfully"));
        }
Exemplo n.º 2
0
        public ActionResult GolfTournamentRegister()
        {
            _logger.Trace("/Events/GolfTournamentRegister (get) called");

            var golfEventReg = new GolfRegistration();

            try
            {
                var golfEventId = new Guid(_miscHandler.ReadOne("golfevent").Value);
                var golfEvent   = _eventHandler.ReadOne(golfEventId);

                golfEventReg.EventRegistration =
                    new EventRegistration
                {
                    EventId       = golfEventId,
                    Event         = golfEvent,
                    PaymentMethod = 6
                };
                golfEventReg.SetupAttendees(true);

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

            return(View(golfEventReg));
        }
Exemplo n.º 3
0
        public ActionResult GolfTournamentRegistrationEdit(Guid id)
        {
            _logger.Trace("/Events/GolfTournamentRegistrationEdit (get) called");

            var golfEventReg = new GolfRegistration {
                IsAdminView = true, ShowPaymentSection = false
            };

            try
            {
                var golfEventId = new Guid(_miscHandler.ReadOne("golfevent").Value);
                var golfEvent   = _eventHandler.ReadOne(golfEventId);

                golfEventReg.EventRegistration = _eventRegistrationHandler.ReadOne(id);
                golfEventReg.SetupAttendees(false);

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

            return(View(golfEventReg));
        }
Exemplo n.º 4
0
        public ActionResult GolfTournamentRegistrationDelete(GolfRegistration golfReg)
        {
            _logger.Trace("/Events/GolfTournamentRegistrationDelete (post) called");

            try
            {
                var result = _golfRegistrationHandler.Delete(golfReg.EventRegistration.Id);
                if (result == ServiceResultEnum.Failure)
                {
                    return(RedirectToAction("GolfTournamentRegistrationIndex").Error(_golfRegistrationHandler.Messages));
                }
            }
            catch (Exception ex)
            {
                _logger.Error("Delete Event Error", ex);
                return(RedirectToAction("GolfTournamentRegistrationIndex").Error(ex.Message));
            }
            return(RedirectToAction("GolfTournamentRegistrationIndex").Success("Event Registration deleted"));
        }
Exemplo n.º 5
0
        public ActionResult GolfTournamentRegistrationEdit(GolfRegistration golfReg, FormCollection collection)
        {
            _logger.Trace("/Events/GolfTournamentRegistrationEdit (post) called");

            try
            {
                var result = _golfRegistrationHandler.Update(ref golfReg);
                if (result == ServiceResultEnum.Failure)
                {
                    _logger.Warning("Golf Tournament Failure: " + string.Join <string>(Environment.NewLine, _golfRegistrationHandler.Messages));
                    return(RedirectToAction("GolfTournamentRegistrationEdit").Error(_golfRegistrationHandler.Messages));
                }
            }
            catch (Exception ex)
            {
                _logger.Error("Golf Registration Error", ex);
                _golfRegistrationHandler.Messages.Add(ex.Message);
                return(RedirectToAction("GolfTournamentRegistrationEdit").Error(_golfRegistrationHandler.Messages));
            }

            return(RedirectToAction("GolfTournamentRegistrationIndex", new { @amount = golfReg.EventRegistration.AmountDue }).Success("Registration and payment submitted successfully"));
        }