347 lines
18 KiB
C#
347 lines
18 KiB
C#
using BMA.EHR.Domain.Common;
|
|
using BMA.EHR.Domain.Extensions;
|
|
using BMA.EHR.Domain.Shared;
|
|
using BMA.EHR.Application.Repositories.Reports;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
|
|
using Swashbuckle.AspNetCore.Annotations;
|
|
using DocumentFormat.OpenXml.Drawing;
|
|
using Telerik.Reporting;
|
|
using Telerik.Reporting.Processing;
|
|
using System.IO;
|
|
|
|
namespace BMA.EHR.Report.Service.Controllers
|
|
{
|
|
[Route("api/v{version:apiVersion}/report/insignia")]
|
|
[ApiVersion("2.0")]
|
|
[ApiController]
|
|
[Produces("application/json")]
|
|
[Authorize]
|
|
[SwaggerTag("API รายงานระบบเครื่องราชอิสริยาภรณ์")]
|
|
public class InsigniaReportController : BaseController
|
|
{
|
|
#region " Fields "
|
|
|
|
private readonly IWebHostEnvironment _hostingEnvironment;
|
|
private readonly IConfiguration _configuration;
|
|
//private readonly ProbationReportRepository _repository;
|
|
private readonly GenericReportGenerator _reportGenerator;
|
|
|
|
|
|
#endregion
|
|
|
|
#region " Constuctor and Destructor "
|
|
|
|
public InsigniaReportController(IWebHostEnvironment hostingEnvironment, IConfiguration configuration, /*ProbationReportRepository repository,*/ GenericReportGenerator reportGenerator)
|
|
{
|
|
|
|
_hostingEnvironment = hostingEnvironment;
|
|
_configuration = configuration;
|
|
//_repository = repository;
|
|
_reportGenerator = reportGenerator;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region " Methods "
|
|
|
|
#region 39-แบบ ขร1 บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ ข้าราชการ ชั้นสายสะพาย
|
|
/// <summary>
|
|
/// 39-แบบ ขร1 บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ ข้าราชการ ชั้นสายสะพาย
|
|
/// </summary>
|
|
/// <param name="id">id </param>
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
/// <returns></returns>
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
[HttpGet("39/{exportType}/{id}")]
|
|
public IActionResult GetInsignia39ConvertReportAsync(Guid id, string exportType = "pdf")
|
|
{
|
|
try
|
|
{
|
|
|
|
var mimeType = "";
|
|
switch (exportType.Trim().ToLower())
|
|
{
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
}
|
|
|
|
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"39-แบบ ขร1 บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ ข้าราชการ ชั้นสายสะพาย.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"insignia.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 40-แบบ ขร2 บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ ข้าราชการ ชั้นต่ำกว่าสายสะพาย
|
|
/// <summary>
|
|
/// 40-แบบ ขร2 บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ ข้าราชการ ชั้นต่ำกว่าสายสะพาย
|
|
/// </summary>
|
|
/// <param name="id">id </param>
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
/// <returns></returns>
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
[HttpGet("40/{exportType}/{id}")]
|
|
public IActionResult GetInsignia40ConvertReportAsync(Guid id, string exportType = "pdf")
|
|
{
|
|
try
|
|
{
|
|
|
|
var mimeType = "";
|
|
switch (exportType.Trim().ToLower())
|
|
{
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
}
|
|
|
|
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"40-แบบ ขร2 บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ ข้าราชการ ชั้นต่ำกว่าสายสะพาย.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"insignia.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 41-แบบ ขร3 บัญชีรายชื่อข้าราชการผู้ขอพระราชทานเครื่องราชฯ
|
|
/// <summary>
|
|
/// 41-แบบ ขร3 บัญชีรายชื่อข้าราชการผู้ขอพระราชทานเครื่องราชฯ
|
|
/// </summary>
|
|
/// <param name="id">id </param>
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
/// <returns></returns>
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
[HttpGet("41/{exportType}/{id}")]
|
|
public IActionResult GetInsignia41ConvertReportAsync(Guid id, string exportType = "pdf")
|
|
{
|
|
try
|
|
{
|
|
|
|
var mimeType = "";
|
|
switch (exportType.Trim().ToLower())
|
|
{
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
}
|
|
|
|
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"41-แบบ ขร3 บัญชีรายชื่อข้าราชการผู้ขอพระราชทานเครื่องราชฯ.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"insignia.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 42-แบบ ขร4 บัญชีแสดงคุณสมบัติของข้าราชการซึ่งเสนอขอเครื่องราชฯ
|
|
/// <summary>
|
|
/// 42-แบบ ขร4 บัญชีแสดงคุณสมบัติของข้าราชการซึ่งเสนอขอเครื่องราชฯ
|
|
/// </summary>
|
|
/// <param name="id">id </param>
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
/// <returns></returns>
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
[HttpGet("42/{exportType}/{id}")]
|
|
public IActionResult GetInsignia42ConvertReportAsync(Guid id, string exportType = "pdf")
|
|
{
|
|
try
|
|
{
|
|
|
|
var mimeType = "";
|
|
switch (exportType.Trim().ToLower())
|
|
{
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
}
|
|
|
|
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"42-แบบ ขร4 บัญชีแสดงคุณสมบัติของข้าราชการซึ่งเสนอขอเครื่องราชฯ.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"insignia.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 43-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี
|
|
/// <summary>
|
|
/// 43-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี
|
|
/// </summary>
|
|
/// <param name="id">id </param>
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
/// <returns></returns>
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
[HttpGet("43/{exportType}/{id}")]
|
|
public IActionResult GetInsignia43ConvertReportAsync(Guid id, string exportType = "pdf")
|
|
{
|
|
try
|
|
{
|
|
|
|
var mimeType = "";
|
|
switch (exportType.Trim().ToLower())
|
|
{
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
}
|
|
|
|
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"43-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"insignia.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 44-บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ
|
|
/// <summary>
|
|
/// 44-บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ
|
|
/// </summary>
|
|
/// <param name="id">id </param>
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
/// <returns></returns>
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
[HttpGet("44/{exportType}/{id}")]
|
|
public IActionResult GetInsignia44ConvertReportAsync(Guid id, string exportType = "pdf")
|
|
{
|
|
try
|
|
{
|
|
|
|
var mimeType = "";
|
|
switch (exportType.Trim().ToLower())
|
|
{
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
}
|
|
|
|
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"44-บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"insignia.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา
|
|
/// <summary>
|
|
/// 45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา
|
|
/// </summary>
|
|
/// <param name="id">id </param>
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
/// <returns></returns>
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
[HttpGet("45/{exportType}/{id}")]
|
|
public IActionResult GetInsignia45ConvertReportAsync(Guid id, string exportType = "pdf")
|
|
{
|
|
try
|
|
{
|
|
|
|
var mimeType = "";
|
|
switch (exportType.Trim().ToLower())
|
|
{
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
}
|
|
|
|
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"insignia.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 46-ประวัติสำหรับการเสนอขอพระราชทานเหรียญจักรพรรดิมาลา
|
|
/// <summary>
|
|
/// 46-ประวัติสำหรับการเสนอขอพระราชทานเหรียญจักรพรรดิมาลา
|
|
/// </summary>
|
|
/// <param name="id">id </param>
|
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
|
/// <returns></returns>
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
[HttpGet("46/{exportType}/{id}")]
|
|
public IActionResult GetInsignia46ConvertReportAsync(Guid id, string exportType = "pdf")
|
|
{
|
|
try
|
|
{
|
|
|
|
var mimeType = "";
|
|
switch (exportType.Trim().ToLower())
|
|
{
|
|
case "pdf": mimeType = "application/pdf"; break;
|
|
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
|
}
|
|
|
|
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"46-ประวัติสำหรับการเสนอขอพระราชทานเหรียญจักรพรรดิมาลา.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"insignia.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
}
|