コード例 #1
0
        private EventRegistrationModel CreateEventRegistrationModel(EventPageBase currentPage, string contentLink)
        {
            var model               = new EventRegistrationModel(currentPage);
            var repository          = ServiceLocator.Current.GetInstance <IContentLoader>();
            var localizationService = ServiceLocator.Current.GetInstance <LocalizationService>();

            var           pageRouteHelper = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance <EPiServer.Web.Routing.PageRouteHelper>();
            PageReference currentPageLink = pageRouteHelper.PageLink;

            model.HostPageData   = pageRouteHelper.Page;
            model.EventPageBase  = currentPage;
            model.Sessions       = BVNetwork.Attend.Business.API.AttendSessionEngine.GetSessionsList(model.EventPageBase.PageLink);
            model.AvailableSeats = AttendRegistrationEngine.GetAvailableSeats(model.EventPageBase.PageLink);
            model.PriceText      = model.EventPageBase.EventDetails.Price > 0 ? model.EventPageBase.EventDetails.Price + " " + localizationService.GetString("/eventRegistrationTemplate/norwegianCurrencey") : localizationService.GetString("/eventRegistrationTemplate/freeOfCharge");
            return(model);
        }
コード例 #2
0
        protected string GetAvailableSeatsText()
        {
            int available = AttendRegistrationEngine.GetAvailableSeats(CurrentPage.ContentLink);

            if (available > 3 && !string.IsNullOrEmpty(CurrentData.ManyAvailableSeats))
            {
                return(string.Format(CurrentData.ManyAvailableSeats, available));
            }
            if (available == 3)
            {
                return(CurrentData.ThreeSeats);
            }
            if (available == 2)
            {
                return(CurrentData.TwoSeats);
            }
            if (available == 1)
            {
                return(CurrentData.OneSeat);
            }
            return(string.Empty);
        }