Esempio n. 1
0
        /// <summary>
        /// Retrieves an announcement by unique ID.
        /// </summary>
        /// <param name="id">The ID of the announcement to retrieve.</param>
        /// <returns>The announcement matching the ID specified if found; otherwise, null.</returns>
        public static Announcement GetAnnouncement(string id)
        {
            Settings settings = Properties.Settings.Default;

            foreach (var announcement in ParseAnnouncements(string.Empty, ListsClient.GetListItems(settings.AnnouncementsListName, string.Format(settings.AnnouncementItemQueryFilter, id), ItemViewFields, QueryOptions)))
            {
                return(announcement);
            }
            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Retrieves a filing date announcement by statement number and election cycle.
        /// </summary>
        /// <param name="statementNumber">The filing statement number to search for.</param>
        /// <param name="electionCycle">The election cycle in which to search.</param>
        /// <returns>The announcement matching the filing statement number and election cycle specified if found; otherwise, null.</returns>
        public static Announcement GetFilingDateAnnouncement(byte statementNumber, string electionCycle)
        {
            Settings settings = Properties.Settings.Default;

            foreach (var announcement in ParseAnnouncements(electionCycle, ListsClient.GetListItems(settings.AnnouncementsListName, string.Format(settings.FilingDateAnnouncementListQueryFilter, statementNumber, electionCycle), ItemViewFields, QueryOptions)))
            {
                return(announcement);
            }
            return(null);
        }
Esempio n. 3
0
        /// <summary>
        /// Retrieves a collection of unexpired announcements filtered by election cycle.
        /// </summary>
        /// <param name="electionCycle">The election cycle to filter results by, or an empty string to retrieve announcements across all elections.</param>
        /// <returns>A collection of unexpired announcements filtered by the election cycle specified.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="electionCycle"/> is null.</exception>
        public static IEnumerable <Announcement> GetAnnouncements(string electionCycle)
        {
            if (electionCycle == null)
            {
                throw new ArgumentNullException("electionCycle", "Target election cycle must not be null.");
            }
            Settings settings = Properties.Settings.Default;
            var      xmlData  = ListsClient.GetListItems(settings.AnnouncementsListName, string.Format(settings.AnnouncementListQueryFilter, electionCycle), ListViewFields, QueryOptions);

            return(ParseAnnouncements(electionCycle, xmlData));
        }