예제 #1
0
        public IEnumerable <CdmaBtsView> GetByTownNames(string city, string district, string town)
        {
            var townItem = _townRepository.QueryTown(city, district, town);

            return(townItem == null
                ? null
                : _btsRepository.GetAll().Where(x => x.TownId == townItem.Id).ToList().MapTo <IEnumerable <CdmaBtsView> >());
        }
예제 #2
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);

            return(townItem == null
                ? null
                : _btsRepository.GetAll().Where(x => x.TownId == townItem.Id).ToList().MapTo <IEnumerable <CdmaBtsView> >());
        }
예제 #3
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);
        }
 public ByBtsQuickSaveOneCdmaCellService(ICdmaCellRepository repository,
                                         CdmaCellBaseRepository baseRepository,
                                         CdmaCellExcel cellInfo, IBtsRepository btsRepository)
     : base(repository, baseRepository, cellInfo)
 {
     _bts = btsRepository.GetAll().FirstOrDefault(x => x.BtsId == cellInfo.BtsId);
 }
        public int SaveBtss(IEnumerable <CollegeBtsExcel> btsExcels, IBtsRepository btsRepository)
        {
            int count = 0;

            foreach (CollegeBtsExcel excel in btsExcels)
            {
                CdmaBts bts = btsRepository.GetAll().FirstOrDefault(x => x.BtsId == excel.BtsId);
                if (bts == null)
                {
                    continue;
                }
                InfrastructureInfo infrastructure = _repository.InfrastructureInfos.FirstOrDefault(x =>
                                                                                                   x.HotspotName == excel.CollegeName && x.HotspotType == HotspotType.College &&
                                                                                                   x.InfrastructureType == InfrastructureType.CdmaBts && x.InfrastructureId == bts.Id);
                if (infrastructure == null)
                {
                    infrastructure = new InfrastructureInfo
                    {
                        HotspotName        = excel.CollegeName,
                        HotspotType        = HotspotType.College,
                        InfrastructureType = InfrastructureType.CdmaBts,
                        InfrastructureId   = bts.Id
                    };
                    _repository.AddOneInfrastructure(infrastructure);
                    _repository.SaveChanges();
                }
                count++;
            }
            return(count);
        }
예제 #6
0
 public ByBtsQuickSaveOneCdmaCellService(ICdmaCellRepository repository,
     CdmaCellBaseRepository baseRepository,
     CdmaCellExcel cellInfo, IBtsRepository btsRepository)
     : base(repository, baseRepository, cellInfo)
 {
     _bts = btsRepository.GetAll().FirstOrDefault(x => x.BtsId == cellInfo.BtsId);
 }
 public int SaveBtss(IEnumerable<CollegeBtsExcel> btsExcels, IBtsRepository btsRepository)
 {
     int count = 0;
     foreach (CollegeBtsExcel excel in btsExcels)
     {
         CdmaBts bts = btsRepository.GetAll().FirstOrDefault(x => x.BtsId == excel.BtsId);
         if (bts==null) continue;
         InfrastructureInfo infrastructure = _repository.FirstOrDefault(x =>
             x.HotspotName == excel.CollegeName && x.HotspotType == HotspotType.College
             && x.InfrastructureType == InfrastructureType.CdmaBts && x.InfrastructureId == bts.Id);
         if (infrastructure == null)
         {
             infrastructure = new InfrastructureInfo
             {
                 HotspotName = excel.CollegeName,
                 HotspotType = HotspotType.College,
                 InfrastructureType = InfrastructureType.CdmaBts,
                 InfrastructureId = bts.Id
             };
             _repository.Insert(infrastructure);
         }
         count++;
     }
     return count;
 }
예제 #8
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;
        }
예제 #9
0
        public static bool DeleteOneBts(this IBtsRepository repository, int btsId)
        {
            CdmaBts bts = repository.GetAll().FirstOrDefault(x => x.BtsId == btsId);

            if (bts == null)
            {
                return(false);
            }
            repository.Delete(bts);
            return(true);
        }
예제 #10
0
        public IEnumerable <SectorTriangle> Get()
        {
            if (ParametersContainer.QueryCdmaCells == null)
            {
                return(new List <SectorTriangle>());
            }
            IEnumerable <EvaluationOutdoorCell> outdoorCells =
                from cell in ParametersContainer.QueryCdmaCells
                let bts = btsRepository.GetAll().FirstOrDefault(x => x.BtsId == cell.BtsId)
                          where bts != null
                          select new EvaluationOutdoorCell(bts, cell);

            return(outdoorCells.GetSectors());
        }
 public void Update()
 {
     foreach (BtsENodebIds idDefinition in _eNodebIds)
     {
         var     id  = idDefinition.BtsId;
         CdmaBts bts = _repository.GetAll().FirstOrDefault(x => x.BtsId == id);
         if (bts == null)
         {
             continue;
         }
         bts.ENodebId = idDefinition.ENodebId;
         _repository.Update(bts);
     }
 }
예제 #12
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);
        }
예제 #13
0
        public UpdateConsideredSaveCdmaCellInfoListService(ICdmaCellRepository repository,
                                                           IEnumerable <CdmaCellExcel> cellInfoList, IBtsRepository btsRepository,
                                                           bool updateExisted = false)
            : base(repository, cellInfoList)
        {
            _updateExisted = updateExisted;
            IEnumerable <CdmaCellExcel> distinctInfos = cellInfoList.Distinct(
                p => new { p.BtsId, p.SectorId, p.Frequency });

            _validInfos
                = from d in distinctInfos
                  join e in btsRepository.GetAll()
                  on d.BtsId equals e.BtsId
                  select d;
        }
예제 #14
0
        public ActionResult UpdateBtsInfo(CdmaBts item)
        {
            CdmaBts bts = _btsRepository.GetAll().FirstOrDefault(x => x.ENodebId == item.ENodebId);

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

            viewModel.Import(bts.ENodebId, _eNodebRepository, _cellRepository, _btsRepository, _cdmaCellRepository,
                             _photoRepository);
            return(View("ENodebEdit", viewModel));
        }
예제 #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();
        }
예제 #16
0
        public UpdateConsideredSaveCdmaCellInfoListService(ICdmaCellRepository repository,
            IEnumerable<CdmaCellExcel> cellInfoList, IBtsRepository btsRepository,
            bool updateExisted = false)
            : base(repository, cellInfoList)
        {
            _updateExisted = updateExisted;
            IEnumerable<CdmaCellExcel> distinctInfos = cellInfoList.Distinct(
                p => new { p.BtsId, p.SectorId, p.Frequency });

            _validInfos
                = from d in distinctInfos
                  join e in btsRepository.GetAll()
                  on d.BtsId equals e.BtsId
                  select d;
        }
예제 #17
0
 public static CdmaBts QueryBts(this IBtsRepository repository,
                                int townId, string name)
 {
     return(repository.GetAll().FirstOrDefault(x => x.TownId == townId && x.Name == name));
 }
예제 #18
0
 public CdmaBts Get(int id)
 {
     return(_repository.GetAll().FirstOrDefault(x => x.ENodebId == id));
 }