public List <TownPreciseStat> QueryTownViews(DateTime begin, DateTime end, int townId, FrequencyBandType frequency) { var query = _repository.GetAllList( x => x.StatTime >= begin && x.StatTime < end && x.FrequencyBandType == frequency && x.TownId == townId) .OrderBy(x => x.StatTime) .ToList(); return(query); }
public PreciseRegionDateView QueryLastDateStat(DateTime initialDate, string city) { var stats = _statRepository.QueryLastDate(initialDate, (repository, beginDate, endDate) => { var query = _statRepository.GetAllList(x => x.StatTime >= beginDate & x.StatTime < endDate && x.FrequencyBandType == FrequencyBandType.All); return(query.FilterTownList(_townRepository.GetAllList().Where(x => x.CityName == city).ToList())); }); var townViews = stats.ConstructViews <TownPreciseStat, TownPreciseView>(_townRepository); return(townViews.QueryRegionDateView <PreciseRegionDateView, DistrictPreciseView, TownPreciseView>(initialDate, DistrictPreciseView.ConstructView)); }
public IEnumerable <PreciseHistory> GetPreciseHistories(DateTime begin, DateTime end) { var results = new List <PreciseHistory>(); while (begin < end.AddDays(1)) { var beginDate = begin.Date; var endDate = beginDate.AddDays(1); var items = _repository.GetAllList(beginDate, endDate, FrequencyBandType.All); var townItems = _regionRepository.GetAllList(x => x.StatTime >= beginDate && x.StatTime < endDate && x.FrequencyBandType == FrequencyBandType.All); var collegeItems = _regionRepository.GetAllList(x => x.StatTime >= beginDate && x.StatTime < endDate && x.FrequencyBandType == FrequencyBandType.College); var marketItems = _regionRepository.GetAllList(x => x.StatTime >= beginDate && x.StatTime < endDate && x.FrequencyBandType == FrequencyBandType.Market); var transportationItems = _regionRepository.GetAllList(x => x.StatTime >= beginDate && x.StatTime < endDate && x.FrequencyBandType == FrequencyBandType.Transportation); var townItems800 = _regionRepository.GetAllList(x => x.StatTime >= beginDate && x.StatTime < endDate && x.FrequencyBandType == FrequencyBandType.Band800VoLte); var townItems1800 = _regionRepository.GetAllList(x => x.StatTime >= beginDate && x.StatTime < endDate && x.FrequencyBandType == FrequencyBandType.Band1800); var townItems2100 = _regionRepository.GetAllList(x => x.StatTime >= beginDate && x.StatTime < endDate && x.FrequencyBandType == FrequencyBandType.Band2100); results.Add(new PreciseHistory { DateString = begin.ToShortDateString(), StatDate = begin.Date, PreciseStats = items.Count, TownPreciseStats = townItems.Count, CollegePreciseStats = collegeItems.Count, MarketPreciseStats = marketItems.Count, TransportationPreciseStats = transportationItems.Count, TownPrecise800Stats = townItems800.Count, TownPrecise1800Stats = townItems1800.Count, TownPrecise2100Stats = townItems2100.Count }); begin = begin.AddDays(1); } return(results); }