รูปสอบคัดเลือก
This commit is contained in:
parent
4e90ffadb2
commit
b950dde304
6 changed files with 37 additions and 3 deletions
|
|
@ -136,6 +136,21 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<dynamic> GetExamAvatarCandidateAsync(Guid id)
|
||||
{
|
||||
var data = await _dbExamContext.Set<Candidate>().AsQueryable()
|
||||
.Where(x => x.Id == id)
|
||||
.Select(p => new
|
||||
{
|
||||
AvatarId = p.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ProfileImg.Id,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.CandidateNotFound);
|
||||
return data.AvatarId;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -78,10 +78,10 @@ namespace BMA.EHR.Domain.ModelsExam.Candidate
|
|||
public string? ResultC { get; set; }
|
||||
|
||||
[Comment("Id รูปโปรไฟล์")]
|
||||
public virtual Document? ProfileImg { get; set; }
|
||||
public Document? ProfileImg { get; set; }
|
||||
|
||||
[Comment("Id หลักฐานชำระเงิน")]
|
||||
public virtual Document? PaymentImg { get; set; }
|
||||
public Document? PaymentImg { get; set; }
|
||||
|
||||
[Comment("ลำดับที่สอบได้")]
|
||||
public string? Number { get; set; }
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ namespace BMA.EHR.Infrastructure.Persistence
|
|||
public DbSet<Education> Educations { get; set; }
|
||||
public DbSet<PeriodExam> PeriodExams { get; set; }
|
||||
public DbSet<PositionExam> PositionExams { get; set; }
|
||||
public DbSet<Document> Documents { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ using Microsoft.AspNetCore.Authorization;
|
|||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Telerik.Reporting;
|
||||
using Telerik.Reporting.Processing;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using System.Drawing;
|
||||
|
||||
namespace BMA.EHR.Report.Service.Controllers
|
||||
{
|
||||
|
|
@ -20,12 +22,15 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
private readonly CandidateReportRepository _service;
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly MinIOService _minIOService;
|
||||
|
||||
public CandidateReportController(CandidateReportRepository service, IWebHostEnvironment hostingEnvironment, IConfiguration configuration)
|
||||
public CandidateReportController(CandidateReportRepository service, IWebHostEnvironment hostingEnvironment,
|
||||
MinIOService minIOService, IConfiguration configuration)
|
||||
{
|
||||
_service = service;
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_configuration = configuration;
|
||||
_minIOService = minIOService;
|
||||
}
|
||||
|
||||
#region ใบสมัคร
|
||||
|
|
@ -43,6 +48,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
{
|
||||
var candidate = await _service.GetExamCandidateAsync(Id);
|
||||
var careers = await _service.GetExamCareerCandidateAsync(Id);
|
||||
var avatar = await _service.GetExamAvatarCandidateAsync(Id);
|
||||
if (candidate != null)
|
||||
{
|
||||
var mimeType = "";
|
||||
|
|
@ -65,6 +71,18 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
||||
tblData.DataSource = careers;
|
||||
|
||||
if (avatar != Guid.Parse("00000000-0000-0000-0000-000000000000"))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Get avatar Image
|
||||
var picContent = (await _minIOService.DownloadFileAsync(avatar)).FileContent;
|
||||
var pictureBox = (Telerik.Reporting.PictureBox)report.Items["detailSection1"].Items["picAvatar"];
|
||||
pictureBox.Value = Image.FromStream(new MemoryStream(picContent));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue