เพิ่มบิ้วไฟล์excel
This commit is contained in:
parent
4b7715cc8a
commit
bd695abf24
8 changed files with 3127 additions and 332 deletions
|
|
@ -112,6 +112,22 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
return sb.ToString();
|
||||
}
|
||||
|
||||
private int GetExamCountTe(string citizenId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var count = _context.Candidates.AsQueryable()
|
||||
.Where(x => x.CitizenId == citizenId)
|
||||
.Count();
|
||||
|
||||
return count;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<int> GetExamCount(Guid exam)
|
||||
{
|
||||
try
|
||||
|
|
@ -358,71 +374,71 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
// .ThenInclude(x => x.Documents)
|
||||
// .ThenInclude(x => x.DocumentFile)
|
||||
// .FirstOrDefaultAsync(x => x.Id == id);
|
||||
var periodExam = await _context.PeriodExams.AsQueryable()
|
||||
.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,
|
||||
// BankExam = x.BankExam.OrderBy(o => o.CreatedAt).Select(b => new BankExam
|
||||
// {
|
||||
// Id = b.Id,
|
||||
// AccountName = b.AccountName,
|
||||
// AccountNumber = b.AccountNumber,
|
||||
// BankName = b.BankName,
|
||||
// }).ToList(),
|
||||
// PositionExam = x.PositionExam.OrderBy(o => o.CreatedAt).Select(b => new PositionExam
|
||||
// {
|
||||
// Id = b.Id,
|
||||
// TypeId = b.TypeId,
|
||||
// TypeName = b.TypeName,
|
||||
// PositionId = b.PositionId,
|
||||
// PositionName = b.PositionName,
|
||||
// }).ToList(),
|
||||
Documents = x.PeriodExamDocuments.OrderBy(o => o.CreatedAt).Select(b => new FileListResponse
|
||||
var periodExam = await _context.PeriodExams.AsQueryable()
|
||||
.Select(x => new PeriodExamCandidateResponseItem
|
||||
{
|
||||
Id = b.Document == null ? "" : b.Document.Id.ToString(),
|
||||
FileName = b.Document == null ? "" : b.Document.FileName,
|
||||
FileSize = b.Document == null ? 0 : b.Document.FileSize,
|
||||
FileType = b.Document == null ? "" : b.Document.FileType,
|
||||
Detail = b.Document == null ? "" : b.Document.Id.ToString(),
|
||||
}).ToList(),
|
||||
Images = x.PeriodExamImages.OrderBy(o => o.CreatedAt).Select(b => new FileListResponse
|
||||
{
|
||||
Id = b.Document == null ? "" : b.Document.Id.ToString(),
|
||||
FileName = b.Document == null ? "" : b.Document.FileName,
|
||||
FileSize = b.Document == null ? 0 : b.Document.FileSize,
|
||||
FileType = b.Document == null ? "" : b.Document.FileType,
|
||||
Detail = b.Document == null ? "" : b.Document.Id.ToString(),
|
||||
}).ToList(),
|
||||
})
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
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,
|
||||
// BankExam = x.BankExam.OrderBy(o => o.CreatedAt).Select(b => new BankExam
|
||||
// {
|
||||
// Id = b.Id,
|
||||
// AccountName = b.AccountName,
|
||||
// AccountNumber = b.AccountNumber,
|
||||
// BankName = b.BankName,
|
||||
// }).ToList(),
|
||||
// PositionExam = x.PositionExam.OrderBy(o => o.CreatedAt).Select(b => new PositionExam
|
||||
// {
|
||||
// Id = b.Id,
|
||||
// TypeId = b.TypeId,
|
||||
// TypeName = b.TypeName,
|
||||
// PositionId = b.PositionId,
|
||||
// PositionName = b.PositionName,
|
||||
// }).ToList(),
|
||||
Documents = x.PeriodExamDocuments.OrderBy(o => o.CreatedAt).Select(b => new FileListResponse
|
||||
{
|
||||
Id = b.Document == null ? "" : b.Document.Id.ToString(),
|
||||
FileName = b.Document == null ? "" : b.Document.FileName,
|
||||
FileSize = b.Document == null ? 0 : b.Document.FileSize,
|
||||
FileType = b.Document == null ? "" : b.Document.FileType,
|
||||
Detail = b.Document == null ? "" : b.Document.Id.ToString(),
|
||||
}).ToList(),
|
||||
Images = x.PeriodExamImages.OrderBy(o => o.CreatedAt).Select(b => new FileListResponse
|
||||
{
|
||||
Id = b.Document == null ? "" : b.Document.Id.ToString(),
|
||||
FileName = b.Document == null ? "" : b.Document.FileName,
|
||||
FileSize = b.Document == null ? 0 : b.Document.FileSize,
|
||||
FileType = b.Document == null ? "" : b.Document.FileType,
|
||||
Detail = b.Document == null ? "" : b.Document.Id.ToString(),
|
||||
}).ToList(),
|
||||
})
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
if (periodExam == null)
|
||||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
if (periodExam == null)
|
||||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
return Success(periodExam);
|
||||
}
|
||||
|
|
@ -1601,7 +1617,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
ExamYear = p.PeriodExam.Year == null ? 0 : p.PeriodExam.Year.Value.ToThaiYear(),
|
||||
Score = sr == null ? 0 : sr.SumA + sr.SumB + sr.SumC,
|
||||
Number = sr == null ? "" : sr.Number,
|
||||
ExamCount = _disableService.GetExamCount(p.CitizenId),
|
||||
CitizenId = p.CitizenId,
|
||||
ExamCount = 0,
|
||||
ScoreExpire = p.PeriodExam.AnnouncementDate == null ? "" : p.PeriodExam.AnnouncementDate.AddYears(2).ToThaiShortDate(),
|
||||
ScoreResult = sr == null ? null : new
|
||||
{
|
||||
|
|
@ -1623,7 +1640,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
})
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return Success(data);
|
||||
return Success(new { data, ExamCount = data == null || data.CitizenId == "" ? 0 : GetExamCountTe(data.CitizenId) });
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue