Merge branch 'develop' into working
# Conflicts: # Controllers/DisableReportController.cs
This commit is contained in:
commit
072f150eed
34 changed files with 15259 additions and 2576 deletions
|
|
@ -362,17 +362,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Id = x.Id.ToString(),
|
||||
Category = GetNameCategory(x.Category),
|
||||
CategoryId = x.Category,
|
||||
Start = x.ExamDate.ToString("yyyy-MM-dd"),
|
||||
End = x.ExamDate.ToString("yyyy-MM-dd"),
|
||||
ExamDate = x.ExamDate.ToString("yyyy-MM-dd"),
|
||||
Announcement_date = x.AnnouncementDate.ToString("yyyy-MM-dd"),
|
||||
Start = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
|
||||
End = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
|
||||
ExamDate = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
|
||||
Announcement_date = x.AnnouncementDate == null ? null : x.AnnouncementDate.Value.ToString("yyyy-MM-dd"),
|
||||
Announcement_startDate = x.AnnouncementStartDate.ToString("yyyy-MM-dd"),
|
||||
Announcement_endDate = x.AnnouncementEndDate.ToString("yyyy-MM-dd"),
|
||||
AnnouncementExam = x.AnnouncementExam,
|
||||
Register_startDate = x.RegisterStartDate.ToString("yyyy-MM-dd"),
|
||||
Register_endDate = x.RegisterEndDate.ToString("yyyy-MM-dd"),
|
||||
Payment_startDate = x.PaymentStartDate.ToString("yyyy-MM-dd"),
|
||||
Payment_endDate = x.PaymentEndDate.ToString("yyyy-MM-dd"),
|
||||
Register_startDate = x.RegisterStartDate == null ? null : x.RegisterStartDate.Value.ToString("yyyy-MM-dd"),
|
||||
Register_endDate = x.RegisterEndDate == null ? null : x.RegisterEndDate.Value.ToString("yyyy-MM-dd"),
|
||||
Payment_startDate = x.PaymentStartDate == null ? null : x.PaymentStartDate.Value.ToString("yyyy-MM-dd"),
|
||||
Payment_endDate = x.PaymentEndDate == null ? null : x.PaymentEndDate.Value.ToString("yyyy-MM-dd"),
|
||||
Title = x.Name,
|
||||
Image = x.PeriodExamImages.OrderBy(o => o.CreatedAt).FirstOrDefault() == null ?
|
||||
"" :
|
||||
|
|
@ -407,17 +407,17 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Id = x.Id.ToString(),
|
||||
Category = GetNameCategory(x.Category),
|
||||
CategoryId = x.Category,
|
||||
Start = x.ExamDate.ToString("yyyy-MM-dd"),
|
||||
End = x.ExamDate.ToString("yyyy-MM-dd"),
|
||||
ExamDate = x.ExamDate.ToString("yyyy-MM-dd"),
|
||||
Announcement_date = x.AnnouncementDate.ToString("yyyy-MM-dd"),
|
||||
Start = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
|
||||
End = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
|
||||
ExamDate = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
|
||||
Announcement_date = x.AnnouncementDate == null ? null : x.AnnouncementDate.Value.ToString("yyyy-MM-dd"),
|
||||
Announcement_startDate = x.AnnouncementStartDate.ToString("yyyy-MM-dd"),
|
||||
Announcement_endDate = x.AnnouncementEndDate.ToString("yyyy-MM-dd"),
|
||||
AnnouncementExam = x.AnnouncementExam,
|
||||
Register_startDate = x.RegisterStartDate.ToString("yyyy-MM-dd"),
|
||||
Register_endDate = x.RegisterEndDate.ToString("yyyy-MM-dd"),
|
||||
Payment_startDate = x.PaymentStartDate.ToString("yyyy-MM-dd"),
|
||||
Payment_endDate = x.PaymentEndDate.ToString("yyyy-MM-dd"),
|
||||
Register_startDate = x.RegisterStartDate == null ? null : x.RegisterStartDate.Value.ToString("yyyy-MM-dd"),
|
||||
Register_endDate = x.RegisterEndDate == null ? null : x.RegisterEndDate.Value.ToString("yyyy-MM-dd"),
|
||||
Payment_startDate = x.PaymentStartDate == null ? null : x.PaymentStartDate.Value.ToString("yyyy-MM-dd"),
|
||||
Payment_endDate = x.PaymentEndDate == null ? null : x.PaymentEndDate.Value.ToString("yyyy-MM-dd"),
|
||||
Title = x.Name,
|
||||
Image = x.PeriodExamImages.OrderBy(o => o.CreatedAt).FirstOrDefault() == null ?
|
||||
"" :
|
||||
|
|
@ -454,15 +454,15 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
CategoryId = x.Category,
|
||||
Start = x.AnnouncementStartDate.ToString("yyyy-MM-dd"),
|
||||
End = x.AnnouncementEndDate.ToString("yyyy-MM-dd"),
|
||||
ExamDate = x.ExamDate.ToString("yyyy-MM-dd"),
|
||||
Announcement_date = x.AnnouncementDate.ToString("yyyy-MM-dd"),
|
||||
ExamDate = x.ExamDate == null ? null : x.ExamDate.Value.ToString("yyyy-MM-dd"),
|
||||
Announcement_date = x.AnnouncementDate == null ? null : x.AnnouncementDate.Value.ToString("yyyy-MM-dd"),
|
||||
Announcement_startDate = x.AnnouncementStartDate.ToString("yyyy-MM-dd"),
|
||||
Announcement_endDate = x.AnnouncementEndDate.ToString("yyyy-MM-dd"),
|
||||
AnnouncementExam = x.AnnouncementExam,
|
||||
Register_startDate = x.RegisterStartDate.ToString("yyyy-MM-dd"),
|
||||
Register_endDate = x.RegisterEndDate.ToString("yyyy-MM-dd"),
|
||||
Payment_startDate = x.PaymentStartDate.ToString("yyyy-MM-dd"),
|
||||
Payment_endDate = x.PaymentEndDate.ToString("yyyy-MM-dd"),
|
||||
Register_startDate = x.RegisterStartDate == null ? null : x.RegisterStartDate.Value.ToString("yyyy-MM-dd"),
|
||||
Register_endDate = x.RegisterEndDate == null ? null : x.RegisterEndDate.Value.ToString("yyyy-MM-dd"),
|
||||
Payment_startDate = x.PaymentStartDate == null ? null : x.PaymentStartDate.Value.ToString("yyyy-MM-dd"),
|
||||
Payment_endDate = x.PaymentEndDate == null ? null : x.PaymentEndDate.Value.ToString("yyyy-MM-dd"),
|
||||
Title = x.Name,
|
||||
Detail = x.Detail,
|
||||
Images = x.PeriodExamImages.OrderBy(x => x.CreatedAt).Select(s => new HomePageLinkResponseItem
|
||||
|
|
@ -479,6 +479,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
Id = s.Id.ToString(),
|
||||
Title = s.PositionName == null ? x.Name : s.PositionName,
|
||||
HighDegree = s.HighDegree == true ? "ปริญญาขึ้นไป" : "ต่ำกว่าปริญญาตรี",
|
||||
Path = $"{x.Id}/{s.Id}",
|
||||
}).ToList(),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
var candidatePosition = await _context.Candidates.AsQueryable()
|
||||
.Include(x => x.PositionExam)
|
||||
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId && x.Status != "register" && x.Status != "rejectRegister");
|
||||
.FirstOrDefaultAsync(x => x.PeriodExam == exam && x.UserId == UserId && x.RegisterDate != null && x.Status != "register" && x.Status != "rejectRegister");
|
||||
|
||||
return new RequestStatusRegistry
|
||||
{
|
||||
|
|
@ -1444,11 +1444,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
if (exam == null)
|
||||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
var position = exam.PositionExam.Where(x => x.Id == Guid.Parse(positionId)).FirstOrDefault();
|
||||
|
||||
if (position == null)
|
||||
throw new Exception(GlobalMessages.PositionExamNotFound);
|
||||
// if (exam.PositionExam != null)
|
||||
// {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
// var position = exam.PositionExam.Where(x => x.Id == Guid.Parse(positionId)).FirstOrDefault();
|
||||
|
||||
// if (position == null)
|
||||
// throw new Exception(GlobalMessages.PositionExamNotFound);
|
||||
// }
|
||||
await _minioService.DeleteFileAsync(Guid.Parse(documentId));
|
||||
}
|
||||
|
||||
|
|
@ -1729,6 +1731,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + exam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่ตรวจสอบข้อมูล";
|
||||
_mailService.SendMailToUser(subject, body, "ananda@frappet.com");
|
||||
if (candidate.RegisterDate == null)
|
||||
candidate.RegisterDate = DateTime.Now;
|
||||
}
|
||||
if (status == "checkPayment")
|
||||
{
|
||||
|
|
@ -1768,21 +1772,21 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " มีคุณสมบัติสมัครสอบไม่ผ่านกรุณาตรวจสอบข้อมูล เนื่องจาก: " + item.Reason;
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
candidate.RejectDetail = item.Reason;
|
||||
}
|
||||
if (status == "rejectPayment")
|
||||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " มีหลักฐานชำระเงินไม่ถูกต้องกรุณาตรวจสอบข้อมูล เนื่องจาก: " + item.Reason;
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
candidate.RejectDetail = item.Reason;
|
||||
}
|
||||
else if (status == "payment" && candidate.PeriodExam.Fee == 0)
|
||||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่จัดที่นั่งสอบ";
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
candidate.Status = "checkSeat";
|
||||
var num = periodExam.Count() + 1;
|
||||
candidate.ExamIdenNumber = "CDC-" + num;
|
||||
|
|
@ -1791,22 +1795,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอชำระค่าสมัครสอบ";
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
}
|
||||
if (candidate.Status == "checkSeat")
|
||||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่จัดที่นั่งสอบ";
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
var num = periodExam.Count() + 1;
|
||||
candidate.ExamIdenNumber = "CDC-" + num;
|
||||
candidate.PaymentDate = DateTime.Now;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " มีคุณสมบัติไม่ผ่านตามเงื่อนไข";
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
_context.Candidates.Remove(candidate);
|
||||
}
|
||||
|
||||
|
|
@ -1829,13 +1834,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สอบคัดเลือกสำเร็จ";
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
}
|
||||
if (status == "checkPoint")
|
||||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่สรุปคะแนนสอบ";
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
}
|
||||
candidate.Status = status;
|
||||
|
||||
|
|
@ -1881,6 +1886,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
.Where(x => x.PeriodExam == exam && x.UserId == UserId)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
var positionName = "";
|
||||
var highDegree = "";
|
||||
if (positionId != "00000000-0000-0000-0000-000000000000")
|
||||
{
|
||||
var position = await _context.PositionExams.AsQueryable()
|
||||
|
|
@ -1892,6 +1899,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate = await _context.Candidates.AsQueryable()
|
||||
.Where(x => x.PeriodExam == exam && x.UserId == UserId && x.PositionExam == position)
|
||||
.FirstOrDefaultAsync();
|
||||
positionName = position.PositionName;
|
||||
highDegree = position.HighDegree == true ? "ปริญญาขึ้นไป" : "ต่ำกว่าปริญญาตรี";
|
||||
}
|
||||
|
||||
if (candidate == null)
|
||||
|
|
@ -1916,8 +1925,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Number = candidate.Number,
|
||||
ReviewPoint = candidate.ReviewPoint,
|
||||
Review = candidate.Review,
|
||||
AnnouncementDate = exam.AnnouncementDate.AddYears(2),
|
||||
AnnouncementDate = exam.AnnouncementDate?.AddYears(2),
|
||||
Id = candidate.Id,
|
||||
Position = positionName,
|
||||
HighDegree = highDegree,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1931,6 +1942,14 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
if (candidate == null)
|
||||
throw new Exception(GlobalMessages.CandidateNotFound);
|
||||
|
||||
var positionName = "";
|
||||
var highDegree = "";
|
||||
if (candidate.PositionExam != null)
|
||||
{
|
||||
positionName = candidate.PositionExam.PositionName;
|
||||
highDegree = candidate.PositionExam.HighDegree == true ? "ปริญญาขึ้นไป" : "ต่ำกว่าปริญญาตรี";
|
||||
}
|
||||
|
||||
return new RequestCardCandidate
|
||||
{
|
||||
Avatar = candidate.ProfileImg == null ? "" : _minioService.ImagesPath(candidate.ProfileImg.Id).Result,
|
||||
|
|
@ -1950,8 +1969,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Number = candidate.Number,
|
||||
ReviewPoint = candidate.ReviewPoint,
|
||||
Review = candidate.Review,
|
||||
AnnouncementDate = candidate.PeriodExam?.AnnouncementDate.AddYears(2),
|
||||
AnnouncementDate = candidate.PeriodExam?.AnnouncementDate?.AddYears(2),
|
||||
Id = candidate.Id,
|
||||
Position = positionName,
|
||||
HighDegree = highDegree,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -1994,7 +2015,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
// })
|
||||
// .ToListAsync();
|
||||
|
||||
return _minioService.ImagesPath(Guid.Parse("08db463c-9bf7-494f-8b35-e9b777256dae")).Result;
|
||||
return _minioService.ImagesPathString("ใบจ่ายเงิน.pdf").Result;
|
||||
}
|
||||
|
||||
public async Task UpdateReviewAsyncCandidate(string examId, string positionId, RequestReview item)
|
||||
|
|
|
|||
|
|
@ -224,6 +224,29 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
return path;
|
||||
}
|
||||
|
||||
public async Task<string> ImagesPathString(string fileId)
|
||||
{
|
||||
if (fileId == null)
|
||||
return "";
|
||||
|
||||
var config = new AmazonS3Config
|
||||
{
|
||||
ServiceURL = Configuration.GetValue<string>("MinIO:Endpoint"),
|
||||
ForcePathStyle = true
|
||||
};
|
||||
|
||||
DateTime expires = DateTime.UtcNow.AddHours(6);
|
||||
GetPreSignedUrlRequest request = new GetPreSignedUrlRequest
|
||||
{
|
||||
BucketName = _bucketName,
|
||||
Key = fileId,
|
||||
Expires = expires,
|
||||
};
|
||||
string path = _s3Client.GetPreSignedURL(request);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -84,43 +84,98 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
}
|
||||
}
|
||||
|
||||
private List<Guid?> GetAllIdByRoot(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ret = new List<Guid?>();
|
||||
|
||||
var oc = _contextMetadata.Organizations.FirstOrDefault(x => x.Id == id && x.IsActive);
|
||||
if (oc != null)
|
||||
ret.Add(oc.Id);
|
||||
|
||||
var child = _contextMetadata.Organizations.AsQueryable().Where(x => x.ParentId == id && x.IsActive).ToList();
|
||||
if (child.Any())
|
||||
{
|
||||
foreach (var item in child)
|
||||
{
|
||||
ret.AddRange(GetAllIdByRoot(item.Id));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<PeriodExamCandidateResponseItem>> GetsAsync(string type, bool showAll = true)
|
||||
{
|
||||
return await _context.PeriodExams.AsQueryable()
|
||||
.Where(p => p.IsActive)
|
||||
.Where(p => p.CheckDisability == false)
|
||||
.Where(p => type.ToUpper() == "ALL" ? (p.AnnouncementExam == true || p.AnnouncementExam == false) : (type.ToUpper() == "EXAM" ? p.AnnouncementExam == true : p.AnnouncementExam == false))
|
||||
.OrderByDescending(d => d.CreatedAt)
|
||||
.Select(x => new PeriodExamCandidateResponseItem
|
||||
{
|
||||
ExamDate = x.ExamDate,
|
||||
AnnouncementEndDate = x.AnnouncementEndDate,
|
||||
AnnouncementStartDate = x.AnnouncementStartDate,
|
||||
AnnouncementDate = x.AnnouncementDate,
|
||||
CheckDisability = x.CheckDisability,
|
||||
CheckDocument = x.CheckDocument,
|
||||
Detail = x.Detail,
|
||||
Fee = x.Fee,
|
||||
Id = x.Id,
|
||||
IsActive = x.IsActive,
|
||||
Name = x.Name,
|
||||
Note = x.Note,
|
||||
OrganizationCodeId = x.OrganizationCodeId,
|
||||
OrganizationCodeName = x.OrganizationCodeName,
|
||||
OrganizationId = x.OrganizationId,
|
||||
OrganizationName = x.OrganizationName,
|
||||
PaymentEndDate = x.PaymentEndDate,
|
||||
PaymentKrungThai = x.PaymentKrungThai,
|
||||
AnnouncementExam = x.AnnouncementExam,
|
||||
Category = x.Category,
|
||||
PaymentStartDate = x.PaymentStartDate,
|
||||
RegisterEndDate = x.RegisterEndDate,
|
||||
RegisterStartDate = x.RegisterStartDate,
|
||||
Round = x.Round,
|
||||
SetSeat = x.SetSeat,
|
||||
Year = x.Year,
|
||||
})
|
||||
.ToListAsync();
|
||||
var periodExams = await _context.PeriodExams.AsQueryable()
|
||||
.Where(p => p.IsActive)
|
||||
.Where(p => p.CheckDisability == false)
|
||||
.Where(p => type.ToUpper() == "ALL" ? (p.AnnouncementExam == true || p.AnnouncementExam == false) : (type.ToUpper() == "EXAM" ? p.AnnouncementExam == true : p.AnnouncementExam == false))
|
||||
.OrderByDescending(d => d.CreatedAt).ToListAsync();
|
||||
var profileOrganizations = await _contextMetadata.ProfileOrganizations.AsQueryable()
|
||||
.ToListAsync();
|
||||
var _periodExams = (from x in periodExams
|
||||
join po in profileOrganizations on Guid.Parse(x.CreatedUserId) equals po?.UserId into poGroup
|
||||
from po in poGroup.DefaultIfEmpty()
|
||||
select new PeriodExamCandidateResponseItem
|
||||
{
|
||||
ExamDate = x.ExamDate,
|
||||
AnnouncementEndDate = x.AnnouncementEndDate,
|
||||
AnnouncementStartDate = x.AnnouncementStartDate,
|
||||
AnnouncementDate = x.AnnouncementDate,
|
||||
CheckDisability = x.CheckDisability,
|
||||
CheckDocument = x.CheckDocument,
|
||||
Detail = x.Detail,
|
||||
Fee = x.Fee,
|
||||
Id = x.Id,
|
||||
IsActive = x.IsActive,
|
||||
Name = x.Name,
|
||||
Note = x.Note,
|
||||
OrganizationCodeId = x.OrganizationCodeId,
|
||||
OrganizationCodeName = x.OrganizationCodeName,
|
||||
OrganizationId = x.OrganizationId,
|
||||
OrganizationName = x.OrganizationName,
|
||||
PaymentEndDate = x.PaymentEndDate,
|
||||
PaymentKrungThai = x.PaymentKrungThai,
|
||||
AnnouncementExam = x.AnnouncementExam,
|
||||
Category = x.Category,
|
||||
PaymentStartDate = x.PaymentStartDate,
|
||||
RegisterEndDate = x.RegisterEndDate,
|
||||
RegisterStartDate = x.RegisterStartDate,
|
||||
Round = x.Round,
|
||||
SetSeat = x.SetSeat,
|
||||
Year = x.Year,
|
||||
OcId = po == null ? null : po.OrganizationId,
|
||||
CreatedUserId = x.CreatedUserId,
|
||||
}).AsQueryable()
|
||||
.ToList();
|
||||
|
||||
var roles = _httpContextAccessor?.HttpContext?.User?.FindAll(ClaimTypes.Role)?.Select(c => c.Value).ToList();
|
||||
if (!roles.Contains("head"))
|
||||
{
|
||||
var criteria = new List<Guid?>();
|
||||
var profileOrganization = await _contextMetadata.ProfileOrganizations.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.UserId == Guid.Parse(UserId));
|
||||
|
||||
if (profileOrganization == null)
|
||||
return new List<PeriodExamCandidateResponseItem>();
|
||||
|
||||
var ocId = _contextMetadata.Organizations.AsQueryable()
|
||||
.FirstOrDefault(x => x.Id == profileOrganization.OrganizationId);
|
||||
if (ocId == null)
|
||||
return new List<PeriodExamCandidateResponseItem>();
|
||||
criteria = GetAllIdByRoot(ocId.Id);
|
||||
|
||||
if (criteria.Any())
|
||||
_periodExams = _periodExams.Where(x => x.CreatedUserId == UserId || criteria.Contains(x.OcId == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OcId)).ToList();
|
||||
}
|
||||
return _periodExams;
|
||||
}
|
||||
|
||||
public async Task<PeriodExamCandidateResponseItem?> GetsExamAndCandidateAsync(string examId, bool showAll = true)
|
||||
|
|
@ -172,6 +227,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
TypeName = b.TypeName,
|
||||
PositionId = b.PositionId,
|
||||
PositionName = b.PositionName,
|
||||
HighDegree = b.HighDegree,
|
||||
}).ToList(),
|
||||
Documents = x.PeriodExamDocuments.OrderBy(o => o.CreatedAt).Select(b => new FileListResponse
|
||||
{
|
||||
|
|
@ -226,7 +282,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Name = periodExam.Name,
|
||||
Round = periodExam.Round,
|
||||
Year = periodExam.Year,
|
||||
Status = DateTime.Now > periodExam.PaymentEndDate,
|
||||
Status = periodExam.PaymentEndDate == null ? true : DateTime.Now > periodExam.PaymentEndDate,
|
||||
SetSeat = periodExam.SetSeat,
|
||||
};
|
||||
}
|
||||
|
|
@ -325,6 +381,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
PeriodExam = periodExam,
|
||||
PositionId = position.PositionId,
|
||||
PositionName = position.PositionName,
|
||||
HighDegree = position.HighDegree,
|
||||
TypeId = position.TypeId,
|
||||
TypeName = position.TypeName,
|
||||
CreatedAt = DateTime.Now,
|
||||
|
|
@ -448,6 +505,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
position.PositionId = positionData.PositionId;
|
||||
position.PositionName = positionData.PositionName;
|
||||
position.HighDegree = positionData.HighDegree;
|
||||
position.TypeId = positionData.TypeId;
|
||||
position.TypeName = positionData.TypeName;
|
||||
position.LastUpdatedAt = DateTime.Now;
|
||||
|
|
@ -478,6 +536,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
PeriodExam = periodExam,
|
||||
PositionId = position.PositionId,
|
||||
PositionName = position.PositionName,
|
||||
HighDegree = position.HighDegree,
|
||||
TypeId = position.TypeId,
|
||||
TypeName = position.TypeName,
|
||||
CreatedAt = DateTime.Now,
|
||||
|
|
@ -600,10 +659,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
var candidate = await _context.Candidates.AsQueryable()
|
||||
.Include(x => x.ProfileImg)
|
||||
.OrderByDescending(d => d.CreatedAt)
|
||||
.Where(x => x.PeriodExam == periodExam && x.Status != "register" && x.Status != "rejectRegister")
|
||||
.Where(x => x.PeriodExam == periodExam && x.RegisterDate != null && x.Status != "register" && x.Status != "rejectRegister")
|
||||
.ToListAsync();
|
||||
if (candidate.Where(x => x.Status == "done").FirstOrDefault() != null)
|
||||
candidate = candidate.OrderBy(x => x.Number).ToList();
|
||||
candidate = candidate.OrderBy(x => Convert.ToInt32(x.Number)).ToList();
|
||||
var i = 0;
|
||||
foreach (var item in candidate)
|
||||
{
|
||||
|
|
@ -621,7 +680,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
.Where(x => x.PeriodExam == periodExam && x.Status == status)
|
||||
.ToListAsync();
|
||||
if (candidate.Where(x => x.Status == "done").FirstOrDefault() != null)
|
||||
candidate = candidate.OrderBy(x => x.Number).ToList();
|
||||
candidate = candidate.OrderBy(x => Convert.ToInt32(x.Number)).ToList();
|
||||
var i = 0;
|
||||
foreach (var item in candidate)
|
||||
{
|
||||
|
|
@ -821,23 +880,23 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
for (int row = 2; row <= rowCount; row++)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine(worksheet);
|
||||
if (worksheet.Cells[row, 1].Value != null)
|
||||
// if (worksheet.Cells[row, 2].Value != null)
|
||||
// {
|
||||
list.Add(new RequestImportSeat
|
||||
{
|
||||
list.Add(new RequestImportSeat
|
||||
{
|
||||
Number = worksheet.Cells[row, 1].Value != null ? worksheet.Cells[row, 1].Value.ToString() : null,
|
||||
CitizenId = worksheet.Cells[row, 2].Value != null ? worksheet.Cells[row, 2].Value.ToString() : null,
|
||||
ExamIdenNumber = 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,
|
||||
PointTotalB = worksheet.Cells[row, 5].Value != null ? worksheet.Cells[row, 5].Value.ToString() : null,
|
||||
PointB = worksheet.Cells[row, 6].Value != null ? worksheet.Cells[row, 6].Value.ToString() : null,
|
||||
ResultB = worksheet.Cells[row, 7].Value != null ? worksheet.Cells[row, 7].Value.ToString() : null,
|
||||
PointTotalC = worksheet.Cells[row, 8].Value != null ? worksheet.Cells[row, 8].Value.ToString() : null,
|
||||
PointC = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null,
|
||||
ResultC = worksheet.Cells[row, 10].Value != null ? worksheet.Cells[row, 10].Value.ToString() : null,
|
||||
Pass = worksheet.Cells[row, 11].Value != null ? (worksheet.Cells[row, 11].Value.ToString()) : null,
|
||||
});
|
||||
}
|
||||
Number = worksheet.Cells[row, 4].Value != null ? worksheet.Cells[row, 4].Value.ToString() : null,
|
||||
CitizenId = worksheet.Cells[row, 5].Value != null ? worksheet.Cells[row, 5].Value.ToString() : null,
|
||||
ExamIdenNumber = worksheet.Cells[row, 6].Value != null ? worksheet.Cells[row, 6].Value.ToString() : null,
|
||||
SeatNumber = worksheet.Cells[row, 7].Value != null ? worksheet.Cells[row, 7].Value.ToString() : null,
|
||||
PointTotalB = worksheet.Cells[row, 8].Value != null ? worksheet.Cells[row, 8].Value.ToString() : null,
|
||||
PointB = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null,
|
||||
ResultB = worksheet.Cells[row, 10].Value != null ? worksheet.Cells[row, 10].Value.ToString() : null,
|
||||
PointTotalC = worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : null,
|
||||
PointC = worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : null,
|
||||
ResultC = worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : null,
|
||||
Pass = worksheet.Cells[row, 14].Value != null ? (worksheet.Cells[row, 14].Value.ToString()) : null,
|
||||
});
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -863,7 +922,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
foreach (var candidate in candidates)
|
||||
{
|
||||
var item = items.FirstOrDefault(x => x.CitizenId == candidate.CitizenId && x.ExamIdenNumber.Trim().ToUpper() == candidate.ExamIdenNumber.Trim().ToUpper());
|
||||
if (candidate.ExamIdenNumber == null || candidate.CitizenId == null)
|
||||
continue;
|
||||
var item = items.FirstOrDefault(x => x.CitizenId == candidate.CitizenId && x.ExamIdenNumber == candidate.ExamIdenNumber);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
|
|
@ -872,7 +933,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.SeatNumber = item.SeatNumber;
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอเจ้าหน้าที่สรุปคะแนนสอบ";
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
candidate.Status = "checkPoint";
|
||||
}
|
||||
else
|
||||
|
|
@ -881,7 +942,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
}
|
||||
candidate.Status = "waiver";
|
||||
}
|
||||
|
|
@ -892,7 +953,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
}
|
||||
candidate.Status = "waiver";
|
||||
}
|
||||
|
|
@ -919,6 +980,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
foreach (var candidate in candidates)
|
||||
{
|
||||
if (candidate.ExamIdenNumber == null || candidate.CitizenId == null)
|
||||
continue;
|
||||
var item = items.FirstOrDefault(x => x.CitizenId == candidate.CitizenId && x.ExamIdenNumber == candidate.ExamIdenNumber);
|
||||
|
||||
if (item != null)
|
||||
|
|
@ -935,7 +998,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
candidate.Number = item.Number;
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สอบคัดเลือกสำเร็จ";
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
// if (candidate.Email != null&& candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
candidate.Status = "done";
|
||||
}
|
||||
else
|
||||
|
|
@ -944,9 +1007,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
// if (candidate.Email != null&& candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
}
|
||||
candidate.Status = "waiver";
|
||||
// candidate.Status = "waiver";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -955,9 +1018,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + periodExam.Name;
|
||||
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: สละสิทธิ์สอบ";
|
||||
if (candidate.Email != null) _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
// if (candidate.Email != null&& candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
|
||||
}
|
||||
candidate.Status = "waiver";
|
||||
// candidate.Status = "waiver";
|
||||
}
|
||||
periodExam.SetSeat = true;
|
||||
}
|
||||
|
|
@ -999,32 +1062,38 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
summarySheet.TabColor = System.Drawing.Color.Black;
|
||||
// summarySheet.DefaultRowHeight = 17;
|
||||
summarySheet.Row(1).Style.Font.Bold = true;
|
||||
summarySheet.Cells[1, 1].Value = "ลำดับที่สอบได้";
|
||||
summarySheet.Cells[1, 2].Value = "เลขบัตรประชาชน";
|
||||
summarySheet.Cells[1, 3].Value = "เลขประจำตัวสอบ";
|
||||
summarySheet.Cells[1, 4].Value = "เลขที่นั่งสอบ";
|
||||
summarySheet.Cells[1, 5].Value = "คะแนนเต็มภาค ข";
|
||||
summarySheet.Cells[1, 6].Value = "คะแนนภาค ข";
|
||||
summarySheet.Cells[1, 7].Value = "ผลสอบภาค ข";
|
||||
summarySheet.Cells[1, 8].Value = "คะแนนเต็มภาค ค";
|
||||
summarySheet.Cells[1, 9].Value = "คะแนนภาค ค";
|
||||
summarySheet.Cells[1, 10].Value = "ผลสอบภาค ค";
|
||||
summarySheet.Cells[1, 11].Value = "ผลการสอบ";
|
||||
summarySheet.Cells[1, 1].Value = "ชำระค่าธรรมเนียม";
|
||||
summarySheet.Cells[1, 2].Value = "วันเวลาชำระ";
|
||||
summarySheet.Cells[1, 3].Value = "วันและเวลาที่สมัคร";
|
||||
summarySheet.Cells[1, 4].Value = "ลำดับที่สอบได้";
|
||||
summarySheet.Cells[1, 5].Value = "เลขบัตรประชาชน";
|
||||
summarySheet.Cells[1, 6].Value = "เลขประจำตัวสอบ";
|
||||
summarySheet.Cells[1, 7].Value = "เลขที่นั่งสอบ";
|
||||
summarySheet.Cells[1, 8].Value = "คะแนนเต็มภาค ข";
|
||||
summarySheet.Cells[1, 9].Value = "คะแนนภาค ข";
|
||||
summarySheet.Cells[1, 10].Value = "ผลสอบภาค ข";
|
||||
summarySheet.Cells[1, 11].Value = "คะแนนเต็มภาค ค";
|
||||
summarySheet.Cells[1, 12].Value = "คะแนนภาค ค";
|
||||
summarySheet.Cells[1, 13].Value = "ผลสอบภาค ค";
|
||||
summarySheet.Cells[1, 14].Value = "ผลการสอบ";
|
||||
int row = 2;
|
||||
|
||||
foreach (var item in candidates)
|
||||
{
|
||||
summarySheet.Cells[row, 1].Value = item.Number;
|
||||
summarySheet.Cells[row, 2].Value = item.CitizenId;
|
||||
summarySheet.Cells[row, 3].Value = item.ExamIdenNumber;
|
||||
summarySheet.Cells[row, 4].Value = item.SeatNumber;
|
||||
summarySheet.Cells[row, 5].Value = item.PointTotalB;
|
||||
summarySheet.Cells[row, 6].Value = item.PointB;
|
||||
summarySheet.Cells[row, 7].Value = item.ResultB;
|
||||
summarySheet.Cells[row, 8].Value = item.PointTotalC;
|
||||
summarySheet.Cells[row, 9].Value = item.PointC;
|
||||
summarySheet.Cells[row, 10].Value = item.ResultC;
|
||||
summarySheet.Cells[row, 11].Value = item.Pass;
|
||||
summarySheet.Cells[row, 1].Value = item.PaymentDate == null ? "ยังไม่ชำระเงิน" : "ชำระแล้ว";
|
||||
summarySheet.Cells[row, 2].Value = item.PaymentDate == null ? "" : item.PaymentDate.Value.ToThaiShortDateTime();
|
||||
summarySheet.Cells[row, 3].Value = item.RegisterDate == null ? "" : item.RegisterDate.Value.ToThaiShortDateTime();
|
||||
summarySheet.Cells[row, 4].Value = item.Number;
|
||||
summarySheet.Cells[row, 5].Value = item.CitizenId;
|
||||
summarySheet.Cells[row, 6].Value = item.ExamIdenNumber;
|
||||
summarySheet.Cells[row, 7].Value = item.SeatNumber;
|
||||
summarySheet.Cells[row, 8].Value = item.PointTotalB;
|
||||
summarySheet.Cells[row, 9].Value = item.PointB;
|
||||
summarySheet.Cells[row, 10].Value = item.ResultB;
|
||||
summarySheet.Cells[row, 11].Value = item.PointTotalC;
|
||||
summarySheet.Cells[row, 12].Value = item.PointC;
|
||||
summarySheet.Cells[row, 13].Value = item.ResultC;
|
||||
summarySheet.Cells[row, 14].Value = item.Pass;
|
||||
row++;
|
||||
}
|
||||
summarySheet.Cells[summarySheet.Dimension.Address].AutoFitColumns();
|
||||
|
|
@ -1084,7 +1153,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
Id = 3,
|
||||
Name = "จำนวนผู้เข้ารับการคัดเลือกทั้งหมด",
|
||||
Count = periodExam.Candidate.Where(x=>x.PaymentImg!=null).Count()
|
||||
Count = periodExam.Candidate.Where(x=>x.SeatNumber != null).Count()
|
||||
},
|
||||
new DashboardResponseItem
|
||||
{
|
||||
|
|
@ -1167,7 +1236,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
OccupationDepartment = c.OccupationDepartment,
|
||||
OccupationEmail = c.OccupationEmail,
|
||||
OccupationTelephone = c.OccupationTelephone,
|
||||
|
||||
RegisterDate = c.RegisterDate,
|
||||
|
||||
Number = c.Number,
|
||||
ExamIdenNumber = c.ExamIdenNumber,
|
||||
|
|
@ -1243,6 +1312,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
summarySheet.Cells[1, 51].Value = "ผลสอบภาค ค";
|
||||
summarySheet.Cells[1, 52].Value = "ผลการสอบ";
|
||||
summarySheet.Cells[1, 53].Value = "วันที่สมัคร";
|
||||
summarySheet.Cells[1, 54].Value = "วันเและเวลาที่สมัคร";
|
||||
int row = 2;
|
||||
|
||||
foreach (var item in candidates)
|
||||
|
|
@ -1279,7 +1349,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
summarySheet.Cells[row, 22].Value = item.MarryFullName;
|
||||
summarySheet.Cells[row, 23].Value = item.FatherFullName;
|
||||
summarySheet.Cells[row, 24].Value = item.MotherFullName;
|
||||
summarySheet.Cells[row, 25].Value = GenerateStatusOccupation(item.OccupationType);
|
||||
summarySheet.Cells[row, 25].Value = item.OccupationType == null ? null : GenerateStatusOccupation(item.OccupationType);
|
||||
summarySheet.Cells[row, 26].Value = item.OccupationPosition;
|
||||
summarySheet.Cells[row, 27].Value = item.OccupationCompany;
|
||||
summarySheet.Cells[row, 28].Value = item.OccupationDepartment;
|
||||
|
|
@ -1302,6 +1372,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
summarySheet.Cells[row, 51].Value = item.ResultC;
|
||||
summarySheet.Cells[row, 52].Value = item.Pass;
|
||||
summarySheet.Cells[row, 53].Value = item.CreatedAt.Date.ToThaiShortDate();
|
||||
summarySheet.Cells[row, 54].Value = item.RegisterDate;
|
||||
row++;
|
||||
}
|
||||
var careers = await _context.Careers
|
||||
|
|
@ -1336,7 +1407,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
summarySheet.Cells[row, 22].Value = item.MarryFullName;
|
||||
summarySheet.Cells[row, 23].Value = item.FatherFullName;
|
||||
summarySheet.Cells[row, 24].Value = item.MotherFullName;
|
||||
summarySheet.Cells[row, 25].Value = GenerateStatusOccupation(item.OccupationType);
|
||||
summarySheet.Cells[row, 25].Value = item.OccupationType == null ? null : GenerateStatusOccupation(item.OccupationType);
|
||||
summarySheet.Cells[row, 26].Value = item.OccupationPosition;
|
||||
summarySheet.Cells[row, 27].Value = item.OccupationCompany;
|
||||
summarySheet.Cells[row, 28].Value = item.OccupationDepartment;
|
||||
|
|
@ -1359,6 +1430,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
summarySheet.Cells[row, 51].Value = item.ResultC;
|
||||
summarySheet.Cells[row, 52].Value = item.Pass;
|
||||
summarySheet.Cells[row, 53].Value = item.CreatedAt.Date.ToThaiShortDate();
|
||||
summarySheet.Cells[row, 54].Value = item.RegisterDate;
|
||||
row++;
|
||||
}
|
||||
if (educations.Count() == 0 && careers.Count() == 0)
|
||||
|
|
@ -1387,7 +1459,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
summarySheet.Cells[row, 22].Value = item.MarryFullName;
|
||||
summarySheet.Cells[row, 23].Value = item.FatherFullName;
|
||||
summarySheet.Cells[row, 24].Value = item.MotherFullName;
|
||||
summarySheet.Cells[row, 25].Value = GenerateStatusOccupation(item.OccupationType);
|
||||
summarySheet.Cells[row, 25].Value = item.OccupationType == null ? null : GenerateStatusOccupation(item.OccupationType);
|
||||
summarySheet.Cells[row, 26].Value = item.OccupationPosition;
|
||||
summarySheet.Cells[row, 27].Value = item.OccupationCompany;
|
||||
summarySheet.Cells[row, 28].Value = item.OccupationDepartment;
|
||||
|
|
@ -1405,6 +1477,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
summarySheet.Cells[row, 51].Value = item.ResultC;
|
||||
summarySheet.Cells[row, 52].Value = item.Pass;
|
||||
summarySheet.Cells[row, 53].Value = item.CreatedAt.Date.ToThaiShortDate();
|
||||
summarySheet.Cells[row, 54].Value = item.RegisterDate;
|
||||
row++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1580,6 +1653,54 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
stream.Position = 0;
|
||||
return stream;
|
||||
}
|
||||
|
||||
public async Task<MemoryStream> DownloadCandidatePaymentAllAsync(string examId)
|
||||
{
|
||||
var periodExam = await _context.PeriodExams.AsQueryable()
|
||||
.Where(x => x.CheckDisability == false)
|
||||
.FirstOrDefaultAsync(x => x.Id == Guid.Parse(examId));
|
||||
|
||||
if (periodExam == null)
|
||||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
var candidates = await _context.Candidates
|
||||
.AsQueryable()
|
||||
.Where(x => x.PeriodExam == periodExam)
|
||||
.Select(c => new
|
||||
{
|
||||
CitizenId = c.CitizenId,
|
||||
FullName = $"{c.PrefixName}{c.FirstName} {c.LastName}",
|
||||
PaymentDate = c.PaymentDate,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var stream = new MemoryStream();
|
||||
using (var package = new ExcelPackage(stream))
|
||||
{
|
||||
var summarySheet = package.Workbook.Worksheets.Add("Payment");
|
||||
summarySheet.TabColor = System.Drawing.Color.Black;
|
||||
summarySheet.Row(1).Style.Font.Bold = true;
|
||||
summarySheet.Cells[1, 1].Value = "เลขบัตรประชาชน";
|
||||
summarySheet.Cells[1, 2].Value = "ชื่อ-สกุล";
|
||||
summarySheet.Cells[1, 3].Value = "ชำระค่าธรรมเนียม";
|
||||
summarySheet.Cells[1, 4].Value = "วันเวลาชำระ";
|
||||
int row = 2;
|
||||
|
||||
foreach (var item in candidates)
|
||||
{
|
||||
summarySheet.Cells[row, 1].Value = item.CitizenId;
|
||||
summarySheet.Cells[row, 2].Value = item.FullName;
|
||||
summarySheet.Cells[row, 3].Value = item.PaymentDate == null ? "ยังไม่ชำระเงิน" : "ชำระแล้ว";
|
||||
summarySheet.Cells[row, 4].Value = item.PaymentDate == null ? "" : item.PaymentDate.Value;
|
||||
row++;
|
||||
}
|
||||
summarySheet.Cells[summarySheet.Dimension.Address].AutoFitColumns();
|
||||
package.Save();
|
||||
}
|
||||
|
||||
stream.Position = 0;
|
||||
return stream;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue