diff --git a/Controllers/CandidateController.cs b/Controllers/CandidateController.cs
index 55c8ed0..0034db6 100644
--- a/Controllers/CandidateController.cs
+++ b/Controllers/CandidateController.cs
@@ -1035,6 +1035,33 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
}
}
+ ///
+ /// ใบสมัครสอบ
+ ///
+ /// รหัสรอบสมัคร
+ /// Id ตำแหน่งสมัครสอบ
+ ///
+ /// เมื่อทำการใบสมัครสอบ สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpGet("card/{examId:length(36)}/{positionId:length(36)}")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> GetsAsyncCardCandidate(string examId, string positionId)
+ {
+ try
+ {
+ var items = await _candidateService.GetsAsyncCardCandidate(examId, positionId);
+
+ return Success(items);
+ }
+ catch (Exception ex)
+ {
+ return Error(ex);
+ }
+ }
+
#endregion
}
}
diff --git a/Request/RequestCardCandidate.cs b/Request/RequestCardCandidate.cs
new file mode 100644
index 0000000..4c72ae5
--- /dev/null
+++ b/Request/RequestCardCandidate.cs
@@ -0,0 +1,17 @@
+using System.Net;
+using BMA.EHR.Recurit.Exam.Service.Models;
+
+namespace BMA.EHR.Recurit.Exam.Service.Request
+{
+ public class RequestCardCandidate
+ {
+ public string? FirstName { get; set; }
+ public string? LastName { get; set; }
+ public string? Prefix { get; set; }
+ public string? CitizenId { get; set; }
+ public string? ExamIdenNumber { get; set; }
+ public string? SeatNumber { get; set; }
+ public string? Point { get; set; }
+ public Guid? Id { get; set; }
+ }
+}
diff --git a/Request/testtest.cs b/Request/testtest.cs
deleted file mode 100644
index e5a7559..0000000
--- a/Request/testtest.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-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 a567698..c0a1f40 100644
--- a/Services/CandidateService.cs
+++ b/Services/CandidateService.cs
@@ -540,7 +540,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
{
Consend = candidate != null,
Status = candidate == null ? null : candidate.Status,
- PositionExam = position,
+ PositionExam = candidatePosition?.PositionExam,
Bank = exam.BankExam.Count() > 0,
Position = candidatePosition == null ? false : true
};
@@ -1314,6 +1314,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
else if (status == "payment" && candidate.PeriodExam.Fee == 0)
{
candidate.Status = "checkSeat";
+ var num = periodExam.Count() + 1;
+ candidate.ExamIdenNumber = "CDC-" + num;
}
if (candidate.Status == "checkSeat")
{
@@ -1367,6 +1369,49 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
+ public async Task GetsAsyncCardCandidate(string examId, string positionId)
+ {
+ var exam = await _context.PeriodExams.AsQueryable()
+ .FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
+
+ if (exam == null)
+ throw new Exception(GlobalMessages.ExamNotFound);
+
+ var candidate = await _context.Candidates.AsQueryable()
+ .Include(x => x.Prefix)
+ .Where(x => x.PeriodExam == exam && x.UserId == UserId)
+ .FirstOrDefaultAsync();
+
+ if (positionId != "00000000-0000-0000-0000-000000000000")
+ {
+ var position = await _context.PositionExams.AsQueryable()
+ .FirstOrDefaultAsync(x => x.Id == Guid.Parse(positionId) && x.PeriodExam == exam);
+
+ if (position == null)
+ throw new Exception(GlobalMessages.PositionExamNotFound);
+
+ candidate = await _context.Candidates.AsQueryable()
+ .Include(x => x.Prefix)
+ .Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
+ .FirstOrDefaultAsync();
+ }
+
+ if (candidate == null)
+ throw new Exception(GlobalMessages.CandidateNotFound);
+
+ return new RequestCardCandidate
+ {
+ FirstName = candidate.FirstName,
+ LastName = candidate.LastName,
+ Prefix = candidate.Prefix?.Name,
+ CitizenId = candidate.CitizenId,
+ ExamIdenNumber = candidate.ExamIdenNumber,
+ SeatNumber = candidate.SeatNumber,
+ Point = candidate.Point,
+ Id = candidate.Id,
+ };
+ }
+
#endregion
}
}
diff --git a/Services/PeriodExamService.cs b/Services/PeriodExamService.cs
index 87fce0c..467a2e8 100644
--- a/Services/PeriodExamService.cs
+++ b/Services/PeriodExamService.cs
@@ -622,10 +622,22 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
- var candidates = await _context.Candidates
- .AsQueryable()
- .Where(x => x.PeriodExam == periodExam)
- .ToListAsync();
+ var candidates = new List();
+ if (periodExam.SetSeat == true)
+ {
+ candidates = await _context.Candidates
+ .AsQueryable()
+ .Where(x => x.PeriodExam == periodExam)
+ .Where(x => x.Status != "waiver")
+ .ToListAsync();
+ }
+ else
+ {
+ candidates = await _context.Candidates
+ .AsQueryable()
+ .Where(x => x.PeriodExam == periodExam)
+ .ToListAsync();
+ }
var stream = new MemoryStream();
using (var package = new ExcelPackage(stream))