diff --git a/Controllers/CandidateController.cs b/Controllers/CandidateController.cs
index 481e469..55c8ed0 100644
--- a/Controllers/CandidateController.cs
+++ b/Controllers/CandidateController.cs
@@ -849,6 +849,42 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
}
}
+ ///
+ /// get id หลักฐานชำระ
+ ///
+ /// รหัสผู้สมัครสอบ
+ ///
+ /// เมื่อ get id หลักฐานชำระสำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpGet("payment-image/{candidateId:length(36)}")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> GetsAsyncPaymentImgCandidate(string candidateId)
+ {
+ try
+ {
+ var doc = await _candidateService.GetsAsyncPaymentImgCandidate(candidateId);
+
+ if (doc == "")
+ return Success();
+
+ var file_data = await _minioService.DownloadFileAsync(Guid.Parse(doc));
+ Response.Headers["Content-Disposition"] = $"inline; filename={file_data.FileName}";
+ var ret = new FileContentResult(file_data.FileContent, file_data.FileType)
+ {
+ FileDownloadName = file_data.FileName
+ };
+
+ return ret;
+ }
+ catch (Exception ex)
+ {
+ return Error(ex);
+ }
+ }
+
///
/// อัปเอกสารหลักฐานการชำระเงิน
///
diff --git a/Controllers/PeriodExamController.cs b/Controllers/PeriodExamController.cs
index 06fdb4d..9808c56 100644
--- a/Controllers/PeriodExamController.cs
+++ b/Controllers/PeriodExamController.cs
@@ -475,6 +475,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
return Error("นามสกุลไฟล์ต้องเป็น .xlsx!");
}
+ // return Success(file);
await _periodExamService.UploadSeatCandidateAsync(examId, file);
return Success();
@@ -510,6 +511,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
return Error("นามสกุลไฟล์ต้องเป็น .xlsx!");
}
+ // return Success(file);
await _periodExamService.UploadPointCandidateAsync(examId, file);
return Success();
diff --git a/Request/RequestStatusRegistry.cs b/Request/RequestStatusRegistry.cs
index 90d1b71..b2fa669 100644
--- a/Request/RequestStatusRegistry.cs
+++ b/Request/RequestStatusRegistry.cs
@@ -7,6 +7,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
{
public bool Consend { get; set; }
public bool Position { get; set; }
+ public bool Bank { get; set; }
public string? Status { get; set; }
public PositionExam? PositionExam { get; set; }
}
diff --git a/Request/testtest.cs b/Request/testtest.cs
new file mode 100644
index 0000000..e5a7559
--- /dev/null
+++ b/Request/testtest.cs
@@ -0,0 +1,10 @@
+using System.Net;
+
+namespace BMA.EHR.Recurit.Exam.Service.Request
+{
+ public class testtest
+ {
+ public CancellationToken? xxx { get; set; }
+ public MemoryStream? zzz { get; set; }
+ }
+}
diff --git a/Services/CandidateService.cs b/Services/CandidateService.cs
index 143166a..a567698 100644
--- a/Services/CandidateService.cs
+++ b/Services/CandidateService.cs
@@ -492,9 +492,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
return candidate.PaymentImg == null ? "" : candidate.PaymentImg.Id.ToString();
}
+ public async Task GetsAsyncPaymentImgCandidate(string candidateId)
+ {
+ var candidate = await _context.Candidates.AsQueryable()
+ .Include(x => x.PaymentImg)
+ .Where(x => x.Id == Guid.Parse(candidateId))
+ .FirstOrDefaultAsync();
+
+ if (candidate == null)
+ throw new Exception(GlobalMessages.CandidateNotFound);
+
+ return candidate.PaymentImg == null ? "" : candidate.PaymentImg.Id.ToString();
+ }
+
public async Task GetsAsyncRegisterExam(string examId, string positionId)
{
var exam = await _context.PeriodExams.AsQueryable()
+ .Include(x => x.BankExam)
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
if (exam == null)
@@ -503,10 +517,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidate = await _context.Candidates.AsQueryable()
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId);
+ var position = await _context.PositionExams.AsQueryable()
+ .FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
+
if (positionId != "00000000-0000-0000-0000-000000000000")
{
- var position = await _context.PositionExams.AsQueryable()
- .FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
+ // var position = await _context.PositionExams.AsQueryable()
+ // .FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
if (position == null)
throw new Exception(GlobalMessages.PositionExamNotFound);
@@ -523,7 +540,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
Consend = candidate != null,
Status = candidate == null ? null : candidate.Status,
- PositionExam = candidatePosition?.PositionExam,
+ PositionExam = position,
+ Bank = exam.BankExam.Count() > 0,
Position = candidatePosition == null ? false : true
};
}
@@ -1279,9 +1297,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate.PeriodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
- var periodExam = await _context.PeriodExams.AsQueryable()
- .Include(x => x.Candidate)
- .FirstOrDefaultAsync(x => x.Id == candidate.PeriodExam.Id);
+ var periodExam = await _context.Candidates.AsQueryable()
+ .Where(x => x.PeriodExam == candidate.PeriodExam && x.ExamIdenNumber != null)
+ .ToListAsync();
if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
@@ -1299,7 +1317,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
}
if (candidate.Status == "checkSeat")
{
- var num = periodExam.Candidate.Count() + 1;
+ var num = periodExam.Count() + 1;
candidate.ExamIdenNumber = "CDC-" + num;
}
}
diff --git a/Services/PeriodExamService.cs b/Services/PeriodExamService.cs
index 0f0240f..87fce0c 100644
--- a/Services/PeriodExamService.cs
+++ b/Services/PeriodExamService.cs
@@ -595,7 +595,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (item != null)
{
- if (candidate.Status == "checkPoint")
+ if (candidate.Status == "checkPoint" || candidate.Status == "done")
{
candidate.Point = item.Point;
candidate.Status = "done";