public int ImportDistributions(string path) { var repo = new ExcelQueryFactory { FileName = path }; var excels = (from c in repo.Worksheet <IndoorDistributionExcel>("Sheet1") select c).ToList(); foreach (var indoorDistributionExcel in excels) { StationDistributions.Push(indoorDistributionExcel); } return(StationDistributions.Count); }
public async Task <bool> DumpOneStationDistribution() { var stat = StationDistributions.Pop(); if (stat == null) { throw new NullReferenceException("stat is null!"); } await _distributionRepository .UpdateOneInUse <IDistributionRepository, IndoorDistribution, IndoorDistributionExcel>(stat); var stationCell = _constructionInformation.FirstOrDefault(x => x.AntennaSerial == stat.IndoorSerialNum); if (stationCell != null) { 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; cell.Lattitute = stat.Lattitute; _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); }