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