/// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="result"></param>
        internal static void Read(XmlReader reader, TransactionSearchResult result)
        {
            if (reader.IsEmptyElement)
            {
                XMLParserUtils.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(TransactionSearchResultSerializer.TransactionSearchResult);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (XMLParserUtils.IsEndElement(reader, TransactionSearchResultSerializer.TransactionSearchResult))
                {
                    XMLParserUtils.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case TransactionSearchResultSerializer.Date:
                        result.Date = reader.ReadElementContentAsDateTime();
                        break;

                    case TransactionSearchResultSerializer.CurrentPage:
                        result.CurrentPage = reader.ReadElementContentAsInt();
                        break;

                    case TransactionSearchResultSerializer.TotalPages:
                        result.TotalPages = reader.ReadElementContentAsInt();
                        break;

                    case TransactionSummaryListSerializer.Transactions:
                        TransactionSummaryListSerializer.Read(reader, result.Transactions);
                        break;

                    default:
                        XMLParserUtils.SkipElement(reader);
                        throw new InvalidOperationException("Unexpected value");
                    }
                }
                else
                {
                    XMLParserUtils.SkipNode(reader);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="result"></param>
        internal static void Read(XmlReader reader, TransactionSearchResult result, bool preApproval)
        {
            if (reader.IsEmptyElement)
            {
                XMLParserUtils.SkipNode(reader);
                return;
            }

            if (preApproval == true)
            {
                reader.ReadStartElement(TransactionSearchResultSerializer.PreApprovalSearchResult);
            }
            else
            {
                reader.ReadStartElement(TransactionSearchResultSerializer.TransactionSearchResult);
            }
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (preApproval == true)
                {
                    if (XMLParserUtils.IsEndElement(reader, TransactionSearchResultSerializer.PreApprovalSearchResult))
                    {
                        XMLParserUtils.SkipNode(reader);
                        break;
                    }
                }
                else
                {
                    if (XMLParserUtils.IsEndElement(reader, TransactionSearchResultSerializer.TransactionSearchResult))
                    {
                        XMLParserUtils.SkipNode(reader);
                        break;
                    }
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case TransactionSearchResultSerializer.Date:
                        result.Date = reader.ReadElementContentAsDateTime();
                        break;

                    case TransactionSearchResultSerializer.CurrentPage:
                        result.CurrentPage = reader.ReadElementContentAsInt();
                        break;

                    case TransactionSearchResultSerializer.TotalPages:
                        result.TotalPages = reader.ReadElementContentAsInt();
                        break;

                    case TransactionSummaryListSerializer.Transactions:
                        TransactionSummaryListSerializer.Read(reader, result.Transactions, preApproval);
                        break;

                    case TransactionSummaryListSerializer.PreApprovals:
                        TransactionSummaryListSerializer.Read(reader, result.PreApprovals, preApproval);
                        break;

                    default:
                        XMLParserUtils.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    XMLParserUtils.SkipNode(reader);
                }
            }
        }