Beispiel #1
0
        public ActionResult CheckOut(CartCheckOut model)
        {
            if (!Utilities.IsValidCart())
            {
                return(RedirectToAction("Index", "home"));
            }

            ServiceResult result = _service.ProcessCart(model, SessionManager.CurrentCart, CurrentUser.UserId);

            if (result.Success)
            {
                var confirmationCode = SessionManager.CurrentCart.ResultingConfirmationCode;
                var cartFocusType    = SessionManager.CurrentCart.CheckOutFocus;
                var eventCity        = (string.IsNullOrEmpty(SessionManager.CurrentCart.EventCity)) ? "" : SessionManager.CurrentCart.EventCity;
                var summary          = _service.GenerateCartSummary(SessionManager.CurrentCart);
                TempData["cartSummary"] = summary;

                // ensure cart focus is correct
                ResetCartFocus();

                SessionManager.CurrentCart = null;
                return(RedirectToAction("ThankYou", new { id = cartFocusType, confirm = confirmationCode, city = eventCity }));
            }

            Utilities.AddModelStateErrors(ModelState, result.GetServiceErrors());
            model.ExpirationMonthList = DirtyGirlExtensions.ConvertToSelectList <Months>();
            model.ExpirationYearList  = Utilities.CreateNumericSelectList(DateTime.Now.Year, DateTime.Now.AddYears(20).Year);
            model.CartSummary         = _service.GenerateCartSummary(SessionManager.CurrentCart);

            return(View(model));
        }
        public ActionResult EditEvent(vmAdmin_EditEvent model)
        {
            if (ModelState.IsValid)
            {
                ServiceResult result;

                //The editor widget tries to keep encoding the html on the post, so decode it before it goes in making sure it stays as raw hmtl.
                model.Event.EventDetails = HttpUtility.HtmlDecode(model.Event.EventDetails);

                result = _eventService.UpdateEvent(model.Event);

                if (result.Success)
                {
                    DisplayMessageToUser(new DisplayMessage(DisplayMessageType.SuccessMessage, "This event has been saved successfully"));
                    return(RedirectToAction("EditEvent", new { id = model.Event.EventId }));
                }
                else
                {
                    Utilities.AddModelStateErrors(this.ModelState, result.GetServiceErrors());
                }
            }


            // repopulate the grids..
            model.RegionList       = _eventService.GetRegionsByCountry(DirtyGirlConfig.Settings.DefaultCountryId);
            model.FeeTypes         = DirtyGirlExtensions.ConvertToSelectList <EventFeeType>();
            model.EventLeadTypes   = Utilities.CreateSelectList(_eventService.GetEventLeadTypes(), value => value.EventLeadTypeId, text => text.TypeName, false);
            model.CouponTypeList   = DirtyGirlExtensions.ConvertToSelectList <CouponType>();
            model.DiscountTypeList = DirtyGirlExtensions.ConvertToSelectList <DiscountType>();
            return(View(model));
        }
        public ActionResult Index(int?eventId)
        {
            vmAdmin_CouponList vm = new vmAdmin_CouponList
            {
                SelectedEventId  = eventId,
                EventList        = _service.GetUpcomingEvents(),
                CouponTypeList   = DirtyGirlExtensions.ConvertToSelectList <CouponType>(),
                DiscountTypeList = DirtyGirlExtensions.ConvertToSelectList <DiscountType>()
            };

            return(View(vm));
        }
Beispiel #4
0
        public ActionResult Facebook()
        {
            vmHomePage vm = new vmHomePage();

            vm.EventDateDetails = _eventService.GetActiveEventDateOverviews(null, null, null, "date", "asc");
            vm.RegionList       = Utilities.CreateSelectList(_eventService.GetRegionsByCountry(DirtyGirlConfig.Settings.DefaultCountryId), x => x.RegionId, x => x.Name);
            vm.MonthList        = DirtyGirlExtensions.ConvertToSelectList <Months>();
            vm.MonthList.Insert(0, new SelectListItem {
                Text = "Select", Value = ""
            });

            return(View(vm));
        }
        public ActionResult RegistrationDetails(Guid itemId)
        {
            if (!Utilities.IsValidCart())
            {
                return(RedirectToAction("Index", "home"));
            }

            var regAction = SessionManager.CurrentCart.ActionItems[itemId];
            var reg       = (Registration)regAction.ActionObject;

            // update address to current user address
            reg.Address1   = CurrentUser.Address1;
            reg.Address2   = CurrentUser.Address2;
            reg.Locality   = CurrentUser.Locality;
            reg.RegionId   = CurrentUser.RegionId;
            reg.PostalCode = CurrentUser.PostalCode;
            reg.Birthday   = DateTime.Now.AddYears(-30).Date;

            var wave    = _service.GetEventWaveById(reg.EventWaveId);
            int eventId = wave.EventDate.EventId;

            var tShirtSizeList = DirtyGirlExtensions.ConvertToSelectList <TShirtSize>();

            tShirtSizeList.RemoveAt(0);

            var allowSurvivors = (_service.GetSurvivorRegistrationsCountByEventDate(wave.EventDateId) < DirtyGirlServiceConfig.Settings.SurvivorSpots);

            var vm = new vmRegistration_Details
            {
                EventWave                = _service.GetEventWaveById(reg.EventWaveId),
                EventOverview            = _service.GetEventOverviewById(eventId),
                RegionList               = _service.GetRegionsByCountry(DirtyGirlConfig.Settings.DefaultCountryId),
                RegistrationTypeList     = DirtyGirlExtensions.ConvertToSelectList <RegistrationType>(),
                TShirtSizeList           = tShirtSizeList,
                PacketDeliveryOptionList = DirtyGirlExtensions.ConvertToSelectList <RegistrationMaterialsDeliveryOption>(),
                EventLeadList            = _service.GetEventLeads(eventId, true),
                RegistrationDetails      = reg,
                ItemId = itemId,
                survivorSpotsAvailable = allowSurvivors
            };

            return(View(vm));
        }
Beispiel #6
0
        private void FillEditUserEnums(vmUser_EditUser model)
        {
            model.Regions = UserService.GetRegionsForCountry((int)CountryCodes.USA);
            model.Regions.AddRange(UserService.GetRegionsForCountry((int)CountryCodes.Canada));

            model.Months = DirtyGirlExtensions.ConvertToSelectList <Months>();

            model.Days = new List <int>();
            for (int i = 1; i <= 31; i++)
            {
                model.Days.Add(i);
            }

            model.Years = new List <int>();
            for (int i = DateTime.Now.Year; i >= DateTime.Now.Year - 100; i--)
            {
                model.Years.Add(i);
            }
        }
Beispiel #7
0
        public ActionResult CheckOut()
        {
            if (!Utilities.IsValidCart())
            {
                return(RedirectToAction("Index", "home"));
            }

            var vm = new CartCheckOut
            {
                ExpirationMonthList = DirtyGirlExtensions.ConvertToSelectList <Months>(),
                ExpirationYearList  = Utilities.CreateNumericSelectList(DateTime.Now.Year, DateTime.Now.AddYears(20).Year),
                CardHolderFirstname = CurrentUser.FirstName,
                CardHolderLastname  = CurrentUser.LastName,
                CardHolderZipCode   = CurrentUser.PostalCode,
                CartSummary         = _service.GenerateCartSummary(SessionManager.CurrentCart)
            };


            return(View(vm));
        }
        public ActionResult EditEvent(int?id)
        {
            vmAdmin_EditEvent vm = new vmAdmin_EditEvent();

            if (id.HasValue)
            {
                vm.Event = _eventService.GetEventById(id.Value) ?? new Event();
            }
            else
            {
                vm.Event = new Event();
            }

            vm.RegionList       = _eventService.GetRegionsByCountry(DirtyGirlConfig.Settings.DefaultCountryId);
            vm.FeeTypes         = DirtyGirlExtensions.ConvertToSelectList <EventFeeType>();
            vm.EventLeadTypes   = Utilities.CreateSelectList(_eventService.GetEventLeadTypes(), value => value.EventLeadTypeId, text => text.TypeName, false);
            vm.CouponTypeList   = DirtyGirlExtensions.ConvertToSelectList <CouponType>();
            vm.DiscountTypeList = DirtyGirlExtensions.ConvertToSelectList <DiscountType>();

            return(View(vm));
        }
        public ActionResult RegistrationDetails(vmRegistration_Details model)
        {
            if (!Utilities.IsValidCart())
            {
                return(RedirectToAction("Index", "home"));
            }

            var regAction = SessionManager.CurrentCart.ActionItems[model.ItemId];
            var reg       = (Registration)regAction.ActionObject;

            if (_service.IsDuplicateRegistration(reg.EventWaveId, CurrentUser.UserId,
                                                 model.RegistrationDetails.FirstName, model.RegistrationDetails.LastName))
            {
                ModelState.AddModelError("FirstName",
                                         "You have already registered for this event wave. You may select another wave above, or, if you would like to register another participant for this wave, please enter their name below.");
            }

            var fullName = model.RegistrationDetails.FirstName + model.RegistrationDetails.LastName;

            if (fullName.Replace(" ", "") == model.RegistrationDetails.EmergencyContact.Replace(" ", ""))
            {
                ModelState.AddModelError("EmergencyContact", "Emergency contact cannot be the same as the registrant.");
            }

            EventWave wave = _service.GetEventWaveById(reg.EventWaveId);

            if (model.RegistrationDetails.Birthday.HasValue)
            {
                if (model.RegistrationDetails.Birthday.Value.AddYears(14) > wave.EventDate.DateOfEvent)
                {
                    ModelState.AddModelError("Birthday", "The participant must be 14 years or older to join the event..");
                }
            }
            else
            {
                ModelState.AddModelError("Birthday", "Registrants Birthday is required.");
            }

            model.RegistrationDetails.Address1   = reg.Address1 = CurrentUser.Address1;
            model.RegistrationDetails.Address2   = reg.Address2 = CurrentUser.Address2;
            model.RegistrationDetails.Locality   = reg.Locality = CurrentUser.Locality;
            model.RegistrationDetails.RegionId   = reg.RegionId = CurrentUser.RegionId;
            model.RegistrationDetails.PostalCode = reg.PostalCode = CurrentUser.PostalCode;

            if (ModelState.IsValid)
            {
                reg.AgreeToTerms               = model.RegistrationDetails.AgreeToTerms;
                reg.CartItemId                 = model.RegistrationDetails.CartItemId;
                reg.DateAdded                  = model.RegistrationDetails.DateAdded;
                reg.Email                      = model.RegistrationDetails.Email;
                reg.EmergencyContact           = model.RegistrationDetails.EmergencyContact;
                reg.EmergencyPhone             = model.RegistrationDetails.EmergencyPhone;
                reg.EventLeadId                = model.RegistrationDetails.EventLeadId;
                reg.FirstName                  = model.RegistrationDetails.FirstName;
                reg.Gender                     = model.RegistrationDetails.Gender;
                reg.IsFemale                   = model.RegistrationDetails.IsFemale;
                reg.IsOfAge                    = model.RegistrationDetails.IsOfAge;
                reg.IsThirdPartyRegistration   = model.RegistrationDetails.IsThirdPartyRegistration;
                reg.LastName                   = model.RegistrationDetails.LastName;
                reg.MedicalInformation         = model.RegistrationDetails.MedicalInformation;
                reg.ParentRegistrationId       = model.RegistrationDetails.ParentRegistrationId;
                reg.Phone                      = model.RegistrationDetails.Phone;
                reg.ReferenceAnswer            = model.RegistrationDetails.ReferenceAnswer;
                reg.RegistrationStatus         = RegistrationStatus.Active;
                reg.RegistrationType           = model.RegistrationDetails.RegistrationType;
                reg.SpecialNeeds               = model.RegistrationDetails.SpecialNeeds;
                reg.Birthday                   = model.RegistrationDetails.Birthday.Value.Date;
                reg.TShirtSize                 = model.RegistrationDetails.TShirtSize;
                reg.PacketDeliveryOption       = (model.RegistrationDetails.PacketDeliveryOption.HasValue ? model.RegistrationDetails.PacketDeliveryOption : RegistrationMaterialsDeliveryOption.OnSitePickup);
                reg.UserId                     = CurrentUser.UserId;
                reg.Signature                  = model.RegistrationDetails.Signature;
                reg.IsIAmTheParticipant        = model.RegistrationDetails.IsIAmTheParticipant;
                reg.IsSignatureConsent         = model.RegistrationDetails.IsSignatureConsent;
                reg.AgreeTrademark             = model.RegistrationDetails.AgreeTrademark;
                reg.ConfirmationCode           = model.RegistrationDetails.ConfirmationCode;
                regAction.ActionObject         = reg;
                regAction.ItemReadyForCheckout = true;


                // should check this better...
                if (((int)reg.PacketDeliveryOption.Value == 1))
                {
                    ActionItem shippingFeeItem = _service.CreateShippingFee(model.ItemId, reg.EventWaveId, reg.PacketDeliveryOption);
                    SessionManager.CurrentCart.ActionItems.Add(Guid.NewGuid(), shippingFeeItem);
                }

                if (CheckAddProcessingFee(reg, model.ItemId))
                {
                    ActionItem processingFeeItem = _service.CreateProcessingFee(model.ItemId, reg.EventWaveId,
                                                                                reg.PacketDeliveryOption);
                    SessionManager.CurrentCart.ActionItems.Add(Guid.NewGuid(), processingFeeItem);
                }
                else
                {
                    // check to see if the processing fee is already in the cart.  If so, we know we do not want it, so remove it.
                    RemoveProcessingFee(model.ItemId);
                }
                return(RedirectToAction("checkout", "cart"));
            }



            model.EventWave                = wave;
            model.EventOverview            = _service.GetEventOverviewById(wave.EventDate.EventId);
            model.RegionList               = _service.GetRegionsByCountry(DirtyGirlConfig.Settings.DefaultCountryId);
            model.RegistrationTypeList     = DirtyGirlExtensions.ConvertToSelectList <RegistrationType>();
            model.EventLeadList            = _service.GetEventLeads(wave.EventDate.EventId, true);
            model.PacketDeliveryOptionList = DirtyGirlExtensions.ConvertToSelectList <RegistrationMaterialsDeliveryOption>();
            model.TShirtSizeList           = DirtyGirlExtensions.ConvertToSelectList <TShirtSize>();
            model.TShirtSizeList.RemoveAt(0);

            return(View(model));
        }