Beispiel #1
0
        protected override IEnumerable <ResponseError> ResponseContainsErrors(XElement root, XNamespace ns)
        {
            var isSuccess = root.Element(ns + "ack");

            if (isSuccess != null && (isSuccess.Value == "Failure" || isSuccess.Value == "PartialFailure"))
            {
                var    ResponseError = new ResponseError();
                string temp          = null;

                if (!string.IsNullOrWhiteSpace(temp = EbayXmlParser <InventoryStatusResponse> .GetElementValue(root, ns, "errorMessage", "error", "message")))
                {
                    ResponseError.ShortMessage = temp;
                }

                if (!string.IsNullOrWhiteSpace(temp = EbayXmlParser <InventoryStatusResponse> .GetElementValue(root, ns, "errorMessage", "error", "errorId")))
                {
                    ResponseError.ErrorCode = temp;
                }

                return(new List <ResponseError> {
                    ResponseError
                });
            }
            return(null);
        }
Beispiel #2
0
        private static ResponseError ParseError(XElement root, XNamespace ns)
        {
            var    ResponseError = new ResponseError();
            string temp          = null;

            if (!string.IsNullOrWhiteSpace(temp = EbayXmlParser <InventoryStatusResponse> .GetElementValue(root, ns, "ShortMessage")))
            {
                ResponseError.ShortMessage = temp;
            }

            if (!string.IsNullOrWhiteSpace(temp = EbayXmlParser <InventoryStatusResponse> .GetElementValue(root, ns, "LongMessage")))
            {
                ResponseError.LongMessage = temp;
            }

            if (!string.IsNullOrWhiteSpace(temp = EbayXmlParser <InventoryStatusResponse> .GetElementValue(root, ns, "ErrorCode")))
            {
                ResponseError.ErrorCode = temp;
            }

            if (!string.IsNullOrWhiteSpace(temp = EbayXmlParser <InventoryStatusResponse> .GetElementValue(root, ns, "UserDisplayHint")))
            {
                ResponseError.UserDisplayHint = temp;
            }

            if (!string.IsNullOrWhiteSpace(temp = EbayXmlParser <InventoryStatusResponse> .GetElementValue(root, ns, "SeverityCode")))
            {
                ResponseError.SeverityCode = temp;
            }

            if (!string.IsNullOrWhiteSpace(temp = EbayXmlParser <InventoryStatusResponse> .GetElementValue(root, ns, "ErrorClassification")))
            {
                ResponseError.ErrorClassification = temp;
            }

            if (!string.IsNullOrWhiteSpace(temp = EbayXmlParser <InventoryStatusResponse> .GetElementValue(root, ns, "ErrorParameters")))
            {
                ResponseError.ErrorParameters = temp;
            }
            return(ResponseError);
        }
Beispiel #3
0
        protected virtual PaginationResult GetPagination(XElement root, XNamespace ns)
        {
            try
            {
                var isSuccess = root.Element(ns + "PaginationResult");
                if (isSuccess != null)
                {
                    var pagination = new PaginationResult();

                    pagination.TotalNumberOfPages = EbayXmlParser <InventoryStatusResponse> .GetElementValue(isSuccess, ns, "TotalNumberOfPages").ToIntOrDefault();

                    pagination.TotalNumberOfEntries = EbayXmlParser <InventoryStatusResponse> .GetElementValue(isSuccess, ns, "TotalNumberOfEntries").ToIntOrDefault();

                    return(pagination);
                }
                return(null);
            }
            catch
            {
                return(null);
            }
        }