using Yw.Hydro;
|
using Yw.Vmo;
|
|
namespace HStation.WinFrmUI
|
{
|
/// <summary>
|
/// 监测点辅助类
|
/// </summary>
|
public class SimulationMonitorHelper
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public SimulationMonitorHelper(SimulationVisualListHelper visualListHelper)
|
{
|
_visualListHelper = visualListHelper;
|
}
|
|
private readonly SimulationVisualListHelper _visualListHelper = null;//可见构件列表辅助类
|
private List<HydroMonitorVmo> _allMonitorList = null;//所有监测点列表
|
|
/// <summary>
|
/// 获取
|
/// </summary>
|
public async Task<List<HydroMonitorVmo>> GetAll()
|
{
|
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>> GetDockingList()
|
{
|
var all = await GetAll();
|
return all?.Where(x => x.SourceType == Yw.Hydro.eSourceType.Docking).ToList();
|
}
|
|
/// <summary>
|
/// 获取分析列表
|
/// </summary>
|
public async Task<List<HydroMonitorVmo>> GetAnalyseList()
|
{
|
var all = await GetAll();
|
return all?.Where(x => x.SourceType == Yw.Hydro.eSourceType.Analyse).ToList();
|
}
|
|
/// <summary>
|
/// 更新
|
/// </summary>
|
public async Task<List<HydroMonitorVmo>> Update(string code)
|
{
|
var all = await GetAll();
|
all.RemoveAll(x => x.Parter == code);
|
var monitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetByParter(_visualListHelper.HydroInfo.ID, code);
|
if (monitorList != null && monitorList.Count > 0)
|
{
|
all.AddRange(monitorList);
|
}
|
return monitorList;
|
}
|
|
/// <summary>
|
/// 更新对接
|
/// </summary>
|
public async Task<List<HydroMonitorVmo>> UpdateDocking(string code)
|
{
|
var all = await GetAll();
|
all.RemoveAll(x => x.Parter == code && x.SourceType == Yw.Hydro.eSourceType.Docking);
|
var monitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetBySourceType(_visualListHelper.HydroInfo.ID, code, Yw.Hydro.eSourceType.Docking);
|
if (monitorList != null && monitorList.Count > 0)
|
{
|
all.AddRange(monitorList);
|
}
|
return monitorList;
|
}
|
|
/// <summary>
|
/// 更新
|
/// </summary>
|
public async Task Update(string code, eSourceType sourceType, List<HydroMonitorVmo> monitorList)
|
{
|
var all = await GetAll();
|
all.RemoveAll(x => x.Parter == code && x.SourceType == sourceType);
|
if (monitorList != null && monitorList.Count > 0)
|
{
|
all.AddRange(monitorList);
|
}
|
}
|
|
/// <summary>
|
/// 更新分析
|
/// </summary>
|
public async Task<List<HydroMonitorVmo>> UpdateAnalyse(string code)
|
{
|
var all = await GetAll();
|
all.RemoveAll(x => x.Parter == code && x.SourceType == Yw.Hydro.eSourceType.Analyse);
|
var monitorList = await BLLFactory<Yw.BLL.HydroMonitor>.Instance.GetBySourceType(_visualListHelper.HydroInfo.ID, code, Yw.Hydro.eSourceType.Analyse);
|
if (monitorList != null && monitorList.Count > 0)
|
{
|
all.AddRange(monitorList);
|
}
|
return monitorList;
|
}
|
|
|
|
|
}
|
}
|