示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="eventItem"></param>
        /// <param name="node"></param>
        public void AddEventParticipant(Event eventItem, XElement node)
        {
            Log.Debug("Started adding event participants.");
            IEnumerable <XElement> participantElements = node.Descendants("eventParticipants");

            foreach (XElement participantElement in participantElements)
            {
                Participant participant = Participant.GetParticipantFromNode(participantElement);
                if (participant != null && participant.ParticipantID != 0)
                {
                    eventItem.AddEventParticipant(participant);
                    eventItem.AddEventParticipantType(participant);
                    BsoArchiveEntities.Current.Save();
                }
            }
            Log.Debug("Finished adding event participants.");
        }
示例#2
0
        /// <summary>
        /// Updates the existing database Participant 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)
            {
                System.Xml.Linq.XElement participantElement = element.Element(Constants.Participant.participantElement);
                Participant updateParticipant = Participant.GetParticipantFromNode(participantElement);

                if (updateParticipant == null)
                {
                    continue;
                }

                System.Xml.Linq.XElement participantNode = element.Element(Constants.Participant.participantElement);

                object newValue = participantNode.GetXElement(tagName);

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