Exemplo n.º 1
0
        public static ENodebView ConstructView(ENodeb eNodeb, IEnumerable <AlarmStat> stats)
        {
            var view = Mapper.Map <ENodeb, ENodebView>(eNodeb);

            view.AlarmTimes = stats.Count(x => x.ENodebId == eNodeb.ENodebId);
            return(view);
        }
        public int SaveENodebs(IEnumerable <CollegeENodebExcel> eNodebExcels, IENodebRepository eNodebRepository)
        {
            int count = 0;

            foreach (CollegeENodebExcel excel in eNodebExcels)
            {
                ENodeb eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == excel.ENodebId);
                if (eNodeb == null)
                {
                    continue;
                }
                InfrastructureInfo infrastructure = _repository.InfrastructureInfos.FirstOrDefault(x =>
                                                                                                   x.HotspotName == excel.CollegeName && x.HotspotType == HotspotType.College &&
                                                                                                   x.InfrastructureType == InfrastructureType.ENodeb && x.InfrastructureId == eNodeb.Id);
                if (infrastructure == null)
                {
                    infrastructure = new InfrastructureInfo
                    {
                        HotspotName        = excel.CollegeName,
                        HotspotType        = HotspotType.College,
                        InfrastructureType = InfrastructureType.ENodeb,
                        InfrastructureId   = eNodeb.Id
                    };
                    _repository.AddOneInfrastructure(infrastructure);
                    _repository.SaveChanges();
                }
                count++;
            }
            return(count);
        }
Exemplo n.º 3
0
        public bool DumpSingleENodebExcel(ENodebExcel info)
        {
            var eNodeb = _eNodebRepository.GetByENodebId(info.ENodebId);

            if (eNodeb == null)
            {
                eNodeb = ENodeb.ConstructENodeb(info, _townRepository);
                var result = _eNodebRepository.Insert(eNodeb);
                if (result == null)
                {
                    return(false);
                }
                var item = BasicImportService.ENodebExcels.FirstOrDefault(x => x.ENodebId == info.ENodebId);
                if (item != null)
                {
                    BasicImportService.ENodebExcels.Remove(item);
                }
                _eNodebRepository.SaveChanges();
                return(true);
            }
            eNodeb.IsInUse = true;
            _eNodebRepository.Update(eNodeb);
            _eNodebRepository.SaveChanges();
            return(true);
        }
 public ByENodebQueryOutdoorCellService(ICellRepository repository, ENodeb eNodeb,
                                        Func <ENodeb, Cell, TOutdoorCell> outdoorCellConstructor)
     : base(repository)
 {
     _eNodeb = eNodeb;
     _outdoorCellConstructor = outdoorCellConstructor;
 }
Exemplo n.º 5
0
        public void Map_Null_Tests()
        {
            ENodeb eNodeb     = null;
            var    eNodebView = eNodeb.MapTo <ENodebView>();

            eNodebView.ShouldBeNull();
        }
Exemplo n.º 6
0
 public void Post(ENodeb eNodeb)
 {
     ENodeb item = _repository.GetAll().FirstOrDefault(x => x.ENodebId == eNodeb.ENodebId);
     if (item != null)
     {
         item.Name = eNodeb.Name;
         item.Address = eNodeb.Address;
     }
 }
Exemplo n.º 7
0
        public void Delete(int id)
        {
            ENodeb eNodeb = _repository.GetAll().FirstOrDefault(x => x.ENodebId == id);

            if (eNodeb != null)
            {
                _repository.Delete(eNodeb);
            }
        }
Exemplo n.º 8
0
        public void Map_ENodebId_Test()
        {
            var eNodeb = new ENodeb {
                ENodebId = 22
            };
            var eNodebView = eNodeb.MapTo <ENodebView>();

            eNodebView.ShouldNotBeNull();
            eNodebView.ENodebId.ShouldBe(22);
        }
Exemplo n.º 9
0
 public void TestEvaluationOutdoorCell()
 {
     ENodeb eNodeb = new ENodeb { Name = "OMG" };
     EvaluationOutdoorCell eodCell = new EvaluationOutdoorCell(eNodeb, cell);
     Assert.IsNotNull(eodCell);
     Assert.AreEqual(eodCell.Height, 1);
     Assert.AreEqual(eodCell.Lattitute, 6);
     Assert.AreEqual(eodCell.Pci, 11);
     Assert.AreEqual(eodCell.CellName, "OMG-9");
 }
Exemplo n.º 10
0
 private void Initialize()
 {
     eNodeb = new ENodeb
     {
         Name     = "eNodeb",
         ENodebId = 2,
         Address  = "address 2",
         TownId   = 10
     };
 }
Exemplo n.º 11
0
        public void Map_Name_Test()
        {
            var eNodeb = new ENodeb {
                Name = "abcde"
            };
            var eNodebView = eNodeb.MapTo <ENodebView>();

            eNodebView.ShouldNotBeNull();
            eNodebView.Name.ShouldBe("abcde");
        }
Exemplo n.º 12
0
        public void Post(ENodeb eNodeb)
        {
            ENodeb item = _repository.GetAll().FirstOrDefault(x => x.ENodebId == eNodeb.ENodebId);

            if (item != null)
            {
                item.Name    = eNodeb.Name;
                item.Address = eNodeb.Address;
            }
        }
Exemplo n.º 13
0
 private void Initialize()
 {
     eNodeb = new ENodeb
     {
         Name = "eNodeb",
         ENodebId = 2,
         Address = "address 2",
         TownId = 10
     };
 }
Exemplo n.º 14
0
        public IEnumerable <SectorTriangle> Get(int id)
        {
            ENodeb eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == id);
            IQueryOutdoorCellsService <EvaluationOutdoorCell> service
                = new ByENodebQueryOutdoorCellService <EvaluationOutdoorCell>(
                      cellRepository, eNodeb, (c, e) => new EvaluationOutdoorCell(c, e));
            List <EvaluationOutdoorCell> outdoorCells = service.Query();

            return(outdoorCells.GetSectors());
        }
Exemplo n.º 15
0
 public static void ShouldBe(this ENodeb eNodeb, string name, string address, int townId, int eNodebId,
                             string gatewayAddress, string ipAddress)
 {
     eNodeb.Name.ShouldBe(name);
     eNodeb.Address.ShouldBe(address);
     eNodeb.TownId.ShouldBe(townId);
     eNodeb.ENodebId.ShouldBe(eNodebId);
     eNodeb.GatewayIp.AddressString.ShouldBe(gatewayAddress);
     eNodeb.Ip.AddressString.ShouldBe(ipAddress);
 }
Exemplo n.º 16
0
        public void TestInitialize_RemoveFirstENodeb()
        {
            Assert.AreEqual(eNodebRepository.Object.Count(), 7);
            ENodeb item = eNodebRepository.Object.GetAll().ElementAt(0);

            eNodebRepository.Object.Delete(item);
            IEnumerable <ENodeb> items = eNodebRepository.Object.GetAll();

            Assert.AreEqual(items.Count(), 6);
            Assert.AreEqual(eNodebRepository.Object.Count(), 6);
        }
Exemplo n.º 17
0
        public void Test_Module_Map_ENodebView()
        {
            var eNodeb = new ENodeb
            {
                ENodebId = 1,
                Factory  = "Huawei"
            };
            var view = eNodeb.MapTo <ENodebView>();

            view.ENodebId.ShouldBe(1);
            view.Factory.ShouldBe("Huawei");
        }
Exemplo n.º 18
0
        private ENodebView GenerateENodebView(ENodeb item)
        {
            if (item == null)
            {
                return(null);
            }
            var town   = _townRepository.Get(item.TownId);
            var result = item.MapTo <ENodebView>();

            town.MapTo(result);
            return(result);
        }
Exemplo n.º 19
0
        public void TestEvaluationOutdoorCell()
        {
            ENodeb eNodeb = new ENodeb {
                Name = "OMG"
            };
            EvaluationOutdoorCell eodCell = new EvaluationOutdoorCell(eNodeb, cell);

            Assert.IsNotNull(eodCell);
            Assert.AreEqual(eodCell.Height, 1);
            Assert.AreEqual(eodCell.Lattitute, 6);
            Assert.AreEqual(eodCell.Pci, 11);
            Assert.AreEqual(eodCell.CellName, "OMG-9");
        }
        public void TestENodebRepository_QueryENodebByTownIdAndName()
        {
            ENodeb eNodeb =
                lteRepository.Object.GetAll().FirstOrDefault(x => x.TownId == 122 && x.Name == "FoshanZhaoming");

            Assert.IsNotNull(eNodeb);
            Assert.AreEqual(eNodeb.ENodebId, 1);
            Assert.AreEqual(eNodeb.GatewayIp.AddressString, "10.17.165.100");
            Assert.AreEqual(eNodeb.Ip.AddressString, "10.17.165.23");
            Assert.IsTrue(eNodeb.IsFdd);
            Assert.AreEqual(eNodeb.Longtitute, 112.9987);
            Assert.AreEqual(eNodeb.Lattitute, 23.1233);
        }
Exemplo n.º 21
0
        public static ENodebView ConstructView(ENodeb item, ITownRepository townRepository)
        {
            var town = townRepository.FirstOrDefault(x => x.Id == item.TownId);
            var view = item.MapTo <ENodebView>();

            if (town != null)
            {
                view.CityName     = town.CityName;
                view.DistrictName = town.DistrictName;
                view.TownName     = town.TownName;
            }
            return(view);
        }
Exemplo n.º 22
0
 public DeleteOneENodebService(IENodebRepository repository, ITownRepository townRepository,
                               string cityName, string districtName, string townName, string eNodebName)
     : this(repository)
 {
     if (townRepository == null)
     {
         _eNodeb = null;
     }
     else
     {
         int townId = townRepository.GetAll().QueryId(cityName, districtName, townName);
         _eNodeb = repository.GetAll().FirstOrDefault(x => x.TownId == townId && x.Name == eNodebName);
     }
 }
Exemplo n.º 23
0
 public DeleteOneENodebService(IENodebRepository repository, ITownRepository townRepository,
     string cityName, string districtName, string townName, string eNodebName)
     : this(repository)
 {
     if (townRepository == null)
     {
         _eNodeb = null;
     }
     else
     {
         int townId = townRepository.GetAll().QueryId(cityName, districtName, townName);
         _eNodeb = repository.GetAll().FirstOrDefault(x => x.TownId == townId && x.Name == eNodebName);
     }
 }
Exemplo n.º 24
0
        public void Save(IEnumerable <ENodebExcel> eNodebInfoList, bool update)
        {
            IEnumerable <ENodebExcel> validInfos =
                eNodebInfoList.Where(x => infoFilter(x))
                .Distinct(new ENodebExcelComparer())
                .Distinct(new ENodebExcelNameComparer());

            foreach (ENodebExcel info in validInfos)
            {
                int        townId = _townList.QueryId(info);
                ENodebBase existedENodebWithSameName = _baseRepository.QueryENodeb(townId, info.Name);
                ENodebBase existedENodebWithSameId   = _baseRepository.QueryENodeb(info.ENodebId);
                if (existedENodebWithSameName == null && existedENodebWithSameId == null)
                {
                    ENodeb eNodeb = new ENodeb();
                    eNodeb.Import(info, townId);
                    _repository.Insert(eNodeb);
                    _infrastructure.ENodebInserted++;
                }
                if (!update)
                {
                    continue;
                }
                if (existedENodebWithSameId != null)
                {
                    ENodeb byIdENodeb = _repository.GetAll().FirstOrDefault(x => x.ENodebId == info.ENodebId);
                    if (byIdENodeb != null)
                    {
                        byIdENodeb.Import(info, townId, false);
                        _repository.Update(byIdENodeb);
                        _infrastructure.ENodebsUpdated++;
                    }
                }
                else if (existedENodebWithSameName != null)
                {
                    ENodeb byNameENodeb =
                        _repository.GetAll().FirstOrDefault(x => x.TownId == townId && x.Name == info.Name);
                    if (byNameENodeb != null)
                    {
                        byNameENodeb.Import(info, townId);
                        _repository.Update(byNameENodeb);
                        _infrastructure.ENodebsUpdated++;
                    }
                }
            }
        }
Exemplo n.º 25
0
        public ActionResult UpdateENodebInfo(ENodeb item)
        {
            ENodeb eNodeb = _eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == item.ENodebId);

            if (eNodeb == null)
            {
                return(View("ENodebEdit", new ENodebDetailsViewModel()));
            }
            eNodeb.Address = item.Address;
            eNodeb.Name    = item.Name;
            eNodeb.Factory = item.Factory;
            ENodebDetailsViewModel viewModel = new ENodebDetailsViewModel();

            viewModel.Import(eNodeb.ENodebId, _eNodebRepository, _cellRepository, _btsRepository, _cdmaCellRepository,
                             _photoRepository);
            return(View("ENodebEdit", viewModel));
        }
Exemplo n.º 26
0
        private ENodebView GenerateENodebView(ENodeb item)
        {
            if (item == null)
            {
                return(null);
            }
            var town = _townRepository.FirstOrDefault(x => x.Id == item.TownId);

            if (town != null)
            {
                var result = town.MapTo <ENodebView>();
                return(item.MapTo(result));
            }
            else
            {
                return(item.MapTo <ENodebView>());
            }
        }
Exemplo n.º 27
0
        public void Save(IEnumerable<ENodebExcel> eNodebInfoList, bool update)
        {
            IEnumerable<ENodebExcel> validInfos =
                eNodebInfoList.Where(x => infoFilter(x))
                .Distinct(new ENodebExcelComparer())
                .Distinct(new ENodebExcelNameComparer());

            foreach (ENodebExcel info in validInfos)
            {
                int townId = _townList.QueryId(info);
                ENodebBase existedENodebWithSameName = _baseRepository.QueryENodeb(townId, info.Name);
                ENodebBase existedENodebWithSameId = _baseRepository.QueryENodeb(info.ENodebId);
                if (existedENodebWithSameName == null && existedENodebWithSameId == null)
                {
                    ENodeb eNodeb = new ENodeb();
                    eNodeb.Import(info, townId);
                    _repository.Insert(eNodeb);
                    _infrastructure.ENodebInserted++;
                }
                if (!update) continue;
                if (existedENodebWithSameId != null)
                {
                    ENodeb byIdENodeb = _repository.GetAll().FirstOrDefault(x => x.ENodebId == info.ENodebId);
                    if (byIdENodeb != null)
                    {
                        byIdENodeb.Import(info, townId, false);
                        _repository.Update(byIdENodeb);
                        _infrastructure.ENodebsUpdated++;
                    }
                }
                else if (existedENodebWithSameName != null)
                {
                    ENodeb byNameENodeb =
                        _repository.GetAll().FirstOrDefault(x => x.TownId == townId && x.Name == info.Name);
                    if (byNameENodeb != null)
                    {
                        byNameENodeb.Import(info, townId);
                        _repository.Update(byNameENodeb);
                        _infrastructure.ENodebsUpdated++;
                    }
                }
            }
        }
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
 public void Put(ENodeb eNodeb)
 {
     _repository.Insert(eNodeb);
 }
Exemplo n.º 31
0
 public void Test_Module_Map_ENodebView()
 {
     var eNodeb = new ENodeb
     {
         ENodebId = 1,
         Factory = "Huawei"
     };
     var view = eNodeb.MapTo<ENodebView>();
     view.ENodebId.ShouldBe(1);
     view.Factory.ShouldBe("Huawei");
 }
Exemplo n.º 32
0
 public DeleteOneENodebService(IENodebRepository repository, int townId, string eNodebName)
     : this(repository)
 {
     _eNodeb = repository.GetAll().FirstOrDefault(x => x.TownId == townId && x.Name == eNodebName);
 }
Exemplo n.º 33
0
 public DeleteOneENodebService(IENodebRepository repository, int eNodebId)
     : this(repository)
 {
     _eNodeb = repository.GetAll().FirstOrDefault(x => x.ENodebId == eNodebId);
 }
Exemplo n.º 34
0
 public bool RemoveOneENodeb(ENodeb eNodeb)
 {
     return true;
 }
Exemplo n.º 35
0
 public void AddOneENodeb(ENodeb eNodeb)
 {
     CurrentProgress += 10;
 }
 public bool RemoveOneENodeb(ENodeb eNodeb)
 {
     return(true);
 }
Exemplo n.º 37
0
 public void Map_Name_Test()
 {
     var eNodeb = new ENodeb { Name = "abcde" };
     var eNodebView = eNodeb.MapTo<ENodebView>();
     eNodebView.ShouldNotBeNull();
     eNodebView.Name.ShouldBe("abcde");
 }
Exemplo n.º 38
0
 public SimpleSaveOneCellService(ICellRepository repository,
                                 CellExcel cellInfo, IENodebRepository eNodebRepository)
     : base(repository, cellInfo)
 {
     _eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == cellInfo.ENodebId);
 }
Exemplo n.º 39
0
 public ActionResult UpdateENodebInfo(ENodeb item)
 {
     ENodeb eNodeb = _eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == item.ENodebId);
     if (eNodeb == null) return View("ENodebEdit", new ENodebDetailsViewModel());
     eNodeb.Address = item.Address;
     eNodeb.Name = item.Name;
     eNodeb.Factory = item.Factory;
     ENodebDetailsViewModel viewModel = new ENodebDetailsViewModel();
     viewModel.Import(eNodeb.ENodebId, _eNodebRepository, _cellRepository, _btsRepository, _cdmaCellRepository,
         _photoRepository);
     return View("ENodebEdit",viewModel);
 }
Exemplo n.º 40
0
 public ByENodebQuickSaveOneCellService(ICellRepository repository, CellBaseRepository baseRepository,
                                        CellExcel cellInfo, IENodebRepository eNodebRepository, bool updateExisted = false)
     : base(repository, cellInfo, baseRepository, updateExisted)
 {
     _eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == cellInfo.ENodebId);
 }
 public void AddOneENodeb(ENodeb eNodeb)
 {
     CurrentProgress += 10;
 }
Exemplo n.º 42
0
 public void Put(ENodeb eNodeb)
 {
     _repository.Insert(eNodeb);
 }
Exemplo n.º 43
0
 public DeleteOneENodebService(IENodebRepository repository, int townId, string eNodebName)
     : this(repository)
 {
     _eNodeb = repository.GetAll().FirstOrDefault(x => x.TownId == townId && x.Name == eNodebName);
 }
Exemplo n.º 44
0
 public void Map_ENodebId_Test()
 {
     var eNodeb = new ENodeb { ENodebId = 22 };
     var eNodebView = eNodeb.MapTo<ENodebView>();
     eNodebView.ShouldNotBeNull();
     eNodebView.ENodebId.ShouldBe(22);
 }
Exemplo n.º 45
0
 public SimpleSaveOneCellService(ICellRepository repository,
     CellExcel cellInfo, IENodebRepository eNodebRepository)
     : base(repository, cellInfo)
 {
     _eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == cellInfo.ENodebId);
 }
Exemplo n.º 46
0
 public ByENodebQuickSaveOneCellService(ICellRepository repository, CellBaseRepository baseRepository,
     CellExcel cellInfo, IENodebRepository eNodebRepository, bool updateExisted = false)
     : base(repository, cellInfo, baseRepository, updateExisted)
 {
     _eNodeb = eNodebRepository.GetAll().FirstOrDefault(x => x.ENodebId == cellInfo.ENodebId);
 }