change column 9999 to null

This commit is contained in:
kittapath-Jool 2025-09-14 23:05:26 +07:00
parent 3080eaca49
commit eda64c053a

View file

@ -1281,18 +1281,18 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
r.LastName = workSheet?.Cells[row, 8]?.GetValue<string>() ?? ""; r.LastName = workSheet?.Cells[row, 8]?.GetValue<string>() ?? "";
r.Gendor = workSheet?.Cells[row, 98]?.GetValue<string>() ?? ""; r.Gendor = workSheet?.Cells[row, 98]?.GetValue<string>() ?? "";
r.National = workSheet?.Cells[row, 9]?.GetValue<string>() ?? ""; r.National = workSheet?.Cells[row, 9]?.GetValue<string>() ?? "";
r.Race = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? ""; r.Race = "";//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
r.Religion = workSheet?.Cells[row, 10]?.GetValue<string>() ?? ""; r.Religion = workSheet?.Cells[row, 10]?.GetValue<string>() ?? "";
r.DateOfBirth = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 11]?.GetValue<string>()) ? _disableService.CheckDateTime(workSheet?.Cells[row, 11]?.GetValue<string>() ?? "", "dd/MM/yyyy") : DateTime.MinValue; r.DateOfBirth = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 11]?.GetValue<string>()) ? _disableService.CheckDateTime(workSheet?.Cells[row, 11]?.GetValue<string>() ?? "", "dd/MM/yyyy") : DateTime.MinValue;
r.CitizenId = workSheet?.Cells[row, 12]?.GetValue<string>() ?? ""; r.CitizenId = workSheet?.Cells[row, 12]?.GetValue<string>() ?? "";
r.typeTest = workSheet?.Cells[row, 13]?.GetValue<string>() ?? ""; r.typeTest = workSheet?.Cells[row, 13]?.GetValue<string>() ?? "";
r.Marry = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? ""; r.Marry = "";//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
r.Isspecial = "N"; r.Isspecial = "N";
r.CitizenCardIssuer = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? ""; r.CitizenCardIssuer = "";//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
r.CitizenCardExpireDate = Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-")); r.CitizenCardExpireDate = DateTime.MinValue;//Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"));
r.ApplyDate = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 87]?.GetValue<string>()) ? _disableService.CheckDateTime(workSheet?.Cells[row, 87]?.GetValue<string>() ?? "", "dd/MM/yyyy") : DateTime.MinValue; r.ApplyDate = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 87]?.GetValue<string>()) ? _disableService.CheckDateTime(workSheet?.Cells[row, 87]?.GetValue<string>() ?? "", "dd/MM/yyyy") : DateTime.MinValue;
r.PositionType = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? ""; r.PositionType = "";//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
r.PositionLevel = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? ""; r.PositionLevel = "";//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "";
r.CreatedAt = DateTime.Now; r.CreatedAt = DateTime.Now;
r.CreatedUserId = UserId ?? ""; r.CreatedUserId = UserId ?? "";
@ -1306,11 +1306,11 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
{ {
Degree = workSheet?.Cells[row, 18]?.GetValue<string>() ?? "", Degree = workSheet?.Cells[row, 18]?.GetValue<string>() ?? "",
Major = workSheet?.Cells[row, 19]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 20]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 19]?.GetValue<string>() ?? "", Major = workSheet?.Cells[row, 19]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 20]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 19]?.GetValue<string>() ?? "",
MajorGroupId = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "", MajorGroupId = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
MajorGroupName = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "", MajorGroupName = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
University = workSheet?.Cells[row, 21]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 22]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 21]?.GetValue<string>() ?? "", University = workSheet?.Cells[row, 21]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 22]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 21]?.GetValue<string>() ?? "",
GPA = (double)workSheet?.Cells[row, 26]?.GetValue<double>(), GPA = (double)workSheet?.Cells[row, 26]?.GetValue<double>(),
Specialist = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "", Specialist = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
HighDegree = workSheet?.Cells[row, 27]?.GetValue<string>() ?? "", HighDegree = workSheet?.Cells[row, 27]?.GetValue<string>() ?? "",
BachelorDate = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 25]?.GetValue<string>()) ? _disableService.CheckDateTime(workSheet?.Cells[row, 11]?.GetValue<string>() ?? "", "dd/MM/yyyy") : DateTime.MinValue, BachelorDate = !string.IsNullOrWhiteSpace(workSheet?.Cells[row, 25]?.GetValue<string>()) ? _disableService.CheckDateTime(workSheet?.Cells[row, 11]?.GetValue<string>() ?? "", "dd/MM/yyyy") : DateTime.MinValue,
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
@ -1327,8 +1327,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
Occupation = workSheet?.Cells[row, 33]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 34]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 33]?.GetValue<string>() ?? "", Occupation = workSheet?.Cells[row, 33]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 34]?.GetValue<string>() ?? "" : workSheet?.Cells[row, 33]?.GetValue<string>() ?? "",
Position = workSheet?.Cells[row, 37]?.GetValue<string>() ?? "", Position = workSheet?.Cells[row, 37]?.GetValue<string>() ?? "",
Workplace = $"{(workSheet?.Cells[row, 36]?.GetValue<string>() ?? "")} {(workSheet?.Cells[row, 35]?.GetValue<string>() ?? "")}", Workplace = $"{(workSheet?.Cells[row, 36]?.GetValue<string>() ?? "")} {(workSheet?.Cells[row, 35]?.GetValue<string>() ?? "")}",
Telephone = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "", Telephone = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
WorkAge = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "", WorkAge = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "", CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "System Administrator", CreatedFullName = FullName ?? "System Administrator",
@ -1349,7 +1349,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
Province = workSheet?.Cells[row, 56]?.GetValue<string>() ?? "", Province = workSheet?.Cells[row, 56]?.GetValue<string>() ?? "",
ZipCode = workSheet?.Cells[row, 57]?.GetValue<string>() ?? "", ZipCode = workSheet?.Cells[row, 57]?.GetValue<string>() ?? "",
Telephone = workSheet?.Cells[row, 58]?.GetValue<string>() ?? "", Telephone = workSheet?.Cells[row, 58]?.GetValue<string>() ?? "",
Mobile = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "", Mobile = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Address1 = $"{(workSheet?.Cells[row, 61]?.GetValue<string>() ?? "")} {(workSheet?.Cells[row, 62]?.GetValue<string>() ?? "")}", Address1 = $"{(workSheet?.Cells[row, 61]?.GetValue<string>() ?? "")} {(workSheet?.Cells[row, 62]?.GetValue<string>() ?? "")}",
Moo1 = workSheet?.Cells[row, 63]?.GetValue<string>() ?? "", Moo1 = workSheet?.Cells[row, 63]?.GetValue<string>() ?? "",
Soi1 = workSheet?.Cells[row, 64]?.GetValue<string>() ?? "", Soi1 = workSheet?.Cells[row, 64]?.GetValue<string>() ?? "",
@ -1396,10 +1396,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
// certificate // certificate
r.Certificates.Add(new DisableCertificate() r.Certificates.Add(new DisableCertificate()
{ {
CertificateNo = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "", CertificateNo = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Description = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "", Description = "",//workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
IssueDate = Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-")), IssueDate = DateTime.MinValue,//Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-")),
ExpiredDate = Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-")), ExpiredDate = DateTime.MinValue,//Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-")),
CreatedAt = DateTime.Now, CreatedAt = DateTime.Now,
CreatedUserId = UserId ?? "", CreatedUserId = UserId ?? "",
CreatedFullName = FullName ?? "System Administrator", CreatedFullName = FullName ?? "System Administrator",
@ -1661,9 +1661,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
imported.Scores.Add(r); imported.Scores.Add(r);
} }
row++; row++;
} // end of sheet loop } // end of sheet loop
} // end of all file loop } // end of all file loop
} }
@ -2028,7 +2028,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
CertificateNo = p.Certificates.Count > 0 CertificateNo = p.Certificates.Count > 0
? p.Certificates.First().CertificateNo ?? "" ? p.Certificates.First().CertificateNo ?? ""
: "", : "",
CertificateIssueDate = p.Certificates.Count > 0 CertificateIssueDate = p.Certificates.Count > 0
? p.Certificates.First().IssueDate != DateTime.MinValue ? p.Certificates.First().IssueDate != DateTime.MinValue
? p.Certificates.First().IssueDate.ToThaiShortDate() ? p.Certificates.First().IssueDate.ToThaiShortDate()
: "" : ""
@ -2334,7 +2334,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
Major = p.Educations.First().Major, Major = p.Educations.First().Major,
University = p.Educations.First().University, University = p.Educations.First().University,
PositionName = p.PositionName, PositionName = p.PositionName,
ExamName = $"{p.PeriodExam!.Name} ครั้งที่ {p.PeriodExam.Round}/{(p.PeriodExam.Year > 2500 ? p.PeriodExam.Year : (p.PeriodExam.Year+543))}".ToThaiNumber(), ExamName = $"{p.PeriodExam!.Name} ครั้งที่ {p.PeriodExam.Round}/{(p.PeriodExam.Year > 2500 ? p.PeriodExam.Year : (p.PeriodExam.Year + 543))}".ToThaiNumber(),
ExamCount = _disableService.GetExamCount(p.CitizenId).ToString().ToThaiNumber(), ExamCount = _disableService.GetExamCount(p.CitizenId).ToString().ToThaiNumber(),
type = p.typeTest == "bangkok" ? "กทม." : p.typeTest == "ocsc" ? "ก.พ." : "", type = p.typeTest == "bangkok" ? "กทม." : p.typeTest == "ocsc" ? "ก.พ." : "",