271 lines
15 KiB
C#
271 lines
15 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/transfer")]
|
|
[ApiVersion("2.0")]
|
|
[ApiController]
|
|
[Produces("application/json")]
|
|
[Authorize]
|
|
[SwaggerTag("API รายงานรายการขอโอน")]
|
|
public class TransferReportController : BaseController
|
|
{
|
|
#region " Fields "
|
|
|
|
private readonly IWebHostEnvironment _hostingEnvironment;
|
|
private readonly IConfiguration _configuration;
|
|
private readonly GenericReportGenerator _reportGenerator;
|
|
|
|
|
|
#endregion
|
|
|
|
#region " Constuctor and Destructor "
|
|
|
|
public TransferReportController(IWebHostEnvironment hostingEnvironment, IConfiguration configuration, GenericReportGenerator reportGenerator)
|
|
{
|
|
|
|
_hostingEnvironment = hostingEnvironment;
|
|
_configuration = configuration;
|
|
_reportGenerator = reportGenerator;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region " Methods "
|
|
|
|
#region คําร้องขอโอนไปถึงส่วนราชการอื่นนอก กรุงเทพมหานครที่ข้าราชการประสงค์ขอโอน
|
|
/// <summary>
|
|
/// คําร้องขอโอนไปถึงส่วนราชการอื่นนอก กรุงเทพมหานครที่ข้าราชการประสงค์ขอโอน
|
|
/// </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("1/{exportType}/{id}")]
|
|
public IActionResult GetTransfer1ConvertReportAsync(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", $"27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-1.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"transfer.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region หนังสือแจ้งสํานักงานการเจ้าหน้าที่ สํานักปลัดกรุงเทพมหานคร ให้ทราบตําแหน่งและตําแหน่งเลขที่ที่ดําเนินการให้โอน
|
|
/// <summary>
|
|
/// หนังสือแจ้งสํานักงานการเจ้าหน้าที่ สํานักปลัดกรุงเทพมหานคร ให้ทราบตําแหน่งและตําแหน่งเลขที่ที่ดําเนินการให้โอน
|
|
/// </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("2/{exportType}/{id}")]
|
|
public IActionResult GetTransfer2ConvertReportAsync(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", $"27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-1.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"transfer.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region หนังสือยินยอมให้โอนและวันที่พร้อมจะให้โอนไปยัง หน่วยงานที่รับโอน
|
|
/// <summary>
|
|
/// หนังสือยินยอมให้โอนและวันที่พร้อมจะให้โอนไปยัง หน่วยงานที่รับโอน
|
|
/// </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("3/{exportType}/{id}")]
|
|
public IActionResult GetTransfer3ConvertReportAsync(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", $"27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-1.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"transfer.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region หนังสือแจ้งสหกรณ์ออมทรัพย์กรุงเทพมหานครเพื่อขอ ตรวจสอบภาระหนี้สินสหกรณ์ออมทรัพย์
|
|
/// <summary>
|
|
/// หนังสือแจ้งสหกรณ์ออมทรัพย์กรุงเทพมหานครเพื่อขอ ตรวจสอบภาระหนี้สินสหกรณ์ออมทรัพย์
|
|
/// </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("4/{exportType}/{id}")]
|
|
public IActionResult GetTransfer4ConvertReportAsync(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", $"27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-1.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"transfer.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region หนังสือถึงสํานักงานการเจ้าหน้าที่ สํานักปลัดกรุงเทพมหานครเพื่อขอตรวจสอบพฤติการณ์ทางวินัย และภาระหนี้สินสวัสดิการ
|
|
/// <summary>
|
|
/// หนังสือถึงสํานักงานการเจ้าหน้าที่ สํานักปลัดกรุงเทพมหานครเพื่อขอตรวจสอบพฤติการณ์ทางวินัย และภาระหนี้สินสวัสดิการ
|
|
/// </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("5/{exportType}/{id}")]
|
|
public IActionResult GetTransfer5ConvertReportAsync(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", $"27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-1.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"transfer.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region หนังสือถึงสถาบันพัฒนาข้าราชการกรุงเทพมหานครเพื่อขอตรวจสอบเรื่องภาระผูกพันการรับทุนและการลา ศึกษาต่อกับทางกรุงเทพมหานคร
|
|
/// <summary>
|
|
/// หนังสือถึงสถาบันพัฒนาข้าราชการกรุงเทพมหานครเพื่อขอตรวจสอบเรื่องภาระผูกพันการรับทุนและการลา ศึกษาต่อกับทางกรุงเทพมหานคร
|
|
/// </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("6/{exportType}/{id}")]
|
|
public IActionResult GetTransfer6ConvertReportAsync(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", $"27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-1.trdp");
|
|
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
|
|
|
return File(contentData, mimeType, $"transfer.{exportType.Trim().ToLower()}");
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
}
|