public static int ImportRegionStats(this IKpiImportController controller, HttpPostedFileBase httpPostedFileBase,
     string[] sheetNames, IRegionRepository regionRepository, ITopCellRepository<CdmaRegionStat> cdmaStatRepository)
 {
     List<CdmaRegionStat> statList =
         httpPostedFileBase.ImportInfo(
             x =>
             {
                 List<CdmaRegionStat> stats = new List<CdmaRegionStat>();
                 using (ExcelImporter excelImporter = new ExcelImporter(x, sheetNames))
                 {
                     foreach (string sheetName in sheetNames)
                     {
                         using (DataTable statTable = excelImporter[sheetName])
                         {
                             ImportExcelListService<CdmaRegionStat> service =
                                 new ImportExcelListService<CdmaRegionStat>(stats, statTable);
                             service.Import();
                         }
                     }
                 }
                 return stats;
             }, "佛山");
     if (statList.Count > 0)
     {
         OptimizeRegion firstOrDefault = regionRepository.GetAllList().FirstOrDefault(
             x => x.Region == statList[0].Region);
         if (firstOrDefault != null)
         {
             controller.SaveTimeKpiStatsService.CurrentCity = firstOrDefault.City;
             controller.Save3GStatsService.CurrentCity = firstOrDefault.City;
         }
     }
     return cdmaStatRepository.SaveStats(statList);
 }
        public KpiController(IRegionRepository regionRepository,
                             ITownRepository townRepository,
                             ITopCellRepository <CdmaRegionStat> cdmaStatRepository,
                             ITopCellRepository <TopDrop2GCell> topDrop2GRepository,
                             ITopCellRepository <TopDrop2GCellDaily> topDrop2GDailyRepository,
                             ITopCellRepository <TopConnection3GCell> topConnection3GRepository,
                             ITopCellRepository <TownPreciseCoverage4GStat> townPrecise4GRepository,
                             IBtsRepository btsRepository,
                             IENodebRepository eNodebRepository)
        {
            this.regionRepository    = regionRepository;
            this.townRepository      = townRepository;
            this.cdmaStatRepository  = cdmaStatRepository;
            this.topDrop2GRepository = topDrop2GRepository;

            this.topDrop2GDailyRepository  = topDrop2GDailyRepository;
            this.topConnection3GRepository = topConnection3GRepository;

            this.townPrecise4GRepository = townPrecise4GRepository;
            this.btsRepository           = btsRepository;
            this.eNodebRepository        = eNodebRepository;

            this.Initialize(topDrop2GRepository, topConnection3GRepository);
            regionNamesService   = new QueryRegionCityNamesService(this.regionRepository.GetAll());
            districtNamesService = new QueryDistinctDistrictNamesService(this.townRepository.GetAll());
        }
Exemple #3
0
        public KpiController(IRegionRepository regionRepository,
            ITownRepository townRepository,
            ITopCellRepository<CdmaRegionStat> cdmaStatRepository,
            ITopCellRepository<TopDrop2GCell> topDrop2GRepository,
            ITopCellRepository<TopDrop2GCellDaily> topDrop2GDailyRepository,
            ITopCellRepository<TopConnection3GCell> topConnection3GRepository,
            ITopCellRepository<TownPreciseCoverage4GStat> townPrecise4GRepository,
            IBtsRepository btsRepository,
            IENodebRepository eNodebRepository,
            IAlarmRepository alarmRepository)
        {
            this.regionRepository = regionRepository;
            this.townRepository = townRepository;
            this.cdmaStatRepository = cdmaStatRepository;
            this.topDrop2GRepository = topDrop2GRepository;

            this.topDrop2GDailyRepository = topDrop2GDailyRepository;
            this.topConnection3GRepository = topConnection3GRepository;

            this.townPrecise4GRepository = townPrecise4GRepository;
            this.btsRepository = btsRepository;
            this.eNodebRepository = eNodebRepository;

            this.Initialize(topDrop2GRepository, topConnection3GRepository);
            regionNamesService = new QueryRegionCityNamesService(this.regionRepository.GetAll());
            districtNamesService = new QueryDistinctDistrictNamesService(this.townRepository.GetAll());

            _alarmRepository = alarmRepository;
        }
Exemple #4
0
        public async void Import(IEnumerable <ImportedFileInfo> validFileInfos)
        {
            Result     = "";
            repository = new TRepository();

            foreach (ImportedFileInfo file in validFileInfos)
            {
                IStatDateImporter importer = GenerateImporter();
                ImportedFileInfo  fileInfo = file;
                importer.Date = fileInfo.FilePath.RetrieveFileNameBody().GetDateExtend();
                TStat stat = repository.Stats.FirstOrDefault(x => x.StatTime == importer.Date);
                if (stat == null)
                {
                    using (StreamReader reader = ReadFile(fileInfo.FilePath))
                    {
                        int count = await importer.ImportStat(reader, CsvFileDescription.CommaDescription);

                        Result += "\n" + fileInfo.FilePath + "完成导入数量:" + count;
                    }
                    fileInfo.FinishState();
                }
                else
                {
                    Result += "\n日期:" + importer.Date.ToShortDateString() + "的统计记录已导入!";
                    fileInfo.UnnecessaryState();
                }
            }
            FileListGrid.SetDataSource(FileInfoList);
        }
 protected override IStatDateImporter GenerateImporter()
 {
     townStatRepository
             = new EFTownPreciseCoverage4GStatRepository();
     eNodebs = (new EFENodebRepository()).GetAllList();
     return(new Precise4GCoverageImporter(repository, townStatRepository,
                                          eNodebs));
 }
 public QueryTopDrop2GService(ITopCellRepository <TopDrop2GCellDaily> dailyStatRepository,
                              int cellId, byte sectorId, short frequency, DateTime statDate)
 {
     _dailyStatRepository = dailyStatRepository;
     _cellId    = cellId;
     _sectorId  = sectorId;
     _frequency = frequency;
     _statDate  = statDate;
 }
 public TopConnection3GController(
     ITopCellRepository <TopConnection3GCell> statRepository,
     IBtsRepository btsRepository,
     IENodebRepository eNodebRepository)
 {
     this.statRepository   = statRepository;
     this.btsRepository    = btsRepository;
     this.eNodebRepository = eNodebRepository;
 }
 public QueryTopDrop2GService(ITopCellRepository<TopDrop2GCellDaily> dailyStatRepository,
     int cellId, byte sectorId, short frequency, DateTime statDate)
 {
     _dailyStatRepository = dailyStatRepository;
     _cellId = cellId;
     _sectorId = sectorId;
     _frequency = frequency;
     _statDate = statDate;
 }
 public TopConnection3GController(
     ITopCellRepository<TopConnection3GCell> statRepository,
     IBtsRepository btsRepository,
     IENodebRepository eNodebRepository)
 {
     this.statRepository = statRepository;
     this.btsRepository = btsRepository;
     this.eNodebRepository = eNodebRepository;
 }
Exemple #10
0
 public static void Initialize(this IKpiImportController controller,
                               ITopCellRepository <TopDrop2GCell> topDrop2GRepository,
                               ITopCellRepository <TopConnection3GCell> topConnection3GRepository)
 {
     controller.SaveTimeKpiStatsService =
         new SaveTimeCityKpiStatsService <TopDrop2GCell, TopDrop2GCellExcel>(topDrop2GRepository);
     controller.Save3GStatsService =
         new SaveTimeCityKpiStatsService <TopConnection3GCell, TopConnection3GCellExcel>(topConnection3GRepository);
 }
 public Precise4GCoverageImporter(
     ITopCellRepository <PreciseCoverage4G> cellStatRepository,
     ITopCellRepository <TownPreciseCoverage4GStat> townStatRepository,
     IEnumerable <ENodeb> eNodebs)
 {
     cellStatService = new SaveTimeSingleKpiStatsService <PreciseCoverage4G, PreciseCoverage4GCsv>(
         cellStatRepository);
     _timeTownStatService = new SaveTimeTownStatsService <TownPreciseCoverage4GStat, PreciseCoverage4GCsv>(
         townStatRepository, eNodebs);
 }
 public Precise4GCoverageImporter(
     ITopCellRepository<PreciseCoverage4G> cellStatRepository,
     ITopCellRepository<TownPreciseCoverage4GStat> townStatRepository,
     IEnumerable<ENodeb> eNodebs)
 {
     cellStatService = new SaveTimeSingleKpiStatsService<PreciseCoverage4G, PreciseCoverage4GCsv>(
         cellStatRepository);
     _timeTownStatService = new SaveTimeTownStatsService<TownPreciseCoverage4GStat, PreciseCoverage4GCsv>(
         townStatRepository, eNodebs);
 }
 public TopDrop2GController(
     ITopCellRepository <TopDrop2GCell> statRepository,
     ITopCellRepository <TopDrop2GCellDaily> dailyStatRepository,
     IBtsRepository btsRepository,
     IENodebRepository eNodebRepository)
 {
     this.statRepository      = statRepository;
     this.dailyStatRepository = dailyStatRepository;
     this.btsRepository       = btsRepository;
     this.eNodebRepository    = eNodebRepository;
 }
 public TopDrop2GController(
     ITopCellRepository<TopDrop2GCell> statRepository,
     ITopCellRepository<TopDrop2GCellDaily> dailyStatRepository,
     IBtsRepository btsRepository,
     IENodebRepository eNodebRepository)
 {
     this.statRepository = statRepository;
     this.dailyStatRepository = dailyStatRepository;
     this.btsRepository = btsRepository;
     this.eNodebRepository = eNodebRepository;
 }
Exemple #15
0
        public static KpiImportResult Import(this IKpiImportController controller,
                                             HttpPostedFileBase httpPostedFileBase, string[] sheetNames,
                                             IRegionRepository regionRepository, ITopCellRepository <CdmaRegionStat> cdmaStatRepository)
        {
            List <CdmaRegionStat> statList =
                httpPostedFileBase.ImportInfo(
                    x =>
            {
                List <CdmaRegionStat> stats = new List <CdmaRegionStat>();
                using (ExcelImporter excelImporter = new ExcelImporter(x, sheetNames))
                {
                    foreach (string sheetName in sheetNames)
                    {
                        using (DataTable statTable = excelImporter[sheetName])
                        {
                            ImportExcelListService <CdmaRegionStat> service =
                                new ImportExcelListService <CdmaRegionStat>(stats, statTable);
                            service.Import();
                        }
                    }
                }
                return(stats);
            }, "佛山");

            if (statList.Count > 0)
            {
                OptimizeRegion firstOrDefault = regionRepository.GetAllList().FirstOrDefault(
                    x => x.Region == statList[0].Region);
                if (firstOrDefault != null)
                {
                    controller.SaveTimeKpiStatsService.CurrentCity = firstOrDefault.City;
                    controller.Save3GStatsService.CurrentCity      = firstOrDefault.City;
                }
            }
            int regionStatsSaved = cdmaStatRepository.SaveStats(statList);
            ExcelStatsImportRepository <TopDrop2GCellExcel> drop2GExcelRepository =
                httpPostedFileBase.ImportInfo(
                    x => new ExcelStatsImportRepository <TopDrop2GCellExcel>(x, "掉话TOP30小区"), "佛山");
            int topDrop2GSaved = controller.SaveTimeKpiStatsService.Save(drop2GExcelRepository.StatList);
            ExcelStatsImportRepository <TopConnection3GCellExcel> connection3GExcelRepository =
                httpPostedFileBase.ImportInfo(
                    x => new ExcelStatsImportRepository <TopConnection3GCellExcel>(x, "连接TOP30小区"), "佛山");
            int topConnection3GSaved = controller.Save3GStatsService.Save(connection3GExcelRepository.StatList);

            return(new KpiImportResult
            {
                RegionStatsSaved = regionStatsSaved,
                TopDrop2GSaved = topDrop2GSaved,
                TopConnection3GSaved = topConnection3GSaved
            });
        }
        public static int SaveStats(this ITopCellRepository <CdmaRegionStat> repository,
                                    IEnumerable <CdmaRegionStat> stats)
        {
            int result = 0;
            IEnumerable <CdmaRegionStat> existedStats = repository.Stats.ToList();

            foreach (CdmaRegionStat stat in stats.Where(stat => existedStats.QueryDateStat(stat.Region, stat.StatDate) == null))
            {
                repository.AddOneStat(stat);
                result++;
            }
            repository.SaveChanges();
            return(result);
        }
        public static KpiImportResult Import(this IKpiImportController controller,
            HttpPostedFileBase httpPostedFileBase, string[] sheetNames,
            IRegionRepository regionRepository, ITopCellRepository<CdmaRegionStat> cdmaStatRepository)
        {
            List<CdmaRegionStat> statList =
                httpPostedFileBase.ImportInfo(
                    x =>
                    {
                        List<CdmaRegionStat> stats = new List<CdmaRegionStat>();
                        using (ExcelImporter excelImporter = new ExcelImporter(x, sheetNames))
                        {
                            foreach (string sheetName in sheetNames)
                            {
                                using (DataTable statTable = excelImporter[sheetName])
                                {
                                    ImportExcelListService<CdmaRegionStat> service =
                                        new ImportExcelListService<CdmaRegionStat>(stats, statTable);
                                    service.Import();
                                }
                            }
                        }
                        return stats;
                    }, "佛山");
            if (statList.Count > 0)
            {
                OptimizeRegion firstOrDefault = regionRepository.GetAllList().FirstOrDefault(
                    x => x.Region == statList[0].Region);
                if (firstOrDefault != null)
                {
                    controller.SaveTimeKpiStatsService.CurrentCity = firstOrDefault.City;
                    controller.Save3GStatsService.CurrentCity = firstOrDefault.City;
                }
            }
            int regionStatsSaved = cdmaStatRepository.SaveStats(statList);
            ExcelStatsImportRepository<TopDrop2GCellExcel> drop2GExcelRepository =
                httpPostedFileBase.ImportInfo(
                    x => new ExcelStatsImportRepository<TopDrop2GCellExcel>(x, "掉话TOP30小区"), "佛山");
            int topDrop2GSaved = controller.SaveTimeKpiStatsService.Save(drop2GExcelRepository.StatList);
            ExcelStatsImportRepository<TopConnection3GCellExcel> connection3GExcelRepository =
                httpPostedFileBase.ImportInfo(
                    x => new ExcelStatsImportRepository<TopConnection3GCellExcel>(x, "连接TOP30小区"), "佛山");
            int topConnection3GSaved = controller.Save3GStatsService.Save(connection3GExcelRepository.StatList);

            return new KpiImportResult
            {
                RegionStatsSaved = regionStatsSaved,
                TopDrop2GSaved = topDrop2GSaved,
                TopConnection3GSaved = topConnection3GSaved
            };
        }
 public FakeStatDateImporterWithRepository(ITopCellRepository <StubTimeStat> repository)
 {
     _repository = repository;
 }
 public FakeSaveTimeDateStatsService(ITopCellRepository <FakeCarrierTimeStat> repository) : base(repository)
 {
 }
 protected SaveTimeKpiStatsService(ITopCellRepository <TStat> repository) : base(repository)
 {
 }
 public SaveTimeTownStatsService(ITopCellRepository <TStat> repository, IEnumerable <ENodeb> eNodebs)
     : base(repository)
 {
     townENodebIdPairs = eNodebs.Select(x => new Tuple <int, int>(x.ENodebId, x.TownId)).Distinct();
 }
 protected SaveTimeStatsService(ITopCellRepository <TStat> repository)
 {
     _repository = repository;
 }
 public QueryLteStatController(ITopCellRepository<TownPreciseCoverage4GStat> lteStatRepository,
     ITownRepository townRepository)
 {
     this.lteStatRepository = lteStatRepository;
     towns = townRepository.GetAllList();
 }
Exemple #24
0
 public KpiStatImporter(ITopCellRepository<TopDrop2GCellDaily> repository,
     int approximateTopnsImport)
 {
     _service = new TopCellRepositoryDropDailyService(repository);
     _approximateTopnsImport = approximateTopnsImport;
 }
 public static void Initialize(this IKpiImportController controller,
     ITopCellRepository<TopDrop2GCell> topDrop2GRepository,
     ITopCellRepository<TopConnection3GCell> topConnection3GRepository)
 {
     controller.SaveTimeKpiStatsService =
         new SaveTimeCityKpiStatsService<TopDrop2GCell, TopDrop2GCellExcel>(topDrop2GRepository);
     controller.Save3GStatsService =
         new SaveTimeCityKpiStatsService<TopConnection3GCell, TopConnection3GCellExcel>(topConnection3GRepository);
 }
 public QueryLteStatController(ITopCellRepository <TownPreciseCoverage4GStat> lteStatRepository,
                               ITownRepository townRepository)
 {
     this.lteStatRepository = lteStatRepository;
     towns = townRepository.GetAllList();
 }
 public QueryPreciseStatController(ITopCellRepository <PreciseCoverage4G> repository)
 {
     _repository = repository;
 }
Exemple #28
0
 public void Import(ITopCellRepository <TStat> repository, DateTime begin, DateTime end)
 {
     Import(repository.Stats, begin, end);
 }
 public TopCellRepositoryDropDailyService(ITopCellRepository <TopDrop2GCellDaily> repository)
     : base(repository)
 {
 }
 public FakeImportStatsService(ITopCellRepository <FakeStat> repository) : base(repository)
 {
 }
 protected ImportStatsService(ITopCellRepository <TStat> repository)
 {
     _repository = repository;
 }
Exemple #32
0
 public KpiStatController(ITopCellRepository <CdmaRegionStat> cdmaStatRepository)
 {
     this.cdmaStatRepository = cdmaStatRepository;
 }
 public SaveTimeSingleKpiStatsService(ITopCellRepository <TStat> repository) : base(repository)
 {
 }
 public QueryPreciseStatController(ITopCellRepository<PreciseCoverage4G> repository)
 {
     _repository = repository;
 }
 public KpiStatImporter(ITopCellRepository <TopDrop2GCellDaily> repository,
                        int approximateTopnsImport)
 {
     _service = new TopCellRepositoryDropDailyService(repository);
     _approximateTopnsImport = approximateTopnsImport;
 }
Exemple #36
0
 public KpiStatController(ITopCellRepository<CdmaRegionStat> cdmaStatRepository)
 {
     this.cdmaStatRepository = cdmaStatRepository;
 }