รูปสอบคัดเลือก

This commit is contained in:
Kittapath 2023-10-09 12:58:45 +07:00
parent 4e90ffadb2
commit b950dde304
6 changed files with 37 additions and 3 deletions

View file

@ -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

View file

@ -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; }

View file

@ -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

View file

@ -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()
{