Пример #1
0
        /// <summary>
        /// Retorna os pontos
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        ProfilePoints GetPoints(Medal.Dimension d)
        {
            for (int i = 0; i < points.Count; i++)
            {
                if (points[i].dimension == d)
                {
                    return(points[i]);
                }
            }

            return(null);
        }
Пример #2
0
        /// <summary>
        /// Pega os pontos
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        decimal GetPointNumberForDimensions(Medal.Dimension d)
        {
            ProfilePoints p = GetPoints(d);

            if (p != null)
            {
                return(p.points);
            }
            else
            {
                return(0);
            }
        }
Пример #3
0
        /// <summary>
        /// Pega os pontos
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        void SetPointNumberForDimensions(Medal.Dimension d, decimal num)
        {
            ProfilePoints p = GetPoints(d);

            if (p != null)
            {
                p.points = num;
                p.Save();
            }
            else
            {
                ProfilePoints pp = new ProfilePoints(this);
                pp.dimension = d;
                pp.points    = num;
                points.Add(pp);
                pp.Save();
            }
        }
Пример #4
0
        /// <summary>
        /// Verifica se as medalhas estão ok
        /// </summary>
        public void CheckMedals(Medal.Dimension d)
        {
            List <Medal> lst = Medal.AllMedalsForPoints(d, GetPointNumberForDimensions(d));

            for (int i = 0; i < lst.Count; i++)
            {
                ProfileMedals pm = GetProfileMedal(lst[i].id);
                if (pm == null)
                {
                    pm          = new ProfileMedals(this);
                    pm.medalsId = lst[i].id;
                    pm.awarded  = DateTime.Now;
                    pm.Save();

                    medals.Add(pm);
                }
            }
        }