report ประวัติทำงาน
This commit is contained in:
parent
0043e86fa3
commit
4e90ffadb2
7 changed files with 46 additions and 34 deletions
|
|
@ -0,0 +1,14 @@
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Application.Common.Interfaces
|
||||||
|
{
|
||||||
|
public interface IApplicationDBExamContext
|
||||||
|
{
|
||||||
|
DbSet<T> Set<T>() where T : class;
|
||||||
|
|
||||||
|
void Attatch<T>(T entity) where T : class;
|
||||||
|
|
||||||
|
Task<int> SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -20,6 +20,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
#region " Fields "
|
#region " Fields "
|
||||||
|
|
||||||
private readonly IApplicationDBContext _dbContext;
|
private readonly IApplicationDBContext _dbContext;
|
||||||
|
private readonly IApplicationDBExamContext _dbExamContext;
|
||||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly OrganizationCommonRepository _organizationCommonRepository;
|
private readonly OrganizationCommonRepository _organizationCommonRepository;
|
||||||
|
|
@ -29,11 +30,13 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
#region " Constructor and Destructor "
|
#region " Constructor and Destructor "
|
||||||
|
|
||||||
public CandidateReportRepository(IApplicationDBContext dbContext,
|
public CandidateReportRepository(IApplicationDBContext dbContext,
|
||||||
MinIOService documentService,
|
IApplicationDBExamContext dbExamContext,
|
||||||
OrganizationCommonRepository organizationCommonRepository,
|
MinIOService documentService,
|
||||||
IWebHostEnvironment hostEnvironment)
|
OrganizationCommonRepository organizationCommonRepository,
|
||||||
|
IWebHostEnvironment hostEnvironment)
|
||||||
{
|
{
|
||||||
_dbContext = dbContext;
|
_dbContext = dbContext;
|
||||||
|
_dbExamContext = dbExamContext;
|
||||||
_hostingEnvironment = hostEnvironment;
|
_hostingEnvironment = hostEnvironment;
|
||||||
_organizationCommonRepository = organizationCommonRepository;
|
_organizationCommonRepository = organizationCommonRepository;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
|
|
@ -46,11 +49,12 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
#region ใบสมัครสอบ
|
#region ใบสมัครสอบ
|
||||||
public async Task<dynamic> GetExamCandidateAsync(Guid id)
|
public async Task<dynamic> GetExamCandidateAsync(Guid id)
|
||||||
{
|
{
|
||||||
var data = await _dbContext.Set<Candidate>().AsQueryable()
|
var data = await _dbExamContext.Set<Candidate>().AsQueryable()
|
||||||
.Where(x => x.Id == id)
|
.Where(x => x.Id == id)
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
|
AvatarId = p.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ProfileImg.Id,
|
||||||
ExamIdenNumber = p.ExamIdenNumber,
|
ExamIdenNumber = p.ExamIdenNumber,
|
||||||
PositionName = p.PositionExam == null ? "" : p.PositionExam.PositionName,
|
PositionName = p.PositionExam == null ? "" : p.PositionExam.PositionName,
|
||||||
PeriodExamName = p.PeriodExam == null ? "" : p.PeriodExam.Name,
|
PeriodExamName = p.PeriodExam == null ? "" : p.PeriodExam.Name,
|
||||||
|
|
@ -88,7 +92,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
DurationStart = y.DurationStart.ToThaiShortDate2(),
|
DurationStart = y.DurationStart.ToThaiShortDate2(),
|
||||||
DurationEnd = y.DurationEnd.ToThaiShortDate2(),
|
DurationEnd = y.DurationEnd.ToThaiShortDate2(),
|
||||||
RangeDate = y.RangeDate,
|
RangeDate = y.RangeDate,
|
||||||
}),
|
}).ToList(),
|
||||||
|
|
||||||
RegistAddress = p.RegistAddress,
|
RegistAddress = p.RegistAddress,
|
||||||
RegistProvinceName = p.RegistProvinceName,
|
RegistProvinceName = p.RegistProvinceName,
|
||||||
|
|
@ -114,34 +118,23 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
if (data == null)
|
if (data == null)
|
||||||
throw new Exception(GlobalMessages.CandidateNotFound);
|
throw new Exception(GlobalMessages.CandidateNotFound);
|
||||||
return data;
|
return data;
|
||||||
|
}
|
||||||
|
public async Task<dynamic> GetExamCareerCandidateAsync(Guid id)
|
||||||
|
{
|
||||||
|
var data = await _dbExamContext.Set<Career>().AsQueryable()
|
||||||
|
.Where(x => x.Candidate != null)
|
||||||
|
.Where(x => x.Candidate.Id == id)
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
Position = p.Position,
|
||||||
|
Type = p.Type,
|
||||||
|
DurationStart = p.DurationStart.ToThaiShortDate2(),
|
||||||
|
DurationEnd = p.DurationEnd.ToThaiShortDate2(),
|
||||||
|
RangeDate = p.RangeDate,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
// string Prefix = string.IsNullOrEmpty(data.Prefix.ToString()) ? string.Empty : data.Prefix.ToString();
|
return data;
|
||||||
// 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ namespace BMA.EHR.Infrastructure
|
||||||
}),
|
}),
|
||||||
ServiceLifetime.Transient);
|
ServiceLifetime.Transient);
|
||||||
|
|
||||||
services.AddScoped<IApplicationDBContext>(provider => provider.GetService<ApplicationDBExamContext>());
|
services.AddScoped<IApplicationDBExamContext>(provider => provider.GetService<ApplicationDBExamContext>());
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace BMA.EHR.Infrastructure.Persistence
|
namespace BMA.EHR.Infrastructure.Persistence
|
||||||
{
|
{
|
||||||
public class ApplicationDBExamContext : DbContext, IApplicationDBContext
|
public class ApplicationDBExamContext : DbContext, IApplicationDBExamContext
|
||||||
{
|
{
|
||||||
#region " From Existing Database "
|
#region " From Existing Database "
|
||||||
public DbSet<Candidate> Candidates { get; set; }
|
public DbSet<Candidate> Candidates { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> GetExamCandidate([FromRoute] Guid Id, string exportType = "pdf")
|
public async Task<ActionResult<ResponseObject>> GetExamCandidate([FromRoute] Guid Id, string exportType = "pdf")
|
||||||
{
|
{
|
||||||
var candidate = await _service.GetExamCandidateAsync(Id);
|
var candidate = await _service.GetExamCandidateAsync(Id);
|
||||||
|
var careers = await _service.GetExamCareerCandidateAsync(Id);
|
||||||
if (candidate != null)
|
if (candidate != null)
|
||||||
{
|
{
|
||||||
var mimeType = "";
|
var mimeType = "";
|
||||||
|
|
@ -60,6 +61,10 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
|
report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
|
||||||
}
|
}
|
||||||
report.DataSource = candidate;
|
report.DataSource = candidate;
|
||||||
|
|
||||||
|
var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
||||||
|
tblData.DataSource = careers;
|
||||||
|
|
||||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Binary file not shown.
BIN
BMA.EHR.Report.Service/Reports/ผลสอบคัดเลือกรายบุคคล.trdp.bak
Normal file
BIN
BMA.EHR.Report.Service/Reports/ผลสอบคัดเลือกรายบุคคล.trdp.bak
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue