20.01.2015 Views

Teach Yourself e.net - Syspro

Teach Yourself e.net - Syspro

Teach Yourself e.net - Syspro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

As you can see from the sample code presented above, we have declared Data, Xml, Xsl,<br />

IO, Text, and SYSPRO's Encore for use within this application.<br />

10.4.2. Creating Method Functions<br />

The following code examples demonstrate functions that can be called from the<br />

application to access the various SYSPRO Class Methods. We present an example in<br />

ASP.NET VB codebehind and C# codebehind.<br />

The methods.aspx.vb and methods.aspx.cs contain these code examples as<br />

functions. Save methods.aspx.vb and methods.aspx.cs to your IIS localhost<br />

directory (usually c:\I<strong>net</strong>pub\wwwroot\ or<br />

c:\I<strong>net</strong>pub\wwwroot\<strong>Syspro</strong>web if you are using the SYSPRO web-based<br />

applications). Open both files in your code editor and explore them as you read through<br />

this section.<br />

Lets start with the Query method from the Query class:<br />

Example 10.8. Query.Query Method in ASP.NET VB codebehind<br />

'********************************************************<br />

'-- <strong>Syspro</strong>Query does the actual call to the specified<br />

' Query business object.<br />

'********************************************************<br />

'Parameters:<br />

'Uid:- GUID returned by Logon<br />

'BusObject:- business object used to do query<br />

'XmlIn:- The xml to be used in query<br />

'********************************************************<br />

'Returns:- The XML returned by the business object.<br />

'********************************************************<br />

Function <strong>Syspro</strong>Query(ByVal Uid As String, ByVal BusObject \<br />

As String, ByVal XmlIn As String) As String<br />

Dim xmlOut As String<br />

Dim EncoreQuery As New Encore.Query()<br />

xmlOut = EncoreQuery.Query(Uid, BusObject, XmlIn)<br />

EncoreQuery = Nothing<br />

Return xmlOut<br />

End Function<br />

10–20

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

Saved successfully!

Ooh no, something went wrong!