Device |
Get Devices by transaction
Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public ISimpleCollection<SimpleDeviceV1> GetAllByTransaction( Guid transactionId, Properties properties )
Parameters
- transactionId Guid
- The transaction identifier.
- properties Properties
- The properties.
Return Value
ISimpleCollection<SimpleDeviceV1>Collection of devices
Implements
ISimpleClientDeviceRepositoryV3.GetAllByTransaction(Guid, Properties)Example
The following example illustrates how SimpleClient filter all devices by transaction Id
C#
using System; using Gamanet.C4.SDK; using Gamanet.C4.SimpleInterfaces; public class Example { static void Main() { // Create instance of simple client var client = new SimpleClient(ConnectorConfiguration.HttpClient); ConnectionInfoV1 token; // Connect to local server var connectionResult = client.Connect(new Uri("https://localhost/"), "Support", "support", out token); if (connectionResult != ConnectionResult.Successful) { Console.WriteLine("Connection unsuccessful, result: {0}", connectionResult); return; } Console.WriteLine("Connection result: {0}", connectionResult); Console.WriteLine(); // Example transaction ID var exampleTransactionId = Guid.Parse("d9e155d6-8296-46c7-a57f-88f914c97531"); // Create the Example Device (Bus Controller) var exampleBusController = new SimpleDeviceV1( Guid.NewGuid(), "BUS", EntityRoot.Device, Guid.Parse("9c2246aa-5d43-414f-85d4-8c3b4e657236") ); exampleBusController.Data["track_TransactionId"] = trasnactionId; // Create the Example Device (Panel) var examplePanel = new SimpleDeviceV1( Guid.NewGuid(), "PANEL", exampleBusController.Id, Guid.Parse("a7395726-1e7f-4c1e-bdef-ce28a869620a") ); examplePanel.Data["track_TransactionId"] = trasnactionId; // Create the Example Device (Door) var exampleDoor = new SimpleDeviceV1( Guid.NewGuid(), "DOOR", examplePanel.Id, Guid.Parse("8b87ea62-9a72-4126-b054-3f8ad0683bf1") ); exampleDoor.Data["track_TransactionId"] = trasnactionId; // Create devices in db client.Devices.Create(exampleBusController); client.Devices.Create(examplePanel); client.Devices.Create(exampleDoor); // Here we retrieve devices based on Transaction ID in their data. var result = client.Devices.GetAllByTransaction(exampleTransactionId, Properties.None); // Output should contain all example devices names foreach ( var device in result) { Console.WriteLine(device.Name); } // Disconnect from server client.Disconnect(); } }
See Also