private void LoadConferenceDayData(IXmlNode nodeDay) { Day day = new Day(); day.Index = int.Parse(nodeDay.Attributes.GetNamedItem("index").InnerText); day.Date = DateTime.Parse(nodeDay.Attributes.GetNamedItem("date").InnerText); Conference.Days.Add(day); XmlNodeList nodesRooms = nodeDay.SelectNodes("room"); foreach (IXmlNode item in nodesRooms) { LoadConferenceRoomData(item, day); } }
private void LoadConferenceEventData(IXmlNode nodeEvent, Day day, Room room) { Event conferenceEvent = new Event(); conferenceEvent.Id = nodeEvent.Attributes.GetNamedItem("id").InnerText; conferenceEvent.Start = day.Date.Add(DateTime.Parse(nodeEvent.SelectSingleNode("start").InnerText).TimeOfDay); conferenceEvent.Duration = TimeSpan.Parse(nodeEvent.SelectSingleNode("duration").InnerText); conferenceEvent.Room = room; conferenceEvent.Day = day; conferenceEvent.Slug = nodeEvent.SelectSingleNode("slug").InnerText; conferenceEvent.Title = nodeEvent.SelectSingleNode("title").InnerText; conferenceEvent.Subtitle = nodeEvent.SelectSingleNode("subtitle").InnerText; string trackName = nodeEvent.SelectSingleNode("track").InnerText; conferenceEvent.Track = Conference.Tracks.FirstOrDefault(item => item.Name == trackName); if (conferenceEvent.Track == null) { conferenceEvent.Track = new Track() { Name = trackName }; Conference.Tracks.Add(conferenceEvent.Track); } string typeName = nodeEvent.SelectSingleNode("type").InnerText; conferenceEvent.Type = Conference.EventTypes.FirstOrDefault(item => item.Name == typeName); if (conferenceEvent.Type == null) { conferenceEvent.Type = new EventType() { Name = typeName }; Conference.EventTypes.Add(conferenceEvent.Type); } conferenceEvent.Language = nodeEvent.SelectSingleNode("language").InnerText; conferenceEvent.Abstract = nodeEvent.SelectSingleNode("abstract").InnerText; conferenceEvent.Description = nodeEvent.SelectSingleNode("description").InnerText; conferenceEvent.Persons = new List<Person>(); IXmlNode nodesPersons = nodeEvent.SelectSingleNode("persons"); XmlNodeList nodesPersonList = nodesPersons.SelectNodes("person"); foreach (IXmlNode item in nodesPersonList) { Person person = LoadConferencePersonData(item); conferenceEvent.Persons.Add(person); } conferenceEvent.Links = new List<Link>(); IXmlNode nodesLinks = nodeEvent.SelectSingleNode("links"); XmlNodeList nodesLinkList = nodesLinks.SelectNodes("link"); foreach (IXmlNode item in nodesLinkList) { Link link = new Link(); link.Name = item.InnerText; link.Url = item.Attributes.GetNamedItem("href").InnerText; conferenceEvent.Links.Add(link); } Conference.Events.Add(conferenceEvent); }
private void LoadConferenceRoomData(IXmlNode nodeRoom, Day day) { string roomName = nodeRoom.Attributes.GetNamedItem("name").InnerText; Room room = Conference.Rooms.FirstOrDefault(item => item.Name == roomName); if(room == null) { room = new Room() { Name = roomName }; Conference.Rooms.Add(room); } XmlNodeList nodesEvents = nodeRoom.SelectNodes("event"); foreach (IXmlNode item in nodesEvents) { LoadConferenceEventData(item, day, room); } }