コード例 #1
0
        public IEnumerable <CdmaBtsView> GetByGeneralName(string name)
        {
            var items =
                _btsRepository.GetAllList().Where(x => x.Name.IndexOf(name.Trim(), StringComparison.Ordinal) >= 0).ToArray();

            if (items.Any())
            {
                return(items.MapTo <IEnumerable <CdmaBtsView> >());
            }
            var btsId = name.Trim().ConvertToInt(0);

            if (btsId > 0)
            {
                items = _btsRepository.GetAll().Where(x => x.BtsId == btsId).ToArray();
                if (items.Any())
                {
                    return(items.MapTo <IEnumerable <CdmaBtsView> >());
                }
            }
            items =
                _btsRepository.GetAllList()
                .Where(
                    x =>
                    x.Address.IndexOf(name.Trim(), StringComparison.Ordinal) >= 0)
                .ToArray();
            return(items.Any() ? items.MapTo <IEnumerable <CdmaBtsView> >() : null);
        }
コード例 #2
0
        public IEnumerable <CdmaBtsView> GetByTownArea(string city, string district, string town)
        {
            var list     = new List <CdmaBtsView>();
            var townItem = _townRepository.GetAllList()
                           .FirstOrDefault(x => x.CityName == city && x.DistrictName == district && x.TownName == town);

            if (townItem == null)
            {
                return(list);
            }
            var boudary = _boundaryRepository.FirstOrDefault(x => x.TownId == townItem.Id);

            if (boudary == null)
            {
                return(list);
            }
            foreach (var townEntity in _townRepository.GetAllList(x => x.CityName == city && x.DistrictName == district && x.TownName != town))
            {
                var views =
                    _btsRepository.GetAllList(x => x.TownId == townEntity.Id)
                    .Where(x => boudary.IsInTownRange(x))
                    .MapTo <List <CdmaBtsView> >();
                views.ForEach(x =>
                {
                    x.DistrictName = district;
                    x.TownName     = townEntity.TownName;
                    x.TownId       = townItem.Id;
                });
                list.AddRange(views);
            }
            return(list);
        }
コード例 #3
0
        public ViewResult TopDrop2G(TopDrop2GViewModel postedModel)
        {
            TopDrop2GViewModel viewModel
                = topDrop2GRepository.Stats.GenerateView <TopDrop2GViewModel, TopDrop2GCell, TopDrop2GCellView>(
                      postedModel.StatDate, regionNamesService.Query().ToList(),
                      btsRepository.GetAllList(), eNodebRepository.GetAllList());

            return(View(viewModel));
        }
コード例 #4
0
        public IEnumerable <CdmaBtsView> GetByTownNames(string city, string district, string town)
        {
            var townItem = _townRepository.GetAllList()
                           .FirstOrDefault(x => x.CityName == city && x.DistrictName == district && x.TownName == town);
            var viewList = _btsRepository.GetAllList(x => x.TownId == townItem.Id).MapTo <List <CdmaBtsView> >();

            viewList.ForEach(x =>
            {
                x.CityName     = city;
                x.DistrictName = district;
                x.TownName     = town;
            });
            return(townItem == null
                ? new List <CdmaBtsView>()
                : viewList);
        }
コード例 #5
0
 public IEnumerable <BtsExcel> GetNewBtsExcels()
 {
     if (!BtsExcels.Any())
     {
         return(new List <BtsExcel>());
     }
     return(from info in BtsExcels
            join bts in _btsRepository.GetAllList()
            on info.BtsId equals bts.BtsId into btsQuery
            from bq in btsQuery.DefaultIfEmpty()
            where bq == null
            select info);
 }
コード例 #6
0
 public ENodebBaseRepository(IBtsRepository inputRepository)
 {
     eNodebBaseList.Clear();
     foreach (CdmaBts bts in inputRepository.GetAllList())
     {
         eNodebBaseList.Add(new ENodebBase
         {
             ENodebId = bts.BtsId,
             Name = bts.Name,
             TownId = bts.TownId
         });
     }
 }
コード例 #7
0
 public ENodebBaseRepository(IBtsRepository inputRepository)
 {
     eNodebBaseList.Clear();
     foreach (CdmaBts bts in inputRepository.GetAllList())
     {
         eNodebBaseList.Add(new ENodebBase
         {
             ENodebId = bts.BtsId,
             Name     = bts.Name,
             TownId   = bts.TownId
         });
     }
 }
コード例 #8
0
 public static IEnumerable <TopCellContainer <TTopCell> > QueryContainers <TTopCell>(this List <TTopCell> topCells,
                                                                                     IBtsRepository btsRepository, IENodebRepository eNodebRepository)
     where TTopCell : IBtsIdQuery
 {
     return(from stat in
            topCells
            join bts in btsRepository.GetAllList()
            on stat.BtsId equals bts.BtsId into btsQuery
            from bq in btsQuery.DefaultIfEmpty()
            join eNodeb in eNodebRepository.GetAllList()
            on bq?.ENodebId ?? -1 equals eNodeb.ENodebId into query
            from q in query.DefaultIfEmpty()
            select new TopCellContainer <TTopCell>
     {
         TopCell = stat,
         LteName = q == null ? "无匹配LTE基站" : q.Name,
         CdmaName = bq == null ? "无匹配CDMA基站" : bq.Name
     });
 }
コード例 #9
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));
        }
コード例 #10
0
 public UpdateCdmaLteIdService(IBtsRepository repository,
                               ICdmaCellRepository cellRepository, IEnumerable <CdmaLteIds> lteIds)
     : this(repository)
 {
     var cdmaLteInfos =
         (from a in repository.GetAllList()
          join b in cellRepository.GetAllList()
          on a.BtsId equals b.BtsId
          where a.ENodebId == -1
          select new { a.BtsId, b.CellId }).Distinct();
     _eNodebIds =
         from a in cdmaLteInfos
         join c in lteIds
         on a.CellId equals c.CdmaCellId
         select new BtsENodebIds
     {
         ENodebId = c.ENodebId,
         BtsId    = a.BtsId
     };
 }
コード例 #11
0
 public UpdateCdmaLteIdService(IBtsRepository repository,
     ICdmaCellRepository cellRepository, IEnumerable<CdmaLteIds> lteIds)
     : this(repository)
 {
     var cdmaLteInfos =
         (from a in repository.GetAllList()
             join b in cellRepository.GetAllList()
                 on a.BtsId equals b.BtsId
             where a.ENodebId == -1
             select new {a.BtsId, b.CellId}).Distinct();
     _eNodebIds =
         from a in cdmaLteInfos
         join c in lteIds
             on a.CellId equals c.CdmaCellId
         select new BtsENodebIds
         {
             ENodebId = c.ENodebId,
             BtsId = a.BtsId
         };
 }
コード例 #12
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));
        }
コード例 #13
0
 public IEnumerable <CdmaBts> Get()
 {
     return(_repository.GetAllList());
 }