コード例 #1
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
            });
        }
コード例 #2
0
        public static CollegeCdmaExcelImporter ImportCdmaInfos(this HttpPostedFileBase cdmaFileBase)
        {
            return(cdmaFileBase.ImportInfo(x =>
            {
                IValueImportable importer =
                    new ExcelBtsImportRepository <CollegeBtsExcel>(x, t => new CollegeBtsExcel(t));
                importer.Import();
                List <CollegeBtsExcel> btsExcels =
                    (importer as ExcelBtsImportRepository <CollegeBtsExcel>).BtsExcelList;
                importer =
                    new ExcelCellImportRepository <CollegeCdmaCellExcel>(x, t => new CollegeCdmaCellExcel(t));
                importer.Import();
                List <CollegeCdmaCellExcel> cellExcels =
                    (importer as ExcelCellImportRepository <CollegeCdmaCellExcel>).CellExcelList;
                importer =
                    new ExcelDistributionImportRepository <CollegeIndoorExcel>(x, t => new CollegeIndoorExcel(t));
                importer.Import();
                List <CollegeIndoorExcel> indoorExcels =
                    (importer as ExcelDistributionImportRepository <CollegeIndoorExcel>).DistributionExcelList;

                return new CollegeCdmaExcelImporter
                {
                    BtsExcels = btsExcels,
                    CellExcels = cellExcels,
                    IndoorExcels = indoorExcels
                };
            }, "3G"));
        }
コード例 #3
0
        public static CollegeLteExcelModel ImportLteInfos(this HttpPostedFileBase lteFileBase)
        {
            return(lteFileBase.ImportInfo(x =>
            {
                IValueImportable importer =
                    new ExcelBtsImportRepository <CollegeENodebExcel>(x, t => new CollegeENodebExcel(t));
                importer.Import();
                List <CollegeENodebExcel> btsExcels =
                    (importer as ExcelBtsImportRepository <CollegeENodebExcel>).BtsExcelList;
                importer =
                    new ExcelCellImportRepository <CollegeCellExcel>(x, t => new CollegeCellExcel(t));
                importer.Import();
                List <CollegeCellExcel> cellExcels =
                    (importer as ExcelCellImportRepository <CollegeCellExcel>).CellExcelList;
                importer =
                    new ExcelDistributionImportRepository <CollegeIndoorExcel>(x, t => new CollegeIndoorExcel(t));
                importer.Import();
                List <CollegeIndoorExcel> indoorExcels =
                    (importer as ExcelDistributionImportRepository <CollegeIndoorExcel>).DistributionExcelList;

                return new CollegeLteExcelModel
                {
                    BtsExcels = btsExcels,
                    CellExcels = cellExcels,
                    IndoorExcels = indoorExcels
                };
            }, "4G"));
        }