Example #1
0
        public double GetRemainingFantasyTeamCost(int fantasyTeamID)
        {
            List <Player> fantasyTeamPlayerList = new SQLitePlayerRepository().GetAllPlayersOfAFantasyTeam(fantasyTeamID);
            double        fantasyTeamCost       = 0;

            foreach (Player player in fantasyTeamPlayerList)
            {
                fantasyTeamCost += player.Price;
            }

            // Stay at 1 decimal place, following the standard set in the database data
            double fantasyTeamPriceLimit = Math.Round(GetPriceLimitForFantasyTeams(), 1);

            return(Math.Round(fantasyTeamPriceLimit - fantasyTeamCost, 1));
        }
Example #2
0
        public List <int> GetEligiblePremierTeams(int fantasyTeamID)
        {
            List <int> eligiblePremierTeamIDs = new List <int>();

            List <PremierTeam> allPremierTeams = GetAllPremierTeams();

            foreach (PremierTeam premierTeam in allPremierTeams)
            {
                SQLitePlayerRepository playerRepository = new SQLitePlayerRepository();
                int premierTeamPlayerAssignedCount      = playerRepository.GetNumberOfPlayersAssignedToFantasyTeamInPremierTeam(premierTeam.PremierTeamID, fantasyTeamID);

                if (premierTeamPlayerAssignedCount < 2)
                {
                    eligiblePremierTeamIDs.Add(premierTeam.PremierTeamID);
                }
            }

            return(eligiblePremierTeamIDs);
        }
Example #3
0
        public double GetPriceLimitForFantasyTeams()
        {
            double averagePlayerCost = new SQLitePlayerRepository().GetAverageCostOfAllPlayers();

            return((averagePlayerCost * 5) + 1);
        }