protected int SaveENodebs(List<ENodebExcel> infoList)
 {
     ParametersDumpInfrastructure infrastructure = new ParametersDumpInfrastructure();
     SaveENodebListService service = new SaveENodebListService(
         eNodebRepository.Object, infrastructure, townRepository.Object);
     service.Save(infoList, true);
     return infrastructure.ENodebInserted;
 }
Example #2
0
 public SaveENodebListService(IENodebRepository repository,
     ParametersDumpInfrastructure infrastructure, ITownRepository townRepository)
 {
     _repository = repository;
     _baseRepository = new ENodebBaseRepository(repository);
     _townList = townRepository.GetAllList();
     _infrastructure = infrastructure;
     _infrastructure.ENodebsUpdated = 0;
 }
 public ByExcelInfoSaveBtsListService(IBtsRepository repository,
     ParametersDumpInfrastructure infrastructure, ITownRepository townRepository,
     IENodebRepository lteRepository = null)
 {
     _infrastructure = infrastructure;
     _townRepository = townRepository;
     _lteRepository = lteRepository;
     _repository = repository;
     _baseRepository = new ENodebBaseRepository(repository);
 }
Example #4
0
 public override void Save(ParametersDumpInfrastructure infrastructure)
 {
     using (var baseRepository = new ENodebBaseRepository(_repository))
     {
         foreach (var cdmaBts in from cdmaBts in _btsInfoList
                                 let bts = baseRepository.QueryENodeb(cdmaBts.BtsId)
                                 where bts == null select cdmaBts)
         {
             _repository.Insert(cdmaBts);
         }
     }
     infrastructure.CdmaBtsUpdated = 0;
 }
 public override void Save(IEnumerable<CellExcel> cellInfoList, ParametersDumpInfrastructure infrastructure)
 {
     infrastructure.CellsInserted = 0;
     foreach (CellExcel info in cellInfoList)
     {
         ByENodebBaseQuickSaveOneCellService service =
             new ByENodebBaseQuickSaveOneCellService(_repository, _baseRepository, info, _baseENodebRepository);
         if (service.Save())
         {
             _baseRepository.ImportNewCellInfo(info);
             infrastructure.CellsInserted++;
         }
     }
 }
Example #6
0
        public object BindModel(ControllerContext controllerContext,
            ModelBindingContext bindingContext)
        {
            ParametersDumpInfrastructure infrastructure
                = (ParametersDumpInfrastructure)controllerContext.HttpContext.Session[sessionKey];

            if (infrastructure == null)
            {
                infrastructure = new ParametersDumpInfrastructure();
                controllerContext.HttpContext.Session[sessionKey] = infrastructure;
            }
            // return the cart
            return infrastructure;
        }
 public override void Save(ParametersDumpInfrastructure infrastructure)
 {
     using (CdmaCellBaseRepository baseRepository = new CdmaCellBaseRepository(_repository))
     {
         foreach (CdmaCell cell in _cells)
         {
             if (_baseBtsRepository.QueryENodeb(cell.BtsId) != null
                 && baseRepository.QueryCell(
                     cell.BtsId, cell.SectorId, cell.CellType) == null)
             {
                 _repository.Insert(cell);
                 infrastructure.CdmaCellsInserted++;
             }
         }
     }
 }
        public void DumpCdmaData(ParametersDumpInfrastructure infrastructure,
            IParametersDumpController controller,
            IParametersDumpConfig config)
        {
            IBtsDumpRepository<BtsExcel> dumpBtsRepository
                = CdmaBtsDumpGenerator(controller, infrastructure);
            dumpBtsRepository.ImportBts = config.ImportBts;
            dumpBtsRepository.UpdateBts = config.UpdateBts;
            dumpBtsRepository.InvokeAction(infrastructure.CdmaBtsRepository);

            ICellDumpRepository<CdmaCellExcel> dumpCellRepository
                = CdmaCellDumpGenerator(controller, infrastructure);
            dumpCellRepository.ImportCell = config.ImportCdmaCell;
            dumpCellRepository.UpdateCell = config.UpdateCdmaCell;
            dumpCellRepository.InvokeAction(infrastructure.CdmaCellRepository);
        }
        public void DumpMmlData(ParametersDumpInfrastructure infrastructure,
            IParametersDumpController controller)
        {
            if (infrastructure.MmlListIsEmpty)
            {
                return;
            }
            IMmlDumpRepository<CdmaBts, CdmaCell, BtsExcel, CdmaCellExcel> dumpRepository
                = MmlDumpGenerator(controller, infrastructure);

            foreach (IMmlImportRepository<CdmaBts, CdmaCell, BtsExcel, CdmaCellExcel> repository
                in infrastructure.MmlRepositoryList)
            {
                dumpRepository.InvokeAction(repository);
            }
        }
        public override void Save(ParametersDumpInfrastructure infrastructure)
        {
            infrastructure.CdmaCellsInserted = 0;

            using (CdmaCellBaseRepository baseRepository = new CdmaCellBaseRepository(_repository))
            {
                foreach (CdmaCellExcel cellInfo in _cellInfoList)
                {
                    SaveOneCdmaCellService service = new ByENodebQuickSaveOneCdmaCellService(
                        _repository, baseRepository, cellInfo, _btsBaseRepository);
                    if (service.Save())
                    {
                        baseRepository.ImportNewCellInfo(cellInfo);
                        infrastructure.CdmaCellsInserted++;
                    }
                }
            }
        }
        public void DumpLteData(ParametersDumpInfrastructure infrastructure,
            IParametersDumpController controller,
            IParametersDumpConfig config)
        {
            IBtsDumpRepository<ENodebExcel> btsDumpRepository
                = LteENodebDumpGenerator(controller, infrastructure);
            btsDumpRepository.ImportBts = config.ImportENodeb;
            btsDumpRepository.UpdateBts = config.UpdateENodeb;
            btsDumpRepository.InvokeAction(infrastructure.LteENodebRepository);

            ICellDumpRepository<CellExcel> cellDumpRepository
                = LteCellDumpGenerator(controller, infrastructure);
            cellDumpRepository.ImportCell = config.ImportLteCell;
            cellDumpRepository.UpdateCell = config.UpdateLteCell;
            LteCellDumpRepository repository = cellDumpRepository as LteCellDumpRepository;
            if (repository != null)
                repository.UpdatePci = config.UpdatePci;
            cellDumpRepository.InvokeAction(infrastructure.LteCellRepository);
        }
 protected int SaveCells(IEnumerable<CellExcel> cellInfos)
 {
     ParametersDumpInfrastructure infrastructure = new ParametersDumpInfrastructure();
     SaveCellInfoListService service = new QuickSaveCellInfoListService(repository.Object,
         eNodebRepository.Object);
     service.Save(cellInfos, infrastructure);
     return infrastructure.CellsInserted;
 }
 protected int[] SaveCellInfos(IEnumerable<CellExcel> cellInfos)
 {
     ParametersDumpInfrastructure infrastructure = new ParametersDumpInfrastructure();
     SaveCellInfoListService service = new UpdateConsideredSaveCellInfoListService(
         repository.Object, eNodebRepository.Object, true);
     service.Save(cellInfos, infrastructure);
     return new[] {infrastructure.CellsInserted, infrastructure.CellsUpdated};
 }
 public abstract void Save(IEnumerable<CellExcel> cellInfoList, ParametersDumpInfrastructure infrastructure);
        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 AssertOriginalTest()
        {
            AssertOriginalParameters();
            int expectedSaved = (btsInfos[0].BtsId == repository.Object.GetAll().ElementAt(0).BtsId) ? 1 : 2;
            ParametersDumpInfrastructure infrastructure = new ParametersDumpInfrastructure();
            ByExcelInfoSaveBtsListService service = new ByExcelInfoSaveBtsListService(
                repository.Object, infrastructure, townRepository);
            service.Save(btsInfos, true);
            Assert.AreEqual(repository.Object.Count(), expectedSaved + 1);

            for (int i = 1; i < repository.Object.Count(); i++)
            {
                AssertElements(repository.Object.GetAll().ElementAt(i), btsInfos[i - expectedSaved + 1]);
            }
        }
 public override void Save(ParametersDumpInfrastructure infrastructure)
 {
     CdmaCell.UpdateFirstFrequency = true;
     List<CdmaCell> validCells = new List<CdmaCell>();
     foreach (CdmaCellExcel info in _validInfos)
     {
         CdmaCell cell = validCells.FirstOrDefault(x =>
             x.BtsId == info.BtsId && x.SectorId == info.SectorId && x.CellType == info.CellType);
         if (cell == null)
         {
             cell = new CdmaCell();
             validCells.Add(cell);
         }
         cell.Import(info, true);
     }
     IEnumerable<CdmaCell> updateCells
         = from v in validCells
           join c in _repository.GetAllList()
           on new { v.BtsId, v.SectorId, v.CellType }
           equals new { c.BtsId, c.SectorId, c.CellType }
           select v;
     infrastructure.CdmaCellsInserted = 0;
     infrastructure.CdmaCellsUpdated = 0;
     if (_updateExisted)
     {
         foreach (CdmaCell cell in updateCells)
         {
             CdmaCell objectCell = _repository.GetAll().FirstOrDefault(
                 x => x.BtsId == cell.BtsId && x.SectorId == cell.SectorId && x.CellType == cell.CellType);
             if (objectCell == null) continue;
             cell.CloneProperties<CdmaCell>(objectCell);
             _repository.Update(cell);
             infrastructure.CdmaCellsUpdated++;
         }
     }
     IEnumerable<CdmaCell> insertCells = validCells.Except(updateCells, new CdmaCellComperer());
     SaveCdmaCellListService service = new SimpleSaveCdmaCellListService(
         _repository, insertCells);
     infrastructure.CdmaCellsInserted += insertCells.Count();
     service.Save(infrastructure);
 }
 private int SaveCells()
 {
     SaveCdmaCellInfoListService service = new SimpleSaveCdmaCellInfoListService(
         repository.Object, cellInfos, btsRepository.Object);
     ParametersDumpInfrastructure infrastructure = new ParametersDumpInfrastructure();
     service.Save(infrastructure);
     return infrastructure.CdmaCellsInserted;
 }
 protected int SaveENodebs(bool update)
 {
     ParametersDumpInfrastructure infrastructure = new ParametersDumpInfrastructure();
     SaveENodebListService service = new SaveENodebListService(
         lteRepository.Object, infrastructure, townRepository.Object);
     service.Save(eNodebInfos, update);
     return infrastructure.ENodebInserted;
 }
 public abstract void Save(ParametersDumpInfrastructure infrastructure);
 public void TestBtsRepositorySaveBts_Original_LteConsidered()
 {
     helper.AssertOriginalParameters();
     helper.AssertOriginalBtsInfos();
     ParametersDumpInfrastructure infrastructure = new ParametersDumpInfrastructure();
     ByExcelInfoSaveBtsListService service = new ByExcelInfoSaveBtsListService(
         repository.Object, infrastructure, townRepository.Object, lteRepository.Object);
     service.Save(btsInfos, true);
     Assert.AreEqual(infrastructure.CdmaBtsUpdated, 2, "failure");
     Assert.AreEqual(repository.Object.Count(), 3);
     Assert.AreEqual(repository.Object.GetAll().ElementAt(0).ENodebId, -1);
     Assert.AreEqual(repository.Object.GetAll().ElementAt(1).TownId, 122);
     Assert.AreEqual(repository.Object.GetAll().ElementAt(1).ENodebId, -1);
     Assert.AreEqual(repository.Object.GetAll().ElementAt(2).ENodebId, -1);
 }
 public override void Save(ParametersDumpInfrastructure infrastructure)
 {
     foreach (CdmaCell cell in _cells)
     {
         _repository.Insert(cell);
         infrastructure.CdmaCellsInserted++;
     }
 }