예제 #1
0
        private void CompleteActions(ActionItem item, int cartItemId, int? discountId, string confirmationCode)
        {
            IRegistrationService regService = new RegistrationService(this._repository, false);

            switch (item.ActionType)
            {
                case CartActionType.NewRegistration:
                    var newReg = (Registration)item.ActionObject;
                    newReg.CartItemId = cartItemId;
                    newReg.ConfirmationCode = confirmationCode;
                    regService.CreateNewRegistration(newReg, discountId);
                    break;
                case CartActionType.EventChange:
                    var changeAction = (ChangeEventAction)item.ActionObject;
                    regService.ChangeEvent(changeAction.RegistrationId, changeAction.UpdatedEventWaveId, cartItemId, confirmationCode);
                    break;
                case CartActionType.TransferRregistration:
                    var transferAction = (TransferAction)item.ActionObject;
                    regService.TransferRegistration(transferAction.RegistrationId, transferAction.FullName, transferAction.Email);
                    break;
                case CartActionType.CancelRegistration:
                    var cancelAction = (CancellationAction)item.ActionObject;
                    regService.CancelRegistration(cancelAction.RegistrationId);
                    break;
            }
        }
예제 #2
0
        public ActionItem CreateShippingFee(Guid regItemGuid, int eventWaveId, RegistrationMaterialsDeliveryOption? deliveryOption)
        {
            var newAction = new ShippingFeeAction {
                RegItemGuid = regItemGuid,
                EventWaveId = eventWaveId
            };
            var newCartItem = new ActionItem
            {
                ActionType = CartActionType.ShippingFee,
                ActionObject = newAction,
                ItemReadyForCheckout = true
            };

            return newCartItem;
        }
        public ActionResult StartCancellation(int regId)
        {
            if (!IsRegistrationAlreadyInCart(regId))
            {
                var itemId = Guid.NewGuid();
                var newAction = new CancellationAction
                    {
                        RegistrationId = regId
                    };
                var newCartItem = new ActionItem
                    {
                        ActionType = CartActionType.CancelRegistration,
                        ActionObject = newAction,
                        ItemReadyForCheckout = true
                    };

                SessionManager.CurrentCart.ActionItems.Add(itemId, newCartItem);
            }
            SessionManager.CurrentCart.CheckOutFocus = CartFocusType.CancelEvent;

            return RedirectToAction("checkout", "cart");
        }
        public ActionResult StartRedemption(string id)
        {
            ServiceResult result = _service.ValidateRedemptionCodeForUserId(id, CurrentUser.UserId);

            if (result.Success)
            {
                RedemptionCode redemptionCode = _service.GetRedemptionCode(id);
                var itemId = Guid.NewGuid();
                var newReg = new Registration
                {
                    UserId = CurrentUser.UserId,
                    FirstName = CurrentUser.FirstName,
                    LastName = CurrentUser.LastName,
                    Address1 = CurrentUser.Address1,
                    Address2 = CurrentUser.Address2,
                    Locality = CurrentUser.Locality,
                    RegionId = CurrentUser.RegionId,
                    PostalCode = CurrentUser.PostalCode,
                    Email = CurrentUser.EmailAddress,
                    RegistrationStatus = RegistrationStatus.Active,
                };

                if (redemptionCode.RedemptionCodeType == RedemptionCodeType.Transfer)
                {
                    newReg.EventWaveId = redemptionCode.GeneratingRegistration.EventWaveId;
                    newReg.TeamId = redemptionCode.GeneratingRegistration.TeamId;
                }

                SessionManager.CurrentCart.DiscountCode = id;

                var newCartItem = new ActionItem
                {
                    ActionType = CartActionType.NewRegistration,
                    ActionObject = newReg,
                    ItemReadyForCheckout = false
                };

                SessionManager.CurrentCart.ActionItems.Add(itemId, newCartItem);
                SessionManager.CurrentCart.CheckOutFocus = CartFocusType.Registration;

                if (redemptionCode.RedemptionCodeType == RedemptionCodeType.Transfer)
                    return RedirectToAction("registrationdetails", "Registration", new {itemId});

                SessionManager.CurrentCart.CheckOutFocus = CartFocusType.Redemption;
                return RedirectToAction("eventselection", "registration", new {itemId});
            }

            string error = "Invalid Redemption Code";
            var errors = result.GetServiceErrors();
            if (errors != null && errors.Count > 0)
                error = errors[0].ErrorMessage;

            return RedirectToAction("InvalidRedemption", "registration", new { redemptionError = error });
        }
        public ActionResult StartNewRegistration(int? eventId, int? eventDateId)
        {
            var itemId = Guid.NewGuid();
            var newReg = new Registration
                {
                    UserId = CurrentUser.UserId,
                    FirstName = CurrentUser.FirstName,
                    LastName = CurrentUser.LastName,
                    Address1 = CurrentUser.Address1,
                    Address2 = CurrentUser.Address2,
                    Locality = CurrentUser.Locality,
                    RegionId = CurrentUser.RegionId,
                    PostalCode = CurrentUser.PostalCode,
                    Email = CurrentUser.EmailAddress,
                    RegistrationStatus = RegistrationStatus.Active
                };
            var newCartItem = new ActionItem
                {
                    ActionType = CartActionType.NewRegistration,
                    ActionObject = newReg,
                    ItemReadyForCheckout = false
                };

            SessionManager.CurrentCart.ActionItems.Add(itemId, newCartItem);
            SessionManager.CurrentCart.CheckOutFocus = CartFocusType.Registration;

            return RedirectToAction("eventSelection", "registration", new { itemId, eventId, eventDateId });
        }
        public ActionResult StartChangeWave(int regId)
        {
            var itemId = Guid.NewGuid();
            var newAction = new ChangeWaveAction
                {
                    RegistrationId = regId
                };
            var newCartItem = new ActionItem
            {
                ActionType = CartActionType.WaveChange,
                ActionObject = newAction,
                ItemReadyForCheckout = false
            };

            SessionManager.CurrentCart.ActionItems.Add(itemId, newCartItem);
            SessionManager.CurrentCart.CheckOutFocus = CartFocusType.ChangeWave;

            var reg = _service.GetRegistrationById(regId);
            return RedirectToAction("EventSelection", "registration", new { itemId, reg.EventWave.EventDate.EventId, reg.EventWave.EventDateId, reg.EventWaveId});
        }
        public ActionResult StartChangeEvent(int eventId, int regId, int waveId, int dateId)
        {
            if (!IsRegistrationAlreadyInCart(regId))
            {
                var newItemId = Guid.NewGuid();

                var newAction = new ChangeEventAction
                    {
                        RegistrationId = regId
                    };
                var newCartItem = new ActionItem
                    {
                        ActionType = CartActionType.EventChange,
                        ActionObject = newAction,
                        ItemReadyForCheckout = false
                    };

                SessionManager.CurrentCart.ActionItems.Add(newItemId, newCartItem);
                SessionManager.CurrentCart.CheckOutFocus = CartFocusType.ChangeEvent;

                return RedirectToAction("EventSelection", "registration",
                                        new
                                            {
                                                itemId = newItemId,
                                                eventId = eventId,
                                                eventDateId = dateId,
                                                eventWaveId = waveId
                                            });
            }
            SessionManager.CurrentCart.CheckOutFocus = CartFocusType.CancelEvent;

            return RedirectToAction("checkout", "cart");
        }