public void Test_Construct(int btsId, byte sectorId, int cellId, bool outdoor, string indoor, double height, double eTilt, double mTilt, string lac) { var cell = new CdmaCell { BtsId = btsId, SectorId = sectorId, CellId = cellId, IsOutdoor = outdoor, Height = height, ETilt = eTilt, MTilt = mTilt, Lac = lac }; var view = CdmaCellView.ConstructView(cell, _repository.Object); if (btsId > 0 && btsId <= 3) { Assert.AreEqual(view.BtsName, "Bts-" + btsId); } else { Assert.IsNull(view.BtsName); } Assert.AreEqual(view.BtsId, btsId); Assert.AreEqual(view.SectorId, sectorId); Assert.AreEqual(view.CellId, cellId); Assert.AreEqual(view.Indoor, indoor); Assert.AreEqual(view.Height, height); Assert.AreEqual(view.DownTilt, eTilt + mTilt); Assert.AreEqual(view.Lac, lac); }
protected override bool SaveWhenBtsNotExisted() { bool result = true; CdmaCellBase cellBase = _baseRepository.QueryCell(_cellInfo.BtsId, _cellInfo.SectorId, _cellInfo.CellType); if (cellBase == null) { CdmaCell cell = new CdmaCell(); cell.Import(_cellInfo, true); _repository.Insert(cell); } else if (cellBase.Frequency < 0 || !cellBase.HasFrequency(_cellInfo.Frequency)) { CdmaCell cell = _repository.Query(_cellInfo.BtsId, _cellInfo.SectorId, _cellInfo.CellType); if (cell != null) { cell.Import(_cellInfo, true); } } else { result = false; } return(result); }
public void Test_Import_UpdateSecondFrequency( int btsId, byte sectorId, int cellId, short frequency, string cellType, double antennaGain, short overallFrequency) { var cell = new CdmaCell { BtsId = 1, SectorId = 2, CellId = 3, Frequency = 1, CellType = "DO", AntennaGain = 12.8, Frequency1 = 37 }; var cellExcelInfo = new CdmaCellExcel { BtsId = btsId, SectorId = sectorId, CellId = cellId, Frequency = frequency, CellType = cellType, AntennaGain = antennaGain }; cell.Import(cellExcelInfo); Assert.AreEqual(cell.BtsId, 1, "btsId"); Assert.AreEqual(cell.SectorId, 2); Assert.AreEqual(cell.CellId, 3); Assert.AreEqual(cell.CellType, "DO"); Assert.AreEqual(cell.Frequency, overallFrequency, "frequency"); Assert.AreEqual(cell.Frequency1, 37); Assert.AreEqual(cell.Frequency2, frequency == 37 || !frequency.IsCdmaFrequency() ? -1 : frequency); Assert.AreEqual(cell.AntennaGain, !frequency.IsCdmaFrequency() || frequency == 37 ? 12.8 : antennaGain); }
public static CdmaCompoundCellView ConstructView(this CdmaCell onexCell, CdmaCell evdoCell, IBtsRepository repository) { CdmaCompoundCellView view = null; if (onexCell != null) { view = Mapper.Map <CdmaCell, CdmaCompoundCellView>(onexCell); view.OnexFrequencyList = onexCell.FrequencyList; if (evdoCell != null) { view.EvdoFrequencyList = evdoCell.FrequencyList; } } else if (evdoCell != null) { view = Mapper.Map <CdmaCell, CdmaCompoundCellView>(evdoCell); view.EvdoFrequencyList = evdoCell.FrequencyList; } if (view != null) { var bts = repository.GetByBtsId(view.BtsId); view.BtsName = bts?.Name; } return(view); }
public int SaveCdmaCells(IEnumerable <CollegeCdmaCellExcel> cellExcels, ICdmaCellRepository cellRepository) { int count = 0; foreach (CollegeCdmaCellExcel excel in cellExcels) { CdmaCell cell = cellRepository.GetAll().FirstOrDefault( x => x.BtsId == excel.BtsId && x.SectorId == excel.SectorId); if (cell == null) { continue; } InfrastructureInfo infrastructure = _repository.InfrastructureInfos.FirstOrDefault(x => x.HotspotName == excel.CollegeName && x.HotspotType == HotspotType.College && x.InfrastructureType == InfrastructureType.CdmaCell && x.InfrastructureId == cell.Id); if (infrastructure == null) { infrastructure = new InfrastructureInfo { HotspotName = excel.CollegeName, HotspotType = HotspotType.College, InfrastructureType = InfrastructureType.CdmaCell, InfrastructureId = cell.Id }; _repository.AddOneInfrastructure(infrastructure); _repository.SaveChanges(); } count++; } return(count); }
public void Test_Import_UpdateFirstFrequency( int btsId, byte sectorId, int cellId, short frequency, string cellType, double antennaGain, short overallFrequency) { var cell = new CdmaCell { BtsId = 1, SectorId = 2, CellId = 3, Frequency = 0, CellType = "DO", AntennaGain = 12.8, Frequency1 = -1 }; var cellExcelInfo = new CdmaCellExcel { BtsId = btsId, SectorId = sectorId, CellId = cellId, Frequency = frequency, CellType = cellType, AntennaGain = antennaGain }; cell.Import(cellExcelInfo); Assert.AreEqual(cell.BtsId, 1, "btsId"); Assert.AreEqual(cell.SectorId, 2); Assert.AreEqual(cell.CellId, 3); Assert.AreEqual(cell.CellType, "DO"); Assert.AreEqual(cell.Frequency, overallFrequency, "frequency"); Assert.AreEqual(cell.Frequency1, overallFrequency == 0 ? -1 : frequency, "frequency1"); Assert.AreEqual(cell.AntennaGain, overallFrequency != 0 ? antennaGain :12.8); Assert.AreEqual(cell.HasFrequency(frequency), overallFrequency != 0); }
public void TestCdmaCellConstruction_SameSecondFrequency() { CdmaCellExcel cellExcelInfo = new CdmaCellExcel { BtsId = 22, SectorId = 2, CellId = 255, Frequency = 78, CellType = "DO" }; using (CdmaCell cell = new CdmaCell { BtsId = 1, SectorId = 2, CellId = 255, Frequency1 = 37, Frequency2 = 78, Frequency = 3 }) { cell.Import(cellExcelInfo, true); Assert.IsNotNull(cell); Assert.AreEqual(cell.BtsId, 1); Assert.AreEqual(cell.SectorId, 2); Assert.AreEqual(cell.CellId, 255); Assert.AreEqual(cell.CellType, null); Assert.AreEqual(cell.Frequency1, 37, "f1"); Assert.AreEqual(cell.Frequency2, 78, "f1"); Assert.AreEqual(cell.Frequency3, -1); Assert.AreEqual(cell.Frequency, 3); Assert.IsTrue(cell.HasFrequency(37)); Assert.IsTrue(cell.HasFrequency(78)); } using (CdmaCell cell = new CdmaCell { BtsId = 1, SectorId = 2, CellId = 255, Frequency1 = 37, Frequency2 = 78, Frequency = 3 }) { CdmaCell.UpdateFirstFrequency = true; cell.Import(cellExcelInfo, true); Assert.IsNotNull(cell); Assert.AreEqual(cell.BtsId, 1); Assert.AreEqual(cell.SectorId, 2); Assert.AreEqual(cell.CellId, 255); Assert.AreEqual(cell.CellType, null); Assert.AreEqual(cell.Frequency1, 37); Assert.AreEqual(cell.Frequency2, 78); Assert.AreEqual(cell.Frequency3, -1); Assert.AreEqual(cell.Frequency, 3); Assert.IsTrue(cell.HasFrequency(37)); Assert.IsTrue(cell.HasFrequency(78)); } }
public static CdmaCellView ConstructView(this CdmaCell cell, IBtsRepository repository) { var view = Mapper.Map <CdmaCell, CdmaCellView>(cell); var bts = repository.GetByBtsId(cell.BtsId); view.BtsName = bts?.Name; return(view); }
protected void Initialize() { btsLineInfo = new MmlLineInfo( "ADD BSCBTSINF: BTSTP=IBSC, BTSID=50, BTSNM=\"张槎工贸\", FN=7, SN=8, SSN=3, ABISCAPOPTMSW=OFF, ABISOPTMCRCSW=OFF, ABISREVFRAMEPERIOD=3, HIGHPW=NOHIGHPW, ABISREDUNDANCESW=OFF, INTRAFADAPFILTER=OFF, ABISBETRFBWTHR=0, PNSHARENUM1X=0, PNSHARENUMDO=0, ABISSATTRANSSW=OFF, DATATRFCRCSW=OFF, TODSW=OFF, VIP1XOCCUPYRES=OFF, BTSGRADE=GRADEC, BTSLOCATIONTYPE=LOCATION0, BTSPHYTYPE=MACRO;" ); bts = btsLineInfo.GenerateCdmaBts(); cellLineInfo = new MmlLineInfo( "ADD CELL: BTSID=4, FN=7, CN=3964, SCTIDLST=\"3\", PNLST=\"198\", SID=13832, NID=65535, PZID=1, TYP=EVDO, LCN=3964, LSCTID=\"3\", ASSALWDO=NO, DOAREVRSSICARRASSNSW=OFF, DOAPRVPRIASSSW=OFF, DOMULTIBANDASSIGNSW=OFF, DOUSERCOUNTTHD=20, DOAUTODWNCOUNTTHD=600, DOUNBLKUSERCOUNTTHD=40, LOCATE=URBAN, MICROCELL=NO, STAYMODE=MODE0, BANDCLASSASSIGNSW=OFF, DOBLOADEQUIARISW=OFF;" ); cell = cellLineInfo.GenerateCdmaCell(); }
public static bool Delete(this ICdmaCellRepository repository, int btsId, byte sectorId, string cellType) { CdmaCell _cell = repository.Query(btsId, sectorId, cellType); if (_cell == null) { return(false); } repository.Delete(_cell); return(true); }
public void Test_CdmaCompoundCellView() { var info = new CdmaCell { ETilt = 0.2, MTilt = 0.3, IsOutdoor = false }; var view = info.MapTo <CdmaCompoundCellView>(); view.DownTilt.ShouldBe(0.5); view.Indoor.ShouldBe("室内"); }
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); }
public void TestCdmaCellConstruction_NewCell() { CdmaCell cell = new CdmaCell { BtsId = 1, SectorId = 2, CellId = 255, Frequency1 = -1 }; CdmaCellExcel cellExcelInfo = new CdmaCellExcel { BtsId = 22, SectorId = 2, CellId = 255, Frequency = 37, CellType = "DO" }; cell.Import(cellExcelInfo, false); Assert.IsNotNull(cell); Assert.AreEqual(cell.BtsId, 1); Assert.AreEqual(cell.SectorId, 2); Assert.AreEqual(cell.CellId, 255); Assert.AreEqual(cell.CellType, null); Assert.AreEqual(cell.Frequency1, 37); Assert.IsTrue(cell.HasFrequency(37)); Assert.IsFalse(cell.HasFrequency(78)); Assert.AreEqual(cell.Frequency, 1); Assert.AreEqual(cell.Frequency2, -1); cell = new CdmaCell { BtsId = 1, SectorId = 2, CellId = 255, Frequency1 = -1 }; cell.Import(cellExcelInfo, true); Assert.IsNotNull(cell); Assert.AreEqual(cell.BtsId, 22); Assert.AreEqual(cell.SectorId, 2); Assert.AreEqual(cell.CellId, 255); Assert.AreEqual(cell.CellType, "DO"); Assert.AreEqual(cell.Frequency1, 37); Assert.IsTrue(cell.HasFrequency(37)); Assert.IsFalse(cell.HasFrequency(78)); Assert.AreEqual(cell.Frequency, 1); Assert.AreEqual(cell.Frequency2, -1); }
protected override bool SaveWhenBtsNotExisted() { CdmaCell cell = _repository.Query(_cellInfo.BtsId, _cellInfo.SectorId, _cellInfo.CellType); bool addCell = false; if (cell == null) { cell = new CdmaCell(); addCell = true; } cell.Import(_cellInfo, true); if (addCell) { _repository.Insert(cell); } else { _repository.Update(cell); } return(true); }
public void TestCdmaCellConstruction_SameFirstFrequency() { CdmaCellExcel cellExcelInfo = new CdmaCellExcel { BtsId = 22, SectorId = 2, CellId = 255, Frequency = 37, CellType = "DO" }; using (CdmaCell cell = new CdmaCell { BtsId = 1, SectorId = 2, CellId = 255, Frequency1 = 37, Frequency = 1 }) { cell.Import(cellExcelInfo, true); Assert.IsNotNull(cell); Assert.AreEqual(cell.BtsId, 1); Assert.AreEqual(cell.SectorId, 2); Assert.AreEqual(cell.CellId, 255); Assert.AreEqual(cell.CellType, null); Assert.AreEqual(cell.Frequency1, 37, "f1"); Assert.AreEqual(cell.Frequency, 1); Assert.AreEqual(cell.Frequency2, -1, "f1"); Assert.IsTrue(cell.HasFrequency(37)); Assert.IsFalse(cell.HasFrequency(78)); } using (CdmaCell cell = new CdmaCell { BtsId = 1, SectorId = 2, CellId = 255, Frequency1 = 37, Frequency = 1 }) { CdmaCell.UpdateFirstFrequency = true; cell.Import(cellExcelInfo, true); Assert.IsNotNull(cell); Assert.AreEqual(cell.BtsId, 1); Assert.AreEqual(cell.SectorId, 2); Assert.AreEqual(cell.CellId, 255); Assert.AreEqual(cell.CellType, null); Assert.AreEqual(cell.Frequency1, 37); Assert.AreEqual(cell.Frequency, 1); Assert.AreEqual(cell.Frequency2, -1); Assert.IsTrue(cell.HasFrequency(37)); Assert.IsFalse(cell.HasFrequency(78)); } }
public void Test_NewCell(int btsId, byte sectorId, int cellId, short frequency, string cellType, int overallFrequency, bool updateFrequency) { var cellExcelInfo = new CdmaCellExcel { BtsId = btsId, SectorId = sectorId, CellId = cellId, Frequency = frequency, CellType = cellType, AntennaGain = 12.8 }; var cell = CdmaCell.ConstructItem(cellExcelInfo); Assert.IsNotNull(cell); Assert.AreEqual(cell.BtsId, btsId); Assert.AreEqual(cell.SectorId, sectorId); Assert.AreEqual(cell.CellId, cellId); Assert.AreEqual(cell.CellType, cellType); Assert.AreEqual(cell.AntennaGain, 12.8); Assert.AreEqual(cell.Frequency, overallFrequency, "Wrong overall frequency"); Assert.AreEqual(cell.Frequency2, -1); Assert.AreEqual(cell.Frequency3, -1); Assert.AreEqual(cell.Frequency4, -1); Assert.AreEqual(cell.Frequency5, -1); if (updateFrequency) { Assert.AreEqual(cell.Frequency1, frequency); Assert.IsTrue(cell.HasFrequency(frequency)); } else { Assert.AreEqual(cell.Frequency1, -1); Assert.IsFalse(cell.HasFrequency(frequency)); } }
protected override bool SaveWhenBtsNotExisted() { CdmaCell cell = _repository.Query(_cellInfo.BtsId, _cellInfo.SectorId, _cellInfo.CellType); bool addCell = false; if (cell == null) { cell = new CdmaCell(); addCell = true; } cell.Import(_cellInfo, true); if (addCell) { _repository.Insert(cell); } else { _repository.Update(cell); } return true; }
protected override bool SaveWhenBtsNotExisted() { bool result = true; CdmaCellBase cellBase = _baseRepository.QueryCell(_cellInfo.BtsId, _cellInfo.SectorId, _cellInfo.CellType); if (cellBase == null) { CdmaCell cell = new CdmaCell(); cell.Import(_cellInfo, true); _repository.Insert(cell); } else if (cellBase.Frequency < 0 || !cellBase.HasFrequency(_cellInfo.Frequency)) { CdmaCell cell = _repository.Query(_cellInfo.BtsId, _cellInfo.SectorId, _cellInfo.CellType); if (cell != null) { cell.Import(_cellInfo, true); } } else { result = false; } return result; }
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); }
public void TestCdmaCellConstruction_UpdateFourthFrequency() { ; CdmaCellExcel cellExcelInfo = new CdmaCellExcel { BtsId = 22, SectorId = 2, CellId = 255, Frequency = 160, CellType = "DO" }; using (CdmaCell cell = new CdmaCell { BtsId = 1, SectorId = 2, CellId = 255, Frequency1 = 37, Frequency2 = 78, Frequency3 = 119, Frequency = 7 }) { cell.Import(cellExcelInfo, true); Assert.IsNotNull(cell); Assert.AreEqual(cell.BtsId, 1); Assert.AreEqual(cell.SectorId, 2); Assert.AreEqual(cell.CellId, 255); Assert.AreEqual(cell.CellType, null); Assert.AreEqual(cell.Frequency1, 37, "f1"); Assert.AreEqual(cell.Frequency2, 78, "f1"); Assert.AreEqual(cell.Frequency3, 119); Assert.AreEqual(cell.Frequency4, 160); Assert.AreEqual(cell.Frequency5, -1); Assert.AreEqual(cell.Frequency, 15); Assert.IsTrue(cell.HasFrequency(37)); Assert.IsTrue(cell.HasFrequency(78)); Assert.IsTrue(cell.HasFrequency(119)); Assert.IsTrue(cell.HasFrequency(160)); } using (CdmaCell cell = new CdmaCell { BtsId = 1, SectorId = 2, CellId = 255, Frequency1 = 37, Frequency2 = 78, Frequency3 = 119, Frequency = 7 }) { CdmaCell.UpdateFirstFrequency = true; cell.Import(cellExcelInfo, true); Assert.IsNotNull(cell); Assert.AreEqual(cell.BtsId, 1); Assert.AreEqual(cell.SectorId, 2); Assert.AreEqual(cell.CellId, 255); Assert.AreEqual(cell.CellType, null); Assert.AreEqual(cell.Frequency1, 37); Assert.AreEqual(cell.Frequency2, 78); Assert.AreEqual(cell.Frequency3, 119); Assert.AreEqual(cell.Frequency4, 160); Assert.AreEqual(cell.Frequency5, -1); Assert.AreEqual(cell.Frequency, 15); Assert.IsTrue(cell.HasFrequency(37)); Assert.IsTrue(cell.HasFrequency(78)); Assert.IsTrue(cell.HasFrequency(119)); Assert.IsTrue(cell.HasFrequency(160)); } }