Documentation of the CarRentalAgentService

Region Class

This class represents a specific geographic region where Sunny Cars has car rental Locations.

For a list of all members of this type, see Region Members.

System.Object
   Data
      Region

public class Region : Data

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

A Region is defined as a geographic area of a specific country like a state, a city or an airport. Any Region might have car rental Locations or subregions as child objects. Thereby a Region should never have both, subregions and Locations. Once a Region has no more subregions, it typically has Locations assigned for car rental.

In terms of object relation, a Region is a tree-node like, composite object typically having a parent region and one or more child regions. Thus, a n-leveled regional categorization of car rental locations is achieved.

Regions having assigned car rental locations can be utilized to request car rental offers by a call of GetRates - Method or GetWeekendSpecials - Method. In contrast, regions which have one ore more subregions (childs) cannot be used to create a car rental offer.

A Region is a localizable object, meaning that a Region supports multi-language localization for its language-dependent properties (i.e. Name).

Available Regions can be requested using multiple methods of the CarRentalAgentService.

But in general there are three different ways:

1.)
You need all available information about a single Region, you only know the Id or the Code of. In this case the different variants of GetRegion - Method may be the first choice. According to the given example, GetRegion - Method may be used as translator between Codes retrieved by GetAirports - Method and the corresponding Region-objects.

2.)
You are searching for all Regions available as subregions of an already known parent-region, all Regions matching a search-string or even the Regions available as return-Regions for a specific known region. In this case the different variants of GetRegions - Method may be of interest.

3.)
You are looking for both Regions and the Locations located within these Regions, which may be helpful to fill a tree-view within your web-frontend. Then the different variants of GetRegionsWithLocations - Method or GetRegionsTree - Method meet your demands.

Example

This example shows how to retrieve a localized Region.

[C#]
RegionRequest rq = new RegionRequest();
rq.Ticket = this.serviceTicket;
rq.Operation.Target = OperationTarget.Test;
rq.Id = 21;
rq.LanguageCode = "EN";
rq.WithChilds = false;

RegionResponse rs = this.service.GetRegion(rq);

Region myRegion = rs.Region;

Console.WriteLine("Loaded Region: {0} (Language: {1})", myRegion.Name, myRegion.LanguageCode);

if (myRegion.HasChilds) 
{
    Console.WriteLine("...Region has subregions");
}
else
{
    Console.WriteLine("...Region has no subregions");
}

if (myRegion.HasLocations)
{
    Console.WriteLine("...Region has locations and can be used to create a car rental offer");
}
else
{
    Console.WriteLine("...Region has no locations, but any subregions may have locations assigned");
}

Requirements

Namespace: SunnyCars.Schema.Osi.WsReservation.V4

Assembly: Sunnycars.Schema.Osi.WsReservation.V4 (in Sunnycars.Schema.Osi.WsReservation.V4.dll)

See Also

Region Members | SunnyCars.Schema.Osi.WsReservation.V4 Namespace | RegionRequest | RegionResponse | RegionsRequest | RegionsResponse | RegionsTreeRequest | RegionsTreeResponse | RegionsWithLocationsRequest | RegionsWithLocationsResponse