ปรับ condition generate file รายงานเกษียณ

This commit is contained in:
Harid Promsri (Bright) 2023-08-30 14:15:29 +07:00
parent 4e7f3f6ff4
commit 86cd829c0e

View file

@ -54,12 +54,12 @@ namespace BMA.EHR.Report.Service.Controllers
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 (string.IsNullOrEmpty(retire.GetType().GetProperty("TypeReport").GetValue(retire)))
{ {
reportfile = $"31-ประกาศเกษียณข้าราชการ-1.trdp"; reportfile = $"31-ประกาศเกษียณข้าราชการ-1.trdp";
returnfile = $"ประกาศเกษียณข้าราชการ.{exportType}"; returnfile = $"ประกาศเกษียณข้าราชการ.{exportType}";
} }
else if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "EDIT") else if (retire.GetType().GetProperty("TypeReport").GetValue(retire) == "ADD" || retire.GetType().GetProperty("TypeReport").GetValue(retire) == "EDIT")
{ {
reportfile = $"31-ประกาศเกษียณข้าราชการ-2.trdp"; reportfile = $"31-ประกาศเกษียณข้าราชการ-2.trdp";
returnfile = $"แก้ไขประกาศเกษียณข้าราชการ.{exportType}"; returnfile = $"แก้ไขประกาศเกษียณข้าราชการ.{exportType}";
@ -71,7 +71,7 @@ namespace BMA.EHR.Report.Service.Controllers
} }
else else
{ {
return Error(retire.GetType().GetProperty("TypeReport").ToString()); return Error(retire.GetType().GetProperty("TypeReport").GetValue(retire));
} }
break; break;
case "EMPLOYEE": case "EMPLOYEE":
@ -79,7 +79,7 @@ namespace BMA.EHR.Report.Service.Controllers
returnfile = $"ประกาศเกษียณลูกจ้าง.{exportType}"; returnfile = $"ประกาศเกษียณลูกจ้าง.{exportType}";
break; break;
default: default:
return BadRequest(retire); return Error(retire.GetType().GetProperty("Type").GetValue(retire));
} }
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", reportfile); var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", reportfile);