예제 #1
0
        public VipDemandDto QuerySingle(string serialNumber)
        {
            var result =
                Mapper.Map <VipDemand, VipDemandDto>(_repository.FirstOrDefault(x => x.SerialNumber == serialNumber));
            var town = _townRepository.Get(result.TownId);

            if (town != null)
            {
                result.District = town.DistrictName;
                result.Town     = town.TownName;
            }
            return(result);
        }
예제 #2
0
        public List <OnlineSustainDto> QueryList(DateTime begin, DateTime end)
        {
            var items = _repository.GetAllList(begin, end);
            var views = items.MapTo <List <OnlineSustainDto> >();

            views.ForEach(x =>
            {
                var town   = _townRepository.Get(x.TownId);
                x.City     = town?.CityName;
                x.District = town?.DistrictName;
                x.Town     = town?.TownName;
            });
            return(views);
        }
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var town = await _townRepository.Get(id.Value);

            if (town == null)
            {
                return(NotFound());
            }
            return(View(town));
        }
예제 #4
0
        public Tuple <string, string, string> GetTownNamesByENodebId(int eNodebId)
        {
            var item = _eNodebRepository.GetByENodebId(eNodebId);
            var town = item == null ? null : _townRepository.Get(item.TownId);

            return(town == null
                ? null
                : new Tuple <string, string, string>(town.CityName, town.DistrictName, town.TownName));
        }
예제 #5
0
        public Tuple <string, string, string> GetTownNamesByENodebId(int eNodebId)
        {
            var item = _eNodebRepository.FirstOrDefault(x => x.ENodebId == eNodebId);
            var town = item == null ? null : _repository.Get(item.TownId);

            return(town == null
                ? null
                : new Tuple <string, string, string>(town.CityName, town.DistrictName, town.TownName));
        }
예제 #6
0
        public static TownPreciseView ConstructView(TownPreciseCoverage4GStat stat, ITownRepository repository)
        {
            var town = stat.TownId == -1 ? null : repository.Get(stat.TownId);
            var view = Mapper.Map <TownPreciseCoverage4GStat, TownPreciseView>(stat);

            view.City     = town?.CityName;
            view.District = town?.DistrictName;
            view.Town     = town?.TownName;
            return(view);
        }
예제 #7
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);
        }
예제 #8
0
        public static TView ConstructView <TStat, TView>(this TStat stat, ITownRepository repository)
            where TStat : ITownId
            where TView : ICityDistrictTown
        {
            var town = stat.TownId == -1 ? null : repository.Get(stat.TownId);
            var view = Mapper.Map <TStat, TView>(stat);

            view.City     = town?.CityName;
            view.District = town?.DistrictName;
            view.Town     = town?.TownName;
            return(view);
        }
예제 #9
0
        public ENodebListViewModel(IENodebRepository eNodebRepository, ITownRepository townRepository,
                                   int townId, int page, int pageSize = 10)
        {
            if (townId != _townId)
            {
                ParametersContainer.QueryENodebs
                        = eNodebRepository.GetAll().Where(x => x.TownId == townId).OrderBy(p => p.Id).ToList();
                _townId = townId;
                Town town = townRepository.Get(TownId);
                _infoTitle = (town == null) ? "" :
                             town.CityName + town.DistrictName + town.TownName + "基站列表";
            }

            this.SetItems(page, pageSize);
        }
예제 #10
0
        public CdmaBtsView GetByBtsId(int btsId)
        {
            var item = _btsRepository.GetByBtsId(btsId);

            if (item == null)
            {
                return(null);
            }
            var view = item.MapTo <CdmaBtsView>();
            var town = _townRepository.Get(item.TownId);

            view.DistrictName = town.DistrictName;
            view.TownName     = town.TownName;
            return(view);
        }
예제 #11
0
        public int UpdateLastDate(DateTime testDate, string networkType, int townId)
        {
            var town = _townRepository.Get(townId);

            if (town == null)
            {
                return(0);
            }
            var item = _repository.FirstOrDefault(x => x.Area == town.TownName);

            if (item == null)
            {
                return(0);
            }
            switch (networkType)
            {
            case "2G":
                if (testDate > item.LatestDate2G)
                {
                    item.LatestDate2G = testDate;
                }
                break;

            case "3G":
                if (testDate > item.LatestDate3G)
                {
                    item.LatestDate3G = testDate;
                }
                break;

            case "4G":
                if (testDate > item.LatestDate4G)
                {
                    item.LatestDate4G = testDate;
                }
                break;

            default:
                if (testDate > item.LatestDateVolte)
                {
                    item.LatestDateVolte = testDate;
                }
                break;
            }
            return(_repository.SaveChanges());
        }
예제 #12
0
        public IEnumerable <PlanningSiteView> QueryPlanningSiteViews(double west, double east, double south, double north)
        {
            var sites =
                _planningSiteRepository.GetAllList(
                    x => x.Longtitute >= west && x.Longtitute <= east && x.Lattitute >= south && x.Lattitute <= north);
            var views = sites.MapTo <List <PlanningSiteView> >();

            views.ForEach(view =>
            {
                var town = view.TownId <= 0 ? null : _townRepository.Get(view.TownId);
                if (town != null)
                {
                    view.District = town.DistrictName;
                    view.Town     = town.TownName;
                }
            });
            return(views);
        }
예제 #13
0
 private static void UpdateTown <TDto>(ITownRepository townRepository, TDto x)
     where TDto : IDistrictTown, ITownId
 {
     if (x.TownId == 0)
     {
         x.District = "未知";
         x.Town     = "未知";
     }
     else
     {
         var town = townRepository.Get(x.TownId);
         if (town != null)
         {
             x.District = town.DistrictName;
             x.Town     = town.TownName;
         }
     }
 }
예제 #14
0
        public void UpdateTown(IENodebRepository eNodebRepository, ITownRepository townRepository)
        {
            var eNodeb = eNodebRepository.FirstOrDefault(x => x.ENodebId == ENodebId);

            if (eNodeb == null)
            {
                return;
            }
            ENodebName = eNodeb.Name;
            var town = eNodeb.TownId == -1 ? null : townRepository.Get(eNodeb.TownId);

            if (town == null)
            {
                return;
            }
            City     = town.CityName;
            District = town.DistrictName;
            Town     = town.TownName;
        }
예제 #15
0
        public IEnumerable <CdmaBtsView> Query(string collegeName)
        {
            var ids =
                _repository.GetAllList(
                    x =>
                    x.HotspotName == collegeName && x.HotspotType == HotspotType.College &&
                    x.InfrastructureType == InfrastructureType.CdmaBts);
            var btss  = ids.Select(x => _btsRepository.GetByBtsId(x.BtsId)).Where(bts => bts != null).ToList();
            var views = Mapper.Map <List <CdmaBts>, List <CdmaBtsView> >(btss);

            views.ForEach(x =>
            {
                var town = _townRepository.Get(x.TownId);
                if (town != null)
                {
                    x.DistrictName = town.DistrictName;
                    x.TownName     = town.TownName;
                }
            });
            return(views);
        }
        public void Handle(BuildingPurchasedEvent domainEvent)
        {
            // The building has now owner, so it is being sold by the town
            if (String.IsNullOrEmpty(domainEvent.Building.OwnerId))
            {
                var town = _townRepository.Get(domainEvent.Building.TownId);
                town.IncreaseAccountBalance((int)domainEvent.Building.Price);
                _townRepository.Update(town);
            }
            // The building has an owner who should be paid for the sale
            else
            {
                var previousOwner = _playerRepository.Get(domainEvent.Building.OwnerId);
                previousOwner.EarnMoney((int)domainEvent.Building.Price);
                _playerRepository.UpdateStats(previousOwner);
            }

            domainEvent.PurchasingPlayer.SpendMoney((int)domainEvent.Building.Price);
            domainEvent.Building.ChangeOwnership(domainEvent.PurchasingPlayer.Id);

            _playerRepository.UpdateStats(domainEvent.PurchasingPlayer);
            _townBuildingRepository.Update(domainEvent.Building);
        }
예제 #17
0
        public void UpdateTown(IENodebRepository eNodebRepository, IBtsRepository btsRepository,
                               ITownRepository townRepository)
        {
            if (ENodebId > 10000)
            {
                UpdateTown(eNodebRepository, townRepository);
            }
            var bts = btsRepository.GetByBtsId(ENodebId);

            if (bts == null)
            {
                return;
            }
            ENodebName = bts.Name;
            var town = bts.TownId == -1 ? null : townRepository.Get(bts.TownId);

            if (town == null)
            {
                return;
            }
            City     = town.CityName;
            District = town.DistrictName;
            Town     = town.TownName;
        }
예제 #18
0
 public Town GetById(string townId)
 {
     return(_townRepository.Get(townId));
 }
예제 #19
0
 public Hashtable Get(HttpContextBase context)
 {
     return(_repo.Get(context));
 }
예제 #20
0
 public void UpdateTown(IENodebRepository eNodebRepository, ITownRepository townRepository)
 {
     var eNodeb = eNodebRepository.GetByENodebId(ENodebId);
     if (eNodeb == null) return;
     ENodebName = eNodeb.Name;
     var town = eNodeb.TownId == -1 ? null : townRepository.Get(eNodeb.TownId);
     if (town == null) return;
     City = town.CityName;
     District = town.DistrictName;
     Town = town.TownName;
 }
예제 #21
0
 public void UpdateTown(IENodebRepository eNodebRepository, IBtsRepository btsRepository,
     ITownRepository townRepository)
 {
     if (ENodebId > 10000)
     {
         UpdateTown(eNodebRepository, townRepository);
     }
     var bts = btsRepository.GetByBtsId(ENodebId);
     if (bts == null) return;
     ENodebName = bts.Name;
     var town = bts.TownId == -1 ? null : townRepository.Get(bts.TownId);
     if (town == null) return;
     City = town.CityName;
     District = town.DistrictName;
     Town = town.TownName;
 }