Esempio n. 1
0
 public void Update(TwitterApp entity)
 {
     using (_connection = Utilities.Database.GetProfiledOpenConnection())
     {
         _connection.Update(entity);
     }
 }
Esempio n. 2
0
 public int Insert(TwitterApp entity)
 {
     using (_connection = Utilities.Database.GetProfiledOpenConnection())
     {
         return _connection.Insert(entity).Value;
     }
 }
Esempio n. 3
0
        public SearchResultWithRateLimit Search(string query, long sinceid, TwitterApp keys)
        {
            var service = new TwitterService(keys.ConsumerKey, keys.ConsumerKeySecret);
            service.AuthenticateWith(keys.Token, keys.TokenSecret);
            var options = new SearchOptions
            {
                Q = System.Web.HttpUtility.UrlEncode(query),
                Count = 100,
                Lang = "en",
                Resulttype = TwitterSearchResultType.Mixed,
                SinceId = sinceid
            };

            // Geocode = new TwitterGeoLocationSearch(39.6456, -79.9433, 30, TwitterGeoLocationSearch.RadiusType.Mi),

            var result = new SearchResultWithRateLimit();
            result.SearchResult = service.Search(options);
            result.RateLimitStatus = service.Response.RateLimitStatus;
            if (result.SearchResult.Statuses.Any())
            {
                result.LastId = result.SearchResult.Statuses.OrderByDescending(f => f.Id).FirstOrDefault().Id;
            }
            else
            {
                result.LastId = sinceid;
            }

            return result;
        }
Esempio n. 4
0
        public SearchResultWithRateLimit Search(string queryTerm, int resultType, long sinceId, TwitterApp keys)
        {
            SearchOptions options = new SearchOptions
            {
                Q = System.Web.HttpUtility.UrlEncode(queryTerm),
                Count = 100,
                Lang = "en",
                Resulttype = (TwitterSearchResultType)resultType,
                SinceId = sinceId
            };

            var service = new TwitterService(keys.ConsumerKey, keys.ConsumerKeySecret);
            service.AuthenticateWith(keys.Token, keys.TokenSecret);
            var result = new SearchResultWithRateLimit();
            result.SearchResult = service.Search(options);
            result.RateLimitStatus = service.Response.RateLimitStatus;
            if (result.SearchResult.Statuses.Any())
            {
                result.LastId = result.SearchResult.Statuses.OrderByDescending(f => f.Id).FirstOrDefault().Id;
            }
            else
            {
                result.LastId = options.SinceId.Value;
            }

            return result;
        }
Esempio n. 5
0
 public TwitterApp SaveOrUpdate(TwitterApp entity)
 {
     if (entity.ApiApplicationId == 0)
     {
         entity.ApiApplicationId = _apiApplicationRepository.Insert(entity);
     }
     else
     {
         _apiApplicationRepository.Update(entity);
     }
     return entity;
 }
Esempio n. 6
0
        public SearchResultWithRateLimit Search(SearchOptions options, TwitterApp keys)
        {
            var service = new TwitterService(keys.ConsumerKey, keys.ConsumerKeySecret);
            service.AuthenticateWith(keys.Token, keys.TokenSecret);
            var result = new SearchResultWithRateLimit();
            result.SearchResult = service.Search(options);
            result.RateLimitStatus = service.Response.RateLimitStatus;
            if (result.SearchResult.Statuses.Any())
            {
                result.LastId = result.SearchResult.Statuses.OrderByDescending(f => f.Id).FirstOrDefault().Id;
            }
            else
            {
                result.LastId = options.SinceId.Value;
            }

            return result;
        }
Esempio n. 7
0
 private SearchResultWithRateLimit GetTweets(string query, TwitterApp app)
 {
     if (HttpContext.Application[query + "Last"] == null)
         HttpContext.Application[query + "Last"] = 10;
     var results = _twitterSearchRepository.Search(query, Convert.ToInt64(HttpContext.Application[query + "Last"]), app);
     HttpContext.Application[query + "Last"] = results.LastId;
     return results;
 }