Show / Hide Table of Contents

Class AssetHandler

Class that contains functions for Asset handling.

Inheritance
System.Object
MesBase
AssetHandler
Inherited Members
MesBase.adminToken
MesBase.SetAdminCredentials(String, String)
MesBase.RESTGetJson<responseType>(String, Boolean)
MesBase.RESTPostJson<responseType>(String, Object, Boolean)
MesBase.RESTPutJson<responseType>(String, Object, Boolean)
MesBase.RESTDeleteJson<responseType>(String, Object, Boolean)
MesBase.CultureCode
MesBase.TranslateString(String, String, Object[])
MesBase.TranslateString(String, Object[])
MesBase.TranslateArray(String[])
MesBase.TranslateArray(String, String[])
MesBase.GetProcesses(Boolean, Boolean, Boolean)
MesBase.GetMesServerSettings(String[], Boolean[], Int32[], String[], String[], String[])
MesBase.GetCommonUserSettings(String)
MesBase.GetGeneralOptionString(String)
MesBase.GetGeneralOptionBool(String)
MesBase.GetGeneralOptionInt(String)
MesBase.DisplayMesTestGUI()
MesBase.GetStorageXml(String)
MesBase.GetStorageValue(String)
MesBase.PutStorageData(String, String, String)
MesBase.RemoveStorageData(String)
MesBase.RethrowException
MesBase.LastException
MesBase.LogExceptions
MesBase.Operator
MesBase.StartTraceToEventLog()
MesBase.StopTraceToEventLog()
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Virinco.WATS.Interface.MES.Asset
Assembly: Virinco.WATS.Interface.MES.dll
Syntax
public class AssetHandler : MesBase

Methods

Calibration(String, DateTime, String)

Register calibration to the specified asset.

Declaration
public AssetResponse Calibration(string serialNumber, DateTime dateTime, string comment)
Parameters
Type Name Description
System.String serialNumber

Calibration asset's serial number.

System.DateTime dateTime

Sets the LastCalibrationDate to the specified date and time.

System.String comment

Asset log comment.

Returns
Type Description
AssetResponse

AssetResponse object (with the calibrated asset)

Calibration(String, Nullable<DateTime>, String)

Register calibration to the specified asset.

Declaration
public AssetResponse Calibration(string serialNumber, DateTime? dateTime = null, string comment = 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).

System.String comment

Asset log comment.

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

CreateAssetType(String, Nullable<Decimal>, Nullable<Decimal>, Nullable<Int32>, Nullable<Int32>, Nullable<Decimal>, Nullable<Decimal>)

Declaration
public AssetResponse CreateAssetType(string name, decimal? calibrationInterval = null, decimal? maintenanceInterval = null, int? runningCountLimit = null, int? totalCountLimit = null, decimal? warningThreshold = null, decimal? alarmTreshold = null)
Parameters
Type Name Description
System.String name
System.Nullable<System.Decimal> calibrationInterval
System.Nullable<System.Decimal> maintenanceInterval
System.Nullable<System.Int32> runningCountLimit
System.Nullable<System.Int32> totalCountLimit
System.Nullable<System.Decimal> warningThreshold
System.Nullable<System.Decimal> alarmTreshold
Returns
Type Description
AssetResponse

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)

GetSubAssets(String, Int32)

Fetches sub assets of a parent asset down to and including level.

Declaration
public AssetResponse GetSubAssets(string serialNumber, int level)
Parameters
Type Name Description
System.String serialNumber

Parent asset serial number

System.Int32 level

How many sub assets of sub assets to get. 0 to get all, 1 to get direct children only.

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, DateTime, String)

Register maintenance to the specified asset.

Declaration
public AssetResponse Maintenance(string serialNumber, DateTime dateTime, string comment)
Parameters
Type Name Description
System.String serialNumber

Maintenance asset serialNumber

System.DateTime dateTime

Sets the LastMaintenanceDate to the specified date and time.

System.String comment

Asset log comment

Returns
Type Description
AssetResponse

AssetResponse Object (with the maintenanced asset)

Maintenance(String, Nullable<DateTime>, String)

Register maintenance to the specified asset.

Declaration
public AssetResponse Maintenance(string serialNumber, DateTime? dateTime = null, string comment = 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).

System.String comment

Asset log comment.

Returns
Type Description
AssetResponse

AssetResponse Object (with the maintenanced asset).

ResetRunningCount(String, String)

Reset running count to 0.

Declaration
public AssetResponse ResetRunningCount(string serialNumber, string comment = null)
Parameters
Type Name Description
System.String serialNumber

Maintenance asset serialNumber

System.String comment

Asset log comment

Returns
Type Description
AssetResponse

AssetResponse Object (with the reset 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

In This Article
Back to top View how-to articles, videos and more at support.virinco.com Send comments on this topic to support@virinco.com