public IEnumerable <CollegeStat> QueryStats()
        {
            IEnumerable <CollegeInfo> infos = _repository.GetAllList();

            return(!infos.Any()
                ? new List <CollegeStat>()
                : infos.Select(x => new CollegeStat(_repository, x, _infrastructureRepository)));
        }
示例#2
0
        public Dictionary <string, double> GetAverageRates(DateTime begin, DateTime end)
        {
            var results = _repository.GetAllList(begin, end);
            var query   = from r in results
                          join c in _collegeRepository.GetAllList() on r.CollegeId equals c.Id
                          select new { c.Name, Rate = r.DownloadRate };

            return(query.GroupBy(x => x.Name).ToDictionary(s => s.Key, t => t.Average(x => x.Rate)));
        }
示例#3
0
        public IEnumerable <CollegeStat> QueryStats(int year)
        {
            var infos = _repository.GetAllList();

            return(!infos.Any()
                ? new List <CollegeStat>()
                : infos.Select(
                       x =>
                       new CollegeStat(_repository, x, _yearRepository.GetByCollegeAndYear(x.Id, year),
                                       _infrastructureRepository, _eNodebRepository, _cellRepository, _btsRepository, _cdmaCellRepository))
                   .Where(x => x.ExpectedSubscribers > 0));
        }
        public ActionResult List()
        {
            IEnumerable <CollegeInfo> infos     = _repository.GetAllList();
            IEnumerable <Town>        towns     = _townRepository.GetAllList();
            CollegeViewModel          viewModel = new CollegeViewModel
            {
                Colleges = infos.Select(x => new CollegeDto(x, towns))
            };

            return(View(viewModel));
        }
示例#5
0
        public List <CollegeView> QueryInfos()
        {
            var views = _repository.GetAllList().MapTo <List <CollegeView> >();

            views.ForEach(view =>
            {
                var region          = _repository.GetRegion(view.Id);
                view.RectangleRange = region?.RectangleRange;
                view.Area           = region?.Area ?? 0;
                view.RegionType     = region?.RegionType ?? 0;
                view.Info           = region?.Info;
                var town            = _townRepository.FirstOrDefault(x => x.Id == view.TownId);
                if (town == null)
                {
                    return;
                }
                view.City     = town.CityName;
                view.District = town.DistrictName;
                view.Town     = town.TownName;
            });
            return(views);
        }
        public Dictionary <string, IEnumerable <Tuple <string, int> > > GetAlarmCounts(DateTime begin, DateTime end)
        {
            var colleges = _repository.GetAllList().Select(x => x.Name);
            var results  = new Dictionary <string, IEnumerable <Tuple <string, int> > >();

            foreach (var college in colleges)
            {
                var alarms = _service.QueryCollegeENodebs(college, begin, end).Where(x => x.AlarmTimes > 0).ToArray();
                if (alarms.Any())
                {
                    results.Add(college, alarms.Select(x => new Tuple <string, int>(x.Name, x.AlarmTimes)));
                }
            }
            return(results);
        }
示例#7
0
        public Dictionary <string, double> GetAverageKpi(DateTime begin, DateTime end, string kpiName)
        {
            var property = typeof(CollegeKpi).GetProperty(kpiName);

            if (property == null)
            {
                return(null);
            }
            var results = _repository.GetAllList(begin, end);
            var query   = from r in results
                          join c in _collegeRepository.GetAllList() on r.CollegeId equals c.Id
                          select new { c.Name, Kpi = (double)property.GetValue(r) };

            return(query.GroupBy(x => x.Name).ToDictionary(s => s.Key, t => t.Average(x => x.Kpi)));
        }
 public IEnumerable <CollegeInfo> Get()
 {
     return(_repository.GetAllList());
 }