report 1-4 เำิม่หมายเหตุแนวนอน
This commit is contained in:
parent
5530c2f9e4
commit
2da120f958
32 changed files with 51300 additions and 13 deletions
|
|
@ -0,0 +1,112 @@
|
|||
using System.Reflection.Metadata;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Responses;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Reports
|
||||
{
|
||||
public class CandidateReportRepository
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly IApplicationDBContext _dbContext;
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly OrganizationCommonRepository _organizationCommonRepository;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public CandidateReportRepository(IApplicationDBContext dbContext,
|
||||
MinIOService documentService,
|
||||
OrganizationCommonRepository organizationCommonRepository,
|
||||
IWebHostEnvironment hostEnvironment)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_hostingEnvironment = hostEnvironment;
|
||||
_organizationCommonRepository = organizationCommonRepository;
|
||||
_documentService = documentService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
#region ใบสมัครสอบ
|
||||
public async Task<dynamic> GetExamCandidateAsync(Guid id)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
|
||||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
ProfileId = p.Profile.Id,
|
||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
||||
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
|
||||
p.Profile.FirstName,
|
||||
p.Profile.LastName,
|
||||
Position = p.Profile.Position == null ? null : p.Profile.Position.Name,
|
||||
PositionId = p.Profile.Position == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Position.Id,
|
||||
PositionType = p.Profile.PositionType == null ? null : p.Profile.PositionType.Name,
|
||||
PositionTypeId = p.Profile.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionType.Id,
|
||||
p.Profile.PositionLine,
|
||||
p.Profile.PositionLineId,
|
||||
PositionLevel = p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name,
|
||||
PositionLevelId = p.Profile.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionLevel.Id,
|
||||
p.Profile.PositionExecutive,
|
||||
p.Profile.PositionExecutiveId,
|
||||
Organization = p.Profile.Oc,
|
||||
OrganizationId = p.Profile.OcId,
|
||||
p.Number,
|
||||
p.Date,
|
||||
p.Location,
|
||||
p.Reason,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.CandidateNotFound);
|
||||
|
||||
string Prefix = string.IsNullOrEmpty(data.Prefix.ToString()) ? string.Empty : data.Prefix.ToString();
|
||||
string FirstName = string.IsNullOrEmpty(data.FirstName.ToString()) ? string.Empty : data.FirstName.ToString();
|
||||
string LastName = string.IsNullOrEmpty(data.LastName.ToString()) ? string.Empty : data.LastName.ToString();
|
||||
string FullName = $"{Prefix} {FirstName} {LastName}";
|
||||
string Date = string.IsNullOrEmpty(data.Date.ToString()) ? "วันที่ - เดือน - พ.ศ. -" : DateTime.Parse(data.Date.ToString()).ToThaiFullDate().ToString().ToThaiNumber();
|
||||
string CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate().ToString().ToThaiNumber();
|
||||
return new
|
||||
{
|
||||
FullName,
|
||||
Date,
|
||||
CurrentDate,
|
||||
data.Position,
|
||||
data.PositionExecutive,
|
||||
data.PositionType,
|
||||
data.PositionLine,
|
||||
data.PositionLevel,
|
||||
data.Organization,
|
||||
data.PositionId,
|
||||
data.PositionExecutiveId,
|
||||
data.PositionTypeId,
|
||||
data.PositionLineId,
|
||||
data.PositionLevelId,
|
||||
data.OrganizationId,
|
||||
data.Number,
|
||||
data.Location,
|
||||
data.Reason,
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue