private static void PopulateResults(XmlNode _eventNode, Event _event) { // Parse Results XmlNode _resultsNode = _eventNode.SelectSingleNode("results"); if (_resultsNode != null) { foreach (XmlNode _resultNode in _resultsNode) { Result _result = new Result(); _result.Name = _resultNode.Attributes["name"].InnerText; _result.Odds = _resultNode.Attributes["price"].InnerText; _result.Place = _resultNode.Attributes["place"].InnerText; _event.Results.Add(_result); } } }
private static void PopulateSelection(Event _event, XmlNode _selectionNode) { if (_selectionNode.NodeType != XmlNodeType.Comment && _selectionNode.Name != "results") { Selection _selection = new Selection(); _selection.ID = Int32.Parse(_selectionNode.Attributes["id"].InnerText); _selection.Name = _selectionNode.Attributes["name"].InnerText; if (_selectionNode.Attributes["runnercode"].InnerText == "N") _selection.Odds = "NR"; else _selection.Odds = _selectionNode.Attributes["price"].InnerText; _event.Selections.Add(_selection); } }
private static void PopulateEvent(EventGroup eventGroup, XmlNode _eventNode) { if (_eventNode.NodeType != XmlNodeType.Comment) { Event _event = new Event(); _event.Id = Int32.Parse(_eventNode.Attributes["id"].InnerText); _event.Name = _eventNode.Attributes["time"].InnerText + " - " + _eventNode.Attributes["name"].InnerText; _event.Date = _eventNode.Attributes["date"].InnerText; _event.Time = _eventNode.Attributes["time"].InnerText; // Populate Selections foreach (XmlNode _selectionNode in _eventNode) { PopulateSelection(_event, _selectionNode); } PopulateResults(_eventNode, _event); eventGroup.Events.Add(_event); } }