namespace Yw.WinFrmUI
{
///
/// 水力阀门状态辅助类
///
public class HydroValveStatusHelper
{
//字典
private static readonly Dictionary _dict = new Dictionary()
{
{ Yw.Hydro.ValveStatus.None,"默认"},
{ Yw.Hydro.ValveStatus.Open,"开启"},
{ Yw.Hydro.ValveStatus.Closed,"关闭"}
};
///
/// 获取状态名称
///
public static string GetStatusName(string code)
{
if (string.IsNullOrEmpty(code))
{
return string.Empty;
}
if (_dict.ContainsKey(code))
{
return _dict[code];
}
return string.Empty;
}
///
/// 获取状态编码
///
public static string GetStatusCode(string name)
{
if (string.IsNullOrEmpty(name))
{
return string.Empty;
}
if (_dict.ContainsValue(name))
{
return _dict.First(x => x.Value == name).Key;
}
return string.Empty;
}
}
}