/// <summary> /// Gets the poll data specified by the pollID, and returns it in a <see cref="PollDataSet"/>. /// </summary> /// <param name="pollID">The ID of the poll to retrieve.</param> /// <returns>A <see cref="PollDataSet"/> containing the specified poll data.</returns> public static PollDataSet GetPoll(Int32 pollID) { PollDataSet p = null; HttpContext context = HttpContext.Current; if (context == null) { p = Polling.Provider.GetPoll(pollID); } else { lock ( cacheSyncObject ) { String cacheKey = "MetaBuilders Polling Current PollDataSet By ID " + pollID.ToString(System.Globalization.CultureInfo.InvariantCulture); p = Polling.GetPollFromCache(cacheKey); if (p == null) { p = Polling.Provider.GetPoll(pollID); Polling.InsertPollIntoCache(cacheKey, p); } } } return(p ?? new PollDataSet()); }
/// <summary> /// Gets the current poll data and returns it in a <see cref="PollDataSet"/>. /// </summary> /// <remarks> /// <p>Which poll is deemed "current" is up to the provider, but the built in providers use the current date and given category as the determining factor.</p> /// </remarks> /// <returns>A <see cref="PollDataSet"/> containing the current poll.</returns> public static PollDataSet GetCurrentPoll(String pollCategory) { if (pollCategory == null) { pollCategory = ""; } PollDataSet p = null; HttpContext context = HttpContext.Current; if (context == null) { p = Polling.Provider.GetCurrentPoll(pollCategory); } else { lock ( cacheSyncObject ) { String cacheKey = "MetaBuilders Polling Current PollDataSet By Category " + pollCategory; p = Polling.GetPollFromCache(cacheKey); if (p == null) { p = Polling.Provider.GetCurrentPoll(pollCategory); Polling.InsertPollIntoCache(cacheKey, p); } } } return(p ?? new PollDataSet()); }