Пример #1
0
        /// <summary>
        /// get the response from the service and format it into a xml response body
        /// </summary>
        /// <param name="RawXml">the xml file sent from the pricing service</param>
        /// <returns>PricingResponseMain data set</returns>
        /// <remarks>
        /// jwames - 7/23/2014 - original code
        /// </remarks>
        private PricingResponseMain GetResponse(string RawXml)
        {
            System.IO.StringReader responseBody = new System.IO.StringReader(RawXml);

            PricingResponseMain response = new PricingResponseMain();

            response.ReadXml(responseBody, System.Data.XmlReadMode.InferSchema);

            return(response);
        }
Пример #2
0
        public List <Price> GetNonBekItemPrices(string branchId, string customerNumber, DateTime shipDate, string source, List <Product> products)
        {
            if (products == null || products.Count == 0)
            {
                return(null);
            }

            List <Price> prices = new List <Price>();

            if (customerNumber == null)
            {
                foreach (Product item in products)
                {
                    prices.Add(new Price()
                    {
                        BranchId       = branchId,
                        CustomerNumber = customerNumber,
                        ItemNumber     = item.ItemNumber,
                        CasePrice      = 0.00,
                        PackagePrice   = 0.00
                    });
                }
            }
            else
            {
                // build the request XML
                System.IO.StringWriter requestBody = new System.IO.StringWriter();
                GetNonBekItemRequestBody(branchId, customerNumber, shipDate, source, products).WriteXml(requestBody);

                // load the pricing service
                com.benekeith.PricingService.PricingSoapClient pricing = new com.benekeith.PricingService.PricingSoapClient();

                // call the pricing service and get the response XML
                PricingResponseMain pricingResponse = GetResponse(pricing.CalculatePricingForNonBekItems(requestBody.ToString()));
                foreach (PricingResponseMain.ItemRow item in pricingResponse.Item)
                {
                    Price itemPrice = new Price();

                    itemPrice.BranchId       = branchId;
                    itemPrice.CustomerNumber = customerNumber;
                    itemPrice.ItemNumber     = item.number;
                    itemPrice.DeviatedCost   = item.DeviatedCost;

                    PricingResponseMain.PricesRow[] priceRows = item.GetPricesRows();

                    itemPrice.CasePrice    = (double)priceRows[0].NetCase;
                    itemPrice.PackagePrice = (double)priceRows[0].NetEach;

                    prices.Add(itemPrice);
                }
            }


            return(prices);
        }