private ServiceResponse MapResult(bool isSuccess, ServiceErrorMessage serviceErrorMessage)
        {
            IsSuccess           = isSuccess;
            ServiceErrorMessage = serviceErrorMessage;

            return(this);
        }
Ejemplo n.º 2
0
        protected Task OnServiceErrorAsync(ServiceErrorMessage serviceErrorMessage)
        {
            if (!string.IsNullOrEmpty(serviceErrorMessage.ErrorMessage))
            {
                // When receives service error message, we suppose server -> service connection doesn't work,
                // and set ErrorMessage to prevent sending message from server to service
                // But messages in the pipe from service -> server should be processed as usual. Just log without
                // throw exception here.
                ErrorMessage = serviceErrorMessage.ErrorMessage;
                Log.ReceivedServiceErrorMessage(_logger, ConnectionId, serviceErrorMessage.ErrorMessage);
            }

            return(Task.CompletedTask);
        }
Ejemplo n.º 3
0
        }  // constructor

        internal int GetInstanceSize()
        {
            int retVal = 0;

            int szInt = sizeof(int), szDate = 8, szDecimal = 16;

            // Id, Uid, CreateDate, Name, FilingNumber, Quantity, ParentUid, Comment,
            // EstimatedTime, DelayedStartTime, DishStatusId, DepartmentId,
            // ServiceErrorMessage
            // WaitingTimerString - 14
            retVal = szInt + (Uid.IsNull() ? 0 : Uid.Length) + szDate
                     + (Name.IsNull() ? 0 : Name.Length)
                     + szInt + szDecimal
                     + (ParentUid.IsNull() ? 0 : ParentUid.Length)
                     + (Comment.IsNull() ? 0 : Comment.Length)
                     + szInt + szInt + szInt + szInt
                     + (ServiceErrorMessage.IsNull() ? 0 : ServiceErrorMessage.Length)
                     + (WaitingTimerString.IsNull() ? 0 : WaitingTimerString.Length);

            return(retVal);
        }
 private bool ServiceErrorMessageEqual(ServiceErrorMessage x, ServiceErrorMessage y)
 {
     return(StringEqual(x.ErrorMessage, y.ErrorMessage));
 }
Ejemplo n.º 5
0
 protected IActionResult TransformServiceErrorToHttpStatusCode(ServiceErrorMessage serviceErrorMessage)
 => serviceErrorMessage.Code switch
 {
 public ServiceResponse Fail(ServiceErrorMessage serviceErrorMessage) => MapResult(false, serviceErrorMessage);
 public DeclensionListResultJson(ServiceErrorMessage message)
 {
     ServiceErrorMessage = message;
 }