예제 #1
0
 public void TestImportENodeb_Original()
 {
     eNodeb.Import(eNodebInfo);
     Assert.AreEqual(eNodeb.ENodebId, 1);
     Assert.AreEqual(eNodeb.Name, "First eNodeb");
     Assert.AreEqual(eNodeb.Factory, "Huawei");
     Assert.AreEqual(eNodeb.GatewayIp.AddressString, "10.17.165.100");
     Assert.AreEqual(eNodeb.Ip.AddressString, "10.17.165.121");
 }
예제 #2
0
 public void Test_Default()
 {
     Initialize();
     eNodeb.Import(eNodebExcel);
     Assert.AreEqual(eNodeb.Name, "eNodeb-excel");
     Assert.AreEqual(eNodeb.ENodebId, 1);
     Assert.AreEqual(eNodeb.Address, "address 1");
     Assert.AreEqual(eNodeb.TownId, -1);
 }
예제 #3
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++;
                    }
                }
            }
        }
예제 #4
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++;
                    }
                }
            }
        }