AddWorkOrderUsingLookups sample - HxGN EAM - 12.1.1 - Customization & Programming - Hexagon

HxGN EAM Web Services Toolkit Programmer

Search by Category
Customization & Programming
HxGN EAM Version

The AddWorkOrderUsingLookups sample application demonstrates how to use components from the Datastream .NET Library to present dialogs with lookup information, such as codes and dates, during data entry. The two primary components that are demonstrated are Datastream.WinForms.Dialogs.LookupDlg and Datastream.WinForms.Dialogs.CalendarDlg. See LookupDlg and CalendarDlg.

Unlike some of the previous sample applications, adding a Web Reference to the appropriate WSDL files is not necessary. The components already include the appropriate references and expose their functionality through .NET components.

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."

The sample's primary form (AddWorkOrderForm) contains input fields to gather information to add a work order.

All the input fields provide lookup capability, except for the work order description. For example, if you click on the lookup icon (), the system will display a dialog that will assist in entering appropriate data for the corresponding field.

The input fields with the associated lookup icon are instances of the Datastream.WinForms.EWSFilterInputBox control from the Datastream .NET Library. This control provides the visual representation we were looking for by simply setting its Style property to EWSFilterInputBoxStyle.TextBoxWithLookup. See Datastream .NET Library.

The lookup dialogs are displayed in response to the LookupButtonClick event for the EWSFilterInputBox controls. This event is triggered when the lookup icon is clicked. The handlers for these events have all been consolidated into one method, LookupButtonClickHandler.

The LookupButtonClickHandler uses the Tag property of the control to determine the type of lookup to provide. The following lookup types are available:

  • A calendar to select a date. This is shown by both the Sched. Start Date and Sched. End Date fields.

  • A control is marked to use this style by placing date in its Tag property.

  • A calendar with hour and minutes fields to select a date and enter a time. This is shown by the Date Reported field. A control is marked to use this style by placing datetime in its Tag property.

  • A list of codes from which to select. This is shown by the WO Organization, Department Code, Equipment, Status Code, Location, Type Code, Cost Code, Class, Reported By and Assigned To fields. A control is marked to use this style by placing a lookup description string in its Tag property.

  • The description string starts with the name of the lookup grid. This is followed by a semi-colon and a comma-separated list of parameter names and values, if any are required by the lookup.

  • The gridtagname= identifies the value of the field that will be returned in the Selection property of the dialog.

  • Below is an example of the string used for the Class field: LVCLAS;parameter.rentity=EVNT,gridtagname=class

  • The following sections will elaborate further on how to call the dialogs that provide each style of lookup functionality as well as what happens when the Submit button is clicked.