public bool DumpOneStat() { var stat = PreciseCoverage4Gs.Pop(); if (stat == null) { return(false); } var nextDate = stat.StatTime.Date.AddDays(1); var item = _repository.FirstOrDefault( x => x.StatTime >= stat.StatTime.Date && x.StatTime < nextDate && x.CellId == stat.CellId && x.SectorId == stat.SectorId); if (item == null) { _repository.Insert(stat); } else { item.TotalMrs = stat.TotalMrs; item.FirstNeighbors = stat.FirstNeighbors; item.SecondNeighbors = stat.SecondNeighbors; item.ThirdNeighbors = stat.ThirdNeighbors; if (stat.Neighbors0 > 0) { item.Neighbors0 = stat.Neighbors0; } if (stat.Neighbors1 > 0) { item.Neighbors1 = stat.Neighbors1; } if (stat.Neighbors2 > 0) { item.Neighbors2 = stat.Neighbors2; } if (stat.Neighbors3 > 0) { item.Neighbors3 = stat.Neighbors3; } if (stat.NeighborsMore > 0) { item.NeighborsMore = stat.NeighborsMore; } } _repository.SaveChanges(); return(true); }
public bool DumpOneStat() { var stat = PreciseCoverage4Gs.Pop(); if (stat == null) { return(false); } var item = _repository.FirstOrDefault( x => x.StatTime == stat.StatTime && x.CellId == stat.CellId && x.SectorId == stat.SectorId); if (item == null) { _repository.Insert(stat); } return(true); }