/// <summary> /// Takes an Event object along with an XElement and creates an EventProject /// object. /// </summary> /// <remarks> /// Takes an Event object along with an XElement node which represents /// an eventItem and gets the Project data from the descendent eventProject /// element and creates a new EventProject object with the Event and Project /// objects. /// </remarks> /// <param name="eventItem"></param> /// <param name="node"></param> public Project AddEventProject(Event eventItem, XElement node) { Log.Debug("Started adding event project."); Project projectItem = Project.GetProjectFromNode(node); if (projectItem != null && projectItem.ProjectID != 0) { eventItem.Project = projectItem; } Log.Debug("Finshed adding event project."); return(projectItem); }
/// <summary> /// Updates the existing database Project 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) { Project updateProject = Project.GetProjectFromNode(element); if (updateProject == null) { continue; } System.Xml.Linq.XElement projectNode = element.Element(Constants.Project.projectElement); object newValue = projectNode.GetXElement(tagName); BsoArchiveEntities.UpdateObject(updateProject, newValue, columnName); } }