LogRepository.CreateAndAssignToTicket Method

Creates new log and assign to ticket.

Namespace: Gamanet.C4.SDK
Assembly: Gamanet.C4.SimpleClient (in Gamanet.C4.SimpleClient.dll) Version: 2026.0.0.733
Syntax
C#
public void CreateAndAssignToTicket(
	Guid ticketId,
	SimpleLogV1 log
)

Parameters

ticketId  Guid
The ticket identifier.
log  SimpleLogV1
The log.

Implements

ISimpleClientLogRepositoryV1.CreateAndAssignToTicket(Guid, SimpleLogV1)
Example
The following example illustrates how SimpleClient gets grouped status definitions
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();

        var exampleTicket = new SimpleTicketV1(Guid.NewGuid(), TicketCategory.Alarm);

        var exampleLog = new SimpleLogV1(
            Guid.NewGuid(), //log id
            "exampleLog", //log name
            Guid.Empty, // log parent id
            LogCategory.DoorOpened);//log category

        exampleLog.Data = new Dictionary<string, object>
        {
            ["DeviceId"] = Guid.NewGuid(),
            ["DeviceIdName"] = "door",
            ["SourceTime"] = DateTime.Now,
        };
        // create SimpleLog
        client.Logs.Create(exampleLog);

        // Create ticket
        client.TicketManagement.Create(exampleTicket, exampleLog.Id);

        // Create log and assign to ticket
        client.Logs.CreateAndAssignToTicket(exampleTicket.Id, exampleLog);

        var result = client.TicketManagement.Get(exampleTicket.Id);
        Console.WriteLine(result);

        // Disconnect from server
        client.Disconnect();
    }
}
See Also

Reference

LogRepository Class
Gamanet.C4.SDK Namespace