ActivEarth.DAO.ChallengeDAO.GetInitializationValue C# (CSharp) Метод

GetInitializationValue() публичный статический Метод

Returns the stored initial value for a user in a particular challenge.
public static GetInitializationValue ( int challengeId, int userId ) : float
challengeId int ID of the challenge to look up.
userId int ID of the user whose value shall be returned.
Результат float
        public static float GetInitializationValue(int challengeId, int userId)
        {
            try
            {
                using (SqlConnection connection = ConnectionManager.GetConnection())
                {
                    var data = new ActivEarthDataProvidersDataContext(connection);
                    var initval = (from c in data.ChallengeInitializationDataProviders
                                    where (c.challenge_id == challengeId) && (c.user_id == userId)
                                    select c).FirstOrDefault();

                    return (initval != null ? (float)initval.value : -1);
                }
            }
            catch (Exception)
            {
                return -1;
            }
        }