25 lines
1005 B
C#
25 lines
1005 B
C#
public enum SimulationRunStatus { Pending, Running, Completed, Cancelled, Failed }
|
|
|
|
public static class SimulationRunStatusExtensions
|
|
{
|
|
public static string ToDbString(this SimulationRunStatus s) => s switch
|
|
{
|
|
SimulationRunStatus.Pending => "PENDING",
|
|
SimulationRunStatus.Running => "RUNNING",
|
|
SimulationRunStatus.Completed => "COMPLETED",
|
|
SimulationRunStatus.Cancelled => "CANCELLED",
|
|
SimulationRunStatus.Failed => "FAILED",
|
|
_ => throw new ArgumentOutOfRangeException(nameof(s))
|
|
};
|
|
|
|
public static SimulationRunStatus FromDbString(string v) => v switch
|
|
{
|
|
"PENDING" => SimulationRunStatus.Pending,
|
|
"RUNNING" => SimulationRunStatus.Running,
|
|
"COMPLETED" => SimulationRunStatus.Completed,
|
|
"CANCELLED" => SimulationRunStatus.Cancelled,
|
|
"FAILED" => SimulationRunStatus.Failed,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown simulation run status: '{v}'")
|
|
};
|
|
}
|