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); }
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++; } } } }
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()); }
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()); }
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)); }
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; }
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); } }
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()); }
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); }
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); }
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(); }
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(); }
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(); }
public DeleteOneENodebService(IENodebRepository repository, int eNodebId) : this(repository) { _eNodeb = repository.GetAll().FirstOrDefault(x => x.ENodebId == eNodebId); }
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); }
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; }
public ENodeb Get(int id) { return(_repository.GetAll().FirstOrDefault(x => x.ENodebId == id)); }
public SimpleSaveOneCellService(ICellRepository repository, CellExcel cellInfo, IENodebRepository eNodebRepository) : base(repository, cellInfo) { _eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == cellInfo.ENodebId); }
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)); }