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, DateTime start, DateTime end, int count = 25, TableContinuationToken continuationToken = null) { if (end == null) { end = DateTime.UtcNow; } if (start == null) { start = end.AddDays(0 - 1); } string query = TableQuery.GenerateFilterCondition( "PartitionKey", QueryComparisons.LessThan, groupID + "_" + Utils.NextKeyString(Utils.ToAzureStorageDayBasedString(start))); query = TableQuery.CombineFilters( query, TableOperators.And, TableQuery.GenerateFilterCondition( "PartitionKey", QueryComparisons.GreaterThanOrEqual, groupID + "_" + Utils.ToAzureStorageDayBasedString(end)) ); query = TableQuery.CombineFilters( query, TableOperators.And, TableQuery.GenerateFilterCondition( "RowKey", QueryComparisons.LessThan, Utils.NextKeyString(Utils.ToAzureStorageSecondBasedString(start))) ); query = TableQuery.CombineFilters( query, TableOperators.And, TableQuery.GenerateFilterCondition( "RowKey", QueryComparisons.GreaterThanOrEqual, Utils.ToAzureStorageSecondBasedString(end)) ); TableQuery <BaseMessageEntity> rangeQuery = new TableQuery <BaseMessageEntity>().Where(query).Take(count);; TableQuerySegment <BaseMessageEntity> queryResult = _publicSquareLine.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 MessagePagination AtLine(string userid, int count = 25, TableContinuationToken continuationToken = null) { string query = GenerateStartWithConditionQuery(userid + "_"); TableQuery <BaseMessageEntity> tableQuery = new TableQuery <BaseMessageEntity>().Where(query).Take(count); TableQuerySegment <BaseMessageEntity> queryResult = _atline.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); }
private DisplayMessagePagination CreateDisplayMsgPag(MessagePagination msgPag) { DisplayMessagePagination dmp = new DisplayMessagePagination(); dmp.continuationToken = msgPag.continuationToken; List <DisplayMessage> msgs = new List <DisplayMessage>(); dmp.message = msgs; foreach (Message msg in msgPag.message) { DisplayMessage dmsg = new DisplayMessage(msg, _attManager, null); dmsg.User = AccountController.GetSimpleUserProfile(msg.User); msgs.Add(dmsg); } return(dmp); }
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); }