Execute query.
Description
Excecutes a query to filter out by place of supply or status.
Package Details
Interface
IServiceRequestManager
Syntax
Task<ICollection<ServiceRequest>> ExecuteQuery<T>(ServiceRequestQuery serviceRequestQuery)
Returns
Task<ICollection<ServiceRequest>>
API
[POST] /api/servicerequests/query
[API JSON Structure]
Returns
Collection of service requests
Example - Filtering by place of supply and status
//This is an exemple of a query using filtering for the place of supply and status. //This will filter all service requests for service id 11. const ServiceRequestStatus status = ServiceRequestStatus.InProgress; const string province = "ON"; var query = new ServiceRequestQuery { ServiceId = ServiceId, Page = 1, PageSize = 25, Version = 1.0F, Filter = $"PlaceOfSupply='{province}' AND Status='{status}'" }; // Get all service requests with metadata using the place of supply and status filter. var requestWithMetadata = await serviceRequestManager.ExecuteQuery<ServiceRequestMetadata>(query, false); // Get all service requests without metadata using the place of supply and status filter. var requestsNoMetadata = await serviceRequestManager.ExecuteQuery<NoMetadata>(query, true);
Example - Filtering by place of supply only
//This is an exemple of a query using filtering for the place of supply and status. //This will filter all service requests for service id 11. const string province = "ON"; var query = new ServiceRequestQuery { ServiceId = ServiceId, Page = 1, PageSize = 25, Version = 1.0F, Filter = $"PlaceOfSupply='{province}'" }; // Get all service requests with metadata using the place of supply and status filter. var requestWithMetadata = await serviceRequestManager.ExecuteQuery<ServiceRequestMetadata>(query, false); // Get all service requests without metadata using the place of supply and status filter. var requestsNoMetadata = await serviceRequestManager.ExecuteQuery<NoMetadata>(query, true);
Example - Filtering by service request status
//This is an exemple of a query using filtering for the place of supply and status. //This will filter all service requests for service id 11. const ServiceRequestStatus status = ServiceRequestStatus.InProgress; var query = new ServiceRequestQuery { ServiceId = ServiceId, Page = 1, PageSize = 25, Version = 1.0F, Filter = $"Status='{status}'" }; // Get all service requests with metadata using the place of supply and status filter. var requestWithMetadata = await serviceRequestManager.ExecuteQuery<ServiceRequestMetadata>(query, false); // Get all service requests without metadata using the place of supply and status filter. var requestsNoMetadata = await serviceRequestManager.ExecuteQuery<NoMetadata>(query, true);