private ActionResult Processing_Bank(int claim, PaymentMode payment) { ActionResult result4; if (payment == null) { throw new ArgumentNullException("payment"); } PaymentBeforeProcessingResult result = BookingProvider.BeforePaymentProcessing(UrlLanguage.CurrentLanguage, payment.paymentparam); if (result == null) { throw new Exception("cannot get payment details"); } if (!result.success) { throw new Exception("payment details fail"); } try { List <ReportParam> list = new List <ReportParam>(); ReportParam item = new ReportParam { Name = "vClaimList", Value = claim.ToString() }; list.Add(item); string str = ConfigurationManager.AppSettings["report_PrintInvoice"]; if (string.IsNullOrEmpty(str)) { throw new Exception("report_PrintInvoice is empty"); } ReportResult result2 = ReportServer.BuildReport(str, ReportFormat.pdf, list.ToArray()); if (result2 == null) { throw new Exception("report data is empty"); } MemoryStream fileStream = new MemoryStream(result2.Content); FileStreamResult result3 = new FileStreamResult(fileStream, "application/pdf") { FileDownloadName = string.Format("invoice_{0}.pdf", claim) }; result4 = result3; } catch (Exception exception) { Tracing.ServiceTrace.TraceEvent(TraceEventType.Error, 0, exception.ToString()); throw; } return(result4); }
private ActionResult BuildVoucher(int claimId) { ActionResult result3; try { List <ReportParam> list = new List <ReportParam>(); ReportParam item = new ReportParam { Name = "vClaimList", Value = claimId.ToString() }; list.Add(item); string str = ConfigurationManager.AppSettings["report_PrintVoucher"]; if (string.IsNullOrEmpty(str)) { throw new Exception("report_PrintVoucher is empty"); } ReportResult result = ReportServer.BuildReport(str, ReportFormat.pdf, list.ToArray()); if (result == null) { throw new Exception("report data is empty"); } MemoryStream fileStream = new MemoryStream(result.Content); FileStreamResult result2 = new FileStreamResult(fileStream, "application/pdf") { FileDownloadName = string.Format("voucher_{0}.pdf", claimId) }; result3 = result2; } catch (Exception exception) { Tracing.ServiceTrace.TraceEvent(TraceEventType.Error, 0, exception.ToString()); throw; } return(result3); }