/// <summary> /// Carrega o artigo pelo id /// </summary> /// <param name="id"></param> /// <returns></returns> public static List <ProfilePoints> LoadAllFrom(Profile pr) { List <ProfilePoints> lst = new List <ProfilePoints>(); SqlCommand sel = new SqlCommand(); sel.CommandText = "SELECT dimension, points FROM " + Base.conf.prefix + "[newsprofilepoints] WHERE userid=@id"; sel.Parameters.Add(new SqlParameter("@id", pr.user.id)); sel.Connection = Base.conf.Open(); SqlDataReader rdr = sel.ExecuteReader(); while (rdr.Read()) { // Pega as informações ProfilePoints pp = new ProfilePoints(pr); pp.dimensionInt = rdr.GetInt32(0); pp.pointsInt = rdr.GetDecimal(1); lst.Add(pp); } rdr.Close(); sel.Connection.Close(); return(lst); }
/// <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); } }
/// <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(); } }