Exemplo n.º 1
0
 private static void GetPayloadOwners(Payload payload, PlayerStatsController playerStatsController, OwnersController ownerController, OwnerTeamsController ownerTeamsController, PlayersController playersController, SeasonWeeks seasonWeek)
 {
     var leaguePoints = ownerTeamsController.GetLeaguePoints(seasonWeek.SeasonWeekId);
     payload.PayloadOwners = new List<PayloadOwner>();
     foreach (var owner in ownerController.GetOwners())
     {
         payload.PayloadOwners.Add(new PayloadOwner
         {
             Owner = owner,
             OwnerPoints = leaguePoints.Where(lp => lp.UniqueId == owner.UniqueId).First(),
             OwnerPlayerStats = playerStatsController.GetPlayerStatsForOwnerWeek(owner.UniqueId, seasonWeek.SeasonWeekId),
             OwnerTeam = playersController.GetOwnersTeamSimulatedWeek(owner.UniqueId, seasonWeek.SeasonWeekId)
         });
     }
 }
Exemplo n.º 2
0
        public string GetUpdatePayload(string uniqueId, int seasonWeekId, string update)
        {
            var payload = new Payload();

            PlayerStatsController playerStatsController = new PlayerStatsController();
            PositionLimitsController positionLimitsController = new PositionLimitsController();
            OwnersController ownerController = new OwnersController();
            OwnerTeamsController ownerTeamsController = new OwnerTeamsController();
            WeeksController weeksController = new WeeksController();
            GamesController gamesController = new GamesController();
            PlayersController playersController = new PlayersController();
            RanksController ranksController = new RanksController();

            var ownerExists = context.Owners.Where(o => o.UniqueId == uniqueId).First();

            var seasonWeek = new SeasonWeeks();
            if (seasonWeekId == -1)
            {
                seasonWeek = weeksController.GetSeasonWeek(DateTime.Now.ToShortDateString());
            }
            else
            {
                seasonWeek = weeksController.GetSeasonWeek(seasonWeekId);
            }

            GetPayloadCurrentOwner(payload, playerStatsController, ownerController, ownerTeamsController, playersController, seasonWeek, uniqueId);

            GetPayloadOwners(payload, playerStatsController, ownerController, ownerTeamsController, playersController, seasonWeek);

            //GetPayloadPositionLimits(payload, positionLimitsController);

            //GetPayloadWeeks(payload, weeksController);

            GetPayloadGames(payload, gamesController, seasonWeek);

            //GetPayloadPlayers(payload, playersController, ownerExists);

            GetPayloadRanks(payload, ranksController, seasonWeek);

            return Compression.Compress(JsonConvert.SerializeObject(payload));
        }
Exemplo n.º 3
0
 private static void GetPayloadCurrentOwner(Payload payload, PlayerStatsController playerStatsController, OwnersController ownerController, OwnerTeamsController ownerTeamsController, PlayersController playersController, SeasonWeeks seasonWeek, string uniqueId)
 {
     payload.CurrentOwner = ownerController.GetOwnerByUniqueId(uniqueId);
     payload.CurrentTeam = playersController.GetOwnersTeamSimulatedWeek(uniqueId, seasonWeek.SeasonWeekId);
     payload.CurrentOwnerPlayerStats = playerStatsController.GetPlayerStatsForOwnerWeek(uniqueId, seasonWeek.SeasonWeekId);
     payload.Owners = ownerController.GetOwners();
 }
Exemplo n.º 4
0
        public string GetOwnerPayload(string uniqueId, int seasonWeekId, string owners)
        {
            var payload = new Payload();

            PlayerStatsController playerStatsController = new PlayerStatsController();
            OwnersController ownerController = new OwnersController();
            OwnerTeamsController ownerTeamsController = new OwnerTeamsController();
            WeeksController weeksController = new WeeksController();
            PlayersController playersController = new PlayersController();

            var ownerExists = context.Owners.Where(o => o.UniqueId == uniqueId).First();

            var seasonWeek = new SeasonWeeks();
            if (seasonWeekId == -1)
            {
                seasonWeek = weeksController.GetSeasonWeek(DateTime.Now.ToShortDateString());
            }
            else
            {
                seasonWeek = weeksController.GetSeasonWeek(seasonWeekId);
            }

            GetPayloadOwners(payload, playerStatsController, ownerController, ownerTeamsController, playersController, seasonWeek);

            return Compression.Compress(JsonConvert.SerializeObject(payload));
        }