/// <summary>
            /// Updates a picking list in Ax.
            /// </summary>
            /// <param name="orderXML">The order as an xml document.</param>
            /// <returns>The saved order as a document.</returns>
            public ReadOnlyCollection <PickReceiveDocument> UpdatePickingList(string orderXML)
            {
                ThrowIf.Null <string>(orderXML, "orderXML");

                var data = this.InvokeMethod(UpdatePickingListMethodName, orderXML);

                // Parse response data
                try
                {
                    List <PickReceiveDocument> results = new List <PickReceiveDocument>();

                    for (int currentStartIndex = 0; currentStartIndex + PickReceiveDocumentLength <= data.Count; currentStartIndex += PickReceiveDocumentLength)
                    {
                        PickReceiveDocument pickReceiveDocument = new PickReceiveDocument();
                        pickReceiveDocument.XMLDocument = (string)data[currentStartIndex];

                        results.Add(pickReceiveDocument);
                    }

                    return(new ReadOnlyCollection <PickReceiveDocument>(results));
                }
                catch (Exception ex)
                {
                    throw new CRT.CommunicationException(
                              CommunicationErrors.Microsoft_Dynamics_Commerce_Runtime_HeadquarterResponseParsingError,
                              ex,
                              string.Format("Unable to parse service response data: {0}", data));
                }
            }
            /// <summary>
            /// Gets a picking list with lines from Ax.
            /// </summary>
            /// <param name="orderId">The order identifier.</param>
            /// <param name="storeNumber">The store number.</param>
            /// <returns>A receiving document.</returns>
            public PickReceiveDocument GetPickingList(string orderId, string storeNumber)
            {
                ThrowIf.Null <string>(storeNumber, "storeNumber");
                ThrowIf.Null <string>(orderId, "orderId");

                var data = this.InvokeMethod(GetPickingListMethodName, orderId, storeNumber);

                // Parse response data
                try
                {
                    PickReceiveDocument pickReceiveDocument = null;

                    for (int currentStartIndex = 0; currentStartIndex + PickReceiveDocumentLength <= data.Count; currentStartIndex += PickReceiveDocumentLength)
                    {
                        pickReceiveDocument             = new PickReceiveDocument();
                        pickReceiveDocument.XMLDocument = (string)data[currentStartIndex];
                    }

                    return(pickReceiveDocument);
                }
                catch (Exception ex)
                {
                    throw new CRT.CommunicationException(
                              CommunicationErrors.Microsoft_Dynamics_Commerce_Runtime_HeadquarterResponseParsingError,
                              ex,
                              string.Format("Unable to parse service response data: {0}", data));
                }
            }
            /// <summary>
            /// Gets a transfer order with lines from Ax.
            /// </summary>
            /// <param name="orderId">The order identifier.</param>
            /// <returns>A picking document.</returns>
            public PickReceiveDocument GetTransferOrder(string orderId)
            {
                ThrowIf.Null <string>(orderId, "orderId");

                var data = this.InvokeMethod(GetTransferOrderMethodName, orderId);

                // Parse response data
                PickReceiveDocument pickReceiveDocument = null;

                for (int currentStartIndex = 0; currentStartIndex + PickReceiveDocumentLength <= data.Count; currentStartIndex += PickReceiveDocumentLength)
                {
                    pickReceiveDocument             = new PickReceiveDocument();
                    pickReceiveDocument.XMLDocument = (string)data[currentStartIndex];
                }

                return(pickReceiveDocument);
            }
            /// <summary>
            /// Get open purchase orders for a store.
            /// </summary>
            /// <param name="storeNumber">The store number.</param>
            /// <returns>A collection of receive documents.</returns>
            public PagedResult <PickReceiveDocument> GetPurchaseOrders(string storeNumber)
            {
                ThrowIf.Null <string>(storeNumber, "storeNumber");

                var data = this.InvokeMethod(GetPurchaseOrdersMethodName, storeNumber);

                // Parse response data
                List <PickReceiveDocument> results = new List <PickReceiveDocument>();

                for (int currentStartIndex = 0; currentStartIndex + PickReceiveDocumentLength <= data.Count; currentStartIndex += PickReceiveDocumentLength)
                {
                    PickReceiveDocument pickReceiveDocument = new PickReceiveDocument();
                    pickReceiveDocument.XMLDocument = (string)data[currentStartIndex];

                    results.Add(pickReceiveDocument);
                }

                return(results.AsPagedResult());
            }
            /// <summary>
            /// Updates a transfer order in Ax.
            /// </summary>
            /// <param name="orderXML">The order as an xml document.</param>
            /// <returns>The saved order as a document.</returns>
            public ReadOnlyCollection <PickReceiveDocument> UpdateTransferOrder(string orderXML)
            {
                ThrowIf.Null <string>(orderXML, "orderXML");

                var data = this.InvokeMethod(UpdateTransferOrderMethodName, orderXML);

                // Parse response data
                List <PickReceiveDocument> results = new List <PickReceiveDocument>();

                for (int currentStartIndex = 0; currentStartIndex + PickReceiveDocumentLength <= data.Count; currentStartIndex += PickReceiveDocumentLength)
                {
                    PickReceiveDocument pickReceiveDocument = new PickReceiveDocument();
                    pickReceiveDocument.XMLDocument = (string)data[currentStartIndex];

                    results.Add(pickReceiveDocument);
                }

                return(new ReadOnlyCollection <PickReceiveDocument>(results));
            }
            /// <summary>
            /// Gets open transfer orders from Ax.
            /// </summary>
            /// <param name="storeNumber">The store number.</param>
            /// <returns>A collection of picking documents.</returns>
            public ReadOnlyCollection <PickReceiveDocument> GetTransferOrders(string storeNumber)
            {
                ThrowIf.Null <string>(storeNumber, "terminalId");

                var data = this.InvokeMethod(GetTransferOrdersMethodName, storeNumber);

                // Parse response data
                List <PickReceiveDocument> results = new List <PickReceiveDocument>();

                for (int currentStartIndex = 0; currentStartIndex + PickReceiveDocumentLength <= data.Count; currentStartIndex += PickReceiveDocumentLength)
                {
                    PickReceiveDocument pickReceiveDocument = new PickReceiveDocument();
                    pickReceiveDocument.XMLDocument = (string)data[currentStartIndex];

                    results.Add(pickReceiveDocument);
                }

                return(new ReadOnlyCollection <PickReceiveDocument>(results));
            }
Esempio n. 7
0
            /// <summary>
            /// Serializes the specified picking receiving document.
            /// </summary>
            /// <param name="pickReceiveDocument">The pick receive document.</param>
            /// <returns>Serialized string for the pick receive document.</returns>
            public static string Serialize(PickReceiveDocument pickReceiveDocument)
            {
                ThrowIf.Null(pickReceiveDocument, "pickReceiveDocument");

                return(SerializationHelper.SerializeObjectToXml <PickReceiveDocument>(pickReceiveDocument));
            }