Exemple #1
0
        public IEnumerable <DoubleFlowRegionFrequencyView> QueryTownFrequencyViews(DateTime begin, DateTime end,
                                                                                   string city, string district, string town)
        {
            var townItem = _townRepository.FirstOrDefault(x =>
                                                          x.CityName == city && x.DistrictName == district && x.TownName == town);

            if (townItem == null)
            {
                return(new List <DoubleFlowRegionFrequencyView>());
            }
            var query = _statRepository.GetAllList(x =>
                                                   x.StatTime >= begin && x.StatTime < end && x.FrequencyBandType != FrequencyBandType.All &&
                                                   x.TownId == townItem.Id);

            if (!query.Any())
            {
                return(new List <DoubleFlowRegionFrequencyView>());
            }
            return(query.GroupBy(x => x.StatTime.Date).Select(g => new DoubleFlowRegionFrequencyView
            {
                Region = town,
                StatDate = g.Key,
                FrequencyViews = new List <FrequencyDoubleFlowView>
                {
                    g.FirstOrDefault(x => x.FrequencyBandType == FrequencyBandType.Band2100)
                    .MapTo <FrequencyDoubleFlowView>(),
                    g.FirstOrDefault(x => x.FrequencyBandType == FrequencyBandType.Band1800)
                    .MapTo <FrequencyDoubleFlowView>(),
                    g.FirstOrDefault(x => x.FrequencyBandType == FrequencyBandType.Band800VoLte)
                    .MapTo <FrequencyDoubleFlowView>()
                }
            }));
        }
Exemple #2
0
        public IEnumerable <AreaTestFileView> QueryTownTestInfos(DateTime begin, DateTime end, string city,
                                                                 string district, string townName)
        {
            var town =
                _townRepository.FirstOrDefault(
                    x => x.CityName == city && x.DistrictName == district && x.TownName == townName);
            var townInfos =
                _areaTestInfoRepository.GetAllList(x => x.TownId == town.Id);

            if (town == null)
            {
                return(new List <AreaTestFileView>());
            }
            var views = from info in townInfos
                        join file in _fileInfoRepository.GetAllList(x => x.TestDate > begin && x.TestDate < end)
                        on info.FileId equals file.Id
                        select new
            {
                Info = info,
                File = file,
                Town = town
            };

            return(views.Select(v =>
            {
                var view = v.Info.MapTo <AreaTestFileView>();
                view.AreaName = v.Town.CityName + v.Town.DistrictName + v.Town.TownName;
                view.CsvFileName = v.File.CsvFileName;
                view.TestDate = v.File.TestDate;
                return view;
            }));
        }
        public TownAreaTestFileView QueryTownTestInfos(DateTime begin, DateTime end, string dataType,
                                                       string city, string district, string town)
        {
            var allInfos = QueryFileInfos(dataType, begin, end).ToList();
            var townItem = _townRepository.FirstOrDefault(x => x.CityName == city && x.DistrictName == district &&
                                                          x.TownName == town);

            return(townItem == null ? null : QueryAreaTestFileViewsInTowns(allInfos, townItem));
        }
Exemple #4
0
        private IEnumerable <TownFlowStat> QueryDateSpanStats(DateTime begin, DateTime end, string city, string district,
                                                              string townName)
        {
            var town =
                _townRepository.FirstOrDefault(
                    x => x.CityName == city && x.DistrictName == district && x.TownName == townName);

            return(town == null
                ? new List <TownFlowStat>()
                : _repository.GetAllList(x => x.TownId == town.Id && x.StatTime >= begin && x.StatTime < end));
        }
Exemple #5
0
        public static ENodebView ConstructView(ENodeb item, ITownRepository townRepository)
        {
            var town = townRepository.FirstOrDefault(x => x.Id == item.TownId);
            var view = item.MapTo <ENodebView>();

            if (town != null)
            {
                view.CityName     = town.CityName;
                view.DistrictName = town.DistrictName;
                view.TownName     = town.TownName;
            }
            return(view);
        }
        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);
        }
Exemple #7
0
        public static TView ConstructAreaView <TStat, TView>(this TStat stat, ITownRepository repository)
            where TStat : IArea
        {
            var town =
                repository.FirstOrDefault(
                    x => x.TownName == (stat.Area == "北窖" ? "北滘" : stat.Area) || x.DistrictName == stat.Area);
            var view = Mapper.Map <TStat, TView>(stat);

            if (town != null)
            {
                town.MapTo(view);
            }
            return(view);
        }
        private ENodebView GenerateENodebView(ENodeb item)
        {
            if (item == null)
            {
                return(null);
            }
            var town = _townRepository.FirstOrDefault(x => x.Id == item.TownId);

            if (town != null)
            {
                var result = town.MapTo <ENodebView>();
                return(item.MapTo(result));
            }
            else
            {
                return(item.MapTo <ENodebView>());
            }
        }