예제 #1
0
 public virtual IActionResult ExportReportContractDealine(ReportContractDealineSearchModel searchModel)
 {
     if (!string.IsNullOrEmpty(searchModel.stringConstructionIds))
     {
         var lstConstruction = searchModel.stringConstructionIds.Split(',').ToList();
         searchModel.SelectedConstructionIds = lstConstruction.Select(c => (int)c.ToNumber()).ToList();
     }
     try
     {
         var report = _reportService.ReportContractDealine(
             SelectedConstructionIds: searchModel.SelectedConstructionIds,
             datetimeFrom: searchModel.datetimeFrom,
             datetimeTo: searchModel.datetimeTo);
         byte[] bytes;
         using (var stream = new MemoryStream())
         {
             _exportManager.ExportContractDeadline(report, stream, Convert.ToDateTime(searchModel.datetimeFrom), Convert.ToDateTime(searchModel.datetimeTo));
             bytes = stream.ToArray();
         }
         return(File(bytes, MimeTypes.TextXlsx, "BaoCaoDSHopDongSapDenHan.xlsx"));
     }
     catch (Exception exc)
     {
         ErrorNotification(exc);
         return(RedirectToAction("List"));
     }
 }