Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="feedSubscription"></param>
        public void ProcessRssSubscription(EventRssSubscription feedSubscription)
        {
            try
            {
                _log.DebugFormat("{0}: Processing feed Id {1} ({2}).", _name, feedSubscription.Id, feedSubscription.RssUrl);
                RssFeeds.ProcessFeed(feedSubscription, _db);
                feedSubscription.ErrorCount = 0;
                _db.ORManager.SaveOrUpdate(feedSubscription);
            }
            catch (Exception ex)
            {
                if (feedSubscription != null)
                {
                    _db.ORManager.Refresh(feedSubscription);

                    feedSubscription.ErrorCount += 1;
                    _db.ORManager.SaveOrUpdate(feedSubscription);

                    _log.Error(string.Format("{0}: Error processing feed {1} ({2})", _name, feedSubscription.Id, feedSubscription.RssUrl), ex);

                    if (feedSubscription.ErrorCount >= ERROR_THRESHOLD)
                    {
                        TextMessagesInterface.SendMessage(_db, feedSubscription.Url.UserId, string.Format("RankTrend has tried unsuccessfully {1} or more times to read the RSS feed that you specified in your RSS Subscription \"{0}\".  This could be for a number of reasons such as the URL you specified does not point to an RSS feed or the RSS feed is not available.  Please verify the URL that you specified for this feed.  If you feel this is in error, please let us know.", feedSubscription.Name, ERROR_THRESHOLD));
                    }
                }
                else
                {
                    _log.Error(ex);
                }
            }
        }
    protected void Acknowledge_Click(object sender, EventArgs e)
    {
        var acknowledgeButton = (LinkButton)sender;

        TextMessagesInterface.AcknowledgeMessage(Global.GetDbConnection(), int.Parse(acknowledgeButton.CommandArgument));
        TextMessagePanel.Style.Add("display", "none");
    }