Ejemplo n.º 1
0
        private void ParseResponseDto()
        {
            string responseStatus;

            if (!TryGetResponseStatusFromResponseDto(out responseStatus))
            {
                if (!TryGetResponseStatusFromResponseBody(out responseStatus))
                {
                    errorCode = StatusDescription;
                    return;
                }
            }

            var rsMap = JsvServiceClient.FromJsv <Dictionary <string, string> >(responseStatus);

            if (rsMap == null)
            {
                return;
            }

            rsMap = new Dictionary <string, string>(rsMap, PclExport.Instance.InvariantComparerIgnoreCase);
            rsMap.TryGetValue("ErrorCode", out errorCode);
            rsMap.TryGetValue("Message", out errorMessage);
            rsMap.TryGetValue("StackTrace", out serverStackTrace);
        }
Ejemplo n.º 2
0
 private bool TryGetResponseStatusFromResponseBody(out string responseStatus)
 {
     responseStatus = string.Empty;
     try
     {
         if (string.IsNullOrEmpty(ResponseBody))
         {
             return(false);
         }
         var map = JsvServiceClient.FromJsv <Dictionary <string, string> >(ResponseBody);
         map = new Dictionary <string, string>(map, PclExport.Instance.InvariantComparerIgnoreCase);
         return(map.TryGetValue("ResponseStatus", out responseStatus));
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        private bool TryGetResponseStatusFromResponseDto(out string responseStatus)
        {
            responseStatus = string.Empty;
            try
            {
                if (ResponseDto == null)
                {
                    return(false);
                }
                var jsv = JsvServiceClient.ToJsv(ResponseDto);
                var map = JsvServiceClient.FromJsv <Dictionary <string, string> >(jsv);
                map = new Dictionary <string, string>(map, PclExport.Instance.InvariantComparerIgnoreCase);

                return(map.TryGetValue("ResponseStatus", out responseStatus));
            }
            catch
            {
                return(false);
            }
        }