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 IEnumerable <Precise4GView> GetTopCountViews(DateTime begin, DateTime end, int topCount, OrderPreciseStatService.OrderPreciseStatPolicy policy, IEnumerable <ENodeb> eNodebs) { if (topCount <= 0) { return(new List <Precise4GView>()); } var orderResult = GetTopCountStats(begin, end, topCount, policy, eNodebs); return(orderResult.Select(x => { var view = Precise4GView.ConstructView(x.PreciseCoverage4G, _eNodebRepository); view.TopDates = x.TopDates; return view; })); }