public static List <int> GetUserAvailableCompetitions(string user)
        {
            List <int> avalaibleCompetitions;

            if (!UserCompetitions.TryGetValue(user, out avalaibleCompetitions))
            {
                using (var context = new Entities())
                {
                    var competitions = from u in context.UniverseAvailables.Where(x => x.UserName == user)
                                       from uc in context.UniverseCompetitions.Where(x => x.IdUniverse == u.IdUniverse)
                                       select uc.Id;
                    avalaibleCompetitions = competitions.ToList();
                }
                UserCompetitions[user] = avalaibleCompetitions;
            }
            return(avalaibleCompetitions);
        }
Beispiel #2
0
        public static void ClearCache(Caches cache)
        {
            switch (cache)
            {
            case Caches.All:
                CompetitionTeams.Clear();
                Teams.Clear();
                TeamsValue.Clear();
                UniverseCompetitions.Clear();
                UserCompetitions.Clear();
                UserUniversesRights.Clear();
                CompetitionTeams.Clear();
                Pricer.PricerHelper.Clear();
                UserUniversesRights.Clear();
                return;

            case Caches.TeamsName:
                Teams.Clear();
                return;

            case Caches.TeamsValue:
                TeamsValue.Clear();
                return;

            case Caches.UniverseCompetitions:
                UniverseCompetitions.Clear();
                return;

            case Caches.UserCompetitions:
                UserCompetitions.Clear();
                return;

            case Caches.UserUniversesRights:
                UserUniversesRights.Clear();
                return;

            case Caches.UserDefaultUniverse:
                UserDefaultUniverse.Clear();
                return;
            }
        }