Exemple #1
0
        public ViewResult KpiImport()
        {
            string message = "";
            QueryNamesService regionService = new QueryOptimizeRegionNamesService(regionRepository.GetAll());
            string[] sheetNames = regionService.Query().ToArray();
            HttpPostedFileBase httpPostedFileBase = Request.Files["dailyKpi"];
            if (httpPostedFileBase != null && httpPostedFileBase.FileName != "")
            {
                int regionStatsSaved = this.ImportRegionStats(httpPostedFileBase, sheetNames, regionRepository, cdmaStatRepository);
                int topDrop2GSaved = this.ImportTopDrop2GStats(httpPostedFileBase);
                int topConnection3GSaved = this.ImportTopConnection3GStats(httpPostedFileBase);

                message+= "成功保存区域指标:" + regionStatsSaved + "条"
                      + "    成功保存TOP掉话指标" + topDrop2GSaved + "条"
                      + "    成功保存TOP连接失败指标" + topConnection3GSaved + "条。";
            }
            httpPostedFileBase = Request.Files["alarmZte"];
            if (httpPostedFileBase != null && httpPostedFileBase.FileName != "")
            {
                int alarmsSaved = httpPostedFileBase.ImportAlarmStats(_alarmRepository);
                message += "成功保存中兴告警记录:" + alarmsSaved + "条";
            }
            httpPostedFileBase = Request.Files["alarmHw"];
            if (httpPostedFileBase != null && httpPostedFileBase.FileName != "")
            {
                int alarmsSaved = httpPostedFileBase.ImportAlarmHuawei(_alarmRepository);
                message += "成功保存华为告警记录:" + alarmsSaved + "条";
            }

            TempData["success"] = message;
            return View("Import");
        }
        public ViewResult KpiImport()
        {
            QueryNamesService regionService = new QueryOptimizeRegionNamesService(regionRepository.GetAll());
            string[] sheetNames = regionService.Query().ToArray();

            HttpPostedFileBase httpPostedFileBase = Request.Files["dailyKpi"];
            if (httpPostedFileBase == null || httpPostedFileBase.FileName == "")
            {
                TempData["error"] = "请选择需要导入的Excel文件!";
                return View("Import");
            }

            KpiImportResult result = this.Import(httpPostedFileBase, sheetNames, regionRepository, cdmaStatRepository);

            TempData["success"]
                = "成功保存区域指标:" + result.RegionStatsSaved + "条"
                  + "    成功保存TOP掉话指标" + result.TopDrop2GSaved + "条"
                  + "    成功保存TOP连接失败指标" + result.TopConnection3GSaved + "条";
            return View("Import");
        }