Exemple #1
0
        private static ScoringSeason LoadSeason(LogicLong id)
        {
            IOperationResult <string> result = ServerScoring.SeasonDatabase.Get(id).Result;

            if (result.Success)
            {
                ScoringSeason scoringSeason = CouchbaseDocument.Load <ScoringSeason>(result.Value);
                scoringSeason.Init();
                return(scoringSeason);
            }

            return(null);
        }
Exemple #2
0
        private static ScoringSeason LoadOrCreateSeason(LogicLong id)
        {
            ScoringSeason scoringSeason = ScoringManager.LoadSeason(id);

            if (scoringSeason == null)
            {
                IOperationResult <string> result = ServerScoring.SeasonDatabase.Insert(id, CouchbaseDocument.Save(scoringSeason = new ScoringSeason(id))).Result;

                if (!result.Success)
                {
                    throw result.Exception;
                }

                scoringSeason.NextCheckTime = DateTime.UtcNow.Date.AddDays(1);
                scoringSeason.Init();
            }

            return(scoringSeason);
        }