Class AssetHandler
Class that contains functions for Asset handling.
Inherited Members
Namespace: Virinco.WATS.Interface.MES.Asset
Assembly: Virinco.WATS.Interface.MES.dll
Syntax
public class AssetHandler : MesBase
Methods
Calibration(String, Nullable<DateTime>)
Register calibration to the specified asset. Client must have admin credentials to register calibration.
Declaration
public AssetResponse Calibration(string serialNumber, DateTime? dateTime = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | serialNumber | Calibration asset's serial number |
System.Nullable<System.DateTime> | dateTime | If specified, sets the LastCalibrationDate to the specified date and time. Default=null (today) |
Returns
Type | Description |
---|---|
AssetResponse | AssetResponse object (with the calibrated asset) |
CreateAsset(String, String, String, String, String)
Creates an Asset of specified type.
Declaration
public AssetResponse CreateAsset(string serialNumber, string assetType, string parentAssetSerialNumber = null, string assetName = null, string assetDescription = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | serialNumber | Asset serial number |
System.String | assetType | Asset type |
System.String | parentAssetSerialNumber | Optional. Serial number of the parent asset. If blank, the new asset will have no parent |
System.String | assetName | Optional. Asset name |
System.String | assetDescription | Optional Asset description |
Returns
Type | Description |
---|---|
AssetResponse | AssetResponse object |
DeleteAsset(String)
Deletes the specified asset. Sub-assets will be updated to no longer contain have a parent. Client must have admin credentials to delete an asset.
Declaration
public AssetResponse DeleteAsset(string serialNumber)
Parameters
Type | Name | Description |
---|---|---|
System.String | serialNumber | Delete asset serial number |
Returns
Type | Description |
---|---|
AssetResponse | AssetResponse object |
GetAsset(String)
Fetches a specific asset.
Declaration
public AssetResponse GetAsset(string serialNumber)
Parameters
Type | Name | Description |
---|---|---|
System.String | serialNumber | Asset serial number |
Returns
Type | Description |
---|---|
AssetResponse | AssetResponse object |
GetAssets(String)
Fetches all assets, filtered by a specified OData (REST) filter.
Declaration
public AssetResponse GetAssets(string filter)
Parameters
Type | Name | Description |
---|---|---|
System.String | filter | OData filter (syntax example: ($"startswith(serialNumber,'{Prefix}')"). NB! Uses camel casing. |
Returns
Type | Description |
---|---|
AssetResponse | AssetResponse object with filtered assets in SubAssets property |
GetAssetsByTag(String)
Fetches all assets, filtered by tag.
Declaration
public AssetResponse GetAssetsByTag(string tag)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | Name of tag. |
Returns
Type | Description |
---|---|
AssetResponse | AssetResponse object with filtered assets in SubAssets property |
GetSubAssets(String)
Fetches all sub assets of a parent asset.
Declaration
public AssetResponse GetSubAssets(string serialNumber)
Parameters
Type | Name | Description |
---|---|---|
System.String | serialNumber | Parent asset serial number |
Returns
Type | Description |
---|---|
AssetResponse | AssetResponse object (with sub-assets) |
IncrementAssetUsageCount(String, Int32, Boolean)
Increment an asset's usage count by default (1) or specified int value.
Declaration
public AssetResponse IncrementAssetUsageCount(string serialNumber, int usageCount = 1, bool incrementSubAssets = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | serialNumber | Asset serial number |
System.Int32 | usageCount | Value of usage count increment (default 1) |
System.Boolean | incrementSubAssets | Boolean with default=false. Set to true if you want to increment the asset's sub-assets. |
Returns
Type | Description |
---|---|
AssetResponse | AssetResponse object (with the incremented asset) |
isConnected()
True if connected to server.
Declaration
public bool isConnected()
Returns
Type | Description |
---|---|
System.Boolean |
Maintenance(String, Nullable<DateTime>)
Register maintenance to the specified asset. Client must have admin credentials to register maintenance.
Declaration
public AssetResponse Maintenance(string serialNumber, DateTime? dateTime = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | serialNumber | Maintenance asset serialNumber |
System.Nullable<System.DateTime> | dateTime | If specified, sets the LastMaintenanceDate to the specified date and time. Default=null (today) |
Returns
Type | Description |
---|---|
AssetResponse | AssetResponse Object (with the maintenanced asset) |
SetParent(String, String)
Sets, updates or remove an asset's parent.
Declaration
public AssetResponse SetParent(string serialNumber, string parentSerialNumber)
Parameters
Type | Name | Description |
---|---|---|
System.String | serialNumber | Asset serial number for the asset whose parent will be set. |
System.String | parentSerialNumber | New parent serialNumber for the asset (can be null). |
Returns
Type | Description |
---|---|
AssetResponse | AssetResponse object (with the asset's parent serial number set) |
UpdateAsset(Asset)
Updates asset object changes.
Declaration
public AssetResponse UpdateAsset(Asset asset)
Parameters
Type | Name | Description |
---|---|---|
Asset | asset | Asset object to be updated |
Returns
Type | Description |
---|---|
AssetResponse | AssetResponse object |