using Yw.Hydro;
using Yw.Vmo;
using static Yw.WinFrmUI.Q3d.EpanetEnum;
namespace HStation.WinFrmUI
{
///
/// 监测点辅助类
///
public class SimulationMonitorHelper
{
///
///
///
public SimulationMonitorHelper(SimulationVisualListHelper visualListHelper)
{
_visualListHelper = visualListHelper;
}
private readonly SimulationVisualListHelper _visualListHelper = null;//可见构件列表辅助类
private List _allMonitorList = null;//所有监测点列表
///
/// 获取
///
public async Task> GetAll()
{
if (_allMonitorList == null)
{
_allMonitorList = await BLLFactory.Instance.GetByModelID(_visualListHelper.HydroInfo.ID);
if (_allMonitorList == null)
{
_allMonitorList = new List();
}
}
return _allMonitorList;
}
///
/// 更新
///
public async Task> Update(string code)
{
var all = await GetAll();
all.RemoveAll(x => x.Parter == code);
var monitorList = await BLLFactory.Instance.GetByParter(_visualListHelper.HydroInfo.ID, code);
if (monitorList != null && monitorList.Count > 0)
{
all.AddRange(monitorList);
}
return monitorList;
}
///
/// 更新
///
public async Task Update(string code, List monitorList)
{
var all = await GetAll();
all.RemoveAll(x => x.Parter == code);
if (monitorList != null && monitorList.Count > 0)
{
all.AddRange(monitorList);
}
}
}
}