Commit 1d408d09 authored by Savorboard's avatar Savorboard

processing pages will contains Scheduled and Enqueued messages.

parent 72ab74b6
...@@ -32,7 +32,7 @@ select count(Id) from [{0}].Published with (nolock) where StatusName = N'Succeed ...@@ -32,7 +32,7 @@ select count(Id) from [{0}].Published with (nolock) where StatusName = N'Succeed
select count(Id) from [{0}].Received with (nolock) where StatusName = N'Succeeded'; select count(Id) from [{0}].Received with (nolock) where StatusName = N'Succeeded';
select count(Id) from [{0}].Published with (nolock) where StatusName = N'Failed'; select count(Id) from [{0}].Published with (nolock) where StatusName = N'Failed';
select count(Id) from [{0}].Received with (nolock) where StatusName = N'Failed'; select count(Id) from [{0}].Received with (nolock) where StatusName = N'Failed';
select count(Id) from [{0}].Published with (nolock) where StatusName = N'Processing'; select count(Id) from [{0}].Published with (nolock) where StatusName in (N'Processing',N'Scheduled',N'Enqueued');
select count(Id) from [{0}].Received with (nolock) where StatusName = N'Processing';", select count(Id) from [{0}].Received with (nolock) where StatusName = N'Processing';",
_options.Schema); _options.Schema);
...@@ -74,9 +74,16 @@ _options.Schema); ...@@ -74,9 +74,16 @@ _options.Schema);
var tableName = queryDto.MessageType == MessageType.Publish ? "Published" : "Received"; var tableName = queryDto.MessageType == MessageType.Publish ? "Published" : "Received";
var where = string.Empty; var where = string.Empty;
if (!string.IsNullOrEmpty(queryDto.StatusName)) if (!string.IsNullOrEmpty(queryDto.StatusName))
{
if (string.Equals(queryDto.StatusName, ProcessingState.StateName, StringComparison.CurrentCultureIgnoreCase))
{
where += " and statusname in (N'Processing',N'Scheduled',N'Enqueued')";
}
else
{ {
where += " and statusname=@StatusName"; where += " and statusname=@StatusName";
} }
}
if (!string.IsNullOrEmpty(queryDto.Name)) if (!string.IsNullOrEmpty(queryDto.Name))
{ {
where += " and name=@Name"; where += " and name=@Name";
...@@ -135,7 +142,10 @@ _options.Schema); ...@@ -135,7 +142,10 @@ _options.Schema);
private int GetNumberOfMessage(IDbConnection connection, string tableName, string statusName) private int GetNumberOfMessage(IDbConnection connection, string tableName, string statusName)
{ {
var sqlQuery = $"select count(Id) from [{_options.Schema}].{tableName} with (nolock) where StatusName = @state"; var sqlQuery = statusName == StatusName.Processing
? $"select count(Id) from [{_options.Schema}].{tableName} with (nolock) where StatusName in (N'Processing',N'Scheduled',N'Enqueued')"
: $"select count(Id) from [{_options.Schema}].{tableName} with (nolock) where StatusName = @state";
var count = connection.ExecuteScalar<int>(sqlQuery, new { state = statusName }); var count = connection.ExecuteScalar<int>(sqlQuery, new { state = statusName });
return count; return count;
} }
...@@ -166,6 +176,7 @@ _options.Schema); ...@@ -166,6 +176,7 @@ _options.Schema);
string statusName, string statusName,
IDictionary<string, DateTime> keyMaps) IDictionary<string, DateTime> keyMaps)
{ {
//SQL Server 2012+
string sqlQuery = string sqlQuery =
$@" $@"
with aggr as ( with aggr as (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment