public IntershopWebService.TotalDetails OrderTotalAmountDetails(string customerID, List <IntershopWebService.IshOrderLine> orderLines, string IshBasketID, string company) { MessageLogger.info(string.Format("OrderTotalAmountDetails(company={0}, customerID={1})", (object)company, (object)customerID)); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Axapta ax = this.axLogon(company); ax.Refresh(); try { AxaptaContainer axaptaContainer1 = ax.CreateAxaptaContainer(); foreach (IntershopWebService.IshOrderLine orderLine in orderLines) { IntershopWebService.IshOrderLine productIn = orderLine; string str = 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) { str = productIn.size; } if (itemDims.FindIndex((Predicate <IntershopWebService.SizeStock>)(f => f.color == productIn.color)) >= 0) { str = productIn.color; } } AxaptaContainer axaptaContainer2 = ax.CreateAxaptaContainer(); axaptaContainer2.Add((object)productIn.ItemID); axaptaContainer2.Add((object)productIn.Qty); axaptaContainer2.Add((object)productIn.SalesUnit); axaptaContainer2.Add((object)str); axaptaContainer1.Add((object)axaptaContainer2); } AxaptaContainer totalContainer = (AxaptaContainer)ax.CallStaticClassMethod("BTX_ISHItemDescriptionProxy", "CalcTotalAmountDetails", (object)customerID, (object)axaptaContainer1, (object)IshBasketID); stopwatch.Stop(); MessageLogger.info(string.Format("OrderTotalAmount() -> {0} ms", (object)stopwatch.ElapsedMilliseconds)); return(this.extractTotalDetails(ax, totalContainer)); } catch (Exception ex) { MessageLogger.info(string.Format("OrderTotalAmount() -> error: {0}", (object)ex.Message)); return((IntershopWebService.TotalDetails)null); } finally { ax.Logoff(); } }
/// <summary> /// Login to AX using current User Identity /// </summary> private void AxLogin() { string company = ConfigurationManager.AppSettings["Ax_Company"]; string configuration = ConfigurationManager.AppSettings["Ax_Configuration"]; Ax = new Axapta(); string[] array = userIdentity.Name.Split(new char[] { '\\' }); Ax.LogonAs(array[1], array[0], null, company, "", "", configuration); #if DEBUG Ax.Refresh(); #endif }
/// <summary> /// Login to AX using credentials specified in the web.config /// </summary> private void AxLoginAs() { ConfigurationBase cb = ConfigurationProvider.getConfiguration(); string Ax_UserName = cb.getStringValue("Ax_UserName"); string Ax_UserDomain = cb.getStringValue("Ax_UserDomain"); string company = cb.getStringValue("Ax_Company"); string configuration = cb.getStringValue("Ax_Configuration"); string Ax_ProxyUserName = cb.getStringValue("Ax_ProxyUserName"); string Ax_ProxyUserPwd = cb.getStringValue("Ax_ProxyUserPwd"); string Ax_ProxyUserDomain = cb.getStringValue("Ax_ProxyUserDomain"); NetworkCredential nc = new NetworkCredential(Ax_ProxyUserName, Ax_ProxyUserPwd, Ax_ProxyUserDomain); Ax = new Axapta(); Ax.LogonAs(Ax_UserName, Ax_UserDomain, nc, company, "", "", configuration); #if DEBUG Ax.Refresh(); #endif }