Exemplo n.º 1
0
        protected override void Initialize()
        {
            CdmaBts bts = new CdmaBts
            {
                BtsId      = 1,
                Name       = "FoshanZhaoming",
                Address    = "FenjiangZhonglu",
                TownId     = 122,
                Longtitute = 112.9987,
                Lattitute  = 23.1233
            };

            repository.Setup(x => x.GetAll()).Returns(new List <CdmaBts>
            {
                bts
            }.AsQueryable());
            repository.Setup(x => x.GetAllList()).Returns(repository.Object.GetAll().ToList());
            repository.Setup(x => x.Count()).Returns(repository.Object.GetAll().Count());
            repository.Setup(x => x.FirstOrDefault(It.IsAny <Expression <Func <CdmaBts, bool> > >()))
            .Returns <Func <CdmaBts, bool> >(Predicate =>
            {
                IEnumerable <CdmaBts> btss = repository.Object.GetAll();
                return(btss.FirstOrDefault(Predicate));
            });
            base.Initialize();
            repository.MockBtsRepositorySaveBts();
            repository.MockBtsRepositoryDeleteBts();
        }
Exemplo n.º 2
0
        public bool DumpSingleBtsExcel(BtsExcel info)
        {
            var bts = CdmaBts.ConstructBts(info, _townRepository);

            if (bts == null)
            {
                bts = CdmaBts.ConstructBts(info, _townRepository);
                var result = _btsRepository.Insert(bts);
                if (result == null)
                {
                    return(false);
                }
                var item = BasicImportService.BtsExcels.FirstOrDefault(x => x.BtsId == info.BtsId);
                if (item != null)
                {
                    BasicImportService.BtsExcels.Remove(item);
                }
                _btsRepository.SaveChanges();
                return(true);
            }
            bts.IsInUse = true;
            _btsRepository.Update(bts);
            _btsRepository.SaveChanges();
            return(true);
        }
Exemplo n.º 3
0
        public bool SaveOneBts(BtsExcel btsInfo, bool updateBts)
        {
            ENodebBase eNodebBase = _baseRepository.QueryENodeb(btsInfo.BtsId);

            CdmaBts bts;

            if (eNodebBase == null)
            {
                bts        = new CdmaBts();
                bts.TownId = _townId;
                bts.Import(btsInfo, true);
                bts.ImportLteInfo(_eNodebList);
                _repository.Insert(bts);
                return(true);
            }
            if (!updateBts)
            {
                return(false);
            }
            bts = _repository.GetAll().FirstOrDefault(x => x.BtsId == btsInfo.BtsId);
            if (bts != null)
            {
                bts.TownId = _townId;
                bts.Import(btsInfo, false);
                bts.ImportLteInfo(_eNodebList);
                _repository.Update(bts);
            }
            return(true);
        }
Exemplo n.º 4
0
 protected override void Initialize()
 {
     CdmaBts bts = new CdmaBts
     {
         BtsId = 1,
         Name = "FoshanZhaoming",
         Address = "FenjiangZhonglu",
         TownId = 122,
         Longtitute = 112.9987,
         Lattitute = 23.1233
     };
     repository.Setup(x => x.GetAll()).Returns(new List<CdmaBts>
     {
         bts
     }.AsQueryable());
     repository.SynchronizeValues<CdmaBts, IBtsRepository>();
     repository.Setup(x => x.FirstOrDefault(It.IsAny<Expression<Func<CdmaBts, bool>>>()))
         .Returns<Func<CdmaBts, bool>>(Predicate =>
     {
         IEnumerable<CdmaBts> btss = repository.Object.GetAll();
         return btss.FirstOrDefault(Predicate);
     });
     base.Initialize();
     repository.MockRepositorySaveItems<CdmaBts, IBtsRepository>();
     repository.MockRepositoryDeleteItems<CdmaBts, IBtsRepository>();
 }
Exemplo n.º 5
0
 public ByBtsQuickSaveOneCdmaCellService(ICdmaCellRepository repository,
     CdmaCellBaseRepository baseRepository,
     CdmaCellExcel cellInfo, IBtsRepository btsRepository)
     : base(repository, baseRepository, cellInfo)
 {
     _bts = btsRepository.GetAll().FirstOrDefault(x => x.BtsId == cellInfo.BtsId);
 }
 public ByBtsQuickSaveOneCdmaCellService(ICdmaCellRepository repository,
                                         CdmaCellBaseRepository baseRepository,
                                         CdmaCellExcel cellInfo, IBtsRepository btsRepository)
     : base(repository, baseRepository, cellInfo)
 {
     _bts = btsRepository.GetAll().FirstOrDefault(x => x.BtsId == cellInfo.BtsId);
 }
Exemplo n.º 7
0
        public void Map_Null_Tests()
        {
            CdmaBts bts     = null;
            var     btsView = bts.MapTo <CdmaBtsView>();

            btsView.ShouldBeNull();
        }
        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);
        }
Exemplo n.º 9
0
        public bool SaveOneBts(BtsExcel btsInfo, bool updateBts)
        {
            ENodebBase eNodebBase = _baseRepository.QueryENodeb(btsInfo.BtsId);

            CdmaBts bts;
            if (eNodebBase == null)
            {
                bts = new CdmaBts();
                bts.TownId = _townId;
                bts.Import(btsInfo, true);
                bts.ImportLteInfo(_eNodebList);
                _repository.Insert(bts);
                return true;
            }
            if (!updateBts) return false;
            bts = _repository.GetAll().FirstOrDefault(x => x.BtsId == btsInfo.BtsId);
            if (bts != null)
            {
                bts.TownId = _townId;
                bts.Import(btsInfo, false);
                bts.ImportLteInfo(_eNodebList);
                _repository.Update(bts);
            }
            return true;
        }
Exemplo n.º 10
0
        public void Map_Address_Test()
        {
            var bts = new CdmaBts {
                Address = "oqwufjoiwofui"
            };
            var btsView = bts.MapTo <CdmaBtsView>();

            btsView.Address.ShouldBe("oqwufjoiwofui");
        }
Exemplo n.º 11
0
        public void Delete(int id)
        {
            CdmaBts bts = _repository.GetAll().FirstOrDefault(x => x.ENodebId == id);

            if (bts != null)
            {
                _repository.Delete(bts);
            }
        }
Exemplo n.º 12
0
        public void Map_BtsId_Test()
        {
            var bts = new CdmaBts {
                BtsId = 23
            };
            var btsView = bts.MapTo <CdmaBtsView>();

            btsView.BtsId.ShouldBe(23);
        }
 private void AssertElements(CdmaBts bts, BtsExcel btsExcel)
 {
     Assert.AreEqual(bts.TownId,
                     GetMatchedTownId(btsExcel, townRepository.GetAll().ElementAt(0)));
     Assert.AreEqual(bts.Name, btsExcel.Name);
     Assert.AreEqual(bts.Longtitute, btsExcel.Longtitute);
     Assert.AreEqual(bts.Lattitute, btsExcel.Lattitute);
     Assert.AreEqual(bts.BtsId, btsExcel.BtsId);
 }
Exemplo n.º 14
0
        public void TestBtsRepository_QueryBtsByTownIdAndName()
        {
            CdmaBts bts = repository.Object.QueryBts(122, "FoshanZhaoming");

            Assert.IsNotNull(bts);
            Assert.AreEqual(bts.BtsId, 1);
            Assert.AreEqual(bts.Longtitute, 112.9987);
            Assert.AreEqual(bts.Lattitute, 23.1233);
        }
Exemplo n.º 15
0
 public static void ShouldBe(this CdmaBts bts, string name, string address, int townId, int btsId,
                             double longtitute, double lattitute)
 {
     bts.Name.ShouldBe(name);
     bts.Address.ShouldBe(address);
     bts.TownId.ShouldBe(townId);
     bts.BtsId.ShouldBe(btsId);
     bts.Longtitute.ShouldBe(longtitute);
     bts.Lattitute.ShouldBe(lattitute);
 }
Exemplo n.º 16
0
        public void TestBtsRepository_QueryBtsById()
        {
            CdmaBts bts = repository.Object.GetAll().FirstOrDefault(x => x.BtsId == 1);

            Assert.IsNotNull(bts);
            Assert.AreEqual(bts.Name, "FoshanZhaoming");
            Assert.AreEqual(bts.TownId, 122);
            Assert.AreEqual(bts.Longtitute, 112.9987);
            Assert.AreEqual(bts.Lattitute, 23.1233);
        }
Exemplo n.º 17
0
 public void Post(CdmaBts bts)
 {
     CdmaBts item = _repository.GetAll().FirstOrDefault(x => x.ENodebId == bts.ENodebId);
     if (item != null)
     {
         item.Name = bts.Name;
         item.Address = bts.Address;
         _repository.Update(item);
     }
 }
Exemplo n.º 18
0
        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);
        }
Exemplo n.º 19
0
        public void Post(CdmaBts bts)
        {
            CdmaBts item = _repository.GetAll().FirstOrDefault(x => x.ENodebId == bts.ENodebId);

            if (item != null)
            {
                item.Name    = bts.Name;
                item.Address = bts.Address;
                _repository.Update(item);
            }
        }
Exemplo n.º 20
0
 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();
 }
Exemplo n.º 21
0
 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();
 }
Exemplo n.º 22
0
        public void Test_Module_Map_CdmaBtsView()
        {
            var bts = new CdmaBts
            {
                BtsId   = 1,
                Address = "Pussy Cat's house"
            };
            var view = bts.MapTo <CdmaBtsView>();

            view.BtsId.ShouldBe(1);
            view.Address.ShouldBe("Pussy Cat's house");
        }
Exemplo n.º 23
0
        public static bool DeleteOneBts(this IBtsRepository repository, ITownRepository townRepository,
                                        string districtName, string townName, string btsName)
        {
            int     townId = townRepository.GetAllList().QueryId(districtName, townName);
            CdmaBts bts    = repository.QueryBts(townId, btsName);

            if (bts == null)
            {
                return(false);
            }
            repository.Delete(bts);
            return(true);
        }
 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);
     }
 }
Exemplo n.º 25
0
        public void TestBtsRepository_DeleteBts_ByBtsId()
        {
            Assert.AreEqual(repository.Object.Count(), 1);
            IEnumerable <CdmaBts> btss = repository.Object.GetAll();

            Assert.AreEqual(btss.Count(), 1);
            CdmaBts bts = repository.Object.GetAll().FirstOrDefault(x => x.BtsId == 1);

            Assert.IsNotNull(bts);
            Assert.IsTrue(repository.Object.DeleteOneBts(1), "Delete Failed");
            Assert.AreEqual(repository.Object.Count(), 0);
            bts = repository.Object.GetAll().FirstOrDefault(x => x.BtsId == 1);
            Assert.IsNull(bts);
            Assert.IsFalse(repository.Object.DeleteOneBts(1), "Delete Success");
        }
Exemplo n.º 26
0
        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));
        }
Exemplo n.º 27
0
        public bool SaveOneBts(BtsExcel btsInfo, bool updateBts)
        {
            _townId = _townRepository.GetAll().QueryId(btsInfo.DistrictName, btsInfo.TownName);
            string  name = btsInfo.Name;
            CdmaBts bts  = _repository.QueryBts(_townId, name);
            CdmaBts existedENodebWithSameId = _repository.GetAll().FirstOrDefault(x => x.BtsId == btsInfo.BtsId);
            bool    addENodeb = false;

            if (bts == null)
            {
                bts = existedENodebWithSameId;
                if (bts == null)
                {
                    bts       = new CdmaBts();
                    addENodeb = true;
                }
            }
            else if (bts != existedENodebWithSameId)
            {
                return(false);
            }

            if (addENodeb)
            {
                bts.TownId = _townId;
                bts.Import(btsInfo, true);
                _repository.Insert(bts);
            }
            else if (updateBts)
            {
                const double tolerance = 1E-6;
                if (Math.Abs(bts.Longtitute) < tolerance && Math.Abs(bts.Lattitute) < tolerance)
                {
                    bts.TownId = _townId;
                    bts.Import(btsInfo, false);
                    _repository.Update(bts);
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }
Exemplo n.º 28
0
        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();
        }
Exemplo n.º 29
0
        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);
        }
Exemplo n.º 30
0
 private void AssertElements(CdmaBts bts, BtsExcel btsExcel)
 {
     Assert.AreEqual(bts.TownId,
         GetMatchedTownId(btsExcel, townRepository.GetAll().ElementAt(0)));
     Assert.AreEqual(bts.Name, btsExcel.Name);
     Assert.AreEqual(bts.Longtitute, btsExcel.Longtitute);
     Assert.AreEqual(bts.Lattitute, btsExcel.Lattitute);
     Assert.AreEqual(bts.BtsId, btsExcel.BtsId);
 }
Exemplo n.º 31
0
 public void Put(CdmaBts bts)
 {
     _repository.Insert(bts);
 }
Exemplo n.º 32
0
 public void Test_Module_Map_CdmaBtsView()
 {
     var bts = new CdmaBts
     {
         BtsId = 1,
         Address = "Pussy Cat's house"
     };
     var view = bts.MapTo<CdmaBtsView>();
     view.BtsId.ShouldBe(1);
     view.Address.ShouldBe("Pussy Cat's house");
 }
Exemplo n.º 33
0
 public void Map_BtsId_Test()
 {
     var bts = new CdmaBts { BtsId = 23 };
     var btsView = bts.MapTo<CdmaBtsView>();
     btsView.BtsId.ShouldBe(23);
 }
Exemplo n.º 34
0
 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);
 }
Exemplo n.º 35
0
 public void Map_Address_Test()
 {
     var bts = new CdmaBts { Address = "oqwufjoiwofui" };
     var btsView = bts.MapTo<CdmaBtsView>();
     btsView.Address.ShouldBe("oqwufjoiwofui");
 }
 public ByBtsQueryOutdoorCellService(ICdmaCellRepository repository, CdmaBts bts)
     : base(repository)
 {
     _bts = bts;
 }
Exemplo n.º 37
0
 public void Put(CdmaBts bts)
 {
     _repository.Insert(bts);
 }
Exemplo n.º 38
0
        public bool SaveOneBts(BtsExcel btsInfo, bool updateBts)
        {
            _townId = _townRepository.GetAll().QueryId(btsInfo.DistrictName, btsInfo.TownName);
            string name = btsInfo.Name;
            CdmaBts bts = _repository.QueryBts(_townId, name);
            CdmaBts existedENodebWithSameId = _repository.GetAll().FirstOrDefault(x => x.BtsId == btsInfo.BtsId);
            bool addENodeb = false;

            if (bts == null)
            {
                bts = existedENodebWithSameId;
                if (bts == null)
                {
                    bts = new CdmaBts();
                    addENodeb = true;
                }
            }
            else if (bts != existedENodebWithSameId) { return false; }

            if (addENodeb)
            {
                bts.TownId = _townId;
                bts.Import(btsInfo, true);
                _repository.Insert(bts);
            }
            else if (updateBts)
            {
                const double tolerance = 1E-6;
                if (Math.Abs(bts.Longtitute) < tolerance && Math.Abs(bts.Lattitute) < tolerance)
                {
                    bts.TownId = _townId;
                    bts.Import(btsInfo, false);
                    _repository.Update(bts);
                }
                else
                { return false; }
            }
            return true;
        }