Exemplo n.º 1
0
 private void LoadReratedMoods(int id, SQLiteDatabase sqLiteDatabase)
 {
     try
     {
         RerateMood reratedMood = new RerateMood();
         string     commandText = "SELECT [RerateMoodID], [MoodsID], [MoodListID], [MoodRating] FROM RerateMood WHERE [ThoughtRecordID] = " + id;
         if (sqLiteDatabase.IsOpen)
         {
             var data = sqLiteDatabase.RawQuery(commandText, null);
             if (data != null)
             {
                 if (data.MoveToFirst())
                 {
                     do
                     {
                         reratedMood = new RerateMood();
                         reratedMood.RerateMoodId    = data.GetInt(0);
                         reratedMood.ThoughtRecordId = id;
                         reratedMood.MoodsId         = data.GetInt(1);
                         reratedMood.MoodListId      = data.GetInt(2);
                         reratedMood.MoodRating      = data.GetInt(3);
                         reratedMood.IsNew           = false;
                         reratedMood.IsDirty         = false;
                         RerateMoodList.Add(reratedMood);
                     }while (data.MoveToNext());
                 }
             }
             data.Close();
         }
     }
     catch (Exception e)
     {
         throw new Exception("Load of Rerate Moods failed - " + e.Message);
     }
 }
Exemplo n.º 2
0
 public void AddRerateMood(RerateMood newRerateMood)
 {
     try
     {
         if (newRerateMood != null)
         {
             RerateMoodList.Add(newRerateMood);
             IsDirty = true;
         }
     }
     catch (Exception e)
     {
         throw new Exception("Attempt to add Rerate Mood failed - " + e.Message);
     }
 }