namespace Yw.WinFrmUI
{
///
/// 水力管段状态辅助类
///
public class HydroLinkStatusHelper
{
//字典
private static readonly Dictionary _dict = new Dictionary()
{
{ Yw.Hydro.LinkStatus.None,"无"},
{ Yw.Hydro.LinkStatus.Open,"开启"},
{ Yw.Hydro.LinkStatus.Closed,"关闭"},
{ Yw.Hydro.LinkStatus.CV,"止回阀"}
};
///
/// 获取状态名称
///
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;
}
}
}