ActivEarth.DAO.BadgeLevelInfoDAO.GetBadgeRequirement C# (CSharp) Method

GetBadgeRequirement() public static method

Retrieves the statistic requirement for a particular badge.
public static GetBadgeRequirement ( Statistic stat, int badgeLevel ) : float
stat Statistic Statistic for which the badge is awarded.
badgeLevel int Desired level of the badge.
return float
        public static float GetBadgeRequirement(Statistic stat, int badgeLevel)
        {
            using (SqlConnection connection = ConnectionManager.GetConnection())
            {
                var data = new ActivEarthDataProvidersDataContext(connection);
                float foundEntry = (from c in data.BadgeConstantsDataProviders
                                      where c.statistic == (byte)stat && c.level == badgeLevel
                                      select (float)c.requirement).FirstOrDefault();

                return (foundEntry >= 0 ? (float)foundEntry : float.PositiveInfinity);
            }
        }