namespace Yw.WinFrmUI
|
{
|
/// <summary>
|
/// 监测值拓展
|
/// </summary>
|
public static class HydroMonitorValueExtensions
|
{
|
|
/// <summary>
|
/// 更新监测值列表
|
/// </summary>
|
public static void UpdateMonitorValue(this List<HydroMonitorValueViewModel> all, string monitorInfo)
|
{
|
if (all == null || all.Count < 1)
|
{
|
return;
|
}
|
if (string.IsNullOrEmpty(monitorInfo))
|
{
|
return;
|
}
|
var allWorkingMonitorList = JsonHelper.Json2Object<List<HydroWorkingMonitorViewModel>>(monitorInfo);
|
all.UpdateMonitorValue(allWorkingMonitorList);
|
}
|
|
/// <summary>
|
/// 更新监测值列表
|
/// </summary>
|
public static void UpdateMonitorValue
|
(
|
this List<HydroMonitorValueViewModel> all,
|
List<HydroWorkingMonitorViewModel> allWorkingMonitorList
|
)
|
{
|
if (all == null || all.Count < 1)
|
{
|
return;
|
}
|
if (allWorkingMonitorList == null || allWorkingMonitorList.Count < 1)
|
{
|
return;
|
}
|
foreach (var monitorValue in all)
|
{
|
var workingMonitor = allWorkingMonitorList.Find(x => x.Relation == monitorValue.Vmo.Parter && x.PropName == monitorValue.Vmo.PropName);
|
if (workingMonitor != null)
|
{
|
monitorValue.PropValue = monitorValue.Vmo.GetPropValue(workingMonitor.PropValue);
|
}
|
}
|
}
|
|
|
|
}
|
}
|