public async Task <bool> DumpOneStationRru() { var stat = StationRrus.Pop(); if (stat == null) { throw new NullReferenceException("stat is null!"); } await _stationRruRepository .UpdateOneInUse <IStationRruRepository, StationRru, StationRruExcel>(stat); var cellSerials = stat.CellSerialNum.GetSplittedFields(','); foreach (var cellSerial in cellSerials) { var stationCell = _constructionInformation.FirstOrDefault(x => x.CellSerialNum == cellSerial); if (stationCell == null) { continue; } { var cell = _cellRepository.FirstOrDefault(x => x.ENodebId == stationCell.ENodebId && x.SectorId == stationCell.SectorId); if (cell != null) { if (cell.Longtitute < 112 && cell.Lattitute < 22 && stat.Longtitute > 112 && stat.Lattitute > 22) { cell.Longtitute = stat.Longtitute ?? 0; cell.Lattitute = stat.Lattitute ?? 0; } } _cellRepository.SaveChanges(); var rru = _rruRepository.FirstOrDefault(x => x.ENodebId == stationCell.ENodebId && x.LocalSectorId == stationCell.LocalCellId); if (rru == null) { rru = new LteRru { ENodebId = stationCell.ENodebId, LocalSectorId = stationCell.LocalCellId, RruName = stat.Address }; _rruRepository.Insert(rru); } else { rru.RruName = stat.Address; } } } _rruRepository.SaveChanges(); return(true); }
public static CellRruView ConstructCellRruView(this Cell cell, IENodebRepository repository, ILteRruRepository rruRepository) { var view = Mapper.Map <Cell, CellRruView>(cell); var eNodeb = repository.FirstOrDefault(x => x.ENodebId == cell.ENodebId); view.ENodebName = eNodeb?.Name; var rru = rruRepository.FirstOrDefault(x => x.ENodebId == cell.ENodebId && x.LocalSectorId == cell.LocalSectorId); rru?.MapTo(view); return(view); }