コード例 #1
0
        public RequestResponse SerializeResponse(string jsonResponse)
        {
            JObject jo = JObject.Parse(jsonResponse);
            RequestResponse response = new RequestResponse();
            response.messageId = (string)jo["messageId"];
            JArray destinationResponses = null;
            try
            {
                destinationResponses = (JArray)jo["destinationResponses"];
            }catch
            {
                destinationResponses = null;
            }
            
            response.statusCode = (string) jo["statusCode"];
            response.statusDetail = (string)jo["statusDescription"];
            response.version = (string)jo["version"];
            if (destinationResponses != null)
            {
                foreach (JObject j in jo["destinationResponses"])
                {
                    DestinationResponse dresponse = new DestinationResponse();
                    dresponse.messageId = (string) j["messageId"];
                    dresponse.address = (string)j["address"];
                    dresponse.statusCode = (string) j["statusCode"];
                    dresponse.statusDetail = (string)j["statusDescription"];
                    dresponse.timeStamp = (string)j["timeStamp"];
                    response.DesinationResponses.Add(dresponse);
                }
            }

            return response;

        }
コード例 #2
0
 DestinationResponse Map(tblRequestResponceDestination dest)
 {
     if (dest == null) return null;
     DestinationResponse desitintion = new DestinationResponse
                                           {
                                               address=dest.Address,
                                               timeStamp=dest.ResponseTimeStamp,
                                               messageId=dest.MessageId,
                                               statusCode=dest.StatusCode,
                                               statusDetail=dest.StatusDetails
                                           };
     return desitintion;
 }