private void LoadEvidenceForHotThought(int id, SQLiteDatabase sqLiteDatabase) { try { EvidenceForHotThought forHot = new EvidenceForHotThought(); string commandText = "SELECT [EvidenceForHotThoughtID], [AutomaticThoughtsID], [Evidence] FROM EvidenceForHotThought WHERE [ThoughtRecordID] = " + id; if (sqLiteDatabase.IsOpen) { var data = sqLiteDatabase.RawQuery(commandText, null); if (data != null) { if (data.MoveToNext()) { do { forHot = new EvidenceForHotThought(); forHot.EvidenceForHotThoughtId = data.GetInt(0); forHot.ThoughtRecordId = id; forHot.AutomaticThoughtsId = data.GetInt(1); forHot.Evidence = data.GetString(2).Trim(); forHot.IsNew = false; forHot.IsDirty = false; EvidenceForHotThoughtList.Add(forHot); }while (data.MoveToNext()); } } data.Close(); } } catch (Exception e) { throw new Exception("Load of Evidence for Hot Thought failed - " + e.Message); } }
public void RemoveEvidenceForHotThought(EvidenceForHotThought evidenceForHotThought) { try { if (evidenceForHotThought != null) { EvidenceForHotThoughtList.Remove(evidenceForHotThought); } } catch (Exception e) { throw new Exception("Attempt to remove Evidence for Hot Thought failed - " + e.Message); } }
public void AddEvidenceForHotThought(EvidenceForHotThought newEvidenceForHotThought) { try { if (newEvidenceForHotThought != null) { EvidenceForHotThoughtList.Add(newEvidenceForHotThought); IsDirty = true; } } catch (Exception e) { throw new Exception("Attempt to add Evidence for Hot Thought failed - " + e.Message); } }