public static Venue Parse(XmlNode node) { Venue venue = new Venue(); if (node.SelectSingleNode("id") != null) { venue.Id = long.Parse(node.SelectSingleNode("id").InnerText); } if (node.SelectSingleNode("name") != null) { venue.Name = node.SelectSingleNode("name").InnerText; } if (node.SelectSingleNode("primarycategory") != null) { venue.PrimaryCategory = Category.Parse(node.SelectSingleNode("primarycategory")); } if (node.SelectSingleNode("address") != null) { venue.Address = node.SelectSingleNode("address").InnerText; } if (node.SelectSingleNode("crossstreet") != null) { venue.CrossStreet = node.SelectSingleNode("crossstreet").InnerText; } if (node.SelectSingleNode("city") != null) { venue.City = node.SelectSingleNode("city").InnerText; } if (node.SelectSingleNode("state") != null) { venue.State = node.SelectSingleNode("state").InnerText; } if (node.SelectSingleNode("zip") != null) { venue.ZipCode = node.SelectSingleNode("zip").InnerText; } venue.Coordinates = Coordinates.Parse(node); if (node.SelectSingleNode("phone") != null) { venue.Phone = node.SelectSingleNode("phone").InnerText; } if (node.SelectSingleNode("twitter") != null) { venue.Twitter = node.SelectSingleNode("twitter").InnerText; } XmlNode distanceNode = node.SelectSingleNode("distance"); if (distanceNode != null) { try { venue.Distance = Double.Parse(node.SelectSingleNode("distance").InnerText); } catch { } } if (node.SelectSingleNode("tags") != null) { List<string> tagsList = new List<string>(); foreach (XmlNode n in node.SelectNodes("tags/tag")) { tagsList.Add(n.InnerText); } venue.Tags = tagsList.ToArray(); } if (node.SelectSingleNode("stats") != null) { if (node.SelectSingleNode("stats/checkins") != null) { venue.CheckIns = int.Parse(node.SelectSingleNode("stats/checkins").InnerText); } if (node.SelectSingleNode("stats/herenow") != null) { venue.HereNow = int.Parse(node.SelectSingleNode("stats/herenow").InnerText); } if (node.SelectSingleNode("stats/mayor") != null) { venue.Mayor = Mayor.Parse(node.SelectSingleNode("stats/mayor")); } } return venue; }
public void LoadVenue(Venue venue) { venueName.Text = venue.Name; this.venue = venue; }