using Yw.Hydro;
using Yw.Vmo;
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> GetDockingList()
{
var all = await GetAll();
return all?.Where(x => x.SourceType == Yw.Hydro.eSourceType.Docking).ToList();
}
///
/// 获取分析列表
///
public async Task> GetAnalyseList()
{
var all = await GetAll();
return all?.Where(x => x.SourceType == Yw.Hydro.eSourceType.Analyse).ToList();
}
///
/// 更新
///
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> UpdateDocking(string code)
{
var all = await GetAll();
all.RemoveAll(x => x.Parter == code && x.SourceType == Yw.Hydro.eSourceType.Docking);
var monitorList = await BLLFactory.Instance.GetBySourceType(_visualListHelper.HydroInfo.ID, code, Yw.Hydro.eSourceType.Docking);
if (monitorList != null && monitorList.Count > 0)
{
all.AddRange(monitorList);
}
return monitorList;
}
///
/// 更新
///
public async Task Update(string code, eSourceType sourceType, List monitorList)
{
var all = await GetAll();
all.RemoveAll(x => x.Parter == code && x.SourceType == sourceType);
if (monitorList != null && monitorList.Count > 0)
{
all.AddRange(monitorList);
}
}
///
/// 更新分析
///
public async Task> UpdateAnalyse(string code)
{
var all = await GetAll();
all.RemoveAll(x => x.Parter == code && x.SourceType == Yw.Hydro.eSourceType.Analyse);
var monitorList = await BLLFactory.Instance.GetBySourceType(_visualListHelper.HydroInfo.ID, code, Yw.Hydro.eSourceType.Analyse);
if (monitorList != null && monitorList.Count > 0)
{
all.AddRange(monitorList);
}
return monitorList;
}
}
}