เพิ่ม export type รายงานเกษียณ
This commit is contained in:
parent
185e4ab225
commit
61e5e4cbd2
1 changed files with 12 additions and 8 deletions
|
|
@ -28,16 +28,18 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region ประกาศเกษียณราชการ
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// รายงานหน้าประกาศเกษียณ
|
/// รายงานหน้าประกาศเกษียณ
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Id">Id ของรอบเกษียณ</param>
|
/// <param name="Id">Id ของรอบเกษียณ</param>
|
||||||
|
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("{Id}")]
|
[HttpGet("{exportType}/{Id}")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetProfileRetirement([FromRoute] Guid Id)
|
public async Task<ActionResult<ResponseObject>> GetProfileRetirement([FromRoute] Guid Id, string exportType = "pdf")
|
||||||
{
|
{
|
||||||
var retire = await _service.GetProfileRetirementdAsync(Id);
|
var retire = await _service.GetProfileRetirementdAsync(Id);
|
||||||
if (retire == null)
|
if (retire == null)
|
||||||
|
|
@ -48,23 +50,24 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
{
|
{
|
||||||
var reportfile = "";
|
var reportfile = "";
|
||||||
var returnfile = "";
|
var returnfile = "";
|
||||||
|
exportType = exportType.Trim();
|
||||||
switch (retire.GetType().GetProperty("Type").GetValue(retire))
|
switch (retire.GetType().GetProperty("Type").GetValue(retire))
|
||||||
{
|
{
|
||||||
case "OFFICER":
|
case "OFFICER":
|
||||||
if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "ADD")
|
if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "ADD")
|
||||||
{
|
{
|
||||||
reportfile = $"31-ประกาศเกษียณข้าราชการ-1.trdp";
|
reportfile = $"31-ประกาศเกษียณข้าราชการ-1.trdp";
|
||||||
returnfile = $"ประกาศเกษียณข้าราชการ.pdf";
|
returnfile = $"ประกาศเกษียณข้าราชการ.{exportType}";
|
||||||
}
|
}
|
||||||
else if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "EDIT")
|
else if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "EDIT")
|
||||||
{
|
{
|
||||||
reportfile = $"31-ประกาศเกษียณข้าราชการ-2.trdp";
|
reportfile = $"31-ประกาศเกษียณข้าราชการ-2.trdp";
|
||||||
returnfile = $"แก้ไขประกาศเกษียณข้าราชการ.pdf";
|
returnfile = $"แก้ไขประกาศเกษียณข้าราชการ.{exportType}";
|
||||||
}
|
}
|
||||||
else if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "REMOVE")
|
else if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "REMOVE")
|
||||||
{
|
{
|
||||||
reportfile = $"31-ประกาศเกษียณข้าราชการ-3.trdp";
|
reportfile = $"31-ประกาศเกษียณข้าราชการ-3.trdp";
|
||||||
returnfile = $"ยกเลิกประกาศเกษียณข้าราชการ.pdf";
|
returnfile = $"ยกเลิกประกาศเกษียณข้าราชการ.{exportType}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -116,10 +119,11 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
};
|
};
|
||||||
|
|
||||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||||
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
|
||||||
var content = result.DocumentBytes;
|
var content = result.DocumentBytes;
|
||||||
return File(content, "application/pdf", returnfile);
|
return File(content, $"application/{exportType}", returnfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue