pdf ใบสมัครสอบ
This commit is contained in:
parent
86a9e90b7a
commit
98b6cc0275
15 changed files with 710 additions and 68 deletions
|
|
@ -5,6 +5,7 @@ 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.ModelsExam.Candidate;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
|
@ -45,65 +46,102 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
#region ใบสมัครสอบ
|
||||
public async Task<dynamic> GetExamCandidateAsync(Guid id)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
|
||||
var data = await _dbContext.Set<Candidate>().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,
|
||||
ExamIdenNumber = p.ExamIdenNumber,
|
||||
PositionName = p.PositionExam == null ? "" : p.PositionExam.PositionName,
|
||||
PeriodExamName = p.PeriodExam == null ? "" : p.PeriodExam.Name,
|
||||
PeriodExamRound = p.PeriodExam == null ? "" : p.PeriodExam.Round.ToString(),
|
||||
PeriodExamYear = p.PeriodExam == null ? "" : p.PeriodExam.Year.ToString(),
|
||||
|
||||
FullName = $"{p.PrefixName}{p.FirstName} {p.LastName}",
|
||||
Religion = p.ReligionName,
|
||||
Nationality = p.Nationality,
|
||||
DateOfBirth = p.DateOfBirth == null ? "" : p.DateOfBirth.Value.ToThaiShortDate2(),
|
||||
Age = p.DateOfBirth == null ? "" : p.DateOfBirth.Value.CalculateAgeStrV2(0, 0),
|
||||
CitizenId = p.CitizenId,
|
||||
|
||||
EducationLevelExamName = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationLevelExamName,
|
||||
EducationName = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationName,
|
||||
EducationMajor = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationMajor,
|
||||
EducationLocation = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationLocation,
|
||||
EducationEndDate = p.Educations.FirstOrDefault() == null || p.Educations.FirstOrDefault().EducationEndDate == null ? "" : p.Educations.FirstOrDefault().EducationEndDate.Value.ToThaiShortDate2(),
|
||||
EducationScores = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationScores,
|
||||
EducationType = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationType,
|
||||
EducationLevelHighName = p.Educations.FirstOrDefault() == null ? "" : p.Educations.FirstOrDefault().EducationLevelHighName,
|
||||
|
||||
OccupationPositionType = p.OccupationPositionType == "other" ? "ผู้ปฏิบัติงานอื่นในกรุงเทพมหานคร" : (p.OccupationPositionType == "temp" ? "ลูกจ้างชั่วคราว" : (p.OccupationPositionType == "perm" ? "ลูกจ้างประจำ" : "-")),
|
||||
OccupationPosition = p.OccupationPosition,
|
||||
OccupationSalary = p.OccupationSalary,
|
||||
OccupationGroup = p.OccupationGroup,
|
||||
OccupationPile = p.OccupationPile,
|
||||
OccupationOrg = p.OccupationOrg,
|
||||
OccupationTelephone = p.OccupationTelephone,
|
||||
|
||||
Careers = p.Careers.Select(y => new
|
||||
{
|
||||
Position = y.Position,
|
||||
Type = y.Type,
|
||||
DurationStart = y.DurationStart.ToThaiShortDate2(),
|
||||
DurationEnd = y.DurationEnd.ToThaiShortDate2(),
|
||||
RangeDate = y.RangeDate,
|
||||
}),
|
||||
|
||||
RegistAddress = p.RegistAddress,
|
||||
RegistProvinceName = p.RegistProvinceName,
|
||||
RegistDistrictName = p.RegistDistrictName,
|
||||
RegistSubDistrictName = p.RegistSubDistrictName,
|
||||
RegistZipCode = p.RegistZipCode,
|
||||
CurrentAddress = p.CurrentAddress,
|
||||
CurrentProvinceName = p.CurrentProvinceName,
|
||||
CurrentSubDistrictName = p.CurrentSubDistrictName,
|
||||
CurrentDistrictName = p.CurrentDistrictName,
|
||||
CurrentZipCode = p.CurrentZipCode,
|
||||
Telephone = p.Telephone,
|
||||
Email = p.Email,
|
||||
|
||||
ContactFullName = $"{p.ContactPrefixName}{p.ContactFirstname} {p.ContactLastname}",
|
||||
ContactRelations = p.ContactRelations,
|
||||
ContactTel = p.ContactTel,
|
||||
|
||||
RegisterDate = p.RegisterDate == null ? "" : p.RegisterDate.Value.ToThaiFullDate(),
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.CandidateNotFound);
|
||||
return data;
|
||||
|
||||
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,
|
||||
};
|
||||
// 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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue