lixiaojun
2025-02-13 bfd1b73be85fd66ee37031eadcd4d09e7dafb52f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
namespace Yw.WinFrmUI
{
    /// <summary>
    /// 水力阻件状态辅助类
    /// </summary>
    public class HydroResistanceStatusHelper
    {
        //字典
        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;
        }
    }
}