แก้ไฟล์ import สมัครสอบคัดเลือก

This commit is contained in:
Kittapath 2023-10-09 15:57:03 +07:00
parent a2847d9d55
commit fde95f3b86
2 changed files with 37 additions and 29 deletions

View file

@ -1985,15 +1985,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.PeriodExam == candidate.PeriodExam) .Where(x => x.PeriodExam == candidate.PeriodExam)
.Where(x => x.PositionExam == candidate.PositionExam) .Where(x => x.PositionExam == candidate.PositionExam)
.Where(x => x.ExamIdenNumber != null) .Where(x => x.ExamIdenNumber != null)
.Where(x => x.Status == "checkRegister") .Where(x => x.Status != "register")
.OrderByDescending(d => d.CreatedAt) .OrderByDescending(d => d.CreatedAt)
.ToListAsync(); .ToListAsync();
if (periodExam == null) if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound); throw new Exception(GlobalMessages.ExamNotFound);
if (candidate.ExamIdenNumber == null)
var num = periodExam.Count() + 1; {
candidate.ExamIdenNumber = candidate.PositionExam == null ? num.ToString() : candidate.PositionExam.Code + num.ToString("D5"); var num = periodExam.Count() + 1;
candidate.ExamIdenNumber = candidate.PositionExam == null ? num.ToString() : candidate.PositionExam.Code + num.ToString("D5");
}
} }
if (status == "checkPayment") if (status == "checkPayment")
{ {
@ -2047,7 +2049,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
else if (status == "payment" && candidate.PeriodExam.Fee == 0) else if (status == "payment" && candidate.PeriodExam.Fee == 0)
{ {
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name; var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: ได้รับใบสมัครแล้ว"; var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่จัดที่นั่งสอบ";
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email); if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
candidate.Status = "checkSeat"; candidate.Status = "checkSeat";
// var num = periodExam.Count() + 1; // var num = periodExam.Count() + 1;
@ -2062,7 +2064,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate.Status == "checkSeat") if (candidate.Status == "checkSeat")
{ {
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name; var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: ได้รับใบสมัครแล้ว"; var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่จัดที่นั่งสอบ";
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email); if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
// var num = periodExam.Count() + 1; // var num = periodExam.Count() + 1;
// candidate.ExamIdenNumber = candidate.PositionExam == null ? num.ToString() : candidate.PositionExam.Code + num; // candidate.ExamIdenNumber = candidate.PositionExam == null ? num.ToString() : candidate.PositionExam.Code + num;
@ -2098,7 +2100,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.ExamNotFound); throw new Exception(GlobalMessages.ExamNotFound);
var periodExam = await _context.Candidates.AsQueryable() var periodExam = await _context.Candidates.AsQueryable()
.Where(x => x.PeriodExam == candidate.PeriodExam && x.ExamIdenNumber != null) .Where(x => x.PeriodExam == candidate.PeriodExam)
.Where(x => x.PositionExam == candidate.PositionExam)
.Where(x => x.ExamIdenNumber != null)
.Where(x => x.Status != "register")
.OrderByDescending(d => d.CreatedAt) .OrderByDescending(d => d.CreatedAt)
.ToListAsync(); .ToListAsync();
@ -2109,11 +2114,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate.PeriodExam.Fee == 0) if (candidate.PeriodExam.Fee == 0)
{ {
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name; var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: ได้รับใบสมัครแล้ว"; var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่จัดที่นั่งสอบ";
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email); if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
candidate.Status = "checkSeat"; candidate.Status = "checkSeat";
var num = periodExam.Count() + 1 + _num; if (candidate.ExamIdenNumber == null)
candidate.ExamIdenNumber = candidate.PositionExam == null ? num.ToString() : candidate.PositionExam.Code + num; {
var num = periodExam.Count() + 1;
candidate.ExamIdenNumber = candidate.PositionExam == null ? num.ToString() : candidate.PositionExam.Code + num.ToString("D5");
}
} }
else if (candidate.PeriodExam.Fee != 0) else if (candidate.PeriodExam.Fee != 0)
{ {

View file

@ -941,28 +941,28 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
CitizenId = worksheet.Cells[row, 3].Value != null ? worksheet.Cells[row, 3].Value.ToString() : null, 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, SeatNumber = worksheet.Cells[row, 4].Value != null ? worksheet.Cells[row, 4].Value.ToString() : null,
PointPath1A = worksheet.Cells[row, 6].Value != null ? worksheet.Cells[row, 6].Value.ToString() : null, PointPath1A = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null,
PointPath2A = worksheet.Cells[row, 7].Value != null ? worksheet.Cells[row, 7].Value.ToString() : null, PointPath2A = worksheet.Cells[row, 10].Value != null ? worksheet.Cells[row, 10].Value.ToString() : null,
PointPath3A = worksheet.Cells[row, 8].Value != null ? worksheet.Cells[row, 8].Value.ToString() : null, PointPath3A = worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : null,
PointTotalA = worksheet.Cells[3, 9].Value != null ? worksheet.Cells[3, 9].Value.ToString()?.Split(" ")[0] : null, PointTotalA = worksheet.Cells[3, 12].Value != null ? worksheet.Cells[3, 12].Value.ToString()?.Split(" ")[0] : null,
PointA = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null, PointA = worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : null,
PointPerA = worksheet.Cells[row, 10].Value != null ? worksheet.Cells[row, 10].Value.ToString() : null, PointPerA = worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : null,
ResultA = worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : null, ResultA = worksheet.Cells[row, 14].Value != null ? worksheet.Cells[row, 14].Value.ToString() : null,
PointTotalB = worksheet.Cells[3, 12].Value != null ? worksheet.Cells[3, 12].Value.ToString()?.Split(" ")[0] : null, PointTotalB = worksheet.Cells[3, 15].Value != null ? worksheet.Cells[3, 15].Value.ToString()?.Split(" ")[0] : null,
PointB = worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : null, PointB = worksheet.Cells[row, 15].Value != null ? worksheet.Cells[row, 15].Value.ToString() : null,
PointPerB = worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : null, PointPerB = worksheet.Cells[row, 16].Value != null ? worksheet.Cells[row, 16].Value.ToString() : null,
ResultB = worksheet.Cells[row, 14].Value != null ? worksheet.Cells[row, 14].Value.ToString() : null, ResultB = worksheet.Cells[row, 17].Value != null ? worksheet.Cells[row, 17].Value.ToString() : null,
PointPath1C = worksheet.Cells[row, 15].Value != null ? worksheet.Cells[row, 15].Value.ToString() : null, PointPath1C = worksheet.Cells[row, 18].Value != null ? worksheet.Cells[row, 18].Value.ToString() : null,
PointPath2C = worksheet.Cells[row, 16].Value != null ? worksheet.Cells[row, 16].Value.ToString() : null, PointPath2C = worksheet.Cells[row, 19].Value != null ? worksheet.Cells[row, 19].Value.ToString() : null,
PointTotalC = worksheet.Cells[3, 17].Value != null ? worksheet.Cells[3, 17].Value.ToString()?.Split(" ")[0] : null, PointTotalC = worksheet.Cells[3, 20].Value != null ? worksheet.Cells[3, 20].Value.ToString()?.Split(" ")[0] : null,
PointC = worksheet.Cells[row, 17].Value != null ? worksheet.Cells[row, 17].Value.ToString() : null, PointC = worksheet.Cells[row, 20].Value != null ? worksheet.Cells[row, 20].Value.ToString() : null,
PointPerC = worksheet.Cells[row, 18].Value != null ? worksheet.Cells[row, 18].Value.ToString() : null, PointPerC = worksheet.Cells[row, 21].Value != null ? worksheet.Cells[row, 21].Value.ToString() : null,
ResultC = worksheet.Cells[row, 19].Value != null ? worksheet.Cells[row, 19].Value.ToString() : null, ResultC = worksheet.Cells[row, 22].Value != null ? worksheet.Cells[row, 22].Value.ToString() : null,
Pass = worksheet.Cells[row, 20].Value != null ? (worksheet.Cells[row, 20].Value.ToString()) : null, Pass = worksheet.Cells[row, 23].Value != null ? (worksheet.Cells[row, 23].Value.ToString()) : null,
ExamReason = worksheet.Cells[row, 24].Value != null ? (worksheet.Cells[row, 24].Value.ToString()) : null, ExamReason = worksheet.Cells[row, 27].Value != null ? (worksheet.Cells[row, 27].Value.ToString()) : null,
}); });
// } // }
} }