AddAndGetWorkOrder sample - HxGN EAM - 12.0 - Customization & Programming - Hexagon

HxGN EAM Web Services Toolkit Programmer Help

Search by Category
Customization & Programming
HxGN EAM Version

The AddAndGetWorkOrder sample demonstrates how to use some of the components provided by the Datastream .NET Library. The demonstrated components include the Datastream.WinForms.ObjectFieldLinkProvider and the Datastream.EWS.Session.

See ObjectFieldLinkProvider and Session.

The sample builds upon the AddWorkOrder sample by replacing how some steps were performed in that sample with how the steps can be accomplished using the library components. The sample also demonstrates how to use another HxGN web service. This is the GetWorkOrder (Function #MP0024) and is described in the MP0024_GetWorkOrder_001.wsdl file.

After creating a project in Visual Studio, add a web reference to the desired WSDL files. See Adding a service reference to a WSDL file.

Once the WSDL files have been added to the project, you will have access to various classes in the WebServices.MP0023 and WebServices.MP0024 namespaces. See the previous sample for information on the WebServices.MP0023 namespace. For the WebServices.MP0024 namespace, the first class of interest is GetWorkOrderService, which contains properties used to construct the SOAP header, as well as the methods needed to call the service. MP0024_GetWorkOrder_001 and MP0024_AddWorkOrder_001_Result are also very important. The former is used to supply the data that the web service will use while the latter is where the web service will return information to the caller.

Since the sample uses components from the Datastream .NET Library, a reference to the library file must be added to the project. This reference will point to the Datastream.EWS.dll file which is the Datastream .NET Library. See the Visual Studio help for "Adding and Removing References."

Some of the components in the library are designed to be used in the Visual Studio Forms Designer. These components should be added to the Visual Studio Toolbox. See the Visual Studio help for "Managing Tabs and Items in the Toolbox" and "Customize Toolbox Dialog Box."

The sample's primary form (AddAndGetWorkOrderForm) has input fields to gather and display information about a work order.

It also has an instance of the Datastream.WinForms.ObjectFieldLinkProvider named ObjFieldLinkProvider. See ObjectField LinkProvider.. This component was dragged from the Toolbox and shows up in the tray area at the bottom of the Form Designer. It allows mapping the value stored in a control with an object property.

The name of the object property to map to is set in the ObjectFieldName property of the control. For example, the WOOrgTextBox has its ObjectFieldName property set to WORKORDERID.ORGANIZATIONID.ORGANIZATIONCODE. The mappings can be used by the CopyValuesFromControls and CopyValuesToControls methods of ObjFieldLinkProvider to move data between an object and the controls.

The form allows two primary actions: adding a work order and retrieving an existing work order. These actions are triggered by the Submit button and the Retrieve button, respectively. The following sections will describe these actions in more detail.