Exemplo n.º 1
0
        public List <TownCoverageStat> QueryTownViews(DateTime begin, DateTime end, int townId, FrequencyBandType frequency)
        {
            var query =
                _townRepository.GetAllList(
                    x =>
                    x.StatDate >= begin && x.StatDate < end && x.FrequencyBandType == frequency &&
                    x.TownId == townId)
                .OrderBy(x => x.StatDate)
                .ToList();

            return(query);
        }
        public CoverageRegionDateView QueryLastDateStat(DateTime initialDate, string city)
        {
            var stats = _statRepository.QueryDate(initialDate, (repository, beginDate, endDate) =>
            {
                var query =
                    _statRepository.GetAllList(x => x.StatDate >= beginDate & x.StatDate < endDate);
                return(query.FilterTownList(_townRepository.GetAllList().Where(x => x.CityName == city).ToList()));
            });
            var townViews = stats.ConstructViews <TownCoverageStat, TownCoverageView>(_townRepository);

            return(townViews.QueryRegionDateDateView <CoverageRegionDateView, DistrictCoverageView, TownCoverageView>(initialDate,
                                                                                                                      DistrictCoverageView.ConstructView));
        }