コード例 #1
0
ファイル: CartService.cs プロジェクト: HansonDodge/DirtyGirl
        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;
        }
コード例 #3
0
        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");
        }
コード例 #4
0
        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 });
        }
コード例 #5
0
        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 });
        }
コード例 #6
0
        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});
        }
コード例 #7
0
        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");
        }