public MessagePagination GetSearchResults(string resultId, int count = 25, TableContinuationToken continuationToken = null) { var mm = new MessageManager(); string query = TableQuery.GenerateFilterCondition( "PartitionKey", QueryComparisons.Equal, resultId); TableQuery <SearchResultEntity> tableQuery = new TableQuery <SearchResultEntity>().Where(query).Take(count); TableQuerySegment <SearchResultEntity> queryResult = _searchResultsTable.ExecuteQuerySegmented(tableQuery, continuationToken); MessagePagination ret = new MessagePagination(); ret.continuationToken = Utils.Token2String(queryResult.ContinuationToken); ret.message = new List <Message>(); foreach (SearchResultEntity entity in queryResult) { var message = mm.GetMessage(entity.MessageId); if (message != null) { ret.message.Add(message); } } return(ret); }
public MessagePagination PublicSquareLine(string groupID, int count = 25, TableContinuationToken continuationToken = null) { TableQuery <BaseMessageEntity> tableQuery = new TableQuery <BaseMessageEntity>().Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.GreaterThan, groupID + "_")).Take(count); TableQuerySegment <BaseMessageEntity> queryResult = _publicSquareLine.ExecuteQuerySegmented(tableQuery, continuationToken); MessagePagination ret = new MessagePagination(); ret.continuationToken = Utils.Token2String(queryResult.ContinuationToken); ret.message = new List <Message>(); foreach (BaseMessageEntity entity in queryResult) { //var msg = JsonConvert.DeserializeObject<Message>(entity.Content); ret.message.Add(entity.ToMessage()); } return(ret); }
public MessagePagination TopicLine(string topicID, DateTime start, DateTime end, int count = 25, TableContinuationToken continuationToken = null) { TableQuery <BaseMessageEntity> rangeQuery = new TableQuery <BaseMessageEntity>().Where( GenerateTimestampConditionQuery(topicID, start, end) ).Take(count);; TableQuerySegment <BaseMessageEntity> queryResult = _topicline.ExecuteQuerySegmented(rangeQuery, continuationToken); MessagePagination ret = new MessagePagination(); ret.continuationToken = Utils.Token2String(queryResult.ContinuationToken); ret.message = new List <Message>(); foreach (BaseMessageEntity entity in queryResult) { //var msg = JsonConvert.DeserializeObject<Message>(entity.Content); ret.message.Add(entity.ToMessage()); } return(ret); }
public CategoryMessage RetriveCategoryMessage(string notifyTo, Category category) { string query = TableQuery.GenerateFilterCondition ( "PartitionKey", QueryComparisons.Equal, CategoryMessageEntity.ToPartitionKey(notifyTo, category.GroupID, category.Name) ); TableQuery <CategoryMessageEntity> tableQuery = new TableQuery <CategoryMessageEntity>().Where(query).Take(1); TableQuerySegment <CategoryMessageEntity> queryResult = _categoryMsgTable.ExecuteQuerySegmented(tableQuery, null); CategoryMessageEntity entity = queryResult.FirstOrDefault(); return(entity); }
public DisplayReplyPagination GetReply(string userid, int count = 25, TableContinuationToken token = null) { TableQuery <BaseReplyEntity> query = new TableQuery <BaseReplyEntity>() .Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, userid)) .Take(count); TableQuerySegment <BaseReplyEntity> queryResult = _replyNotification.ExecuteQuerySegmented(query, token); ReplyPagination ret = new ReplyPagination(); ret.continuationToken = Utils.Token2String(queryResult.ContinuationToken); ret.message = new List <Reply>(); foreach (BaseReplyEntity entity in queryResult) { ret.message.Add(entity.ToReply()); } return(new DisplayReplyPagination(ret)); }