import file

This commit is contained in:
kittapath 2025-06-11 15:20:18 +07:00
parent 24bf7a4c67
commit 9e21548d61
12 changed files with 14577 additions and 14649 deletions

View file

@ -1071,99 +1071,99 @@ namespace BMA.EHR.Recruit.Service.Controllers
if (cell1 == "" || cell1 == null) break;
var r = new Models.Recruits.Recruit();
r.ExamId = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ExamID)]?.GetValue<string>();
r.CitizenId = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PersonalID)]?.GetValue<string>();
r.Prefix = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Prefix)]?.GetValue<string>();
r.FirstName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.FirstName)]?.GetValue<string>();
r.LastName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.LastName)]?.GetValue<string>();
r.Gendor = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Gender)]?.GetValue<string>();
r.National = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.National)]?.GetValue<string>().IsNull("");
r.Race = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Race)]?.GetValue<string>().IsNull("");
r.Religion = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Religion)]?.GetValue<string>().IsNull("");
r.DateOfBirth = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.DateOfBirth)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"));
r.Marry = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Marry)]?.GetValue<string>();
r.ExamId = workSheet?.Cells[row, 9999]?.GetValue<string>();
r.CitizenId = workSheet?.Cells[row, 0]?.GetValue<string>();
r.Prefix = workSheet?.Cells[row, 4]?.GetValue<string>() == "อื่น ๆ" ? workSheet?.Cells[row, 5]?.GetValue<string>() : workSheet?.Cells[row, 4]?.GetValue<string>();
r.FirstName = workSheet?.Cells[row, 6]?.GetValue<string>();
r.LastName = workSheet?.Cells[row, 7]?.GetValue<string>();
r.Gendor = workSheet?.Cells[row, 9999]?.GetValue<string>();
r.National = workSheet?.Cells[row, 9999]?.GetValue<string>().IsNull("");
r.Race = workSheet?.Cells[row, 9999]?.GetValue<string>().IsNull("");
r.Religion = workSheet?.Cells[row, 9999]?.GetValue<string>().IsNull("");
r.DateOfBirth = Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"));
r.Marry = workSheet?.Cells[row, 9999]?.GetValue<string>();
r.Isspecial = "N";
r.CitizenCardIssuer = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PersonalCardIssue)]?.GetValue<string>();
r.CitizenCardExpireDate = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PersonalCardExpireDate)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"));
r.ApplyDate = (DateTime)workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ApplyDate)]?.GetValue<DateTime>();
r.PositionName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionName)]?.GetValue<string>().IsNull("");
r.PositionType = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionType)]?.GetValue<string>().IsNull("");
r.PositionLevel = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PositionLevel)]?.GetValue<string>().IsNull("");
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, 9999]?.GetValue<string>().IsNull("");
r.PositionType = workSheet?.Cells[row, 9999]?.GetValue<string>().IsNull("");
r.PositionLevel = workSheet?.Cells[row, 9999]?.GetValue<string>().IsNull("");
// address
r.Addresses.Add(new RecruitAddress()
{
Address = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Address)]?.GetValue<string>() ?? "",
Moo = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Moo)]?.GetValue<string>() ?? "",
Soi = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Soi)]?.GetValue<string>() ?? "",
Road = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Road)]?.GetValue<string>() ?? "",
District = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.District)]?.GetValue<string>() ?? "",
Amphur = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Amphur)]?.GetValue<string>() ?? "",
Province = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Province)]?.GetValue<string>() ?? "",
ZipCode = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ZipCode)]?.GetValue<string>() ?? "",
Telephone = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Telephone)]?.GetValue<string>() ?? "",
Mobile = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Mobile)]?.GetValue<string>() ?? "",
Address1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Address1)]?.GetValue<string>() ?? "",
Moo1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Moo1)]?.GetValue<string>() ?? "",
Soi1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Soi1)]?.GetValue<string>() ?? "",
Road1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Road1)]?.GetValue<string>() ?? "",
District1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.District1)]?.GetValue<string>() ?? "",
Amphur1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Amphur1)]?.GetValue<string>() ?? "",
Province1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Province1)]?.GetValue<string>() ?? "",
ZipCode1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ZipCode1)]?.GetValue<string>() ?? "",
Address = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Moo = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Soi = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Road = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
District = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Amphur = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Province = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
ZipCode = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Telephone = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Mobile = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Address1 = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Moo1 = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Soi1 = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Road1 = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
District1 = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Amphur1 = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Province1 = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
ZipCode1 = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
});
// payment
r.Payments.Add(new RecruitPayment()
{
PaymentId = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.PaymentID)]?.GetValue<string>() ?? "",
CompanyCode = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CompanyCode)]?.GetValue<string>() ?? "",
TextFile = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.TextFile)]?.GetValue<string>() ?? "",
BankCode = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.BankCode)]?.GetValue<string>() ?? "",
AccountNumber = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.AccouontNumer)]?.GetValue<string>() ?? "",
TransDate = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.TransDate)]?.GetValue<string>() ?? "",
TransTime = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.TransTime)]?.GetValue<string>() ?? "",
CustomerName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CustomerName)]?.GetValue<string>() ?? "",
RefNo1 = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.RefNo1)]?.GetValue<string>() ?? "",
TermBranch = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.TermBranch)]?.GetValue<string>() ?? "",
TellerId = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.TellerID)]?.GetValue<string>() ?? "",
CreditDebit = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CreditDebit)]?.GetValue<string>() ?? "",
PaymentType = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Type)]?.GetValue<string>(),
ChequeNo = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ChequeNo)]?.GetValue<string>() ?? "",
Amount = (decimal)workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Amount)]?.GetValue<decimal>(),
ChqueBankCode = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.ChqBankCode)]?.GetValue<string>() ?? ""
PaymentId = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
CompanyCode = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
TextFile = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
BankCode = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
AccountNumber = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
TransDate = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
TransTime = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
CustomerName = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
RefNo1 = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
TermBranch = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
TellerId = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
CreditDebit = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
PaymentType = workSheet?.Cells[row, 9999]?.GetValue<string>(),
ChequeNo = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Amount = (decimal)workSheet?.Cells[row, 9999]?.GetValue<decimal>(),
ChqueBankCode = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? ""
});
// occupation
r.Occupations.Add(new RecruitOccupation()
{
Occupation = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Occupation)]?.GetValue<string>() ?? "",
Position = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Position)]?.GetValue<string>() ?? "",
Workplace = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Workplace)]?.GetValue<string>() ?? "",
Telephone = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.WorkplaceTelephone)]?.GetValue<string>() ?? "",
WorkAge = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.WorkAge)]?.GetValue<string>() ?? "",
Occupation = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Position = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Workplace = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Telephone = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
WorkAge = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
});
// certificate
r.Certificates.Add(new RecruitCertificate()
{
CertificateNo = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CertificateNo)]?.GetValue<string>() ?? "",
Description = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CertificateDesc)]?.GetValue<string>() ?? "",
IssueDate = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CertificateIssueDate)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-")),
ExpiredDate = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.CertificateExpireDate)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"))
CertificateNo = 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, "-")),
ExpiredDate = Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"))
});
r.Educations.Add(new RecruitEducation()
{
Degree = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Degree)]?.GetValue<string>() ?? "",
Major = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.Major)]?.GetValue<string>() ?? "",
MajorGroupId = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.MajorGroupID)]?.GetValue<string>() ?? "",
MajorGroupName = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.MajorGroupName)]?.GetValue<string>() ?? "",
University = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.University)]?.GetValue<string>() ?? "",
GPA = (double)workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.GPA)]?.GetValue<double>(),
Specialist = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.SpecialList)]?.GetValue<string>() ?? "",
HighDegree = workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.HighDegree)]?.GetValue<string>() ?? "",
BachelorDate = Convert.ToDateTime(workSheet?.Cells[row, GetColumnIndex(cols, CandidateFileHeader.BachelorDate)]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"))
Degree = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
Major = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
MajorGroupId = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
MajorGroupName = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
University = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
GPA = (double)workSheet?.Cells[row, 9999]?.GetValue<double>(),
Specialist = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
HighDegree = workSheet?.Cells[row, 9999]?.GetValue<string>() ?? "",
BachelorDate = Convert.ToDateTime(workSheet?.Cells[row, 9999]?.GetValue<string>().ToDateTime(DateTimeFormat.Ymd, "-"))
});
r.RecruitImport = imported;