示例#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.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;
        }
示例#3
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.Category      = doc.GetElementsByTagName("category")[0].InnerText;
            toReturn.Description   = doc.GetElementsByTagName("description")[0].InnerText;
            toReturn.Privacy       = doc.GetElementsByTagName("privacy")[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);

            toReturn.Url            = doc.GetElementsByTagName("url")[1].InnerText;
            toReturn.Status         = doc.GetElementsByTagName("status")[0].InnerText;
            toReturn.Repeats        = doc.GetElementsByTagName("repeats")[0].InnerText;
            toReturn.RepeatSchedule = "yes" == toReturn.Repeats ? doc.GetElementsByTagName("repeat_schedule")[0].InnerText : string.Empty;

            var venues       = doc.GetElementsByTagName("venue");
            var venueBuilder = new VenueBuilder(this.Context);

            foreach (XmlNode venueNode in venues)
            {
                var venue = venueBuilder.Build(venueNode.OuterXml);
                toReturn.Venues.Add(venue.Id, venue);
            }


            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);
            }

            var organizer        = doc.GetElementsByTagName("organizer");
            var organizerBuilder = new EventOrganizerBuilder(this.Context);

            toReturn.Organizer = organizerBuilder.Build(organizer[0].OuterXml);

            return(toReturn);
        }
示例#4
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;
        }