fixed an error where get command cant serlialize employee

This commit is contained in:
Tim G. | SnapixLP
2025-06-06 11:56:37 +02:00
parent 8630c4c346
commit 78a7597689
3 changed files with 124 additions and 48 deletions

View File

@@ -146,7 +146,8 @@ public class Server
// Deserialize the command result to an Employee object
try
{
return Task.FromResult(Employee.FromJson(commandResult));
var employee = Employee.FromJson(commandResult);
return Task.FromResult(employee);
}
catch (JsonException)
{
@@ -233,6 +234,18 @@ public class Server
return Task.FromException<string>(new Exception("Failed to clock break."));
}
}
public Task<string> ClockHistory(string employeeCode)
{
var commandResult = ExecuteCommandAsync("fullClockHistory " + employeeCode).Result;
return Task.FromResult(commandResult);
}
public Task<string> FullClockHistory(int limit = 50)
{
var commandResult = ExecuteCommandAsync("fullClockHistory " + limit).Result;
return Task.FromResult(commandResult);
}
}