public void TestBalanceAnswer() { BalanceAnswerLineDoc ba = new BalanceAnswerLineDoc(); ba.FreeQuantity = 456; ba.PickLocationQuantity = 100; ba.TopickQuantity = 123; ba.ProductNumber = "1234567890"; int transactionid = new Random().Next(); string transid = Convert.ToString(transactionid); BalanceAnswer("TestChannel", "TestChannelRef", transid, ba); }
private string HandleMessageType(HAPITRANS transfer) { string error = ""; string Url = ""; try { Url = FindUrlToUse(transfer.WEBS_PROFILE_ID, transfer.HAPIOBJECTNAME); Tracing.TraceEvent(TraceEventType.Verbose, 0, String.Format(" use Url = {0}", Url)); if (String.IsNullOrEmpty(Url)) { return("unknown url for " + transfer.WEBS_PROFILE_ID + " - " + transfer.HAPIOBJECTNAME); } sender.Url = Url; switch (transfer.HAPIOBJECTNAME) { case "DR": // -- HAPIOBJECTNAME_Delivery_Receipt { DeliveryReceiptHeadSelect handler = new DeliveryReceiptHeadSelect(this.db); DeliveryReceiptHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.DeliveryReceipt(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "BA": // -- HAPIOBJECTNAME_Balance_Answer { BalanceAnswerLineSelect handler = new BalanceAnswerLineSelect(this.db); BalanceAnswerLineDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.BalanceAnswer(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "PR": // -- HAPIOBJECTNAME_Pick_Receipt { PickReceiptHeadSelect handler = new PickReceiptHeadSelect(this.db); PickReceiptHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.PickReceipt(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "IC": // -- HAPIOBJECTNAME_Item_Change { InventoryChangeLineSelect handler = new InventoryChangeLineSelect(this.db); InventoryChangeLineDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.InventoryChange(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "PM": // -- HAPIOBJECTNAME_Packing_Material { ReturnedPackingMaterialHeadSelect handler = new ReturnedPackingMaterialHeadSelect(this.db); ReturnedPackingMaterialHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.ReturnedPackingMaterial(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "RR": // -- HAPIOBJECTNAME_Return_Receipt { ReturnReceiptHeadSelect handler = new ReturnReceiptHeadSelect(this.db); ReturnReceiptHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.VendorReturnReceipt(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "IR": // -- HAPIOBJECTNAME_Inspection_Receipt { InspectionReceiptHeadSelect handler = new InspectionReceiptHeadSelect(this.db); InspectionReceiptHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.InspectionReceipt(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "SR": // -- HAPIOBJECTNAME_Shipment_Report { ASNHeadSelect handler = new ASNHeadSelect(this.db); ASNHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.ASN(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "COR": // -- HAPIOBJECTNAME_Confirmation_Of_Receipt { ConfirmationOfReceiptHeadSelect handler = new ConfirmationOfReceiptHeadSelect(this.db); ConfirmationOfReceiptHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.ConfirmationOfReceipt(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "IOC": // -- HAPIOBJECTNAME_Inbound_Order_Completed { InboundOrderCompletedSelect handler = new InboundOrderCompletedSelect(this.db); InboundOrderCompletedDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.InboundOrderCompleted(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "TI": // -- HAPIOBJECTNAME_Transport_Instruction { TransportInstructionSelect handler = new TransportInstructionSelect(this.db); TransportInstructionDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.TransportInstruction(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "TP": // -- HAPIOBJECTNAME_Trp_Plan { TransportPlanHeadSelect handler = new TransportPlanHeadSelect(this.db); TransportPlanHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.TransportPlan(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } default: error = string.Format("transfer type {0} not found", transfer.HAPIOBJECTNAME); break; } // switch (transfer.HAPIOBJECTNAME) } catch (UriFormatException e) { error = "The format of the URI is invalid. URL: " + Url + ", HAPITRANS_ID: " + transfer.HAPITRANS_ID + Environment.NewLine + e.Message + Environment.NewLine + e.StackTrace; } catch (InvalidOperationException e) { error = "Failed to reach " + sender.Url + " for " + transfer.HAPIOBJECTNAME + Environment.NewLine + e.Message + Environment.NewLine + e.StackTrace; } catch (System.Web.Services.Protocols.SoapException e) { error = "Interface mismatch. URL: " + sender.Url + ", HAPIOBJECTNAME: " + transfer.HAPIOBJECTNAME + ", HAPITRANS_ID: " + transfer.HAPITRANS_ID + Environment.NewLine + e.Message + Environment.NewLine + e.StackTrace; } catch (Exception e) { error = "Unexpected error. URL: " + sender.Url + ", HAPIOBJECTNAME: " + transfer.HAPIOBJECTNAME + ", HAPITRANS_ID: " + transfer.HAPITRANS_ID + Environment.NewLine + e.Message + Environment.NewLine + e.StackTrace; } return(error); }
public void BalanceAnswer(string ChannelId, string ChannelRef, string TransactionId, BalanceAnswerLineDoc aBalanceAnswerLineDoc) { EnterProc(); BalanceAnswerLineInsert aBalanceAnswerLineHandler; try { MessageTransaction mt = BeginWebmethod(ChannelId, ChannelRef, TransactionId, "BA"); try { aBalanceAnswerLineHandler = new BalanceAnswerLineInsert(this); } catch (Exception e) { Exception InternalError = new Exception("InternalError: Building insert handler", e); throw (InternalError); } try { if (aBalanceAnswerLineDoc == null) { Exception InternalError = new Exception("DataError: Root object cannot be null"); throw (InternalError); } aBalanceAnswerLineHandler.Process(ref mt, null, aBalanceAnswerLineDoc); GetDataBase().Commit(); } catch (Exception e) { try { GetDataBase().Rollback(); } catch (Exception) {} Exception InternalError = new Exception("DataError: Error processing data", e); throw (InternalError); } } finally { EndWebmethod(); } ExitProc(); return; }
public void BalanceAnswer(string ChannelId, string ChannelRef, string TransactionId, BalanceAnswerLineDoc aBalanceAnswerLineDoc) { // transform external object to packaged object understandable by BizTalk BalanceAnswer part = new BalanceAnswer(); part.ChannelId = ChannelId; part.ChannelRef = ChannelRef; part.TransactionId = TransactionId; part.aBalanceAnswerLineDoc = aBalanceAnswerLineDoc; ArrayList inHeaders = null; ArrayList inoutHeaders = null; ArrayList inoutHeaderResponses = null; ArrayList outHeaderResponses = null; SoapUnknownHeader[] unknownHeaderResponses = null; // Parameter information object[] invokeParams = new object[] { part }; ParamInfo[] inParamInfos = new ParamInfo[] { new ParamInfo(typeof(BalanceAnswer), "part") }; ParamInfo[] outParamInfos = null; // Define the assembly (port) // NOTE! This line is only a sample, it needs to be modified to match your orchestration // at least regarding your project name and the public access token string bodyTypeAssemblyQualifiedName = "YOUR_ORCHESTRATION_PROJECT.FromWMSschema+BalanceAnswer, YOUR_ORCHESTRATION_PROJECT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" + "92267163d02e63da"; // BizTalk invocation // NOTE! This line is only a sample, it needs to be modified to match your orchestration // regarding the operation to call this.Invoke("Operation_1", invokeParams, inParamInfos, outParamInfos, 0, bodyTypeAssemblyQualifiedName, inHeaders, inoutHeaders, out inoutHeaderResponses, out outHeaderResponses, null, null, null, out unknownHeaderResponses, true, false); }
public System.IAsyncResult BeginBalanceAnswer(string ChannelId, string ChannelRef, string TransactionId, BalanceAnswerLineDoc aBalanceAnswerLineDoc, System.AsyncCallback callback, object asyncState) { return(this.BeginInvoke("BalanceAnswer", new object[] { ChannelId, ChannelRef, TransactionId, aBalanceAnswerLineDoc }, callback, asyncState)); }
public void BalanceAnswer(string ChannelId, string ChannelRef, string TransactionId, BalanceAnswerLineDoc aBalanceAnswerLineDoc) { this.Invoke("BalanceAnswer", new object[] { ChannelId, ChannelRef, TransactionId, aBalanceAnswerLineDoc }); return; }
public void BalanceAnswer(string ChannelId, string ChannelRef, string TransactionId, BalanceAnswerLineDoc aBalanceAnswerLineDoc) { BalanceAnswer balanceAnswer = new BalanceAnswer(); balanceAnswer.aBalanceAnswerLineDoc = aBalanceAnswerLineDoc; ForwardHelper forwardHelper = new ForwardHelper(); try { forwardHelper.CreateContext(ChannelId, ChannelRef, TransactionId, "BA"); forwardHelper.Forward(balanceAnswer); } catch (Exception e) { try { forwardHelper.Abort(); } catch { // ignore exceptions in exception handler } Exception InternalError = new Exception("DataError: Error processing data", e); throw (InternalError); } finally { forwardHelper.ReleaseContext(); } return; }