Ejemplo n.º 1
0
        public async Task <bool> DumpOneStationENodeb()
        {
            var stat = ENodebBases.Pop();

            if (stat == null)
            {
                throw new NullReferenceException("stat is null!");
            }
            await _eNodebBaseRepository
            .UpdateOneInUse <IENodebBaseRepository, ENodebBase, ENodebBaseExcel>(stat);

            await _eNodebRepository
            .UpdateOneInUse <IENodebRepository, ENodeb, ENodebBaseExcel, Town>(stat, Towns, excel =>
            {
                if (excel.StationDistrict == "南海")
                {
                    return(excel.StationTown.Replace("金沙", "丹灶").Replace("小塘", "狮山"));
                }
                if (excel.StationDistrict != "禅城" || excel.StationTown == "南庄")
                {
                    return(excel.StationTown);
                }
                return(_stationDictionary.CalculateStationTown(excel));
            }, (info, excel) =>
            {
                var station = _stationDictionary.FirstOrDefault(x => x.StationNum == excel.StationNum);
                if (station == null)
                {
                    return;
                }
                info.Address = station.Address;
                if (string.IsNullOrEmpty(info.PlanNum))
                {
                    info.PlanNum = excel.ProjectSerial;
                }
            }, excel =>
            {
                var candidates = Towns.Select(x => new { x.TownName, x.Id }).ToList();
                var result     = candidates.FirstOrDefault(x => excel.ENodebName.Contains(x.TownName));
                if (result != null)
                {
                    return(result.Id);
                }
                var station = _stationDictionary.FirstOrDefault(x => x.StationNum == excel.StationNum);
                if (station == null)
                {
                    return(-1);
                }
                result = candidates.FirstOrDefault(x =>
                                                   station.ElementName.Contains(x.TownName) || station.Address.Contains(x.TownName));
                if (result != null)
                {
                    return(result.Id);
                }
                return(-1);
            });

            return(true);
        }
Ejemplo n.º 2
0
        public ENodebView GetByStationNum(string stationNum)
        {
            var station =
                _stationDictionaryRepository.FirstOrDefault(x => x.StationNum == stationNum && x.IsRru == false);

            if (station == null)
            {
                return(null);
            }
            var item = _eNodebRepository.FirstOrDefault(x => x.ENodebId == station.ENodebId) ??
                       _eNodebRepository.FirstOrDefault(x => x.PlanNum == station.PlanNum);

            return(GenerateENodebView(item));
        }
Ejemplo n.º 3
0
        public bool UpdateStationPosition(string serialNum, double longtitute, double lattitute, string address)
        {
            var item = _repository.FirstOrDefault(x => x.StationNum == serialNum);

            if (item == null)
            {
                return(false);
            }
            item.Longtitute = longtitute;
            item.Lattitute  = lattitute;
            item.Address    = address;
            _repository.SaveChanges();
            return(true);
        }
        public static string CalculateStationTown(this IStationDictionaryRepository repository, ENodebBaseExcel excel)
        {
            var candidates = new[] { "石湾", "张槎", "祖庙" };

            if (candidates.FirstOrDefault(x => excel.StationTown == x) != null)
            {
                return(excel.StationTown);
            }
            var candidates2 = new[]
            {
                "石湾", "张槎", "祖庙", "朝东", "桂城", "季华", "佛大", "澜石", "同济", "亲仁", "敦厚", "大富", "城西",
                "化纤", "中院", "吴勤"
            };
            var result = candidates2.FirstOrDefault(x => excel.ENodebName.Contains(x));

            if (result != null)
            {
                switch (result)
                {
                case "石湾":
                case "季华":
                case "澜石":
                case "中院":
                    return("石湾");

                case "张槎":
                case "佛大":
                case "大富":
                case "城西":
                    return("张槎");

                default:
                    return("祖庙");
                }
            }
            var station = repository.FirstOrDefault(x => x.StationNum == excel.StationNum);

            if (station == null)
            {
                return(excel.StationTown);
            }
            result = candidates.FirstOrDefault(x =>
                                               station.ElementName.Contains(x) || station.Address.Contains(x));
            return(result ?? excel.StationTown);
        }
Ejemplo n.º 5
0
        public IEnumerable <CellRruView> GetByStationNum(string stationNum)
        {
            var station =
                _stationDictionaryRepository.FirstOrDefault(x => x.StationNum == stationNum);

            if (station == null)
            {
                return(null);
            }
            var item = _eNodebRepository.FirstOrDefault(x => x.ENodebId == station.ENodebId) ??
                       _eNodebRepository.FirstOrDefault(x => x.PlanNum == station.PlanNum);

            if (item == null)
            {
                return(new List <CellRruView>());
            }
            return(GetCellViews(item.ENodebId));
        }