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> >()); }
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> >()); }
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); }
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; }
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 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); }
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); } }
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 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; }
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)); }
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 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; }
public static CdmaBts QueryBts(this IBtsRepository repository, int townId, string name) { return(repository.GetAll().FirstOrDefault(x => x.TownId == townId && x.Name == name)); }
public CdmaBts Get(int id) { return(_repository.GetAll().FirstOrDefault(x => x.ENodebId == id)); }