Exemplo n.º 1
0
        /// <summary>
        /// Sends a FindParts message to a store.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <param name="format">The format of the data (XML or JSON).</param>
        /// <param name="extension">The message header extension.</param>
        /// <returns>The sent message on success; <c>null</c> otherwise.</returns>
        public virtual EtpMessage <FindParts> FindParts(string uri, string format = Formats.Xml, IMessageHeaderExtension extension = null)
        {
            var body = new FindParts
            {
                Uri    = uri ?? string.Empty,
                Format = format ?? Formats.Xml,
            };

            return(SendRequest(body, extension: extension));
        }
        /// <summary>
        /// Handles the FindParts message from a customer.
        /// </summary>
        /// <param name="header">The message header.</param>
        /// <param name="findParts">The FindParts message.</param>
        protected virtual void HandleFindParts(IMessageHeader header, FindParts findParts)
        {
            var args = Notify(OnFindParts, header, findParts, new FindPartsResponse());

            HandleFindParts(args);

            if (!args.Cancel)
            {
                FindPartsResponse(header, args.Context.ObjectParts, args.Context.ServerSortOrder);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Sends a FindParts message to a store.
        /// </summary>
        /// <param name="uri">The URI.</param>
        /// <returns>The message identifier.</returns>
        public virtual long FindParts(string uri)
        {
            var header = CreateMessageHeader(Protocols.GrowingObjectQuery, MessageTypes.GrowingObjectQuery.FindParts);

            var findParts = new FindParts()
            {
                Uri = uri
            };

            return(Session.SendMessage(header, findParts,
                                       h => _requests[h.MessageId] = uri // Cache requested URIs by message ID
                                       ));
        }