예제 #1
0
        protected void CreateSession_Click(object sender, EventArgs e)
        {
            string       sessionName = string.IsNullOrEmpty(SessionName.Text) ? "New Session" : SessionName.Text;
            SessionBlock session     = AttendSessionEngine.GenerateSession(CurrentPage as EventPageBase, sessionName, (CurrentPage as EventPageBase).EventDetails.EventStart, (CurrentPage as EventPageBase).EventDetails.EventEnd);

            ClientScript.RegisterStartupScript(this.GetType(), "scriptid", "window.parent.location.href='" + EPiServer.Editor.PageEditing.GetEditUrl((session as IContent).ContentLink) + "'", true);
        }
예제 #2
0
        public static void ConvertSessionBlocksToSessions(List <SessionBlock> sessionBlocks, List <Session> sessions)
        {
            string groupName = "";
            string groupID   = "";

            for (int i = 0; i < sessionBlocks.Count; i++)
            {
                SessionBlock currentBlock = sessionBlocks[i];

                bool nextSessionIsConcurrent;
                bool previousSessionIsConcurrent;

                if (string.IsNullOrEmpty(currentBlock.TrackID))
                {
                    nextSessionIsConcurrent = (i < sessionBlocks.Count - 1) &&
                                              sessionBlocks[i + 1].Start == sessionBlocks[i].Start;
                    previousSessionIsConcurrent = (i > 0) && sessionBlocks[i - 1].Start == sessionBlocks[i].Start;
                }
                else
                {
                    nextSessionIsConcurrent = (i < sessionBlocks.Count - 1) &&
                                              sessionBlocks[i + 1].TrackID == sessionBlocks[i].TrackID;
                    previousSessionIsConcurrent = (i > 0) && sessionBlocks[i - 1].TrackID == sessionBlocks[i].TrackID;
                }
                if (!previousSessionIsConcurrent || currentBlock.Mandatory)
                {
                    groupID   = "Session-" + (currentBlock as IContent).ContentLink.ID;
                    groupName = currentBlock.TrackID;
                }
                sessions.Add(GenerateSession(sessionBlocks[i], groupName, groupID, nextSessionIsConcurrent, previousSessionIsConcurrent));
            }
        }
예제 #3
0
        public static Session GenerateSession(SessionBlock currentSession, string groupName, string groupID, bool nextSessionIsConcurrent, bool previousSessionIsConcurrent)
        {
            Session newSession = new Session();

            newSession.CurrentSessionBlock = currentSession;

            newSession.Name     = (currentSession as IContent).Name;
            newSession.Enabled  = currentSession.NumberOfSeats == 0 || (currentSession.NumberOfSeats - GetParticipants(currentSession).Count) > 0;
            newSession.Selected = currentSession.Mandatory;
            newSession.NewGroup = !previousSessionIsConcurrent;

            if (!previousSessionIsConcurrent)
            {
                if (string.IsNullOrEmpty(groupName))
                {
                    newSession.Header = currentSession.Start.ToString("HH:mm");
                }
                else
                {
                    newSession.Header = groupName;
                }
            }
            newSession.Group = groupID;

            if (currentSession.IntroContent != null)
            {
                newSession.IntroContent = currentSession.IntroContent.ToHtmlString();
            }

            newSession.CheckBox  = !nextSessionIsConcurrent && !previousSessionIsConcurrent && !currentSession.Mandatory;
            newSession.ContentID = (currentSession as IContent).ContentLink.ID;
            return(newSession);
        }
예제 #4
0
        public static SessionBlock GenerateSession(EventPageBase EventPageBase, string name, DateTime start, DateTime end)
        {
            var          contentRepository = ServiceLocator.Current.GetInstance <IContentRepository>();
            SessionBlock newSession        = contentRepository.GetDefault <SessionBlock>(GetOrCreateSessionFolder(EventPageBase.ContentLink).ContentLink);

            newSession.Start         = start;
            newSession.End           = end;
            newSession.NumberOfSeats = EventPageBase.EventDetails.NumberOfSeats;
            newSession.EventPage     = EventPageBase.ContentLink.ToPageReference();
            IContent newSessionContent = newSession as IContent;

            newSessionContent.Name = name;
            contentRepository.Save(newSessionContent, EPiServer.DataAccess.SaveAction.Publish, EPiServer.Security.AccessLevel.NoAccess);
            return(newSession);
        }
예제 #5
0
        public static List <ParticipantBlock> GetParticipants(SessionBlock session)
        {
            List <ParticipantBlock> sessionParticipants = new List <ParticipantBlock>();
            int sessionID         = (session as IContent).ContentLink.ID;
            var eventParticipants = AttendRegistrationEngine.GetParticipants(session.EventPage);

            foreach (ParticipantBlock participant in eventParticipants)
            {
                if (participant.Sessions != null && participant.Sessions.Items != null && participant.Sessions.Items.Count > 0)
                {
                    if ((from s in participant.Sessions.Items where s.ContentLink.ID == sessionID select s.ContentLink.ID).Any <int>())
                    {
                        sessionParticipants.Add(participant);
                    }
                }
            }
            return(sessionParticipants);
        }
예제 #6
0
 public ComboItem(SessionBlock item, int index)
 {
     this.index = index;
     this.Item  = item;
 }