// public EventCollection SearchEvents(String query, int offset, int limit) { EventCollection collection = new EventCollection(); collection.Events = new List<EEvent>(); xsd.search srch = this.ProcessRequest(query, offset, limit); foreach (xsd.searchEvent evnt in srch.events) { collection.Events.Add(new EEvent() { Description = evnt.description, Title = evnt.title, UrlLink = evnt.url, ImageThumb = (evnt.image != null && evnt.image.thumb != null) ? evnt.image.thumb.url : "http://api.eventful.com/images/powered/eventful_88x31.gif", StartTime = evnt.start_time }); } return collection; }
public String GetHtmlContent(string searchText, String data, String sense, Object source, Dictionary<String, String> uniqueLinks) { searchText = HttpUtility.UrlDecode(searchText); if (source == null) source = this.GetSource(searchText, data); if (source == null) throw new ArgumentNullException("Source is NULL"); this.collection = source as EventCollection; if (this.collection == null) throw new InvalidCastException("Source is not of correct type"); bool hasData = false; String html = String.Empty; if (this.collection.Events.Count > 0) { hasData = true; html += "<td id=\"tdEventful\" style=\"width: 100%;vertical-align: top\">"; html += " <table style=\"width: 100%\" cellpadding=\"0\" cellspacing=\"0\">"; html += " <tr>"; html += " <td style=\"border-bottom: dotted 1px Silver; width: 100%; color: Black; font-family: Calibri;font-size: 16px;\">"; html += " <b>E</b>vent(s) <a target=\"_blank\" href=\"http://eventful.com\" style=\"font-size:small;color:green;text-decoration:none;font-family:Calibri\">"; html += " source: eventful"; html += " </a>"; html += " </td>"; html += " </tr>"; html += " <tr>"; html += " <td align=\"left\">"; html += " <table align=\"left\" style=\"width: 100%;height:50px;font-family:Calibri\" cellpadding=\"0\" cellspacing=\"0\">"; foreach (EEvent evnt in this.collection.Events) { DateTime start = DateTime.MaxValue; String title = String.IsNullOrEmpty(evnt.Title) ? evnt.Description : evnt.Title; if (DateTime.TryParse(evnt.StartTime, out start)) title += "<span style=\"font-size:smallest\"><b> (" + start.ToString("d MMM, HH:mm") + ")</b></span>"; html += " <tr>"; html += " <td style=\"width: 41px;height:41px;;vertical-align:top;\" align=\"center\">"; html += " <a href=\"" + evnt.UrlLink + "\" style=\"text-decoration:none\""; html += " <img style=\"border:none;width: 40px;height:40px;\" src=\"" + evnt.ImageThumb + "\" alt=\"event\" />"; html += " </a>"; html += " </td>"; html += " <td style=\"width: 5px;\"> </td>"; html += " <td style=\"vertical-align:top;font-family:Calibri;font-size:14px;\" align=\"left\">"; html += title; html += " </td>"; html += " </tr><tr><td colspan=\"3\" style=\"height:3px;border-top:dotted 1px Silver;\"></td></tr>"; } html += " </table>"; html += " </td>"; html += " </tr>"; html += " <tr><td align=\"right\"><a href=\"http://eventful.com/" + searchText + "\" style=\"font-size:12px;;font-family:Calibri\">more events</a></td></tr>"; html += " <tr><td style=\"height:2px;\"></td></tr>"; html += " </table>"; html += "</td>"; } return hasData ? html : String.Empty; }