20.01.2015 Views

Teach Yourself e.net - Syspro

Teach Yourself e.net - Syspro

Teach Yourself e.net - Syspro

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example 5.24. ASP.NET Visual Basic codebehind of Transaction.Build<br />

' Logon and trap any exceptions<br />

Dim UserId As String<br />

Dim Obj As New Encore.Utilities()<br />

Try<br />

UserId = Obj.Logon("ADMIN", " ", "1", " ", 5, 0, 0, " ")<br />

Catch exc As Exception<br />

Response.Write("Exception - message:" & exc.Message)<br />

Exit Sub<br />

End Try<br />

' Run generic query returning a sales order<br />

Dim Trn As New Encore.Transaction()<br />

Dim XmlOut As String<br />

' Build an XML string for s/o header build<br />

Dim XmlIn As New System.Text.StringBuilder()<br />

XmlIn.Append("")<br />

XmlIn.Append("")<br />

XmlIn.Append("")<br />

XmlIn.Append("0000001")<br />

XmlIn.Append("")<br />

XmlIn.Append("")<br />

Try<br />

XmlOut = Trn.Build(UserId, "SORRSH", XmlIn.ToString())<br />

Catch exc As Exception<br />

Response.Write("Unable to run business object SORRSH - \<br />

Exception:" & exc.Message)<br />

Exit Sub<br />

End Try<br />

Response.ContentType = "text/xml"<br />

Response.Write(XmlOut)<br />

Response.End()<br />

' Logoff and Cancel your current Session<br />

Dim ReturnCode As Long<br />

ReturnCode = Obj.Logoff(UserId)<br />

Obj = Nothing<br />

5–42

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!