Compare commits
No commits in common. "dev" and "v1.0.11" have entirely different histories.
13 changed files with 179 additions and 3470 deletions
|
|
@ -86,7 +86,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private string? RootDnaId => _httpContextAccessor?.HttpContext?.User?.FindFirst("orgRootDnaId")?.Value;
|
||||
private string? token => _httpContextAccessor.HttpContext.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
|
@ -283,10 +282,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
|
||||
#endregion
|
||||
|
||||
#region " จัดการรอบการสมัครสอบคัดเลือกอื่นๆ "
|
||||
#region " จัดการรอบการสมัครสอบคัดเลือกผู้พิการ "
|
||||
|
||||
/// <summary>
|
||||
/// แสดงข้อมูลรอบการสอบคัดเลือกอื่นๆ
|
||||
/// แสดงข้อมูลรอบการสอบคัดเลือกผู้พิการ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
|
|
@ -341,9 +340,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// แสดงข้อมูลรอบการสอบคัดเลือกอื่นๆเป็นรายการ
|
||||
/// แสดงข้อมูลรอบการสอบคัดเลือกผู้พิการเป็นรายการ
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกอื่นๆ</param>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกผู้พิการ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
|
|
@ -382,7 +381,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
AnnouncementEndDate = x.AnnouncementEndDate,
|
||||
AnnouncementStartDate = x.AnnouncementStartDate,
|
||||
AnnouncementDate = x.AnnouncementDate,
|
||||
ScoreExpireDate = x.ScoreExpireDate,
|
||||
CheckDisability = x.CheckDisability,
|
||||
CheckDocument = x.CheckDocument,
|
||||
Detail = x.Detail,
|
||||
|
|
@ -452,7 +450,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// เพิ่มข้อมูลรอบการจัดสอบคัดเลือกอื่นๆ
|
||||
/// เพิ่มข้อมูลรอบการจัดสอบคัดเลือกผู้พิการ
|
||||
/// </summary>
|
||||
/// <param name="req">Request parameters</param>
|
||||
/// <returns></returns>
|
||||
|
|
@ -488,9 +486,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
PaymentEndDate = req.PaymentEndDate,
|
||||
Note = req.Note,
|
||||
AnnouncementDate = req.AnnouncementDate,
|
||||
ScoreExpireDate = req.ScoreExpireDate,
|
||||
CheckDisability = true,
|
||||
OrganizationId = req.rootDnaId,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
|
|
@ -503,7 +499,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
|
@ -527,9 +523,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขข้อมูลรอบการจัดสอบคัดเลือกอื่นๆ
|
||||
/// แก้ไขข้อมูลรอบการจัดสอบคัดเลือกผู้พิการ
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกอื่นๆ</param>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกผู้พิการ</param>
|
||||
/// <param name="req">Request parameters</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการเพิ่มข้อมูลสำเร็จ</response>
|
||||
|
|
@ -572,9 +568,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
data.ExamDate = req.ExamDate;
|
||||
data.Note = req.Note;
|
||||
data.AnnouncementDate = req.AnnouncementDate;
|
||||
// ScoreExpireDate อัปเดตเฉพาะเมื่อ FE ส่งค่ามาเท่านั้น (ไม่บังคับส่ง)
|
||||
if (req.ScoreExpireDate.HasValue)
|
||||
data.ScoreExpireDate = req.ScoreExpireDate;
|
||||
data.LastUpdatedAt = DateTime.Now;
|
||||
data.LastUpdateUserId = UserId ?? "";
|
||||
data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
|
|
@ -592,9 +585,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// ลบข้อมูลรอบการจัดสอบคัดเลือกอื่นๆ
|
||||
/// ลบข้อมูลรอบการจัดสอบคัดเลือกผู้พิการ
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกอื่นๆ</param>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกผู้พิการ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการลบข้อมูลสำเร็จ</response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
|
|
@ -653,7 +646,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
#region " Candidate Files "
|
||||
|
||||
/// <summary>
|
||||
/// แสดงข้อมูลสำหรับหน้าจอ รายการนำเข้าข้อมูลผู้สมัครสอบคัดเลือกอื่นๆ
|
||||
/// แสดงข้อมูลสำหรับหน้าจอ รายการนำเข้าข้อมูลผู้สมัครสอบคัดเลือกผู้พิการ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อแสดงรายการข้อมูลสำเร็จ</response>
|
||||
|
|
@ -675,16 +668,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
string role = jsonData["result"]?.ToString() ?? string.Empty;
|
||||
string rootDnaId = string.Empty;
|
||||
if (role != "OWNER")
|
||||
{
|
||||
rootDnaId = RootDnaId?.ToString() ?? "";
|
||||
}
|
||||
|
||||
var data = await _context.PeriodExams.AsQueryable()
|
||||
.Where(x => x.CheckDisability == true)
|
||||
.Where(x => string.IsNullOrEmpty(rootDnaId) || x.OrganizationId == Guid.Parse(rootDnaId))
|
||||
.Include(x => x.ImportFile)
|
||||
.Include(x => x.Disables)
|
||||
.Include(x => x.ScoreImport)
|
||||
|
|
@ -709,7 +694,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
ImportYear = x.ScoreImport.Year,
|
||||
ImportDate = x.CreatedAt.Date.ToThaiShortDate(),
|
||||
ScoreCount = x.ScoreImport.Scores.Count(),
|
||||
ResultCount = x.ScoreImport.Scores.Count(x => x.ExamStatus == "ผ่าน" && !string.IsNullOrEmpty(x.Number))
|
||||
ResultCount = x.ScoreImport.Scores.Count(x => !string.IsNullOrEmpty(x.Number))
|
||||
},
|
||||
x.CreatedUserId,
|
||||
})
|
||||
|
|
@ -727,7 +712,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// นำเข้ารายชื่อผู้สมัครสอบคัดเลือกอื่นๆ
|
||||
/// นำเข้ารายชื่อผู้สมัครสอบคัดเลือกผู้พิการ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำนำเข้าข้อมูลสำเร็จ</response>
|
||||
|
|
@ -779,7 +764,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
{
|
||||
new DisableImportHistory
|
||||
{
|
||||
Description = "นำเข้าข้อมูลผู้สมัครสอบคัดเลือกอื่นๆ",
|
||||
Description = "นำเข้าข้อมูลผู้สมัครสอบคัดเลือกผู้พิการ",
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
|
|
@ -969,9 +954,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// ลบข้อมูลนำข้อมูลผู้สมัครสอบคัดเลือกอื่นๆ
|
||||
/// ลบข้อมูลนำข้อมูลผู้สมัครสอบคัดเลือกผู้พิการ
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกอื่นๆ</param>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกผู้พิการ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำนำเข้าข้อมูลสำเร็จ</response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
|
|
@ -1034,9 +1019,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// แสดงประวัติการนำเข้าข้อมูลการสอบคัดเลือกอื่นๆ
|
||||
/// แสดงประวัติการนำเข้าข้อมูลการสอบคัดเลือกผู้พิการ
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกอื่นๆ</param>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกผู้พิการ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำนำเข้าข้อมูลสำเร็จ</response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
|
|
@ -1074,9 +1059,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// นำเข้ารายชื่อผู้สมัครสอบคัดเลือกอื่นๆ (ข้อมูลผู้สมัครสอบ)
|
||||
/// นำเข้ารายชื่อผู้สมัครสอบคัดเลือกผู้พิการ (ข้อมูลผู้สมัครสอบ)
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกอื่นๆ</param>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกผู้พิการ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำนำเข้าข้อมูลสำเร็จ</response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
|
|
@ -1145,7 +1130,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
// สร้างรอบการบรรจุ โดยเอาเข้ามูลมาใส่จาก Request
|
||||
imported.ImportHostories.Add(new DisableImportHistory
|
||||
{
|
||||
Description = "นำเข้าข้อมูลผู้สมัครสอบคัดเลือกอื่นๆ",
|
||||
Description = "นำเข้าข้อมูลผู้สมัครสอบคัดเลือกผู้พิการ",
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
|
|
@ -1474,9 +1459,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
|
||||
#region " Score File "
|
||||
/// <summary>
|
||||
/// นำเข้าผลคะแนนสอบคัดเลือกอื่นๆ (บัญชีรวมคะแนน)
|
||||
/// นำเข้าผลคะแนนสอบคัดเลือกผู้พิการ (บัญชีรวมคะแนน)
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกอื่นๆ</param>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกผู้พิการ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำนำเข้าข้อมูลสำเร็จ</response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
|
|
@ -1589,7 +1574,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
|
||||
var r = new DisableScore();
|
||||
|
||||
#region นำเข้าผลคะแนนสอบคัดเลือกอื่นๆ old
|
||||
#region นำเข้าผลคะแนนสอบคัดเลือกผู้พิการ old
|
||||
|
||||
////r.ExamId = workSheet?.Cells[row, 2]?.GetValue<string>();
|
||||
|
||||
|
|
@ -1699,9 +1684,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
|
||||
#region " Result File "
|
||||
/// <summary>
|
||||
/// นำเข้าผลการสอบคัดเลือกอื่นๆ (ผลการสอบ)
|
||||
/// นำเข้าผลการสอบคัดเลือกผู้พิการ (ผลการสอบ)
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกอื่นๆ </param>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกผู้พิการ </param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำนำเข้าข้อมูลสำเร็จ</response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
|
|
@ -1773,7 +1758,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
.Select(g => g.First())
|
||||
.ToDictionary(s => s.ExamId, s => s);
|
||||
|
||||
// ถ้าไม่มีผลคะแนนสอบคัดเลือกอื่นๆให้จบการทำงาน
|
||||
// ถ้าไม่มีผลคะแนนสอบคัดเลือกผู้พิการให้จบการทำงาน
|
||||
if (score.Count == 0) return Success();
|
||||
|
||||
var file = Request.Form.Files[0];
|
||||
|
|
@ -2066,9 +2051,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
case "notpass":
|
||||
queryWithScores = queryWithScores.Where(x => x.score != null && x.score.ExamStatus == "ไม่ผ่าน");
|
||||
break;
|
||||
case "other":
|
||||
queryWithScores = queryWithScores.Where(x => x.score != null && !new[] { "ขส.", "ผ่าน", "ไม่ผ่าน" }.Contains(x.score.ExamStatus));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2338,15 +2320,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
Score = score == null ? 0.0 : score.TotalScore,
|
||||
Number = score == null ? "" : score.Number,
|
||||
ExamCount = _disableService.GetExamCount(disable.CitizenId),
|
||||
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||
//ScoreExpire = disable.PeriodExam.AnnouncementDate == null
|
||||
// ? ""
|
||||
// : disable.PeriodExam.AnnouncementDate != DateTime.MinValue
|
||||
// ? disable.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate()
|
||||
// : "",
|
||||
ScoreExpire = disable.PeriodExam.ScoreExpireDate == null
|
||||
ScoreExpire = disable.PeriodExam.AnnouncementDate == null
|
||||
? ""
|
||||
: disable.PeriodExam.ScoreExpireDate.Value.ToThaiShortDate(),
|
||||
: disable.PeriodExam.AnnouncementDate != DateTime.MinValue
|
||||
? disable.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate()
|
||||
: "",
|
||||
typeTest = disable.typeTest,
|
||||
ScoreResult = score == null ? null : new
|
||||
{
|
||||
|
|
@ -2560,7 +2538,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// โอนคนสรรหาไปบรรจุ (คัดเลือกอื่นๆ)
|
||||
/// โอนคนสรรหาไปบรรจุ
|
||||
/// </summary>
|
||||
/// <param name="examId">รหัสรอบสมัคร</param>
|
||||
/// <returns></returns>
|
||||
|
|
@ -2591,7 +2569,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
/// <summary>
|
||||
/// ผลคะแนนผู้สมัครสอบ
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกอื่นๆ</param>
|
||||
/// <param name="id">รหัสรอบการสอบคัดเลือกผู้พิการ</param>
|
||||
/// <param name="examId">เลขประจำตัวสอบ</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจำนวนผู้สอบผ่านแข่งขันเพื่อบรรจุเข้ารับราชการเป็นข้าราชการ กทม. สามัญสำเร็จ</response>
|
||||
|
|
@ -2698,15 +2676,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
T = score != null ? score.TotalScore.ToString().ToThaiNumber() : "",
|
||||
Result = score != null ? score.ExamStatus : "",
|
||||
Number = score != null && score.Number != null ? score.Number.ToString().ToThaiNumber() : "",
|
||||
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||
//Expire = disable.PeriodExam.AnnouncementDate == null
|
||||
// ? ""
|
||||
// : disable.PeriodExam.AnnouncementDate != DateTime.MinValue
|
||||
// ? disable.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate().ToString().ToThaiNumber()
|
||||
// : "",
|
||||
Expire = disable.PeriodExam.ScoreExpireDate == null
|
||||
Expire = disable.PeriodExam.AnnouncementDate == null
|
||||
? ""
|
||||
: disable.PeriodExam.ScoreExpireDate.Value.ToThaiShortDate().ToString().ToThaiNumber(),
|
||||
: disable.PeriodExam.AnnouncementDate != DateTime.MinValue
|
||||
? disable.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate().ToString().ToThaiNumber()
|
||||
: "",
|
||||
};
|
||||
|
||||
var result = new
|
||||
|
|
|
|||
|
|
@ -191,9 +191,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
Number = sr == null ? "" : sr.Number,
|
||||
// ExamCount = 10,
|
||||
// ExamCount = GetExamCountTes(p.CitizenId),
|
||||
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||
//ScoreExpire = p.PeriodExam.AnnouncementDate == null ? "" : p.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate(),
|
||||
ScoreExpire = p.PeriodExam.ScoreExpireDate == null ? "" : p.PeriodExam.ScoreExpireDate.Value.ToThaiShortDate(),
|
||||
ScoreExpire = p.PeriodExam.AnnouncementDate == null ? "" : p.PeriodExam.AnnouncementDate.Value.AddYears(2).ToThaiShortDate(),
|
||||
FullA = sr == null ? 0 : sr.FullA,
|
||||
SumA = sr == null ? 0 : sr.SumA,
|
||||
FullB = sr == null ? 0 : sr.FullB,
|
||||
|
|
|
|||
|
|
@ -1002,7 +1002,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// โอนคนสรรหาไปบรรจุ (สอบคัดเลือก)
|
||||
/// โอนคนสรรหาไปบรรจุ
|
||||
/// </summary>
|
||||
/// <param name="examId">รหัสรอบสมัคร</param>
|
||||
/// <returns></returns>
|
||||
|
|
|
|||
|
|
@ -2392,11 +2392,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Data.Migrations
|
|||
.HasColumnOrder(9)
|
||||
.HasComment("รอบการสอบ");
|
||||
|
||||
b.Property<DateTime?>("ScoreExpireDate")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(6)
|
||||
.HasComment("วันหมดอายุบัญชี");
|
||||
|
||||
b.Property<bool>("SetSeat")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("เช็คอัพคะแนน");
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,31 +0,0 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Recurit.Exam.Service.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class update_PeriodExams_add_ScoreExpireDate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "ScoreExpireDate",
|
||||
table: "PeriodExams",
|
||||
type: "datetime(6)",
|
||||
nullable: true,
|
||||
comment: "วันหมดอายุบัญชี")
|
||||
.Annotation("Relational:ColumnOrder", 6);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ScoreExpireDate",
|
||||
table: "PeriodExams");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -41,9 +41,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Models
|
|||
[Column(Order = 5), Comment("วันประกาศผลสอบ")]
|
||||
public DateTime? AnnouncementDate { get; set; }
|
||||
|
||||
[Column(Order = 6), Comment("วันหมดอายุบัญชี")]
|
||||
public DateTime? ScoreExpireDate { get; set; }
|
||||
|
||||
[Required, Column(Order = 6), Comment("วันเริ่มประกาศ")]
|
||||
public DateTime AnnouncementStartDate { get; set; } = DateTime.Now.Date;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var req = await client.GetAsync(apiPath);
|
||||
var res = await req.Content.ReadAsStringAsync();
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
|
|||
namespace BMA.EHR.Recurit.Exam.Service.Request.Disables
|
||||
{
|
||||
/// <summary>
|
||||
/// ตัวแปรสำหรับสร้างข้อมูลการสอบคัดเลือกอื่นๆ
|
||||
/// ตัวแปรสำหรับสร้างข้อมูลการสอบคัดเลือกผู้พิการ
|
||||
/// </summary>
|
||||
public class PostDisableImportRequest
|
||||
{
|
||||
|
|
@ -82,15 +82,5 @@ namespace BMA.EHR.Recurit.Exam.Service.Request.Disables
|
|||
/// วันที่ประกาศผลสอบ
|
||||
/// </summary>
|
||||
public DateTime AnnouncementDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// วันหมดอายุบัญชี (ไม่บังคับส่ง)
|
||||
/// </summary>
|
||||
public DateTime? ScoreExpireDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// รหัส DNA หน่วยงาน
|
||||
/// </summary>
|
||||
public Guid? rootDnaId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Request
|
|||
public DateTime AnnouncementStartDate { get; set; } = DateTime.Now.Date;
|
||||
public DateTime AnnouncementEndDate { get; set; } = DateTime.Now.Date;
|
||||
public DateTime? AnnouncementDate { get; set; }
|
||||
public DateTime? ScoreExpireDate { get; set; }
|
||||
public DateTime? ExamDate { get; set; }
|
||||
public Guid? OrganizationCodeId { get; set; }
|
||||
public string? OrganizationCodeName { get; set; }
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Response
|
|||
public DateTime AnnouncementStartDate { get; set; }
|
||||
public DateTime AnnouncementEndDate { get; set; }
|
||||
public DateTime? AnnouncementDate { get; set; }
|
||||
public DateTime? ScoreExpireDate { get; set; }
|
||||
public DateTime? ExamDate { get; set; }
|
||||
public Guid? OrganizationCodeId { get; set; }
|
||||
public string? OrganizationCodeName { get; set; }
|
||||
|
|
|
|||
|
|
@ -2480,9 +2480,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Number = candidate.Number,
|
||||
ReviewPoint = candidate.ReviewPoint,
|
||||
Review = candidate.Review,
|
||||
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||
//AnnouncementDate = exam.AnnouncementDate?.AddYears(2),
|
||||
AnnouncementDate = exam.ScoreExpireDate,
|
||||
AnnouncementDate = exam.AnnouncementDate?.AddYears(2),
|
||||
Id = candidate.Id,
|
||||
Position = positionName,
|
||||
PositionLevel = positionLevelName,
|
||||
|
|
@ -2542,9 +2540,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Number = candidate.Number,
|
||||
ReviewPoint = candidate.ReviewPoint,
|
||||
Review = candidate.Review,
|
||||
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||
//AnnouncementDate = candidate.PeriodExam?.AnnouncementDate?.AddYears(2),
|
||||
AnnouncementDate = candidate.PeriodExam?.ScoreExpireDate,
|
||||
AnnouncementDate = candidate.PeriodExam?.AnnouncementDate?.AddYears(2),
|
||||
Id = candidate.Id,
|
||||
Position = positionName,
|
||||
PositionLevel = positionLevelName,
|
||||
|
|
@ -2667,7 +2663,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token?.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||
{
|
||||
citizenId
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ using Microsoft.EntityFrameworkCore;
|
|||
using OfficeOpenXml;
|
||||
using OfficeOpenXml.Style;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
|
|
@ -109,7 +108,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
AnnouncementEndDate = x.AnnouncementEndDate,
|
||||
AnnouncementStartDate = x.AnnouncementStartDate,
|
||||
AnnouncementDate = x.AnnouncementDate,
|
||||
ScoreExpireDate = x.ScoreExpireDate,
|
||||
CheckDisability = x.CheckDisability,
|
||||
CheckDocument = x.CheckDocument,
|
||||
Detail = x.Detail,
|
||||
|
|
@ -159,7 +157,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
AnnouncementEndDate = x.AnnouncementEndDate,
|
||||
AnnouncementStartDate = x.AnnouncementStartDate,
|
||||
AnnouncementDate = x.AnnouncementDate,
|
||||
ScoreExpireDate = x.ScoreExpireDate,
|
||||
CheckDisability = x.CheckDisability,
|
||||
CheckDocument = x.CheckDocument,
|
||||
Detail = x.Detail,
|
||||
|
|
@ -355,7 +352,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
PaymentEndDate = inserted.PaymentEndDate,
|
||||
AnnouncementStartDate = inserted.AnnouncementStartDate,
|
||||
AnnouncementDate = inserted.AnnouncementDate,
|
||||
ScoreExpireDate = inserted.ScoreExpireDate,
|
||||
ExamDate = inserted.ExamDate,
|
||||
AnnouncementEndDate = inserted.AnnouncementEndDate,
|
||||
OrganizationCodeId = inserted.OrganizationCodeId,
|
||||
|
|
@ -458,9 +454,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
periodExam.PaymentEndDate = updated.PaymentEndDate;
|
||||
periodExam.AnnouncementStartDate = updated.AnnouncementStartDate;
|
||||
periodExam.AnnouncementDate = updated.AnnouncementDate;
|
||||
// ScoreExpireDate อัปเดตเฉพาะเมื่อ FE ส่งค่ามาเท่านั้น (ไม่บังคับส่ง)
|
||||
if (updated.ScoreExpireDate.HasValue)
|
||||
periodExam.ScoreExpireDate = updated.ScoreExpireDate;
|
||||
periodExam.ExamDate = updated.ExamDate;
|
||||
periodExam.AnnouncementEndDate = updated.AnnouncementEndDate;
|
||||
periodExam.OrganizationCodeId = updated.OrganizationCodeId;
|
||||
|
|
@ -1144,7 +1137,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
for (int row = 4; row <= rowCount; row++)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(worksheet);
|
||||
if (worksheet.Cells[row, 2].Value == null) continue;
|
||||
// if (worksheet.Cells[row, 2].Value != null)
|
||||
// {
|
||||
list.Add(new RequestImportSeat
|
||||
{
|
||||
Number = worksheet.Cells[row, 1].Value != null ? worksheet.Cells[row, 1].Value.ToString() : null,
|
||||
|
|
@ -1152,57 +1146,58 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
CitizenId = worksheet.Cells[row, 3].Value != null ? worksheet.Cells[row, 3].Value.ToString() : null,
|
||||
SeatNumber = worksheet.Cells[row, 4].Value != null ? worksheet.Cells[row, 4].Value.ToString() : null,
|
||||
|
||||
PointPath1A = worksheet.Cells[row, 9].Value != null ? ExtractFirstNumber(worksheet.Cells[row, 9].Value.ToString()) : null,
|
||||
PointPath2A = worksheet.Cells[row, 10].Value != null ? ExtractFirstNumber(worksheet.Cells[row, 10].Value.ToString()) : null,
|
||||
PointPath3A = worksheet.Cells[row, 11].Value != null ? ExtractFirstNumber(worksheet.Cells[row, 11].Value.ToString()) : null,
|
||||
PointTotalA = worksheet.Cells[3, 12].Value != null ? ExtractFirstNumber(worksheet.Cells[3, 12].Value.ToString()) : null,
|
||||
PointA = worksheet.Cells[row, 12].Value != null ? ExtractFirstNumber(worksheet.Cells[row, 12].Value.ToString()) : null,
|
||||
PointPerA = worksheet.Cells[row, 13].Value != null ? ExtractFirstNumber(worksheet.Cells[row, 13].Value.ToString()) : null,
|
||||
PointPath1A = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null,
|
||||
PointPath2A = worksheet.Cells[row, 10].Value != null ? worksheet.Cells[row, 10].Value.ToString() : null,
|
||||
PointPath3A = worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : null,
|
||||
PointTotalA = worksheet.Cells[3, 12].Value != null ? worksheet.Cells[3, 12].Value.ToString()?.Split(" ")[0] : null,
|
||||
PointA = worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : null,
|
||||
PointPerA = worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : null,
|
||||
ResultA = worksheet.Cells[row, 14].Value != null ? worksheet.Cells[row, 14].Value.ToString() : null,
|
||||
|
||||
PointTotalB = worksheet.Cells[3, 15].Value != null ? ExtractFirstNumber(worksheet.Cells[3, 15].Value.ToString()) : null,
|
||||
PointB = worksheet.Cells[row, 15].Value != null ? ExtractFirstNumber(worksheet.Cells[row, 15].Value.ToString()) : null,
|
||||
PointPerB = worksheet.Cells[row, 16].Value != null ? ExtractFirstNumber(worksheet.Cells[row, 16].Value.ToString()) : null,
|
||||
PointTotalB = worksheet.Cells[3, 15].Value != null ? worksheet.Cells[3, 15].Value.ToString()?.Split(" ")[0] : null,
|
||||
PointB = worksheet.Cells[row, 15].Value != null ? worksheet.Cells[row, 15].Value.ToString() : null,
|
||||
PointPerB = worksheet.Cells[row, 16].Value != null ? worksheet.Cells[row, 16].Value.ToString() : null,
|
||||
ResultB = worksheet.Cells[row, 17].Value != null ? worksheet.Cells[row, 17].Value.ToString() : null,
|
||||
|
||||
PointPath1C = worksheet.Cells[row, 18].Value != null ? ExtractFirstNumber(worksheet.Cells[row, 18].Value.ToString()) : null,
|
||||
PointPath2C = worksheet.Cells[row, 19].Value != null ? ExtractFirstNumber(worksheet.Cells[row, 19].Value.ToString()) : null,
|
||||
PointTotalC = worksheet.Cells[3, 20].Value != null ? ExtractFirstNumber(worksheet.Cells[3, 20].Value.ToString()) : null,
|
||||
PointC = worksheet.Cells[row, 20].Value != null ? ExtractFirstNumber(worksheet.Cells[row, 20].Value.ToString()) : null,
|
||||
PointPerC = worksheet.Cells[row, 21].Value != null ? ExtractFirstNumber(worksheet.Cells[row, 21].Value.ToString()) : null,
|
||||
PointPath1C = worksheet.Cells[row, 18].Value != null ? worksheet.Cells[row, 18].Value.ToString() : null,
|
||||
PointPath2C = worksheet.Cells[row, 19].Value != null ? worksheet.Cells[row, 19].Value.ToString() : null,
|
||||
PointTotalC = worksheet.Cells[3, 20].Value != null ? worksheet.Cells[3, 20].Value.ToString()?.Split(" ")[0] : null,
|
||||
PointC = worksheet.Cells[row, 20].Value != null ? worksheet.Cells[row, 20].Value.ToString() : null,
|
||||
PointPerC = worksheet.Cells[row, 21].Value != null ? worksheet.Cells[row, 21].Value.ToString() : null,
|
||||
ResultC = worksheet.Cells[row, 22].Value != null ? worksheet.Cells[row, 22].Value.ToString() : null,
|
||||
|
||||
Pass = worksheet.Cells[row, 23].Value != null ? worksheet.Cells[row, 23].Value.ToString() : null,
|
||||
ExamReason = worksheet.Cells[row, 27].Value != null ? worksheet.Cells[row, 27].Value.ToString() : null,
|
||||
});
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[row, 9].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"กรอกจำนวนคะแนนไม่ถูกต้อง (แถวที่ {row} คอลัมน์ I)");
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[row, 10].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"กรอกจำนวนคะแนนไม่ถูกต้อง (แถวที่ {row} คอลัมน์ J)");
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[row, 11].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"กรอกจำนวนคะแนนไม่ถูกต้อง (แถวที่ {row} คอลัมน์ K)");
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[3, 12].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"รูปแบบคะแนนรวมไม่ถูกต้อง กรุณากรอกตัวเลขนำหน้า เช่น '100 คะเนน' หรือ '100' หรือเว้นว่างไว้ (แถวที่ 3 คอลัมน์ L)");
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[row, 12].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"กรอกจำนวนคะแนนไม่ถูกต้อง (แถวที่ {row} คอลัมน์ L)");
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[row, 13].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"กรอกจำนวนคะแนนไม่ถูกต้อง (แถวที่ {row} คอลัมน์ M)");
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[3, 15].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"รูปแบบคะแนนรวมไม่ถูกต้อง กรุณากรอกตัวเลขนำหน้า เช่น '100 คะเนน' หรือ '100' หรือเว้นว่างไว้ (แถวที่ 3 คอลัมน์ O)");
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[row, 15].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"กรอกจำนวนคะแนนไม่ถูกต้อง (แถวที่ {row} คอลัมน์ O)");
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[row, 16].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"กรอกจำนวนคะแนนไม่ถูกต้อง (แถวที่ {row} คอลัมน์ P)");
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[row, 18].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"กรอกจำนวนคะแนนไม่ถูกต้อง (แถวที่ {row} คอลัมน์ R)");
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[row, 19].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"กรอกจำนวนคะแนนไม่ถูกต้อง (แถวที่ {row} คอลัมน์ S)");
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[3, 20].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"รูปแบบคะแนนรวมไม่ถูกต้อง กรุณากรอกตัวเลขนำหน้า เช่น '100 คะเนน' หรือ '100' หรือเว้นว่างไว้ (แถวที่ 3 คอลัมน์ T)");
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[row, 20].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"กรอกจำนวนคะแนนไม่ถูกต้อง (แถวที่ {row} คอลัมน์ T)");
|
||||
if (!int.TryParse(ExtractFirstNumber(worksheet.Cells[row, 21].Value?.ToString()) ?? "0", out _))
|
||||
throw new Exception($"กรอกจำนวนคะแนนไม่ถูกต้อง (แถวที่ {row} คอลัมน์ U)");
|
||||
if (!int.TryParse(worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
if (!int.TryParse(worksheet.Cells[row, 10].Value != null ? worksheet.Cells[row, 10].Value.ToString() : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
if (!int.TryParse(worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
if (!int.TryParse(worksheet.Cells[3, 12].Value != null ? worksheet.Cells[3, 12].Value.ToString()?.Split(" ")[0] : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
if (!int.TryParse(worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
if (!int.TryParse(worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
if (!int.TryParse(worksheet.Cells[3, 15].Value != null ? worksheet.Cells[3, 15].Value.ToString()?.Split(" ")[0] : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
if (!int.TryParse(worksheet.Cells[row, 15].Value != null ? worksheet.Cells[row, 15].Value.ToString() : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
if (!int.TryParse(worksheet.Cells[row, 16].Value != null ? worksheet.Cells[row, 16].Value.ToString() : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
if (!int.TryParse(worksheet.Cells[row, 18].Value != null ? worksheet.Cells[row, 18].Value.ToString() : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
if (!int.TryParse(worksheet.Cells[row, 19].Value != null ? worksheet.Cells[row, 19].Value.ToString() : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
if (!int.TryParse(worksheet.Cells[3, 20].Value != null ? worksheet.Cells[3, 20].Value.ToString()?.Split(" ")[0] : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
if (!int.TryParse(worksheet.Cells[row, 20].Value != null ? worksheet.Cells[row, 20].Value.ToString() : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
if (!int.TryParse(worksheet.Cells[row, 21].Value != null ? worksheet.Cells[row, 21].Value.ToString() : "0", out _))
|
||||
throw new Exception("กรอกจำนวนคะแนนไม่ถูกต้อง");
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1210,20 +1205,6 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ดึงเฉพาะส่วนตัวเลขนำหน้าจากค่าในเซลล์คะแนน
|
||||
/// เช่น "100 คะแนน" / "100คะแนน" / " 100 " -> "100"
|
||||
/// รองรับทั้งกรณีมี/ไม่มีช่องว่างคั่น หากเซลล์ว่างจะคืน null (เพื่อเก็บ NULL ใน DB)
|
||||
/// หมายเหตุ: จุดที่ใช้ตรวจสอบ (validation) ต้องใส่ ?? "0" เพื่อให้ค่าว่างผ่านการตรวจ
|
||||
/// </summary>
|
||||
private static string? ExtractFirstNumber(string? raw)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(raw))
|
||||
return null;
|
||||
var match = Regex.Match(raw, @"^\s*\d+");
|
||||
return match.Success ? match.Value : raw.Trim();
|
||||
}
|
||||
|
||||
public async Task UploadSeatCandidateAsync(string examId, IFormFile excels)
|
||||
{
|
||||
var periodExam = await _context.PeriodExams.AsQueryable()
|
||||
|
|
@ -1251,57 +1232,30 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
if (candidate.Status == "checkSeat")
|
||||
{
|
||||
candidate.SeatNumber = item.SeatNumber;
|
||||
// var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
// var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: ติดตามประกาศทาง Website";
|
||||
// try
|
||||
// {
|
||||
// if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Console.WriteLine($"[MailError] ส่ง email ไม่สำเร็จ: {candidate.Email} | {ex.Message}");
|
||||
// if (ex.InnerException != null)
|
||||
// Console.WriteLine($"[MailError] Inner: {ex.InnerException.Message}");
|
||||
// }
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: ติดตามประกาศทาง Website";
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
candidate.Status = "checkPoint";
|
||||
}
|
||||
else
|
||||
{
|
||||
// if (candidate.Status != "waiver")
|
||||
// {
|
||||
// var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
// var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
|
||||
// try
|
||||
// {
|
||||
// if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Console.WriteLine($"[MailError] ส่ง email ไม่สำเร็จ: {candidate.Email} | {ex.Message}");
|
||||
// if (ex.InnerException != null)
|
||||
// Console.WriteLine($"[MailError] Inner: {ex.InnerException.Message}");
|
||||
// }
|
||||
// }
|
||||
if (candidate.Status != "waiver")
|
||||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
}
|
||||
candidate.Status = "waiver";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if (candidate.Status != "waiver")
|
||||
// {
|
||||
// var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
// var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
|
||||
// try
|
||||
// {
|
||||
// if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Console.WriteLine($"[MailError] ส่ง email ไม่สำเร็จ: {candidate.Email} | {ex.Message}");
|
||||
// if (ex.InnerException != null)
|
||||
// Console.WriteLine($"[MailError] Inner: {ex.InnerException.Message}");
|
||||
// }
|
||||
// }
|
||||
if (candidate.Status != "waiver")
|
||||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
}
|
||||
candidate.Status = "waiver";
|
||||
}
|
||||
periodExam.SetSeat = true;
|
||||
|
|
@ -1353,32 +1307,32 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.PointPerC = item.PointPerC;
|
||||
candidate.ResultC = item.ResultC;
|
||||
candidate.Pass = item.Pass;
|
||||
candidate.ExamReason = string.IsNullOrWhiteSpace(item.ExamReason) ? null : item.ExamReason;
|
||||
candidate.Number = string.IsNullOrWhiteSpace(item.Number) ? null : item.Number;
|
||||
// var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
// var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สอบคัดเลือกสำเร็จ <br />" + "ผลการสอบของท่าน คือ " + candidate.Pass;
|
||||
// if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
candidate.ExamReason = item.ExamReason;
|
||||
candidate.Number = item.Number;
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สอบคัดเลือกสำเร็จ <br />" + "ผลการสอบของท่าน คือ " + candidate.Pass;
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
candidate.Status = "done";
|
||||
}
|
||||
else
|
||||
{
|
||||
// if (candidate.Status != "waiver")
|
||||
// {
|
||||
// var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
// var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
|
||||
// if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
// }
|
||||
if (candidate.Status != "waiver")
|
||||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
}
|
||||
// candidate.Status = "waiver";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if (candidate.Status != "waiver")
|
||||
// {
|
||||
// var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
// var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
|
||||
// if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
// }
|
||||
if (candidate.Status != "waiver")
|
||||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
}
|
||||
// candidate.Status = "waiver";
|
||||
}
|
||||
periodExam.SetSeat = true;
|
||||
|
|
@ -1588,37 +1542,37 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
_data.Add(new
|
||||
{
|
||||
Number = item.Number != null ? item.Number.ToString() : "",
|
||||
ExamIdenNumber = item.ExamIdenNumber != null ? item.ExamIdenNumber.ToString() : "",
|
||||
CitizenId = item.CitizenId != null ? item.CitizenId.ToString() : "",
|
||||
SeatNumber = item.SeatNumber != null ? item.SeatNumber.ToString() : "",
|
||||
PrefixName = item.PrefixName != null ? item.PrefixName.ToString() : "",
|
||||
FullName = item.FirstName != null && item.LastName != null ? $"{item.FirstName} {item.LastName}" : "",
|
||||
PositionName = item.PositionExam != null && item.PositionExam?.PositionName != null ? item.PositionExam?.PositionName.ToString() : "",
|
||||
PositionLevelName = item.PositionExam != null && item.PositionExam?.PositionLevelName != null ? item.PositionExam?.PositionLevelName.ToString() : "",
|
||||
Number = item.Number != null ? item.Number.ToString() : "-",
|
||||
ExamIdenNumber = item.ExamIdenNumber != null ? item.ExamIdenNumber.ToString() : "-",
|
||||
CitizenId = item.CitizenId != null ? item.CitizenId.ToString() : "-",
|
||||
SeatNumber = item.SeatNumber != null ? item.SeatNumber.ToString() : "-",
|
||||
PrefixName = item.PrefixName != null ? item.PrefixName.ToString() : "-",
|
||||
FullName = item.FirstName != null && item.LastName != null ? $"{item.FirstName} {item.LastName}" : "-",
|
||||
PositionName = item.PositionExam != null && item.PositionExam?.PositionName != null ? item.PositionExam?.PositionName.ToString() : "-",
|
||||
PositionLevelName = item.PositionExam != null && item.PositionExam?.PositionLevelName != null ? item.PositionExam?.PositionLevelName.ToString() : "-",
|
||||
|
||||
PointPath1A = item.PointPath1A != null ? item.PointPath1A.ToString() : "",
|
||||
PointPath2A = item.PointPath2A != null ? item.PointPath2A.ToString() : "",
|
||||
PointPath3A = item.PointPath3A != null ? item.PointPath3A.ToString() : "",
|
||||
PointA = item.PointA != null ? item.PointA.ToString() : "",
|
||||
PointPerA = item.PointPerA != null ? item.PointPerA.ToString() : "",
|
||||
ResultA = item.ResultA != null ? item.ResultA.ToString() : "",
|
||||
PointPath1A = item.PointPath1A != null ? item.PointPath1A.ToString() : "0",
|
||||
PointPath2A = item.PointPath2A != null ? item.PointPath2A.ToString() : "0",
|
||||
PointPath3A = item.PointPath3A != null ? item.PointPath3A.ToString() : "0",
|
||||
PointA = item.PointA != null ? item.PointA.ToString() : "0",
|
||||
PointPerA = item.PointPerA != null ? item.PointPerA.ToString() : "0",
|
||||
ResultA = item.ResultA != null ? item.ResultA.ToString() : "-",
|
||||
|
||||
PointB = item.PointB != null ? item.PointB.ToString() : "",
|
||||
PointPerB = item.PointPerB != null ? item.PointPerB.ToString() : "",
|
||||
ResultB = item.ResultB != null ? item.ResultB.ToString() : "",
|
||||
PointB = item.PointB != null ? item.PointB.ToString() : "0",
|
||||
PointPerB = item.PointPerB != null ? item.PointPerB.ToString() : "0",
|
||||
ResultB = item.ResultB != null ? item.ResultB.ToString() : "-",
|
||||
|
||||
PointPath1C = item.PointPath1C != null ? item.PointPath1C.ToString() : "",
|
||||
PointPath2C = item.PointPath2C != null ? item.PointPath2C.ToString() : "",
|
||||
PointC = item.PointC != null ? item.PointC.ToString() : "",
|
||||
PointPerC = item.PointPerC != null ? item.PointPerC.ToString() : "",
|
||||
ResultC = item.ResultC != null ? item.ResultC.ToString() : "",
|
||||
PointPath1C = item.PointPath1C != null ? item.PointPath1C.ToString() : "0",
|
||||
PointPath2C = item.PointPath2C != null ? item.PointPath2C.ToString() : "0",
|
||||
PointC = item.PointC != null ? item.PointC.ToString() : "0",
|
||||
PointPerC = item.PointPerC != null ? item.PointPerC.ToString() : "0",
|
||||
ResultC = item.ResultC != null ? item.ResultC.ToString() : "-",
|
||||
|
||||
Pass = item.Pass != null ? item.Pass.ToString() : "",
|
||||
Pass = item.Pass != null ? item.Pass.ToString() : "-",
|
||||
PaymentStatus = item.PeriodExam == null || item.PeriodExam.Fee <= 0 ? "ไม่มีชำระเงิน" : (item.PaymentDate == null ? "ยังไม่ชำระเงิน" : "ชำระแล้ว"),
|
||||
PaymentDate = item.PaymentDate == null ? "" : $"{item.PaymentDate.Value.ToThaiShortDate()} {item.PaymentDate.Value:HH:mm:ss.ffff}".ToString(),
|
||||
RegisterDate = item.RegisterDate == null ? "" : $"{item.RegisterDate.Value.ToThaiShortDate()} {item.RegisterDate.Value:HH:mm:ss.ffff}".ToString(),
|
||||
ExamReason = item.ExamReason != null ? item.ExamReason.ToString() : ""
|
||||
PaymentDate = item.PaymentDate == null ? "-" : $"{item.PaymentDate.Value.ToThaiShortDate()} {item.PaymentDate.Value:HH:mm:ss.ffff}".ToString(),
|
||||
RegisterDate = item.RegisterDate == null ? "-" : $"{item.RegisterDate.Value.ToThaiShortDate()} {item.RegisterDate.Value:HH:mm:ss.ffff}".ToString(),
|
||||
ExamReason = item.ExamReason != null ? item.ExamReason.ToString() : "-"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1626,37 +1580,37 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
_data.Add(new
|
||||
{
|
||||
Number = "",
|
||||
ExamIdenNumber = "",
|
||||
CitizenId = "",
|
||||
SeatNumber = "",
|
||||
PrefixName = "",
|
||||
FullName = "",
|
||||
PositionName = "",
|
||||
PositionLevelName = "",
|
||||
Number = "-",
|
||||
ExamIdenNumber = "-",
|
||||
CitizenId = "-",
|
||||
SeatNumber = "-",
|
||||
PrefixName = "-",
|
||||
FullName = "-",
|
||||
PositionName = "-",
|
||||
PositionLevelName = "-",
|
||||
|
||||
PointPath1A = "",
|
||||
PointPath2A = "",
|
||||
PointPath3A = "",
|
||||
PointA = "",
|
||||
PointPerA = "",
|
||||
ResultA = "",
|
||||
PointPath1A = "-",
|
||||
PointPath2A = "-",
|
||||
PointPath3A = "-",
|
||||
PointA = "-",
|
||||
PointPerA = "-",
|
||||
ResultA = "-",
|
||||
|
||||
PointB = "",
|
||||
PointPerB = "",
|
||||
ResultB = "",
|
||||
PointB = "-",
|
||||
PointPerB = "-",
|
||||
ResultB = "-",
|
||||
|
||||
PointPath1C = "",
|
||||
PointPath2C = "",
|
||||
PointC = "",
|
||||
PointPerC = "",
|
||||
ResultC = "",
|
||||
PointPath1C = "-",
|
||||
PointPath2C = "-",
|
||||
PointC = "-",
|
||||
PointPerC = "-",
|
||||
ResultC = "-",
|
||||
|
||||
Pass = "",
|
||||
PaymentStatus = "",
|
||||
PaymentDate = "",
|
||||
RegisterDate = "",
|
||||
ExamReason = ""
|
||||
Pass = "-",
|
||||
PaymentStatus = "-",
|
||||
PaymentDate = "-",
|
||||
RegisterDate = "-",
|
||||
ExamReason = "-"
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -2984,9 +2938,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Number = periodExam.Candidate.Where(x => x.Status.Contains("done")).Count(),
|
||||
PlacementType = await _contextMetadata.PlacementTypes.FirstOrDefaultAsync(x => x.Name.Trim().ToUpper().Contains("สอบคัดเลือก")) == null ? await _contextMetadata.PlacementTypes.FirstOrDefaultAsync() : await _contextMetadata.PlacementTypes.FirstOrDefaultAsync(x => x.Name.Trim().ToUpper().Contains("สอบคัดเลือก")),
|
||||
StartDate = DateTime.Now,
|
||||
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||
//EndDate = DateTime.Now.AddYears(2).AddDays(-1),
|
||||
EndDate = periodExam.ScoreExpireDate ?? DateTime.Now.AddYears(2).AddDays(-1),
|
||||
EndDate = DateTime.Now.AddYears(2).AddDays(-1),
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "",
|
||||
|
|
@ -3003,7 +2955,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
|
@ -3198,7 +3150,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
var _placement = await _contextMetadata.Placements.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.PlacementType.Name == "คัดเลือกอื่นๆ" && x.RefId == periodExam.Id);
|
||||
.FirstOrDefaultAsync(x => x.PlacementType.Name == "คัดเลือกคนพิการ" && x.RefId == periodExam.Id);
|
||||
if (_placement != null)
|
||||
throw new Exception("รอบการสอบนี้ได้ทำการบรรจุไปแล้ว");
|
||||
|
||||
|
|
@ -3216,11 +3168,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Round = periodExam.Round?.ToString() ?? "",
|
||||
Year = (int)(periodExam.Year ?? 0),
|
||||
Number = await _context.Disables.AsQueryable().Where(x => x.PeriodExam == periodExam).CountAsync(),
|
||||
PlacementType = placementTypesCache.FirstOrDefault(x => x.Name.Trim().ToUpper().Contains("คัดเลือกอื่นๆ")) ?? placementTypesCache.First(),
|
||||
PlacementType = placementTypesCache.FirstOrDefault(x => x.Name.Trim().ToUpper().Contains("คัดเลือกคนพิการ")) ?? placementTypesCache.First(),
|
||||
StartDate = accountStartDate,
|
||||
// เดิมคำนวณวันหมดอายุจาก AnnouncementDate + 2 ปี (เก็บไว้สำหรับอ้างอิงข้อมูลเก่า)
|
||||
//EndDate = accountStartDate.AddYears(2).AddDays(-1),
|
||||
EndDate = periodExam.ScoreExpireDate ?? accountStartDate.AddYears(2).AddDays(-1),
|
||||
EndDate = accountStartDate.AddYears(2).AddDays(-1),
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue