예제 #1
0
 /// <summary>
 /// Generates the note XML.
 /// </summary>
 /// <param name="root">The root node.</param>
 public void GenerateNoteXML(XmlNode root)
 {
     foreach (string noteID in Notes)
     {
         GedcomNoteRecord note = Database[noteID] as GedcomNoteRecord;
         if (note != null)
         {
             note.GenerateXML(root);
         }
         else
         {
             System.Diagnostics.Debug.WriteLine("Pointer to non existant note");
         }
     }
 }
예제 #2
0
        /// <summary>
        /// Deletes this instance.
        /// </summary>
        /// <exception cref="Exception">Ref Count already 0</exception>
        public virtual void Delete()
        {
            /* if (RefCount == 0) // This was causing individual deletes not to happen properly.
             * {
             *  // TODO: Not good, need to feed back to user instead of blowing up.
             *  throw new Exception("Ref Count already 0");
             * } */

            RefCount--;
            if (RefCount <= 0)
            {
                if (multimedia != null)
                {
                    foreach (string objeID in multimedia)
                    {
                        GedcomMultimediaRecord obje = (GedcomMultimediaRecord)Database[objeID];
                        obje.Delete();
                    }
                }

                if (sources != null)
                {
                    foreach (GedcomSourceCitation citation in sources)
                    {
                        citation.Delete();
                    }
                }

                if (notes != null)
                {
                    foreach (string noteID in notes)
                    {
                        GedcomNoteRecord note = (GedcomNoteRecord)Database[noteID];
                        note.Delete();
                    }
                }

                if (!string.IsNullOrEmpty(XrefId))
                {
                    Database.Remove(XrefId, this);
                }
            }
        }