Esempio n. 1
0
        public static IEnumerable <Item> GetItems(GetItemsRequest request)
        {
            // If we don't have what we need to make this call, stop here.
            if (request.Configuration == null)
            {
                throw new InvalidRequestException("ExigoService.GetItems() requires an OrderConfiguration.");
            }

            if (request.Configuration.CategoryID == 0 && request.CategoryID == null && request.ItemCodes.Length == 0)
            {
                throw new InvalidRequestException("ExigoService.GetItems() requires either a CategoryID or a collection of item codes.");
            }
            ;

            // Build the request.
            var getItemsrequest = new Common.Api.ExigoWebService.GetItemsRequest
            {
                ItemCodes     = request.ItemCodes,
                CurrencyCode  = request.Configuration.CurrencyCode,
                PriceType     = request.Configuration.PriceTypeID,
                LanguageID    = 0,
                WarehouseID   = request.Configuration.WarehouseID,
                WebID         = 1,
                WebCategoryID = (request.ItemCodes.Length == 0 ?
                                 request.Configuration.CategoryID as Nullable <int> :
                                 null)
            };

            var api = Exigo.WebService();

            // Execute request and get the response.
            var response = api.GetItems(getItemsrequest);

            foreach (var itemResponse in response.Items)
            {
                yield return((Item)itemResponse);
            }
        }
Esempio n. 2
0
        public static IEnumerable <string> GetEligibleItemCodes(string[] itemCodes, IOrderConfiguration Configuration, int priceTypeiD)
        {
            var getItemsrequest = new Common.Api.ExigoWebService.GetItemsRequest
            {
                ItemCodes     = itemCodes,
                CurrencyCode  = Configuration.CurrencyCode,
                PriceType     = priceTypeiD,
                LanguageID    = Configuration.LanguageID,
                WarehouseID   = Configuration.WarehouseID,
                WebID         = 1,
                WebCategoryID = null
            };

            var api = Exigo.WebService();

            // Execute request and get the response.
            var response = api.GetItems(getItemsrequest);

            foreach (var itemResponse in response.Items)
            {
                yield return(itemResponse.ItemCode);
            }
        }