예제 #1
0
        public Event Build(string xmlString)
        {
            this.Validate(xmlString);

            var toReturn = new Event(this.Context);

            var doc = new XmlDocument();
            doc.LoadXml(xmlString);

            toReturn.Id = long.Parse(doc.GetElementsByTagName("id")[0].InnerText);
            toReturn.Title = doc.GetElementsByTagName("title")[0].InnerText;
            toReturn.Description = doc.GetElementsByTagName("description")[0].InnerText; ;
            toReturn.StartDateTime = DateTime.Parse(doc.GetElementsByTagName("start_date")[0].InnerText);
            toReturn.EndDateTime = DateTime.Parse(doc.GetElementsByTagName("end_date")[0].InnerText);
            toReturn.Created = DateTime.Parse(doc.GetElementsByTagName("created")[0].InnerText);
            toReturn.Modified = DateTime.Parse(doc.GetElementsByTagName("modified")[0].InnerText);

            var tickets = doc.GetElementsByTagName("ticket");
            var builder = new TicketBuilder(this.Context);
            foreach (XmlNode ticketNode in tickets)
            {
                var ticket = builder.Build(ticketNode.OuterXml);
                toReturn.Tickets.Add(ticket.Id, ticket);
            }


            return toReturn;
        }
예제 #2
0
        public Event Build(string xmlString)
        {
            this.Validate(xmlString);

            var toReturn = new Event(this.Context);

            var doc = new XmlDocument();
            doc.LoadXml(xmlString);

            toReturn.Id = long.Parse(doc.GetElementsByTagName("id")[0].InnerText);
            toReturn.Title = doc.GetElementsByTagName("title")[0].InnerText;
            toReturn.Status = doc.GetElementsByTagName("status")[0].InnerText;
            toReturn.Description = FixEntities(CleanWordHtml(doc.GetElementsByTagName("description")[0].InnerText));
            toReturn.Url = doc.GetElementsByTagName("url")[1].InnerText;
            toReturn.StartDateTime = DateTime.Parse(doc.GetElementsByTagName("start_date")[0].InnerText);
            toReturn.EndDateTime = DateTime.Parse(doc.GetElementsByTagName("end_date")[0].InnerText);
            toReturn.Timezone = doc.GetElementsByTagName("timezone")[0].InnerText;
            toReturn.Created = DateTime.Parse(doc.GetElementsByTagName("created")[0].InnerText);
            toReturn.Modified = DateTime.Parse(doc.GetElementsByTagName("modified")[0].InnerText);


            //TICKETS
            var tickets = doc.GetElementsByTagName("ticket");
            var builder = new TicketBuilder(this.Context);
            foreach (XmlNode ticketNode in tickets)
            {
                var ticket = builder.Build(ticketNode.OuterXml);
                toReturn.Tickets.Add(ticket.Id, ticket);
            }
            
            //VENUE
            var venue = doc.GetElementsByTagName("venue")[0];
            var venueBuilder = new VenueBuilder(this.Context);
            toReturn.Venue = venueBuilder.Build(venue.OuterXml);

            return toReturn;
        }