Ejemplo n.º 1
0
 public void populateUser(DataRow dataRow, DataTable moods)
 {
     this.id            = Int32.Parse(dataRow["id"].ToString());
     this.username      = dataRow["username"].ToString();
     this.type          = Int32.Parse(dataRow["type"].ToString());
     this.mood          = new Mood().getMoodById(moods, intExtension.ParseInt(dataRow["moodId"].ToString()));
     this.totalScore    = Int32.Parse(dataRow["totalScore"].ToString());
     this.totalStrength = Int32.Parse(dataRow["totalStrength"].ToString());
     this.picture       = dataRow["picture"].ToString();
 }
Ejemplo n.º 2
0
        public Mood getMoodById(DataTable moods, int?moodId)
        {
            Mood mood = new Mood();

            mood.id          = null;
            mood.description = "No Mood";
            if (moodId == null)
            {
                return(mood);
            }

            foreach (DataRow row in moods.Rows)
            {
                if (row["id"].ToString() == moodId.ToString())
                {
                    mood.id          = intExtension.ParseInt(row["id"].ToString());
                    mood.description = row["description"].ToString();
                    return(mood);
                }
            }

            return(mood);
        }