server state cleanup

This commit is contained in:
2020-04-05 21:35:42 +00:00
parent e367b4b132
commit 8443c7c5bf
15 changed files with 116 additions and 101 deletions

View File

@@ -1,6 +1,6 @@
using System;
using Microsoft.Extensions.Logging;
using AyaNova.Biz;
namespace AyaNova.Api.ControllerHelpers
{
@@ -108,6 +108,26 @@ namespace AyaNova.Api.ControllerHelpers
}
}
//get the api error code associated with the server state
public ApiErrorCode ApiErrorCode
{
get
{
switch (_currentState)
{
case ServerState.Open:
throw new System.NotSupportedException("ApiServerState:ApiErrorCode - No error code is associated with server state OPEN");
case ServerState.OpsOnly:
return ApiErrorCode.API_OPS_ONLY;
case ServerState.Closed:
return ApiErrorCode.API_CLOSED;
}
throw new System.NotSupportedException("ApiServerState:ApiErrorCode - No error code is associated with server state UNKNOWN");
}
}
public void SetOpsOnly(string reason)
{
@@ -143,7 +163,7 @@ namespace AyaNova.Api.ControllerHelpers
{
get
{
return _currentState == ServerState.OpsOnly;
return _currentState == ServerState.OpsOnly && !SYSTEM_LOCK;
}
}
@@ -168,7 +188,7 @@ namespace AyaNova.Api.ControllerHelpers
{
get
{
return IsOpen || IsOpsOnly;
return (IsOpen || IsOpsOnly) && !SYSTEM_LOCK;
}
}