public List <TopPrecise4GContainer> GetTopCountStats(DateTime begin, DateTime end, int topCount, OrderPreciseStatService.OrderPreciseStatPolicy policy) { var query = _repository.GetAll() .Where(x => x.StatTime >= begin && x.StatTime <end && x.TotalMrs> TotalMrsThreshold); var result = from q in query.AsEnumerable() group q by new { q.CellId, q.SectorId } into g select new TopPrecise4GContainer { PreciseCoverage4G = new PreciseCoverage4G { CellId = g.Key.CellId, SectorId = g.Key.SectorId, FirstNeighbors = g.Sum(q => q.FirstNeighbors), SecondNeighbors = g.Sum(q => q.SecondNeighbors), ThirdNeighbors = g.Sum(q => q.ThirdNeighbors), TotalMrs = g.Sum(q => q.TotalMrs) }, TopDates = g.Count() }; var orderResult = result.Order(policy, topCount); return(orderResult); }
public void UpdateKpi(IPreciseCoverage4GRepository repository, DateTime begin, DateTime end) { var query = repository.GetAll().Where(x => x.StatTime >= begin && x.StatTime < end && x.CellId == ENodebId && x.SectorId == SectorId).ToList(); if (query.Count > 0) { var sum = query.Sum(x => x.TotalMrs); PreciseRate = sum == 0 ? 100 : 100 - (double)query.Sum(x => x.SecondNeighbors) / sum * 100; } }