Fix Bug นำเข้าข้อมูลสมัครสอบแข่งขัน
This commit is contained in:
parent
8a3df45c03
commit
eec08ab7b3
6 changed files with 1802 additions and 83 deletions
|
|
@ -634,7 +634,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
x.Order,
|
||||
ImportDate = x.CreatedAt.Date.ToThaiShortDate(),
|
||||
ExamCount = x.Recruits.Count(),
|
||||
Score = x.ScoreImport == null ? null :
|
||||
Score = x.ScoreImport == null || x.ScoreImport.Scores.Count == 0 ? null :
|
||||
new
|
||||
{
|
||||
ID = x.ScoreImport.Id,
|
||||
|
|
@ -973,7 +973,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// นำเข้ารายชื่อผู้สมัครสอบแข่งขัน
|
||||
/// นำเข้ารายชื่อผู้สมัครสอบแข่งขัน (ข้อมูลผู้สมัครสอบ)
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสรอบการสอบแข่งขัน</param>
|
||||
/// <returns></returns>
|
||||
|
|
@ -1073,7 +1073,8 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
|
||||
var r = new Models.Recruits.Recruit();
|
||||
r.ExamId = workSheet?.Cells[row, 1]?.GetValue<string>() ?? "";
|
||||
r.CitizenId = workSheet?.Cells[row, 12]?.GetValue<string>() ?? "";
|
||||
r.PositionName = workSheet?.Cells[row, 3]?.GetValue<string>() ?? "";
|
||||
r.HddPosition = workSheet?.Cells[row, 4]?.GetValue<string>() ?? "";
|
||||
r.Prefix = workSheet?.Cells[row, 5]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 6]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 5]?.GetValue<string>() ?? "";
|
||||
r.FirstName = workSheet?.Cells[row, 7]?.GetValue<string>() ?? "";
|
||||
r.LastName = workSheet?.Cells[row, 8]?.GetValue<string>() ?? "";
|
||||
|
|
@ -1081,17 +1082,16 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
r.National = workSheet?.Cells[row, 9]?.GetValue<string>() ?? "";
|
||||
r.Race = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
r.Religion = workSheet?.Cells[row, 10]?.GetValue<string>() ?? "";
|
||||
//r.DateOfBirth = DateTime.TryParseExact(workSheet?.Cells[row, 11]?.GetValue<string>()?.Trim(), "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out var dob) && dob.Year > 2500 ? dob.AddYears(-543) : DateTime.MinValue;
|
||||
r.DateOfBirth = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 11]?.GetValue<string>()) ? _recruitService.CheckDateTime(workSheet?.Cells[row, 11]?.GetValue<string>() ?? "", "dd/MM/yyyy") : DateTime.MinValue;
|
||||
r.CitizenId = workSheet?.Cells[row, 12]?.GetValue<string>() ?? "";
|
||||
r.Marry = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
r.Isspecial = "N";
|
||||
r.CitizenCardIssuer = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
r.CitizenCardExpireDate = Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"));
|
||||
r.ApplyDate = (DateTime)workSheet?.Cells[row, 9999]?.GetValue<DateTime>();
|
||||
r.PositionName = workSheet?.Cells[row, 3]?.GetValue<string>() ?? "";
|
||||
r.HddPosition = workSheet?.Cells[row, 4]?.GetValue<string>() ?? "";
|
||||
r.ApplyDate = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 87]?.GetValue<string>()) ? _recruitService.CheckDateTime(workSheet?.Cells[row, 87]?.GetValue<string>() ?? "", "dd/MM/yyyy") : DateTime.MinValue;
|
||||
r.PositionType = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
r.PositionLevel = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
|
||||
|
||||
r.CreatedAt = DateTime.Now;
|
||||
r.CreatedUserId = UserId ?? "";
|
||||
r.CreatedFullName = FullName ?? "System Administrator";
|
||||
|
|
@ -1239,7 +1239,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
|
||||
#region " Score File "
|
||||
/// <summary>
|
||||
/// นำเข้าผลคะแนนสอบแข่งขัน
|
||||
/// นำเข้าผลคะแนนสอบแข่งขัน (บัญชีรวมคะแนน)
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสรอบการสอบแข่งขัน</param>
|
||||
/// <returns></returns>
|
||||
|
|
@ -1327,6 +1327,14 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
Scores = new List<RecruitScore>()
|
||||
};
|
||||
|
||||
// preload recruits ทั้งหมดของครั้งเดียว และ Group ExamId เอาเฉพาะ key ที่ไม่ซ้ำ
|
||||
var recruitsDict = await _context.Recruits
|
||||
.Where(x => x.RecruitImport.Id == rec_import.Id)
|
||||
.GroupBy(x => x.ExamId)
|
||||
.Where(g => g.Count() == 1)
|
||||
.Select(g => g.First())
|
||||
.ToDictionaryAsync(x => x.ExamId, x => x);
|
||||
|
||||
// import datafile
|
||||
System.IO.File.WriteAllBytes(importFile, fileContent);
|
||||
|
||||
|
|
@ -1377,62 +1385,14 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
#endregion
|
||||
|
||||
r.ExamId = workSheet?.Cells[row, 2]?.GetValue<string>();
|
||||
r.CitizenId = workSheet?.Cells[row, 3]?.GetValue<string>();
|
||||
|
||||
// ภาคความรู้ความสามารถที่ใช้เฉพาะตำแหน่ง
|
||||
r.FullA = 200;
|
||||
r.SumA = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 5]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 5]?.GetValue<double>();
|
||||
r.PercentageA = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 6]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 6]?.GetValue<double>();
|
||||
r.AStatus = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 7]?.GetValue<string>()) ? "" : workSheet?.Cells[row, 7]?.GetValue<string>();
|
||||
r.SumAB = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 5]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 5]?.GetValue<double>();
|
||||
r.ABStatus = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 7]?.GetValue<string>()) ? "" : workSheet?.Cells[row, 7]?.GetValue<string>();
|
||||
|
||||
// ภาคความเหมาะสมกับตำแหน่ง
|
||||
r.FullC = 50;
|
||||
r.SumC = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 8]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 8]?.GetValue<double>();
|
||||
r.FullD = 50;
|
||||
r.SumD = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 9]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 9]?.GetValue<double>();
|
||||
r.SumCD = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 10]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 10]?.GetValue<double>();
|
||||
r.PercentageC = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 11]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 11]?.GetValue<double>();
|
||||
r.CStatus = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 12]?.GetValue<string>()) ? "" : workSheet?.Cells[row, 12]?.GetValue<string>();
|
||||
|
||||
r.FullScore = 300;
|
||||
r.TotalScore = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 13]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 13]?.GetValue<double>(); ;
|
||||
|
||||
if (workSheet?.Cells[row, 7]?.GetValue<string>() == "ขาดสอบ")
|
||||
{
|
||||
r.ExamStatus = "ขส.";
|
||||
}
|
||||
else if (workSheet?.Cells[row, 14]?.GetValue<string>() == "ได้")
|
||||
{
|
||||
r.ExamStatus = "ผ่าน";
|
||||
}
|
||||
else if (workSheet?.Cells[row, 14]?.GetValue<string>() == "ตก")
|
||||
{
|
||||
r.ExamStatus = "ไม่ผ่าน";
|
||||
}
|
||||
else
|
||||
{
|
||||
r.ExamStatus = "-";
|
||||
}
|
||||
|
||||
r.RemarkScore = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 15]?.GetValue<string>()) ? string.Empty : workSheet?.Cells[row, 15]?.GetValue<string>();
|
||||
r.Major = workSheet.Name;
|
||||
|
||||
r.CreatedAt = DateTime.Now;
|
||||
r.CreatedUserId = UserId ?? "";
|
||||
r.CreatedFullName = FullName ?? "System Administrator";
|
||||
r.LastUpdatedAt = DateTime.Now;
|
||||
r.LastUpdateUserId = UserId ?? "";
|
||||
r.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
|
||||
imported.Scores.Add(r);
|
||||
row++;
|
||||
var recruit = await _context.Recruits.AsQueryable()
|
||||
.Include(x => x.RecruitImport)
|
||||
.Where(x => x.RecruitImport == rec_import && x.ExamId == r.ExamId)
|
||||
.FirstOrDefaultAsync();
|
||||
if (recruit != null)
|
||||
//var recruit = await _context.Recruits.AsQueryable()
|
||||
// .Include(x => x.RecruitImport)
|
||||
// .Where(x => x.RecruitImport == rec_import && x.ExamId == r.ExamId)
|
||||
// .FirstOrDefaultAsync();
|
||||
|
||||
// ใช้ dictionary lookup แทน query DB ทีละรอบ
|
||||
if (!string.IsNullOrEmpty(r.ExamId) && recruitsDict.TryGetValue(r.ExamId, out var recruit))
|
||||
{
|
||||
var apiUrl = $"{_configuration["API"]}/org/find/head/officer";
|
||||
using (var client = new HttpClient())
|
||||
|
|
@ -1449,9 +1409,63 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
recruit.AuthPosition = org.result.position == null ? "" : org.result.position;
|
||||
}
|
||||
}
|
||||
|
||||
r.CitizenId = workSheet?.Cells[row, 3]?.GetValue<string>();
|
||||
|
||||
// ภาคความรู้ความสามารถที่ใช้เฉพาะตำแหน่ง
|
||||
r.FullA = 200;
|
||||
r.SumA = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 5]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 5]?.GetValue<double>();
|
||||
r.PercentageA = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 6]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 6]?.GetValue<double>();
|
||||
r.AStatus = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 7]?.GetValue<string>()) ? "" : workSheet?.Cells[row, 7]?.GetValue<string>();
|
||||
r.SumAB = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 5]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 5]?.GetValue<double>();
|
||||
r.ABStatus = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 7]?.GetValue<string>()) ? "" : workSheet?.Cells[row, 7]?.GetValue<string>();
|
||||
|
||||
// ภาคความเหมาะสมกับตำแหน่ง
|
||||
r.FullC = 50;
|
||||
r.SumC = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 8]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 8]?.GetValue<double>();
|
||||
r.FullD = 50;
|
||||
r.SumD = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 9]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 9]?.GetValue<double>();
|
||||
r.SumCD = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 10]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 10]?.GetValue<double>();
|
||||
r.PercentageC = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 11]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 11]?.GetValue<double>();
|
||||
r.CStatus = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 12]?.GetValue<string>()) ? "" : workSheet?.Cells[row, 12]?.GetValue<string>();
|
||||
|
||||
r.FullScore = 300;
|
||||
r.TotalScore = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 13]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 13]?.GetValue<double>(); ;
|
||||
|
||||
if (workSheet?.Cells[row, 7]?.GetValue<string>() == "ขาดสอบ")
|
||||
{
|
||||
r.ExamStatus = "ขส.";
|
||||
}
|
||||
else if (workSheet?.Cells[row, 14]?.GetValue<string>() == "ได้")
|
||||
{
|
||||
r.ExamStatus = "ผ่าน";
|
||||
}
|
||||
else if (workSheet?.Cells[row, 14]?.GetValue<string>() == "ตก")
|
||||
{
|
||||
r.ExamStatus = "ไม่ผ่าน";
|
||||
}
|
||||
else
|
||||
{
|
||||
r.ExamStatus = "-";
|
||||
}
|
||||
|
||||
r.RemarkScore = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 15]?.GetValue<string>()) ? string.Empty : workSheet?.Cells[row, 15]?.GetValue<string>();
|
||||
r.Major = workSheet.Name;
|
||||
|
||||
r.CreatedAt = DateTime.Now;
|
||||
r.CreatedUserId = UserId ?? "";
|
||||
r.CreatedFullName = FullName ?? "System Administrator";
|
||||
r.LastUpdatedAt = DateTime.Now;
|
||||
r.LastUpdateUserId = UserId ?? "";
|
||||
r.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
|
||||
imported.Scores.Add(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
row++;
|
||||
|
||||
} // end of sheet loop
|
||||
} // end of all file loop
|
||||
}
|
||||
|
||||
// finally save to database
|
||||
|
|
@ -1477,7 +1491,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
|
||||
#region " Result File "
|
||||
/// <summary>
|
||||
/// นำเข้าผลการสอบแข่งขัน
|
||||
/// นำเข้าผลการสอบแข่งขัน (ผลการสอบ)
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสรอบการสอบแข่งขัน</param>
|
||||
/// <returns></returns>
|
||||
|
|
@ -1514,14 +1528,47 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
if (rec_import == null)
|
||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||
|
||||
// update ฟิลด์ลำดับที่สอบได้และหมายเหตุจากลำดับที่สอบได้อันเก่าก่อน
|
||||
if (rec_import.ScoreImport != null && rec_import.ScoreImport.Scores != null)
|
||||
{
|
||||
var _oldScores = rec_import.ScoreImport.Scores
|
||||
.Where(x => !string.IsNullOrEmpty(x.Number))
|
||||
.ToList();
|
||||
if (_oldScores.Count > 0)
|
||||
{
|
||||
foreach (var x in _oldScores)
|
||||
{
|
||||
x.Number = null;
|
||||
x.RemarkExamOrder = null;
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
// create import history
|
||||
rec_import.ImportHostories.Add(new RecruitImportHistory
|
||||
{
|
||||
Description = "นำเข้าข้อมูลผลการสอบ",
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
});
|
||||
|
||||
// preload score
|
||||
var score = rec_import.ScoreImport.Scores
|
||||
.Where(s => !string.IsNullOrEmpty(s.ExamId))
|
||||
.ToDictionary(s => s.ExamId, s => s);
|
||||
|
||||
// ถ้าไม่มีผลคะแนนสอบแข่งขันให้จบการทำงาน
|
||||
if (score.Count == 0) return Success();
|
||||
|
||||
var file = Request.Form.Files[0];
|
||||
using (var stream = file.OpenReadStream())
|
||||
using (var c_package = new ExcelPackage(stream))
|
||||
{
|
||||
var score = rec_import.ScoreImport.Scores
|
||||
.Where(s => !string.IsNullOrEmpty(s.ExamId))
|
||||
.ToDictionary(s => s.ExamId, s => s);
|
||||
|
||||
{
|
||||
foreach (var workSheet in c_package.Workbook.Worksheets)
|
||||
{
|
||||
var totalRows = workSheet.Dimension.Rows;
|
||||
|
|
@ -1535,7 +1582,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
row++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (score.TryGetValue(examId, out var existingScore))
|
||||
{
|
||||
existingScore.Number = workSheet?.Cells[row, 1]?.GetValue<string>();
|
||||
|
|
@ -1658,7 +1705,6 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
majorgroup = dr["majorgroup"].ToString(),
|
||||
certificateNo = dr["certificateno"].ToString(),
|
||||
certificateIssueDate = dr["certificateIssueDate"] == null || Convert.ToDateTime(dr["certificateIssueDate"]) == DateTime.MinValue ? "" : Convert.ToDateTime(dr["certificateIssueDate"]).ToThaiShortDate(),
|
||||
//ExamScore = dr["score"] == null ? 0 : dr["score"].ToString().ToInteger(),
|
||||
ExamScore = string.IsNullOrWhiteSpace(dr["score"]?.ToString()) ? 0 : decimal.Parse(dr["score"]?.ToString()),
|
||||
ExamResult = dr["result"].ToString(),
|
||||
ExamAttribute = dr["examAttribute"].ToString(),
|
||||
|
|
@ -1668,6 +1714,7 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
university = dr["university"].ToString(),
|
||||
position_name = dr["position_name"].ToString(),
|
||||
hddPosition = dr["hddPosition"].ToString(),
|
||||
typeTest = dr["typeTest"].ToString(),
|
||||
position_level = dr["position_level"].ToString(),
|
||||
position_type = dr["position_type"].ToString(),
|
||||
exam_name = dr["exam_name"].ToString(),
|
||||
|
|
@ -1761,12 +1808,22 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
ProfileID = p.CitizenId,
|
||||
p.Prefix,
|
||||
FullName = $"{p.FirstName} {p.LastName}",
|
||||
DateOfBirth = p.DateOfBirth.ToThaiShortDate(),
|
||||
DateOfBirth = p.DateOfBirth != null
|
||||
? p.DateOfBirth != DateTime.MinValue
|
||||
? p.DateOfBirth.ToThaiShortDate()
|
||||
: ""
|
||||
: "",
|
||||
Gender = p.Gendor,
|
||||
Degree = p.Educations.First().Degree,
|
||||
Major = p.Educations.First().Major,
|
||||
CertificateNo = p.Certificates.First().CertificateNo,
|
||||
CertificateIssueDate = p.Certificates.First().IssueDate.ToThaiShortDate(),
|
||||
CertificateNo = p.Certificates.Count > 0
|
||||
? p.Certificates.First().CertificateNo ?? ""
|
||||
: "",
|
||||
CertificateIssueDate = p.Certificates.Count > 0
|
||||
? p.Certificates.First().IssueDate != DateTime.MinValue
|
||||
? p.Certificates.First().IssueDate.ToThaiShortDate()
|
||||
: ""
|
||||
: "",
|
||||
ExamResult = sr == null ? "" : sr.ExamStatus,
|
||||
ExamAttribute = _recruitService.CheckValidCertificate(p.Certificates.First().IssueDate, 5) ? "มีคุณสมบัติ" : "ไม่มีคุณสมบัติ",
|
||||
IsSpecial = p.Isspecial,
|
||||
|
|
@ -1781,17 +1838,26 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
Score = sr == null ? 0.0 : sr.SumA + sr.SumB + sr.SumC,
|
||||
Number = sr == null ? "" : sr.Number,
|
||||
ExamCount = _recruitService.GetExamCount(p.CitizenId),
|
||||
ScoreExpire = p.RecruitImport.AnnouncementDate == null ? "" : p.RecruitImport.AnnouncementDate.Value.AddYears(2).ToThaiShortDate(),
|
||||
ScoreExpire = p.RecruitImport.AnnouncementDate == null
|
||||
? ""
|
||||
: p.RecruitImport.AnnouncementDate != DateTime.MinValue
|
||||
? p.RecruitImport.AnnouncementDate.Value.AddYears(2).ToThaiShortDate()
|
||||
: "",
|
||||
typeTest = p.typeTest,
|
||||
ScoreResult = sr == null ? null : new
|
||||
{
|
||||
ScoreAFull = sr.FullA,
|
||||
ScoreA = sr.SumA,
|
||||
ScoreBFull = sr.FullB,
|
||||
ScoreB = sr.SumB,
|
||||
ScoreAB = sr.SumAB,
|
||||
ScoreCFull = sr.FullC,
|
||||
ScoreC = sr.SumC,
|
||||
ScoreSumFull = sr.FullA + sr.FullB + sr.FullC,
|
||||
ScoreSum = sr.SumA + sr.SumB + sr.SumC,
|
||||
ScoreDFull = sr.FullD,
|
||||
ScoreD = sr.SumD,
|
||||
ScoreCD = sr.SumCD,
|
||||
ScoreSumFull = sr.FullScore,
|
||||
ScoreSum = sr.TotalScore,
|
||||
ExamResult = sr.ExamStatus
|
||||
},
|
||||
Attachments = p.Documents.Select(a => new
|
||||
|
|
@ -2113,8 +2179,8 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
|||
r.ExamId,
|
||||
r.CitizenId,
|
||||
Fullname = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||
Full = s.FullA + s.FullB + s.FullC,
|
||||
Sum = s.SumA + s.SumB + s.SumC,
|
||||
Full = s.FullScore != null ? s.FullScore : 0,
|
||||
Sum = s.TotalScore != null ? s.TotalScore : 0,
|
||||
Status = s.ExamStatus,
|
||||
r.PositionName,
|
||||
r.PositionType,
|
||||
|
|
|
|||
1601
Migrations/20250904045932_add_field_typeTest.Designer.cs
generated
Normal file
1601
Migrations/20250904045932_add_field_typeTest.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
30
Migrations/20250904045932_add_field_typeTest.cs
Normal file
30
Migrations/20250904045932_add_field_typeTest.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Recruit.Service.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class add_field_typeTest : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "typeTest",
|
||||
table: "Recruits",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ประเภทการสอบภาค ก.")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "typeTest",
|
||||
table: "Recruits");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -213,6 +213,10 @@ namespace BMA.EHR.Recruit.Service.Migrations
|
|||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)");
|
||||
|
||||
b.Property<string>("typeTest")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ประเภทการสอบภาค ก.");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RecruitImportId");
|
||||
|
|
|
|||
|
|
@ -77,11 +77,15 @@ namespace BMA.EHR.Recruit.Service.Models.Recruits
|
|||
public DateTime ApplyDate { get; set; }
|
||||
|
||||
public string? PositionName { get; set; }
|
||||
[Comment("บัญชีสอบ")]
|
||||
public string? HddPosition { get; set; } = string.Empty;
|
||||
public string? PositionType { get; set; }
|
||||
public string? PositionLevel { get; set; }
|
||||
public string? AuthName { get; set; }
|
||||
public string? AuthPosition { get; set; }
|
||||
|
||||
[Comment("บัญชีสอบ")]
|
||||
public string? HddPosition { get; set; } = string.Empty;
|
||||
|
||||
[Comment("ประเภทการสอบภาค ก.")]
|
||||
public string? typeTest { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -392,10 +392,24 @@ namespace BMA.EHR.Recruit.Service.Services
|
|||
public DateTime CheckDateTime(string Date, string Formate)
|
||||
{
|
||||
// ตอนนี้ทำไว้ให้รองรับแค่ "dd/MM/yyyy", "yyyy-MM-dd"
|
||||
Date = Date.Trim();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(Date))
|
||||
return DateTime.MinValue;
|
||||
|
||||
// กรณีอยู่ในรูปแบบ string double
|
||||
if (double.TryParse(Date, out double oaDate))
|
||||
{
|
||||
try
|
||||
{
|
||||
Date = DateTime.FromOADate(oaDate).ToString(Formate);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Date = DateTime.MinValue.ToString(Formate);
|
||||
}
|
||||
}
|
||||
|
||||
string[] parts = Date.Trim().Replace("-", "/").Split("/");
|
||||
|
||||
if (parts.Length != 3)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue