diff --git a/ApiControllers/eva_adjust_postponement_quotaControllers.cs b/ApiControllers/eva_adjust_postponement_quotaControllers.cs
index 0d161fd..f9c0ca6 100644
--- a/ApiControllers/eva_adjust_postponement_quotaControllers.cs
+++ b/ApiControllers/eva_adjust_postponement_quotaControllers.cs
@@ -15,6 +15,7 @@ using TodoAPI2.Models;
using System.Data;
using Microsoft.Extensions.Configuration;
using System.IO;
+using System.Net;
namespace TodoAPI2.Controllers
{
@@ -315,6 +316,44 @@ namespace TodoAPI2.Controllers
return BadRequest(ModelState);
}
+ ///
+ /// Download Report
+ ///
+ ///
+ ///
+ /// Return list of items by specifced keyword
+ /// Returns the item
+ /// Error Occurred
+ [HttpGet("rep_eva_savemessage")]
+ [ProducesResponseType(typeof(FileStreamResult), 200)]
+ [ProducesResponseType(400)]
+ [ProducesResponseType(500)]
+ //[ValidateAntiForgeryToken]
+ public IActionResult rep_eva_savemessage(rep_eva_savemessageReportRequestModel model)
+ {
+ try
+ {
+ if (!MyHelper.checkAuth(Configuration, HttpContext)) return Unauthorized();
+ //var httpclient = MyHelper.getHttpClient(Configuration);
+ var httpclient = new WebClient();
+ string mainurl = MyHelper.GetConfig(Configuration, "JasperReportServer:MainURL");
+ string reportsite = MyHelper.GetConfig(Configuration, "JasperReportServer:reportsite");
+ string username = MyHelper.GetConfig(Configuration, "JasperReportServer:username");
+ string password = MyHelper.GetConfig(Configuration, "JasperReportServer:password");
+ string url = $"{mainurl}{reportsite}/rep_eva_savemessage.{model.filetype}?{MyHelper.GetParameterForJasperReport(model)}&j_username={username}&j_password={password}";
+
+ var data = httpclient.DownloadData(url);
+ var stream = new MemoryStream(data);
+
+ return File(stream, model.contentType);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogCritical($"Exception while GetReport.", ex);
+ return StatusCode(500, $"Exception while GetReport. {ex.Message}");
+ }
+ }
+
}
}
diff --git a/Models/rep_eva_savemessage/rep_eva_savemessageReportRequestModel.cs b/Models/rep_eva_savemessage/rep_eva_savemessageReportRequestModel.cs
new file mode 100644
index 0000000..de95e7d
--- /dev/null
+++ b/Models/rep_eva_savemessage/rep_eva_savemessageReportRequestModel.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Threading.Tasks;
+using TTSW.EF;
+using TTSW.Utils;
+using TTSW.Constant;
+using TTSW.Common;
+
+namespace TodoAPI2.Models
+{
+ public class rep_eva_savemessageReportRequestModel
+ {
+ public int? quota_id { get; set; }
+ public string filetype { get; set; }
+ public string contentType { get { return MyHelper.GetContentType(filetype); } }
+ }
+}
+
diff --git a/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml b/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml
index d449432..7b64946 100644
--- a/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml
+++ b/Views/eva_adjust_postponement_quotaView/eva_adjust_postponement_quota_d.cshtml
@@ -5,6 +5,29 @@
Layout = "_LayoutDirect";
}
+
@@ -103,6 +126,7 @@
+
diff --git a/tb320eva.xml b/tb320eva.xml
index d6cf165..498212c 100644
--- a/tb320eva.xml
+++ b/tb320eva.xml
@@ -886,6 +886,16 @@
If the model is invalid
Error Occurred
+
+
+ Download Report
+
+
+
+ Return list of items by specifced keyword
+ Returns the item
+ Error Occurred
+
Default constructure for dependency injection
diff --git a/wwwroot/js/eva_adjust_postponement_quota/eva_adjust_postponement_quota_d.js b/wwwroot/js/eva_adjust_postponement_quota/eva_adjust_postponement_quota_d.js
index f2b94e3..1131ed5 100644
--- a/wwwroot/js/eva_adjust_postponement_quota/eva_adjust_postponement_quota_d.js
+++ b/wwwroot/js/eva_adjust_postponement_quota/eva_adjust_postponement_quota_d.js
@@ -180,3 +180,33 @@ function CalculateRemainQuota(m) {
}
+// ================================================= report rep_eva_savemessage ==================================================
+
+function rep_eva_savemessage_GetSearchParameter(fileType) {
+ var eva_adjust_postponement_quotaObject = new Object();
+ eva_adjust_postponement_quotaObject.quota_id = $("#eva_adjust_postponement_quota_id").val();
+
+ eva_adjust_postponement_quotaObject.fileType = fileType;
+
+ return eva_adjust_postponement_quotaObject;
+}
+
+function rep_eva_savemessage_DoSearch(fileType) {
+ if (!ValidateForm('eva_adjust_postponement_quota', eva_adjust_postponement_quota_customValidation)) {
+ return;
+ }
+
+ var p = $.param(rep_eva_savemessage_GetSearchParameter(fileType));
+
+ var report_url = apisite + eva_adjust_postponement_quota_API + "rep_eva_savemessage?" + p;
+
+ if (fileType === "pdf") {
+ $("#report_result").attr("src", report_url);
+ $("#report_result").show();
+ $("#report_xModel").modal("show");
+ } else {
+ $("#report_result").hide();
+ window.open(report_url);
+ }
+
+}