public static IEnumerable<Cell> QueryCollegeCells(this IInfrastructureRepository repository,
     ICellRepository cellRepository, CollegeInfo info)
 {
     IEnumerable<int> ids = repository.InfrastructureInfos.Where(x =>
         x.HotspotName == info.Name && x.InfrastructureType == InfrastructureType.Cell
         ).Select(x => x.InfrastructureId).ToList();
     return ids.Select(cellRepository.Get).Where(cell => cell != null).ToList();
 }
 public static IEnumerable<CdmaBts> QueryCollegeBtss(this IInfrastructureRepository repository,
     IBtsRepository btsRepository, CollegeInfo info)
 {
     IEnumerable<int> ids = repository.InfrastructureInfos.Where(x =>
         x.HotspotName == info.Name && x.InfrastructureType == InfrastructureType.CdmaBts
         ).Select(x => x.InfrastructureId).ToList();
     return ids.Select(btsRepository.Get).Where(bts => bts != null).ToList();
 }
예제 #3
0
 public CollegeStat(ICollegeRepository repository, CollegeInfo info, 
     IInfrastructureRepository infrastructureRepository)
 {
     CollegeRegion region = repository.GetRegion(info.Id);
     Name = info.Name;
     ExpectedSubscribers = info.ExpectedSubscribers;
     Area = region.Area;
     Id = region.AreaId;
     UpdateStats(infrastructureRepository);
 }
 public static IEnumerable<IndoorDistribution> QueryCollegeCdmaDistributions(
     this IInfrastructureRepository repository,
     IIndoorDistributioinRepository indoorRepository, CollegeInfo info)
 {
     IEnumerable<int> ids = repository.InfrastructureInfos.Where(x =>
         x.HotspotName == info.Name && x.InfrastructureType == InfrastructureType.CdmaIndoor
         ).Select(x => x.InfrastructureId).ToList();
     return ids.Select(i => indoorRepository.IndoorDistributions.FirstOrDefault(x => x.Id == i)
         ).Where(distribution => distribution != null).ToList();
 }
예제 #5
0
 public CollegeDto(CollegeInfo info, IEnumerable<Town> towns)
 {
     info.CloneProperties(this);
     Town town = towns.FirstOrDefault(x => x.Id == info.TownId);
     if (town != null)
     {
         CityName = town.CityName;
         DistrictName = town.DistrictName;
         TownName = town.TownName;
     }
 }
예제 #6
0
 public async Task<IHttpActionResult> Post(CollegeDto info)
 {
     if (!ModelState.IsValid) return BadRequest(ModelState);
     Town town = _townRepository.FirstOrDefault(x => x.CityName == info.CityName &&
                                                     x.DistrictName == info.DistrictName &&
                                                     x.TownName == info.TownName);
     if (town == null) return BadRequest("Town Not Found!");
     CollegeInfo item = new CollegeInfo {TownId = town.Id};
     info.CloneProperties(item);
     await _repository.InsertOrUpdateAsync(item);
     return Ok();
 }
 private void UpdateRegion(int id, double area, string message, CollegeInfo info, RegionType type)
 {
     CollegeRegion region = _repository.GetRegion(id);
     if (region == null)
     {
         info.CollegeRegion = new CollegeRegion
         {
             Area = area,
             Info = message,
             RegionType = type
         };
     }
     else
     {
         region.Area = area;
         region.Info = message;
         region.RegionType = type;
     }
 }
 public static void UpdateCollegeInfos(ICollegeController controller, CollegeInfo info)
 {
     QueryENodebs = controller.InfrastructureRepository.QueryCollegeENodebs(
         controller.ENodebRepository, info);
     QueryCells = controller.InfrastructureRepository.QueryCollegeCells(
         controller.CellRepository, info);
     QueryBtss = controller.InfrastructureRepository.QueryCollegeBtss(
         controller.BtsRepository, info);
     QueryCdmaCells = controller.InfrastructureRepository.QueryCollegeCdmaCells(
         controller.CdmaCellRepository, info);
     QueryLteDistributions = controller.InfrastructureRepository.QueryCollegeLteDistributions(
         controller.IndoorDistributioinRepository, info);
     QueryCdmaDistributions = controller.InfrastructureRepository.QueryCollegeCdmaDistributions(
         controller.IndoorDistributioinRepository, info);
 }
 public static IEnumerable<ENodeb> QueryCollegeENodebs(this IInfrastructureRepository repository,
     IENodebRepository eNodebRepository, CollegeInfo info)
 {
     IEnumerable<int> ids = repository.InfrastructureInfos.Where(x =>
         x.HotspotName == info.Name && x.InfrastructureType == InfrastructureType.ENodeb
         ).Select(x => x.InfrastructureId).ToList();
     return ids.Select(i => eNodebRepository.GetAll().FirstOrDefault(x => x.Id == i)
         ).Where(eNodeb => eNodeb != null).ToList();
 }