示例#1
0
 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);
     }
 }
示例#2
0
        public void RemoveAutomaticThought(AutomaticThoughts automaticThought, SQLiteDatabase sqlDatabase)
        {
            try
            {
                //caller will have to warn User that any EvidenceForHotThought and EvidenceAgainstHotThought based on this will also be removed
                if (automaticThought != null)
                {
                    //find and remove any EvidenceForHotThought with this ID
                    foreach (var evidenceForHotThought in EvidenceForHotThoughtList)
                    {
                        if (evidenceForHotThought.AutomaticThoughtsId == automaticThought.AutomaticThoughtsId)
                        {
                            EvidenceForHotThoughtList.Remove(evidenceForHotThought);
                            evidenceForHotThought.Remove(sqlDatabase);
                            break;
                        }
                    }
                    //find and remove any EvidenceAgainstHotThought with this ID
                    foreach (var evidenceAgainstHotThought in EvidenceAgainstHotThoughtList)
                    {
                        if (evidenceAgainstHotThought.AutomaticThoughtsId == automaticThought.AutomaticThoughtsId)
                        {
                            EvidenceAgainstHotThoughtList.Remove(evidenceAgainstHotThought);
                            evidenceAgainstHotThought.Remove(sqlDatabase);
                            break;
                        }
                    }

                    automaticThought.Remove(sqlDatabase);
                    AutomaticThoughtsList.Remove(automaticThought);
                }
            }
            catch (Exception e)
            {
                throw new Exception("Attempt to remove Automatic Thought failed - " + e.Message);
            }
        }