Exemplo n.º 1
0
        public IEnumerable <ENodebView> GetByTownNames(string city, string district, string town)
        {
            var townItem = _townRepository.QueryTown(city, district, town);

            return(townItem == null
                ? null
                : _eNodebRepository.GetAll().Where(x => x.TownId == townItem.Id).ToList().MapTo <IEnumerable <ENodebView> >());
        }
        public int SaveENodebs(IEnumerable <CollegeENodebExcel> eNodebExcels, IENodebRepository eNodebRepository)
        {
            int count = 0;

            foreach (CollegeENodebExcel excel in eNodebExcels)
            {
                ENodeb eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == excel.ENodebId);
                if (eNodeb == null)
                {
                    continue;
                }
                InfrastructureInfo infrastructure = _repository.InfrastructureInfos.FirstOrDefault(x =>
                                                                                                   x.HotspotName == excel.CollegeName && x.HotspotType == HotspotType.College &&
                                                                                                   x.InfrastructureType == InfrastructureType.ENodeb && x.InfrastructureId == eNodeb.Id);
                if (infrastructure == null)
                {
                    infrastructure = new InfrastructureInfo
                    {
                        HotspotName        = excel.CollegeName,
                        HotspotType        = HotspotType.College,
                        InfrastructureType = InfrastructureType.ENodeb,
                        InfrastructureId   = eNodeb.Id
                    };
                    _repository.AddOneInfrastructure(infrastructure);
                    _repository.SaveChanges();
                }
                count++;
            }
            return(count);
        }
Exemplo n.º 3
0
        public void Save(IEnumerable <ENodebExcel> eNodebInfoList, bool update)
        {
            IEnumerable <ENodebExcel> validInfos =
                eNodebInfoList.Where(x => infoFilter(x))
                .Distinct(new ENodebExcelComparer())
                .Distinct(new ENodebExcelNameComparer());

            foreach (ENodebExcel info in validInfos)
            {
                int        townId = _townList.QueryId(info);
                ENodebBase existedENodebWithSameName = _baseRepository.QueryENodeb(townId, info.Name);
                ENodebBase existedENodebWithSameId   = _baseRepository.QueryENodeb(info.ENodebId);
                if (existedENodebWithSameName == null && existedENodebWithSameId == null)
                {
                    ENodeb eNodeb = new ENodeb();
                    eNodeb.Import(info, townId);
                    _repository.Insert(eNodeb);
                    _infrastructure.ENodebInserted++;
                }
                if (!update)
                {
                    continue;
                }
                if (existedENodebWithSameId != null)
                {
                    ENodeb byIdENodeb = _repository.GetAll().FirstOrDefault(x => x.ENodebId == info.ENodebId);
                    if (byIdENodeb != null)
                    {
                        byIdENodeb.Import(info, townId, false);
                        _repository.Update(byIdENodeb);
                        _infrastructure.ENodebsUpdated++;
                    }
                }
                else if (existedENodebWithSameName != null)
                {
                    ENodeb byNameENodeb =
                        _repository.GetAll().FirstOrDefault(x => x.TownId == townId && x.Name == info.Name);
                    if (byNameENodeb != null)
                    {
                        byNameENodeb.Import(info, townId);
                        _repository.Update(byNameENodeb);
                        _infrastructure.ENodebsUpdated++;
                    }
                }
            }
        }
Exemplo n.º 4
0
        public IEnumerable <SectorTriangle> Get(int id)
        {
            ENodeb eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == id);
            IQueryOutdoorCellsService <EvaluationOutdoorCell> service
                = new ByENodebQueryOutdoorCellService <EvaluationOutdoorCell>(
                      cellRepository, eNodeb, (c, e) => new EvaluationOutdoorCell(c, e));
            List <EvaluationOutdoorCell> outdoorCells = service.Query();

            return(outdoorCells.GetSectors());
        }
Exemplo n.º 5
0
        public static IEnumerable <ENodeb> QueryCollegeENodebs(this IInfrastructureRepository repository,
                                                               IENodebRepository eNodebRepository, CollegeInfo info)
        {
            IEnumerable <int> ids = repository.InfrastructureInfos.Where(x =>
                                                                         x.HotspotName == info.Name && x.InfrastructureType == InfrastructureType.ENodeb
                                                                         ).Select(x => x.InfrastructureId).ToList();

            return(ids.Select(i => eNodebRepository.GetAll().FirstOrDefault(x => x.Id == i)
                              ).Where(eNodeb => eNodeb != null).ToList());
        }
Exemplo n.º 6
0
        public void ImportCellList(IENodebRepository eNodebRepository, ICellRepository cellRepository,
                                   IGeoPoint <double> southWest, IGeoPoint <double> northEast)
        {
            IEnumerable <ENodeb> eNodebs = eNodebRepository.GetAll().FilterGeoPointList(
                southWest.Longtitute - GeoMath.BaiduLongtituteOffset,
                southWest.Lattitute - GeoMath.BaiduLattituteOffset,
                northEast.Longtitute - GeoMath.BaiduLongtituteOffset,
                northEast.Lattitute - GeoMath.BaiduLattituteOffset).ToList();

            ImportCellList(cellRepository.Query(eNodebs));
        }
Exemplo n.º 7
0
        public bool DeleteOneTown(IENodebRepository eNodebRepository, IBtsRepository btsRepository)
        {
            Town town = _repository.GetAllList().Query(_city.Trim(), _district.Trim(), _town.Trim());

            if (town == null) return false;
            ENodeb eNodeb
                = (eNodebRepository != null && eNodebRepository.GetAll() != null) ?
                    eNodebRepository.GetAll().FirstOrDefault(x => x.TownId == town.Id) :
                    null;
            CdmaBts bts
                = (btsRepository != null && btsRepository.GetAll() != null)
                    ? btsRepository.GetAll().FirstOrDefault(x => x.TownId == town.Id)
                    : null;
            if (eNodeb == null && bts == null)
            {
                _repository.Delete(town);
                return true;
            }
            return false;
        }
Exemplo n.º 8
0
 public DeleteOneENodebService(IENodebRepository repository, ITownRepository townRepository,
                               string cityName, string districtName, string townName, string eNodebName)
     : this(repository)
 {
     if (townRepository == null)
     {
         _eNodeb = null;
     }
     else
     {
         int townId = townRepository.GetAll().QueryId(cityName, districtName, townName);
         _eNodeb = repository.GetAll().FirstOrDefault(x => x.TownId == townId && x.Name == eNodebName);
     }
 }
Exemplo n.º 9
0
 public DeleteOneENodebService(IENodebRepository repository, ITownRepository townRepository,
     string cityName, string districtName, string townName, string eNodebName)
     : this(repository)
 {
     if (townRepository == null)
     {
         _eNodeb = null;
     }
     else
     {
         int townId = townRepository.GetAll().QueryId(cityName, districtName, townName);
         _eNodeb = repository.GetAll().FirstOrDefault(x => x.TownId == townId && x.Name == eNodebName);
     }
 }
Exemplo n.º 10
0
        public IEnumerable <SectorTriangle> Get()
        {
            if (ParametersContainer.QueryCells == null)
            {
                return(new List <SectorTriangle>());
            }
            IEnumerable <EvaluationOutdoorCell> outdoorCells =
                from cell in ParametersContainer.QueryCells
                let eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == cell.ENodebId)
                             where eNodeb != null
                             select new EvaluationOutdoorCell(eNodeb, cell);

            return(outdoorCells.GetSectors());
        }
Exemplo n.º 11
0
        public bool DeleteOneTown(IENodebRepository eNodebRepository, IBtsRepository btsRepository)
        {
            Town town = _repository.GetAllList().Query(_city.Trim(), _district.Trim(), _town.Trim());

            if (town == null)
            {
                return(false);
            }
            ENodeb eNodeb
                = (eNodebRepository != null && eNodebRepository.GetAll() != null) ?
                  eNodebRepository.GetAll().FirstOrDefault(x => x.TownId == town.Id) :
                  null;
            CdmaBts bts
                = (btsRepository != null && btsRepository.GetAll() != null)
                    ? btsRepository.GetAll().FirstOrDefault(x => x.TownId == town.Id)
                    : null;

            if (eNodeb == null && bts == null)
            {
                _repository.Delete(town);
                return(true);
            }
            return(false);
        }
Exemplo n.º 12
0
        public ENodebListViewModel(IENodebRepository eNodebRepository, ITownRepository townRepository,
                                   int townId, int page, int pageSize = 10)
        {
            if (townId != _townId)
            {
                ParametersContainer.QueryENodebs
                        = eNodebRepository.GetAll().Where(x => x.TownId == townId).OrderBy(p => p.Id).ToList();
                _townId = townId;
                Town town = townRepository.Get(TownId);
                _infoTitle = (town == null) ? "" :
                             town.CityName + town.DistrictName + town.TownName + "基站列表";
            }

            this.SetItems(page, pageSize);
        }
Exemplo n.º 13
0
        public ActionResult UpdateENodebInfo(ENodeb item)
        {
            ENodeb eNodeb = _eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == item.ENodebId);

            if (eNodeb == null)
            {
                return(View("ENodebEdit", new ENodebDetailsViewModel()));
            }
            eNodeb.Address = item.Address;
            eNodeb.Name    = item.Name;
            eNodeb.Factory = item.Factory;
            ENodebDetailsViewModel viewModel = new ENodebDetailsViewModel();

            viewModel.Import(eNodeb.ENodebId, _eNodebRepository, _cellRepository, _btsRepository, _cdmaCellRepository,
                             _photoRepository);
            return(View("ENodebEdit", viewModel));
        }
        public override void Save(IEnumerable <CellExcel> cellInfoList, ParametersDumpInfrastructure infrastructure)
        {
            IEnumerable <CellExcel> distinctInfos
                = cellInfoList.Distinct(p => new { p.ENodebId, p.SectorId, p.Frequency });
            IEnumerable <CellExcel> _validInfos
                = from d in distinctInfos
                  join e in _eNodebRepository.GetAll()
                  on d.ENodebId equals e.ENodebId
                  select d;
            var updateCells
                = (from v in _validInfos
                   join c in _repository.GetAll()
                   on new { v.ENodebId, v.SectorId, v.Frequency }
                   equals new { c.ENodebId, c.SectorId, c.Frequency }
                   select new { Info = v, Data = c }).ToList();

            infrastructure.CellsUpdated       = 0;
            infrastructure.NeighborPciUpdated = 0;
            if (_updateExisted)
            {
                foreach (var cell in updateCells.Where(x => x.Data.Pci != x.Info.Pci))
                {
                    cell.Info.CloneProperties(cell.Data);
                    _repository.Update(cell.Data);
                    infrastructure.CellsUpdated++;
                }

                if (_updatePci)
                {
                    infrastructure.NeighborPciUpdated = SaveLteCellRelationService.UpdateNeighborPci(_validInfos);
                }
            }
            IEnumerable <Cell> insertInfos = _validInfos.Except(updateCells.Select(x => x.Info)).Select(x =>
            {
                Cell cell = new Cell();
                cell.Import(x);
                return(cell);
            }).ToList();

            _repository.AddCells(insertInfos);
            infrastructure.CellsInserted = insertInfos.Count();
        }
Exemplo n.º 15
0
        public void Import(int eNodebId,
                           IENodebRepository eNodebRepository, ICellRepository cellRepository, IBtsRepository btsRepository,
                           ICdmaCellRepository cdmaCellRepository, IENodebPhotoRepository photoRepository)
        {
            ENodeb eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == eNodebId);

            if (eNodeb != null)
            {
                ENodeb = eNodeb;
                Cells  = cellRepository.GetAll().Where(x => x.ENodebId == eNodebId).ToList();
            }
            CdmaBts bts = btsRepository.GetAll().FirstOrDefault(x => x.ENodebId == eNodebId);

            if (bts != null)
            {
                int btsId = bts.BtsId;
                Bts       = bts;
                CdmaCells = cdmaCellRepository.GetAll().Where(x => x.BtsId == btsId).ToList();
            }
            Photos = photoRepository.Photos.Where(x => x.ENodebId == eNodebId).ToList();
        }
Exemplo n.º 16
0
 public static IEnumerable<ENodeb> QueryCollegeENodebs(this IInfrastructureRepository repository,
     IENodebRepository eNodebRepository, CollegeInfo info)
 {
     IEnumerable<int> ids = repository.InfrastructureInfos.Where(x =>
         x.HotspotName == info.Name && x.InfrastructureType == InfrastructureType.ENodeb
         ).Select(x => x.InfrastructureId).ToList();
     return ids.Select(i => eNodebRepository.GetAll().FirstOrDefault(x => x.Id == i)
         ).Where(eNodeb => eNodeb != null).ToList();
 }
Exemplo n.º 17
0
 public DeleteOneENodebService(IENodebRepository repository, int eNodebId)
     : this(repository)
 {
     _eNodeb = repository.GetAll().FirstOrDefault(x => x.ENodebId == eNodebId);
 }
Exemplo n.º 18
0
 public ByENodebQuickSaveOneCellService(ICellRepository repository, CellBaseRepository baseRepository,
     CellExcel cellInfo, IENodebRepository eNodebRepository, bool updateExisted = false)
     : base(repository, cellInfo, baseRepository, updateExisted)
 {
     _eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == cellInfo.ENodebId);
 }
Exemplo n.º 19
0
 public DeleteOneENodebService(IENodebRepository repository, int townId, string eNodebName)
     : this(repository)
 {
     _eNodeb = repository.GetAll().FirstOrDefault(x => x.TownId == townId && x.Name == eNodebName);
 }
Exemplo n.º 20
0
 public DeleteOneENodebService(IENodebRepository repository, int townId, string eNodebName)
     : this(repository)
 {
     _eNodeb = repository.GetAll().FirstOrDefault(x => x.TownId == townId && x.Name == eNodebName);
 }
 public int SaveENodebs(IEnumerable<CollegeENodebExcel> eNodebExcels, IENodebRepository eNodebRepository)
 {
     int count = 0;
     foreach (CollegeENodebExcel excel in eNodebExcels)
     {
         ENodeb eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == excel.ENodebId);
         if (eNodeb==null) continue;
         InfrastructureInfo infrastructure = _repository.FirstOrDefault(x =>
             x.HotspotName == excel.CollegeName && x.HotspotType == HotspotType.College
             && x.InfrastructureType == InfrastructureType.ENodeb && x.InfrastructureId == eNodeb.Id);
         if (infrastructure == null)
         {
             infrastructure = new InfrastructureInfo
             {
                 HotspotName = excel.CollegeName,
                 HotspotType = HotspotType.College,
                 InfrastructureType = InfrastructureType.ENodeb,
                 InfrastructureId = eNodeb.Id
             };
             _repository.Insert(infrastructure);
         }
         count++;
     }
     return count;
 }
Exemplo n.º 22
0
 public DeleteOneENodebService(IENodebRepository repository, int eNodebId)
     : this(repository)
 {
     _eNodeb = repository.GetAll().FirstOrDefault(x => x.ENodebId == eNodebId);
 }
Exemplo n.º 23
0
 public ENodeb Get(int id)
 {
     return(_repository.GetAll().FirstOrDefault(x => x.ENodebId == id));
 }
Exemplo n.º 24
0
 public SimpleSaveOneCellService(ICellRepository repository,
                                 CellExcel cellInfo, IENodebRepository eNodebRepository)
     : base(repository, cellInfo)
 {
     _eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == cellInfo.ENodebId);
 }
Exemplo n.º 25
0
 public ByENodebQuickSaveOneCellService(ICellRepository repository, CellBaseRepository baseRepository,
                                        CellExcel cellInfo, IENodebRepository eNodebRepository, bool updateExisted = false)
     : base(repository, cellInfo, baseRepository, updateExisted)
 {
     _eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == cellInfo.ENodebId);
 }
Exemplo n.º 26
0
 public void ImportCellList(IENodebRepository eNodebRepository, ICellRepository cellRepository,
     IGeoPoint<double> southWest, IGeoPoint<double> northEast)
 {
     IEnumerable<ENodeb> eNodebs = eNodebRepository.GetAll().FilterGeoPointList(
         southWest.Longtitute - GeoMath.BaiduLongtituteOffset,
         southWest.Lattitute - GeoMath.BaiduLattituteOffset,
         northEast.Longtitute - GeoMath.BaiduLongtituteOffset,
         northEast.Lattitute - GeoMath.BaiduLattituteOffset).ToList();
     ImportCellList(cellRepository.Query(eNodebs));
 }
Exemplo n.º 27
0
 public SimpleSaveOneCellService(ICellRepository repository,
     CellExcel cellInfo, IENodebRepository eNodebRepository)
     : base(repository, cellInfo)
 {
     _eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == cellInfo.ENodebId);
 }