Exemplo n.º 1
0
 private void SetInfo()
 {
     if (ResponseJSON.ContainsKey(APIConstants.INFO))
     {
         Info = new ResponseInfo((JObject)ResponseJSON[APIConstants.INFO]);
     }
 }
Exemplo n.º 2
0
        protected override void HandleFaultyResponse()
        {
            string code = null, message = null;

            if ((HttpStatusCode == APIConstants.ResponseCode.NO_CONTENT) || (HttpStatusCode == APIConstants.ResponseCode.NOT_MODIFIED))
            {
                throw new ZCRMException(true, (int)HttpStatusCode.Value, HttpStatusCode.Value.ToString());
            }
            code    = ResponseJSON.ContainsKey(APIConstants.CODE) ? ResponseJSON[APIConstants.CODE].ToString() : "ERROR";
            message = ResponseJSON.ContainsKey(APIConstants.MESSAGE) ? ResponseJSON[APIConstants.MESSAGE].ToString() : "Empty response";
            ZCRMLogger.LogError(code + " " + message);
            throw new ZCRMException(true, (int)HttpStatusCode.Value, code, message, ResponseJSON);
        }
Exemplo n.º 3
0
        protected override void ProcessDataResponse()
        {
            BulkEntitiesResponse = new List <EntityResponse>();
            JArray recordsArray = new JArray();

            if (ResponseJSON.ContainsKey(APIConstants.DATA))
            {
                recordsArray = (JArray)ResponseJSON[APIConstants.DATA];
                foreach (JObject recordJSON in recordsArray)
                {
                    if (recordJSON.ContainsKey(APIConstants.STATUS))
                    {
                        EntityResponse individualResponse = new EntityResponse(recordJSON);
                        BulkEntitiesResponse.Add(individualResponse);
                    }
                }
            }
            else if (ResponseJSON.ContainsKey(APIConstants.TAGS))
            {
                recordsArray = (JArray)ResponseJSON[APIConstants.TAGS];
                foreach (JObject recordJSON in recordsArray)
                {
                    if (recordJSON.ContainsKey(APIConstants.STATUS))
                    {
                        EntityResponse individualResponse = new EntityResponse(recordJSON);
                        BulkEntitiesResponse.Add(individualResponse);
                    }
                }
            }
            else if (ResponseJSON.ContainsKey(APIConstants.TAXES))
            {
                recordsArray = (JArray)ResponseJSON[APIConstants.TAXES];
                foreach (JObject recordJSON in recordsArray)
                {
                    if (recordJSON.ContainsKey(APIConstants.STATUS))
                    {
                        EntityResponse individualResponse = new EntityResponse(recordJSON);
                        BulkEntitiesResponse.Add(individualResponse);
                    }
                }
            }
        }