/// <summary>
        /// Gets the event collection.
        /// </summary>
        /// <param name="xmlData">
        /// The XML data.
        /// </param>
        /// <returns>
        /// </returns>
        private HLinkEventModelCollection GetEventCollection(XElement xmlData)
        {
            HLinkEventModelCollection t = new HLinkEventModelCollection();

            var theERElement =
                from _ORElementEl in xmlData.Elements(ns + "eventref")
                select _ORElementEl;

            if (theERElement.Any())
            {
                // load event object references
                foreach (XElement theLoadORElement in theERElement)
                {
                    HLinkEventModel t2 = new HLinkEventModel
                    {
                        HLinkKey = GetAttribute(theLoadORElement.Attribute("hlink")),
                        GRole    = GetAttribute(theLoadORElement.Attribute("role")),
                        GAttributeRefCollection = GetAttributeCollection(theLoadORElement),
                        GNoteRefCollection      = GetNoteCollection(theLoadORElement),
                    };

                    t2.GAttributeRefCollection.Title = "HLink Attributes";
                    t2.GNoteRefCollection.Title      = "HLink Notes";

                    t.Add(t2);
                }
            }

            // Return sorted by the default text
            t.SortAndSetFirst();

            return(t);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the persons events and those of any families they were in.
        /// </summary>
        /// <returns>
        /// CardGroup
        /// </returns>
        public CardGroup EventsIncFamily()
        {
            // Get the personal events
            HLinkEventModelCollection t = new HLinkEventModelCollection();

            t.AddRange(PersonObject.GEventRefCollection);

            // Get Family events
            foreach (HLinkFamilyModel families in PersonObject.GParentInRefCollection)
            {
                foreach (HLinkEventModel familyEvent in families.DeRef.GEventRefCollection)
                {
                    t.Add(familyEvent);
                }
            }

            t.Sort(x => x.DeRef.GDate);

            return(t.GetCardGroup());
        }