Exemplo n.º 1
0
        public void AddSession(SessionModel session)
        {
            sessionDb.Sessions.InsertOnSubmit(session);
            sessionDb.SubmitChanges();
            InsertIntoSessions(Sessions, session);

            Game.Difficulty difficulty = (Game.Difficulty)session.Difficulty;
            switch (difficulty)
            {
                case Game.Difficulty.Easy:
                    InsertIntoSessions(EasySessions, session);
                    break;
                case Game.Difficulty.Medium:
                    InsertIntoSessions(MediumSessions, session);
                    break;
                case Game.Difficulty.Hard:
                    InsertIntoSessions(HardSessions, session);
                    break;
            }
        }
Exemplo n.º 2
0
        public void InsertIntoSessions(Collection<SessionModel> sessions, SessionModel session)
        {
            int i = 0;
            while (i < sessions.Count)
            {
                if (sessions[i].Duration < session.Duration)
                {
                    break;
                }
                i++;
            }

            sessions.Insert(i, session);
        }