コード例 #1
0
ファイル: IViewModel.cs プロジェクト: dongdong-2009/LteTools
        public static TViewModel GenerateView <TViewModel, TStat, TView>(
            this IEnumerable <TStat> stats, DateTime statDate, IEnumerable <string> cities,
            IEnumerable <CdmaBts> btss, IEnumerable <ENodeb> eNodebs)
            where TStat : class, ITimeStat, ICdmaCell, new()
            where TViewModel : class, ITopViewModel <TView>, new()
            where TView : class, ICdmaLteNames, new()
        {
            IEnumerable <TStat> lastDateCells
                = stats.GetLastDateStatsConsideringIllegalDate(statDate);
            CdmaLteNamesService <TStat> service = new CdmaLteNamesService <TStat>(lastDateCells,
                                                                                  btss, eNodebs);
            DateTime endDate = (lastDateCells.Any()) ?
                               lastDateCells.First().StatTime.Date : DateTime.Today.AddDays(-1);
            IEnumerable <TView> cellViews = service.Clone <TView>();

            return(cellViews.GenerateView <TViewModel, TView>(
                       endDate, cities));
        }
コード例 #2
0
        public static IEnumerable <TopStatCount> QueryTopCounts <TCell, TView>(this IEnumerable <TCell> stats,
                                                                               IBtsRepository btsRepository, IENodebRepository eNodebRepository, int topCounts)
            where TCell : class, ICdmaCell, new()
            where TView : class, IGetTopCellView, new()
        {
            CdmaLteNamesService <TCell> service = new CdmaLteNamesService <TCell>(stats,
                                                                                  btsRepository.GetAllList(), eNodebRepository.GetAllList());
            IEnumerable <TView>        cellViews  = service.Clone <TView>();
            IEnumerable <TopStatCount> statCounts = from v in cellViews
                                                    group v by new { v.CdmaName, v.SectorId, v.Frequency } into g
                                       select new TopStatCount
            {
                CarrierName = g.Key.CdmaName + "-"
                              + g.Key.SectorId + "-" + g.Key.Frequency,
                TopDates   = g.Count(),
                SumOfTimes = g.Sum(v => v.Drops)
            };

            return(statCounts.OrderByDescending(x => x.SumOfTimes).Take(topCounts));
        }
コード例 #3
0
 public JsonResult Query(DateTime begin, DateTime end, string city, int topCounts = 20)
 {
     DateTime endDate = end.AddDays(1);
     IEnumerable<TopConnection3GCell> stats = statRepository.GetAll().QueryTimeStats(begin, endDate, city).ToList();
     if (stats.Any())
     {
         CdmaLteNamesService<TopConnection3GCell> service = new CdmaLteNamesService<TopConnection3GCell>(
             stats, btsRepository.GetAllList(), eNodebRepository.GetAllList());
         IEnumerable<TopConnection3GCellView> cellViews
             = service.Clone<TopConnection3GCellView>();
         var statCounts = from v in cellViews
                          group v by new { v.CdmaName, v.SectorId } into g
                          select new
                          {
                              CarrierName = g.Key.CdmaName + "-" + g.Key.SectorId,
                              TopDates = g.Count(),
                              SumOfTimes= g.Sum(v => v.ConnectionFails)
                          };
         return Json(statCounts.OrderByDescending(x => x.SumOfTimes).Take(topCounts),
             JsonRequestBehavior.AllowGet);
     }
     return Json(new List<int>(), JsonRequestBehavior.AllowGet);
 }
コード例 #4
0
        public JsonResult Query(DateTime begin, DateTime end, string city, int topCounts = 20)
        {
            DateTime endDate = end.AddDays(1);
            IEnumerable <TopConnection3GCell> stats = statRepository.Stats.QueryTimeStats(begin, endDate, city).ToList();

            if (stats.Any())
            {
                CdmaLteNamesService <TopConnection3GCell> service = new CdmaLteNamesService <TopConnection3GCell>(
                    stats, btsRepository.GetAllList(), eNodebRepository.GetAllList());
                IEnumerable <TopConnection3GCellView> cellViews
                    = service.Clone <TopConnection3GCellView>();
                var statCounts = from v in cellViews
                                 group v by new { v.CdmaName, v.SectorId } into g
                    select new
                {
                    CarrierName = g.Key.CdmaName + "-" + g.Key.SectorId,
                    TopDates    = g.Count(),
                    SumOfTimes  = g.Sum(v => v.ConnectionFails)
                };
                return(Json(statCounts.OrderByDescending(x => x.SumOfTimes).Take(topCounts),
                            JsonRequestBehavior.AllowGet));
            }
            return(Json(new List <int>(), JsonRequestBehavior.AllowGet));
        }