duheng
2024-12-04 7079cbb505471a8d3251cac4e27c7a3841f8e656
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using Yw.Vmo;
 
namespace HStation.WinFrmUI
{
    /// <summary>
    /// 监测点辅助类
    /// </summary>
    public class SimulationMonitorHelper
    {
        /// <summary>
        /// 
        /// </summary>
        public SimulationMonitorHelper(SimulationVisualListHelper visualListHelper)
        {
            _visualListHelper = visualListHelper;
        }
 
        private SimulationVisualListHelper _visualListHelper = null;//可见构件列表辅助类
        private List<HydroMonitorVmo> _allMonitorList = null;//所有监测点列表
 
        /// <summary>
        /// 获取
        /// </summary>
        public async Task<List<HydroMonitorVmo>> Get()
        {
            if (_allMonitorList == null)
            {
                _allMonitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetByModelID(_visualListHelper.HydroInfo.ID);
                if (_allMonitorList == null)
                {
                    _allMonitorList = new List<HydroMonitorVmo>();
                }
            }
            return _allMonitorList;
        }
 
        /// <summary>
        /// 更新
        /// </summary>
        public async Task<List<HydroMonitorVmo>> Update(string code)
        {
            var allMonitorList = await Get();
            allMonitorList.RemoveAll(x => x.Relation == code);
            var monitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetByRelation(_visualListHelper.HydroInfo.ID, code);
            if (monitorList != null && monitorList.Count > 0)
            {
                allMonitorList.AddRange(monitorList);
            }
            return monitorList;
        }
 
 
 
 
 
    }
}