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