public List <IntershopWebService.ProductPrice> GetItemsPrice(List <IntershopWebService.ProductPriceIn> products, string company, string customerID) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); MessageLogger.info(string.Format("GetItemsPrice(count={0}, custaccount={1}, company={2})", (object)products.Count, (object)customerID, (object)company)); Axapta ax = this.axLogon(company); List <IntershopWebService.ProductPrice> productPriceList = new List <IntershopWebService.ProductPrice>(); try { foreach (IntershopWebService.ProductPriceIn product in products) { object obj = ax.CallStaticClassMethod("BTX_ISHItemDescriptionProxy", "GetSalesPrice", (object)customerID, (object)product.itemId, (object)product.unitId); IntershopWebService.ProductPrice productPrice = new IntershopWebService.ProductPrice() { itemId = product.itemId, price = Math.Round(Convert.ToDouble(obj), 2) }; productPrice.miscCharges = this.ExtractMiscCharges(ax, productPrice.itemId, customerID, productPrice.price, (int)product.quantity, product.unitId); stopwatch.Stop(); MessageLogger.info(string.Format("GetItemsPrice({0}, {1}, {2}) -> {3} , exec time -> {4} ms", (object)productPrice.itemId, (object)customerID, (object)company, (object)productPrice.price, (object)stopwatch.ElapsedMilliseconds)); productPriceList.Add(productPrice); } return(productPriceList); } catch (Exception ex) { return((List <IntershopWebService.ProductPrice>)null); } finally { ax.Logoff(); } }
public IntershopWebService.ProductPrice GetItemPrice(string itemId, string customerID, string Unit, string company) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Axapta ax = this.axLogon(company); IntershopWebService.ProductPrice productPrice = new IntershopWebService.ProductPrice(); try { double num = Convert.ToDouble(ax.CallStaticClassMethod("BTX_ISHItemDescriptionProxy", "GetSalesPrice", new object[4] { (object)customerID, (object)itemId, (object)Unit, (object)"" })); productPrice.itemId = itemId; productPrice.price = num; productPrice.miscCharges = this.ExtractMiscCharges(ax, productPrice.itemId, customerID, productPrice.price, 1, Unit); stopwatch.Stop(); MessageLogger.info(string.Format("GetItemPrice({0}, {1}, {2}, {3}) -> {4} , exec time -> {5} ms", (object)itemId, (object)customerID, (object)Unit, (object)company, (object)productPrice.price, (object)stopwatch.ElapsedMilliseconds)); return(productPrice); } catch (Exception ex) { return((IntershopWebService.ProductPrice)null); } finally { ax.Logoff(); } }
public List <IntershopWebService.ProductPrice> GetItemsPriceSize(List <IntershopWebService.ProductPriceIn> products, string company, string customerID) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Axapta ax = null; if (products.Count == 1) { MessageLogger.info(string.Format("GetItemsPriceSize(itemId={0}, custaccount={1}, company={2})", products[0].itemId, customerID, company)); } else { MessageLogger.info(string.Format("GetItemsPriceSize(count={0}, custaccount={1}, company={2})", (object)products.Count, (object)customerID, (object)company)); } try { ax = this.axLogon(company); List <IntershopWebService.ProductPrice> productPriceList = new List <IntershopWebService.ProductPrice>(); foreach (IntershopWebService.ProductPriceIn product in products) { IntershopWebService.ProductPriceIn productIn = product; IntershopWebService.ProductPrice productPrice = new IntershopWebService.ProductPrice(); productPrice.itemId = productIn.itemId; string inventSizeId = string.Empty; productIn.size = this.normalizeXmlString(productIn.size); productIn.color = this.normalizeXmlString(productIn.color); List <IntershopWebService.SizeStock> itemDims = this.getItemDims(productIn.itemId, company); if (itemDims.Count > 0 && (!string.IsNullOrEmpty(productIn.size) || !string.IsNullOrEmpty(productIn.color))) { if (itemDims.FindIndex((Predicate <IntershopWebService.SizeStock>)(f => f.size == productIn.size)) >= 0) { inventSizeId = productIn.size; } if (itemDims.FindIndex((Predicate <IntershopWebService.SizeStock>)(f => f.color == productIn.color)) >= 0) { inventSizeId = productIn.color; } } double salesPrice; string priceTypeStr; this.ExtractPriceValues((AxaptaContainer)ax.CallStaticClassMethod("BTX_ISHItemDescriptionProxy", "GetPriceType", new object[4] { (object)customerID, (object)productIn.itemId, (object)productIn.unitId, (object)inventSizeId }), out salesPrice, out priceTypeStr); productPrice.price = salesPrice; productPrice.priceType = priceTypeStr; productPrice.miscCharges = this.ExtractMiscCharges(ax, productPrice.itemId, customerID, productPrice.price, 1, inventSizeId, productIn.unitId); stopwatch.Stop(); MessageLogger.info(string.Format("GetItemsPriceSize({0}, {1}, {2}, {3}, {4}) -> {5}, exec time -> {6} ms", (object)productIn.itemId, (object)productIn.size, (object)productIn.color, (object)customerID, (object)company, (object)productPrice.price, (object)stopwatch.ElapsedMilliseconds)); productPriceList.Add(productPrice); } return(productPriceList); } catch (Exception ex) { if (products.Count == 1) { MessageLogger.info(string.Format("GetItemsPriceSize(itemId={0}, custaccount={1}, company={2}) -> error: {3}", products[0].itemId, customerID, company, ex.Message)); } else { MessageLogger.info(string.Format("GetItemsPriceSize(count={0}, custaccount={1}, company={2}) -> error: {3}", products.Count, customerID, company, ex.Message)); } MessageLogger.info(string.Format("Stack trace: {0}", ex.StackTrace.ToString())); return((List <IntershopWebService.ProductPrice>)null); } finally { ax.Logoff(); } }