How to develop a Simple Application
None
This document will outline the Business Objects Environment and the development of a simple application.
Requirements
Visual Studio 2022 IDE
.NET Framework (not .NET Core)
Module license for E.Net Business Objects
SDK.dll located within our DATASCOPE WMS SDK
A WMS Test Environment
If you would like more information on Getting Started, you can refer to the Business Objects Overview User Guide.
If you don’t like reading, you can watch the video.
Try it!
How to Develop a Simple Application
Prerequisites
As per the prerequisites, you will have to get our DATASCOPE WMS SDK, specifically the DATASCOPE.SDK.dll file, prior to starting coding.
To do that, you will need the .dll file from the DATASCOPE WMS server.
On the DATASCOPE WMS server, browse to C:/ Program Files (x86) / DATASCOPE / DATASCOPE WMS SDK / DATASCOPE.SDK.dll.
Right-click on the .dll file and select Copy.
Paste it on your local machine (C:/Business Objects should be fine) where you will be developing the new app. Creating a folder specifically for Business Objects might be a good idea.
A second prerequisite is to have the WMS_ENET_OBJECT license. To confirm your licensing is correct:
On the DATASCOPE WMS Server, browse to the Licensing folder in your File Explorer.
It will typically be located under C: / DatascopeLicense / License.xml.
Open the License.xml file and search for WMS_ENET_OBJECTS.
This .xml file can also be copied from the DATASCOPE WMS server to your local machine (C:/Business Objects)
If you do not have WMS_ENET_OBJECTS within your license file, then you are not licensed to use this. Contact your local DSP (Datascope Solution Provider) to obtain the Business Objects License and continue with the development.
Setting up your project within Visual Studio
Create a project
First, you'll create a C# application project. The project type comes with all the template files you'll need before you've even added anything.
Open Visual Studio
On the start window, select Create a new project.
From the Create a new project window, search for WinForms and select the Windows Forms App (.NET Framework) template for C#.
Select Next
In the Configure your new project window, enter a name in the Project name box. Example: BODemo
Select Create
Insert the DATASCOPE.SDK.dll as a Reference
The base Windows Form Application screen will open.
Next, you must include the DATASCOPE.SDK.dll as a Reference under the References
Right-click on References within your project
Select Add Reference
Browse to the C:/Business Objects folder on your local machine and insert the DATASCOPE.SDK.dll file in the Reference list for the project.
Next, you can start coding.
Create the application using the Login Business Objects
Right-click on Form1.cs and select View Code.
The first process, before you can start using Business Objects, is to create a login page.
Add buttons and text fields to the Form
Select Form1.cs [Design] Tab to the top of the screen.
From the Toolbox, on the left-hand side of the screen, you can search for some Labels to add to your form design.
Next, you can add Button controls by dragging them onto the form, and the same goes for the Text controls.
Structure these controls around on your form by dragging them as you would like the form to look like.
In the Properties window, locate the Text field and change the label1 – 4 names to the appropriate names.
Update all labels with the required names.
Continue to update the [Name] in the Properties for the text boxes as well. Use a prefix of txt to indicate it is a textbox. For example, txtOperator.
Lastly, update the button with a [Name] and display Text.
The next step will be to build the login call using the Business Objects provided.
Add code to the form
Select the Form1.cs tab at the top of the screen.
Step 1 – Set the DATASCOPE WMS API End Point
Before we can start calling any Business Objects, we must first indicate the location of the DATASCOPE WMS server by adding the IP address into the code from where the Login must be called.
We provide a method for this purpose within the DATASCOPE WMS SDK.
There’s a static call that can be used to set the API details – SetAPIDetails() – within the SDK. This will be the API details of the DATASCOPE WMS server.
Some parameters must then be added.
If running on a standard port, you can just add the IP Address/name of the server, otherwise, you must add the port number as well. If you do not specify the port number, it will use the standard port number of 8081.
The above step will always be required, otherwise, the system will not know where to direct the calls.
Step 2 – Instantiate the Object
The second step is to create an object for logging in.
Again, it is provided in the DATASCOPE SDK.
Start by entering the DATASCOPE.SDK.BusinessObjects.Utilities. Module.
Enter the oOperatorBO Business Objects and instantiate it. Nothing will go into the constructor; it will just be an empty constructor.
Step 3 – Set the Properties
Next, you must start to define the properties of the Business Objects. All our Objects Properties, are prefixed with the letter ‘p’, so start by entering your Object name, for example, oOperatorBO.p and a list of all Properties applicable to the Business Object will display.
These Properties must then be set to the various text boxes you have created earlier in Form1.cs [Design] Tab.
Step 4 – Call the Object
Lastly, you must call the object. Again, enter the Business Object, oOperatorBO.Logon(). This doesn’t require any parameters, but has a return type of DATASCOPE.SDK.Response
All our Business Objects will respond with this specific Object, which contains information about whether the call was successful, what information it’s returning or any error messages.
Therefore, this Response type must be instantiated.
This concluded the call. We do, however, still need to determine whether the call went through successfully and where the GUID is.
Step 5 – Address Error Management
The response will come back into the oResponse object. This is just a generic object that comes back depending on the business object that will have a set amount of data. In this case, it will just return a string, which we will display in the GUID.
First, we must determine whether it was a successful post or log in.
If it is successful, we will get a GUID back inside our oResponse object. We must indicate that it must return a string inside the GUID.
If it is unsuccessful, we can grab the error from the oResponse object and display a message.
Your app should be ready to build now.
Right-click on the form name under the Solution Explorer.
Select Build
Locate the file, to test it on the server, by opening the File Explorer.
Copy the entire folder (in our example, Debug) and paste it on the DATASCOPE WMS Server.
As we stated earlier the location must be local host, we can just paste it on the server Desktop.
Run the application
Open the BODemo.exe file.
The Form will open, and you can start entering data into each field.
Select the Logon button once done.
Once processed you should get a respond back to the GUID.
This is a SYSPRO and DATASCOPE GUID, so when calling the DATASCOPE Business Objects you must supply a GUID. If the GUID was not obtained through this process it will not work. A validation on the module licensing, etc that checks whether the GUID was obtained at the DATASCOPE Login. For example, you will not be able to log in directly into the E.Net Object in SYSPRO and use the same GUID. It will not process.
To summarize the steps required when creating a Simple Login App using the Operator Business Objects.
Step 1 – Set the DATASCOPE WMS API End Point
Step 2 – Instantiate the Object
Step 3 – Set the Properties (this is based on documentation)
Step 4 – Call the Object (in this example we didn’t have any parameters, but when doing Business Objects, they will always require a GUID to come in here. On the Main Business Objects there are a lot of Properties. The GUID doesn’t go into the properties, but in the parameter of the Call.
Step 5 – Address Error Management.
The next step will be to use the GUID and do a transaction in the system.