public void Update(TwitterApp entity) { using (_connection = Utilities.Database.GetProfiledOpenConnection()) { _connection.Update(entity); } }
public int Insert(TwitterApp entity) { using (_connection = Utilities.Database.GetProfiledOpenConnection()) { return _connection.Insert(entity).Value; } }
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; }
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; }
public TwitterApp SaveOrUpdate(TwitterApp entity) { if (entity.ApiApplicationId == 0) { entity.ApiApplicationId = _apiApplicationRepository.Insert(entity); } else { _apiApplicationRepository.Update(entity); } return entity; }
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; }
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; }