private void LoadEvidenceAgainstHotThought(int id, SQLiteDatabase sqLiteDatabase) { try { EvidenceAgainstHotThought againstHot = new EvidenceAgainstHotThought(); string commandText = "SELECT [EvidenceAgainstHotThoughtID], [AutomaticThoughtsID], [Evidence] FROM EvidenceAgainstHotThought WHERE [ThoughtRecordID] = " + id; if (sqLiteDatabase.IsOpen) { var data = sqLiteDatabase.RawQuery(commandText, null); if (data != null) { if (data.MoveToNext()) { do { againstHot = new EvidenceAgainstHotThought(); againstHot.EvidenceAgainstHotThoughtId = data.GetInt(0); againstHot.ThoughtRecordId = id; againstHot.AutomaticThoughtsId = data.GetInt(1); againstHot.Evidence = data.GetString(2).Trim(); againstHot.IsNew = false; againstHot.IsDirty = false; EvidenceAgainstHotThoughtList.Add(againstHot); }while (data.MoveToNext()); } } data.Close(); } } catch (Exception e) { throw new Exception("Load of Evidence against Hot Thought failed - " + e.Message); } }
public void RemoveEvidenceAgainstHotThought(EvidenceAgainstHotThought evidenceAgainstHotThought) { try { if (evidenceAgainstHotThought != null) { EvidenceAgainstHotThoughtList.Remove(evidenceAgainstHotThought); } } catch (Exception e) { throw new Exception("Attempt to remove Evidence against Hot Thought failed - " + e.Message); } }
public void AddEvidenceAgainstHotThought(EvidenceAgainstHotThought newEvidenceAgainstHotThought) { try { if (newEvidenceAgainstHotThought != null) { EvidenceAgainstHotThoughtList.Add(newEvidenceAgainstHotThought); IsDirty = true; } } catch (Exception e) { throw new Exception("Attempt to add Evidence Against Hot Thought failed - " + e.Message); } }