added clockhistory and get command

This commit is contained in:
Tim G. | SnapixLP
2025-06-06 09:06:59 +02:00
parent c2608f4bf6
commit 8630c4c346
4 changed files with 175 additions and 4 deletions

View File

@@ -5,4 +5,17 @@ public enum EmployeeState
OUT,
IN,
BREAK,
}
public static class EmployeeStateExtensions
{
public static string ToFriendlyString(this EmployeeState state)
{
return state switch
{
EmployeeState.OUT => "Clocked Out",
EmployeeState.IN => "Clocked In",
EmployeeState.BREAK => "On Break",
_ => state.ToString()
};
}
}

View File

@@ -139,9 +139,9 @@ public class Server
// Implement logic to get a worker by ID or code
if (id != null)
commandResult = ExecuteCommandAsync("get worker byid " + id).Result;
commandResult = ExecuteCommandAsync("get employee byid " + id).Result;
else
commandResult = ExecuteCommandAsync("get worker bycode " + id).Result;
commandResult = ExecuteCommandAsync("get employee bycode " + code).Result;
// Deserialize the command result to an Employee object
try
@@ -233,4 +233,6 @@ public class Server
return Task.FromException<string>(new Exception("Failed to clock break."));
}
}
}