Пример #1
0
        /// <summary>
        /// Tkes an Event object along with an XElement and creates an EventType
        /// object.
        /// </summary>
        /// <param name="eventItem"></param>
        /// <remarks>
        /// Tkes an Event object along with an XElement node which represents an
        /// eventItem and gets the Type data from the descendant eventType element
        /// and creates a new EventType with the Event and Type objects.
        /// </remarks>
        /// <param name="node"></param>
        public Season AddEventSeason(Event eventItem, XElement node)
        {
            Log.Debug("Started adding event season.");
            Season seasonItem = Season.GetSeasonFromNode(node);

            if (seasonItem != null && seasonItem.SeasonID != 0)
            {
                eventItem.Season = seasonItem;
            }

            Log.Debug("Finished adding event season.");
            return(seasonItem);
        }
Пример #2
0
        /// <summary>
        /// Updates the existing database Season on the column name using the
        /// XML document parsed using the tagName.
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="columnName"></param>
        /// <param name="tagName"></param>
        public void UpdateData(System.Xml.Linq.XDocument doc, string columnName, string tagName)
        {
            IEnumerable <System.Xml.Linq.XElement> eventElements = doc.Descendants(Constants.Event.eventElement);

            foreach (System.Xml.Linq.XElement element in eventElements)
            {
                Season updateSeason = Season.GetSeasonFromNode(element);

                if (updateSeason == null)
                {
                    continue;
                }

                System.Xml.Linq.XElement seasonNode = element.Element(Constants.Season.seasonElement);

                object newValue = seasonNode.GetXElement(tagName);

                BsoArchiveEntities.UpdateObject(updateSeason, newValue, columnName);
            }
        }