public void AddWaterData(SubNodeInfo subnode) { if (subnode.WaterData.DeviceAddr == "") { return; } SubNodeInfo.WaterRecord water; var rs = WaterDatas.FirstOrDefault(q => q.Key == subnode.LongAddr); if (rs.Value == null) { water = new SubNodeInfo.WaterRecord(); WaterDatas.Add(subnode.LongAddr, water); } else { water = rs.Value; } water.DeviceAddr = subnode.WaterData.DeviceAddr; water.MeterTime = subnode.WaterData.MeterTime; water.MeterType = subnode.WaterData.MeterType; water.CurrValue = subnode.WaterData.CurrValue; water.CalcDays = subnode.WaterData.CalcDays; water.LastValue = subnode.WaterData.LastValue; water.MeterStatus = subnode.WaterData.ProductYear; }
public void RemoveWaterData(SubNodeInfo subnode) { var rs = AmeterDatas.FirstOrDefault(q => q.Key == subnode.LongAddr); if (rs.Value != null) { WaterDatas.Remove(subnode.LongAddr); } }
public void AddAmeterData(SubNodeInfo subnode) { if (subnode.AmeterData.ReadTime == "") { return; } SubNodeInfo.AmeterRecord ameter; var rs = AmeterDatas.FirstOrDefault(q => q.Key == subnode.LongAddr); if (rs.Value == null) { ameter = new SubNodeInfo.AmeterRecord(); AmeterDatas.Add(subnode.LongAddr, ameter); } else { ameter = rs.Value; } ameter.DayValue = subnode.AmeterData.DayValue; ameter.ReadTime = subnode.AmeterData.ReadTime.Substring(0); }