Using TravelData

TravelData is a library that allows searching for data and creating bookings. Refer to TravelportMapping.xlsx for a mapping between Smartpoint SDK properties and agent and payment information.

To use TravelData,

  1. Add a reference to Travelport.TravelData.dll.

  2. Import the namespaces:

    • Travelport.TravelData

    • Travelport.TravelData.Factory

    • Travelport.TravelData.Search

  3. Get the factory used by the connection that is owned by a given TEControl. For example:

    var te=UIHelper.Instance.CurrentTEControl;

    var factory = te.Connection.CommunicationFactory;

    This code gets the factory that is being used by the current TEControl. You can change the code to use any TEControl in any window. Remember that any given SmartTerminalWindow and its TEControls can be pointing to a particular factory, and other TEControls from another SmartTerminalWindow might be pointing to a different factory (by using a different client ID).

  4. To search for information, instantiate and populate the search criteria in method-specific classes found in the Travelport.TravelData.Search namespace.

  5. Call the method on the factory supplying search criteria as a parameter.

  6. A method-specific response object is returned with data and any relevant error information. The response object contains one or more business objects such as Booking or HotelSegment.

Code sample

This sample contains the functionality for sending a terminal entry and for populating a simple availability.

  • The TerminalViewModel.cs file sends a user entry as a terminal command through Galileo Desktop.

    Modify the TerminalViewModel.cs file

    The TerminalViewModel.cs file was modified to provide the terminal functionality.

    1. A reference to Travelport.TravelData.dll was added. The default location is C:\Program Files (x86)\Travelport\Smartpoint.

    2. Namespaces were imported.
    3. When writing a Smartpoint plug-in, you do not need to create a new factory. Instead, use UIHelper.Instance.CurrentTEControl.Connection.CommunicationFactory to determine the factory you need to use. In the code below, TravelData functionality is being highlighted and a factory was created.
    4. Within the GalileoDesktopFactory, the response is set as the response to the user's entry. SendTerminalCommand is used to send the user's entry.
    5. The response is translated into a text box that can be viewed.

 

  • The AvailabilityViewModel.cs file is modified to use the codes that the user enters to populate a TravelData air availability search.

    Modify the AvailabilityViewModel.cs file

    The AvailabilityViewModel.cs file was modified to provide an origin, a destination, and a date field.

    1. Namespaces were added.
    2. View model properties are bound to origin, destination, and date.
    3. Segments are tied to TravelData type AirSegment.
    4. Send is turned into a TravelData AirAvailabilitySearch. AirAvailabilitySearch has a number of options. Refer to the TravelData documentation for information about each option.
    5. AirAvailabilitySearch origin and destination are of type IataLocation. IataLocation uses cached data to provide information about locations. IataLocation lets you choose how user entries are translated into locations (e.g., airport only or airport or city).
    6. When writing a Smartpoint plug-in, you do not need to create a new factory. Instead, use UIHelper.Instance.CurrentTEControl.Connection.CommunicationFactory to determine the factory you need to use. In the code below, TravelData functionality is being highlighted and a factory was created.

    7. The response is defined as a collection of AirSegment.
    8. Within the GalileoDesktopFactory, the response is set as the response to the user's entry. GetAvailability is used to send the user's entry.
    9. The response is translated into a text box that can be viewed.
    10. Book uses BookAirSegments and requires the segment that the user wants to book, number of seats to book, and booking class. In this basic example, the number of seats and booking class (selectedSegment.BookingClass) is hardcoded.