namespace Yw.WinFrmUI
|
{
|
/// <summary>
|
/// 水流流向辅助类
|
/// </summary>
|
public class HydroFlowDirectionHelper
|
{
|
//字典
|
private static readonly Dictionary<int, string> _dict = new Dictionary<int, string>()
|
{
|
{ Yw.Hydro.FlowDirection.None,"无"},
|
{ Yw.Hydro.FlowDirection.Positive,"正"},
|
{ Yw.Hydro.FlowDirection.Negative,"反"}
|
};
|
|
/// <summary>
|
/// 获取名称
|
/// </summary>
|
public static string GetName(int code)
|
{
|
if (_dict.ContainsKey(code))
|
{
|
return _dict[code];
|
}
|
return string.Empty;
|
}
|
|
/// <summary>
|
/// 获取编码
|
/// </summary>
|
public static int GetCode(string name)
|
{
|
if (_dict.ContainsValue(name))
|
{
|
return _dict.First(x => x.Value == name).Key;
|
}
|
return Yw.Hydro.FlowDirection.None;
|
}
|
|
}
|
}
|