示例#1
0
        public FileResult ExportTitle(TitleSearch titleSearch)
        {
            ExportReportService _export      = new ExportReportService();
            DownLoadFile        downloadFile = _export.GenerateTitleReport(titleSearch);

            //string path = ConfigurationManager.AppSettings["directoryPath"];
            //string path = App.Config.ReportDirectoryPath;
            //string downloadFile = string.Format(path, file);
            return(File(downloadFile.bufferByte, "application/vnd.ms-excel", downloadFile.FileName));
        }
示例#2
0
        public ActionResult ExportTitle(TitleSearch titleSearch)
        {
            //Titles(TitleSearch titleSearch, int? pageNumber)
            IExportReportService _export = new ExportReportService();
            int recordCount = _export.GetTitleReportRecordCount(titleSearch);

            if (recordCount > App.Config.MaxTitleReportDownloadRecordLimit)
            {
                titleSearch.Territory = string.IsNullOrEmpty(titleSearch.TerritoryConcat) ? titleSearch.Territory : titleSearch.TerritoryConcat.Split('|');
                titleSearch.Language  = string.IsNullOrEmpty(titleSearch.LanguageConcate) ? titleSearch.Language : titleSearch.LanguageConcate.Split('|');
                titleSearch.Region    = string.IsNullOrEmpty(titleSearch.RegionConcat) ? titleSearch.Region : titleSearch.RegionConcat.Split('|');
                TempData["ErrorMsg"]  = string.Format("There are {0} records that you are trying to download. Record count should not exceed {1} records.", recordCount, App.Config.MaxTitleReportDownloadRecordLimit);
                return(RedirectToAction("Titles", "Title", new { @titleSearch = titleSearch }));
                //return RedirectToAction("Index");
            }

            DownLoadFile downloadFile = _export.GenerateTitleReport(titleSearch);

            return(File(downloadFile.bufferByte, "application/vnd.ms-excel", downloadFile.FileName));
        }