แก้ไฟล์ deploy

This commit is contained in:
Kittapath 2023-05-02 03:57:51 +07:00
parent 4b07fe7409
commit a95a36e454
4 changed files with 403 additions and 342 deletions

View file

@ -10,6 +10,7 @@ using BMA.EHR.Recurit.Exam.Service.Request.Disables;
using BMA.EHR.Recurit.Exam.Service.Response;
using BMA.EHR.Recurit.Exam.Service.Responses;
using BMA.EHR.Recurit.Exam.Service.Services;
using BMA.EHR.Recurit.Exam.Service.Responses.Document;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
@ -340,25 +341,90 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
{
try
{
var data = await _context.PeriodExams.AsQueryable()
.Where(x => x.CheckDisability == true)
.Include(x => x.ImportFile)
.Include(x => x.Disables)
.ThenInclude(x => x.Addresses)
.Include(x => x.Disables)
.ThenInclude(x => x.Occupations)
.Include(x => x.Disables)
.ThenInclude(x => x.Certificates)
.Include(x => x.Disables)
.ThenInclude(x => x.Educations)
.Include(x => x.Disables)
.ThenInclude(x => x.Payments)
.Include(x => x.Disables)
.ThenInclude(x => x.Documents)
.ThenInclude(x => x.DocumentFile)
.FirstOrDefaultAsync(x => x.Id == id);
// var data = await _context.PeriodExams.AsQueryable()
// .Where(x => x.CheckDisability == true)
// .Include(x => x.ImportFile)
// .Include(x => x.Disables)
// .ThenInclude(x => x.Addresses)
// .Include(x => x.Disables)
// .ThenInclude(x => x.Occupations)
// .Include(x => x.Disables)
// .ThenInclude(x => x.Certificates)
// .Include(x => x.Disables)
// .ThenInclude(x => x.Educations)
// .Include(x => x.Disables)
// .ThenInclude(x => x.Payments)
// .Include(x => x.Disables)
// .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
{
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);
return Success(data);
if (periodExam == null)
throw new Exception(GlobalMessages.ExamNotFound);
return Success(periodExam);
}
catch (Exception ex)
{