mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
Use the Enum functions for string-to-enum and enum-to-string conversions
Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
parent
50176afc14
commit
fc75ceb4ce
@ -377,28 +377,15 @@ namespace XenAdmin.Model
|
||||
|
||||
internal static DiagnosticAlertSeverity StringToDiagnosticAlertSeverity(string severity)
|
||||
{
|
||||
switch (severity)
|
||||
{
|
||||
case "Error":
|
||||
return DiagnosticAlertSeverity.Error;
|
||||
case "Warning":
|
||||
return DiagnosticAlertSeverity.Warning;
|
||||
default:
|
||||
return DiagnosticAlertSeverity.Info;
|
||||
}
|
||||
DiagnosticAlertSeverity result;
|
||||
if (Enum.TryParse(severity, out result))
|
||||
return result;
|
||||
return DiagnosticAlertSeverity.Info;
|
||||
}
|
||||
|
||||
internal static string DiagnosticAlertSeverityToString(DiagnosticAlertSeverity severity)
|
||||
{
|
||||
switch (severity)
|
||||
{
|
||||
case DiagnosticAlertSeverity.Error:
|
||||
return "Error";
|
||||
case DiagnosticAlertSeverity.Warning:
|
||||
return "Warning";
|
||||
default:
|
||||
return "Info";
|
||||
}
|
||||
return severity.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user