List of public methods. Note that along with each call return value there will be a additional info obejct having
- a. AuthenticationValue.ServiceResult int value 0=Failed result | value >0 (1=ok, n=count of returned objects)
- b. AuthenticationValue.ServiceResultDescription blank if all good, else description of the issue
Get a single vehicle
private int GetVehicle(long vehicleId)
{
_service = new ServiceVehicleSelects();
_auth = new Authentication {Ticket = MyPrivateToken};
_service.AuthenticationValue = _auth;
VehicleProxy singleVehicle = _service.GetVehicle(vehicleId);
if (_service.AuthenticationValue.ServiceResult > 0 && singleVehicle.Vehicle != null)
{
Trace.WriteLine(singleVehicle.Vehicle.ManufacturerModel);
}
return _service.AuthenticationValue.ServiceResult;
}
Get a vehicle count
Get a count of vehicles based on the given query, Generally this function is used before calling GetVehicleCollection method,
in order to figure out how many records return for Pagination.
//Get vehicle count with blank query (requesting for all records)
[TestMethod]
public void VehicleCollectionCountAllRecords()
{
var query = new VehicleSearchQueryProxy();
int returnVal = GetVehicleCount(query);
Assert.IsTrue(returnVal >0);
Trace.WriteLine(returnVal + " records found");
}
//Get vehicle count with a valid query
[TestMethod]
public void VehicleCollectionCountQueryTest()
{
var query = new VehicleSearchQueryProxy();
query.ManufacturerNameLike = "Toyota";
query.ModelNameLike = "Allex";
int returnVal = GetVehicleCount(query);
Assert.IsTrue(returnVal > 0);
Trace.WriteLine(returnVal + " records found");
}
private int GetVehicleCount(VehicleSearchQueryProxy query)
{
_service = new ServiceVehicleSelects();
_auth = new Authentication();
_auth.Ticket = MyPrivateToken;
_service.AuthenticationValue = _auth;
return _service.GetVehicleCollectionCount(query);
}
Get a list of vehicles
// Get record collection with a blank query
[TestMethod]
public void VehicleCollectionAllRecords()
{
//blank query
var query = new VehicleSearchQueryProxy();
VehicleProxyCollection returnValue = GetVehicleCollection(query);
Assert.IsTrue(returnValue != null && returnValue.Vehicles.Length > 0 && returnValue.Vehicles[0] != null);
foreach (VehicleProxy vehicle in returnValue.Vehicles)
{
string temp = string.Empty;
temp += "Make: " + vehicle.Vehicle.ManufacturerName;
temp += "| Model: " + vehicle.Vehicle.ModelName;
temp += "| Year: " + vehicle.Vehicle.Year;
temp += "| Images: " + vehicle.Images.Length;
Trace.WriteLine(temp);
}
}
// Get record collection with query
[TestMethod]
public void VehicleCollectionQuery()
{
var query = new VehicleSearchQueryProxy();
query.ManufacturerNameLike = "Toyota";
query.ModelNameLike = "Allex";
VehicleProxyCollection returnValue = GetVehicleCollection(query);
Assert.IsTrue(returnValue != null && returnValue.Vehicles.Length > 0 && returnValue.Vehicles[0] != null);
foreach (VehicleProxy vehicle in returnValue.Vehicles)
{
string temp = string.Empty;
temp += "Make: " + vehicle.Vehicle.ManufacturerName;
temp += "| Model: " + vehicle.Vehicle.ModelName;
temp += "| Year: " + vehicle.Vehicle.Year;
temp += "| Images: " + vehicle.Images.Length;
Trace.WriteLine(temp);
}
}
private VehicleProxyCollection GetVehicleCollection(VehicleSearchQueryProxy query)
{
_service = new ServiceVehicleSelects();
_auth = new Authentication();
_auth.Ticket = MyPrivateToken;
_service.AuthenticationValue = _auth;
VehicleProxyCollection vehicleCollection = _service.GetVehicleCollection(query);
if (_service.AuthenticationValue.ServiceResult > 0 && vehicleCollection.Vehicles != null)
{
Trace.WriteLine("Return count: " + _service.AuthenticationValue.ServiceResult);
}
return vehicleCollection;
}
Search Query Parameters
You may pass parameteres via a ""VehicleProxy" class inorder to filter requested data.
Data Parameters
- ManufacturerNameLike
Example "toyota", "Nissan" not case sensitive.
- ModelNameLike
Example "Allex", "Skyline" not case sensitive.
- PriceFrom
- PriceTo
- TypeNameLike
Allowed types are: Classic, Coach, Competition Car, Convertible, Coupe, Damaged Car, Go Karts, Hatchback,Hot Rod Kart, RV-SUV, Sedan,Station Wagon, Ute and Van.
- YearFrom
- YearTo
Control Parameters
- CompanyId
Only applicable for multi branch dealerships.
- AssociateBranchId
Only applicable for multi branch dealerships. Main branch is requesting another branche's records by passing the branch id.
- AssociateBranchList
Only applicable for multi branch dealerships. Main branch is requesting records of multiple branch's, a list of branch id's seperated by comma.
- MaxRecords
You may restrict number of records recieved my this attaribute.
- PageSize
Used in pagination. How many records to request for one page.
- PageNumber
Used in pagination. Which page number to retrieve.
- OrderByName
Which filed name to sort the result collection. Any field in "VehicleProxy" class can be sorted by.
- SortByName
"asc" or "desc".