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