namespace Yw.WinFrmUI
|
{
|
/// <summary>
|
/// 监测值拓展
|
/// </summary>
|
public static class HydroMonitorValueExtensions
|
{
|
|
/// <summary>
|
/// 更新监测值列表
|
/// </summary>
|
public static void UpdateMonitorValue(this List<HydroMonitorValueViewModel> allMonitorValueList, string monitorInfo)
|
{
|
if (allMonitorValueList == null || allMonitorValueList.Count < 1)
|
{
|
return;
|
}
|
if (string.IsNullOrEmpty(monitorInfo))
|
{
|
return;
|
}
|
var allWorkingMonitorList = JsonHelper.Json2Object<List<HydroWorkingMonitorViewModel>>(monitorInfo);
|
if (allWorkingMonitorList == null || allWorkingMonitorList.Count < 1)
|
{
|
return;
|
}
|
allMonitorValueList.UpdateMonitorValue(allWorkingMonitorList);
|
}
|
|
/// <summary>
|
/// 更新监测值列表
|
/// </summary>
|
public static void UpdateMonitorValue(this List<HydroMonitorValueViewModel> allMonitorValueList, List<HydroWorkingMonitorViewModel> 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.PropValue = workingMonitor.PropValue;
|
}
|
}
|
}
|
|
|
|
}
|
}
|