diff --git a/BMA.EHR.Application/ApplicationServicesRegistration.cs b/BMA.EHR.Application/ApplicationServicesRegistration.cs index 9080623b..50db27f0 100644 --- a/BMA.EHR.Application/ApplicationServicesRegistration.cs +++ b/BMA.EHR.Application/ApplicationServicesRegistration.cs @@ -32,6 +32,7 @@ namespace BMA.EHR.Application services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); return services; } diff --git a/BMA.EHR.Application/Repositories/MinIOExamService.cs b/BMA.EHR.Application/Repositories/MinIOExamService.cs new file mode 100644 index 00000000..38ff70d8 --- /dev/null +++ b/BMA.EHR.Application/Repositories/MinIOExamService.cs @@ -0,0 +1,366 @@ +using Amazon.S3; +using Amazon.S3.Model; +using BMA.EHR.Domain.Models.Documents; +using BMA.EHR.Domain.Shared; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; +using System.Net.Http.Headers; +using BMA.EHR.Application.Common.Interfaces; +using Amazon; +using BMA.EHR.Domain.Models.Organizations; +using MimeTypes; +using Profile = BMA.EHR.Domain.Models.HR.Profile; + +namespace BMA.EHR.Application.Repositories +{ + public class MinIOExamService + { + #region " Fields " + + private readonly IApplicationDBExamContext _dbContext; + private readonly IConfiguration _configuration; + private readonly AmazonS3Client _s3Client; + private readonly IWebHostEnvironment _hostingEnvironment; + private string _bucketName = string.Empty; + + #endregion + + #region " Constructors " + + public MinIOExamService(IApplicationDBExamContext dbContext, + IConfiguration configuration, + IWebHostEnvironment hostingEnvironment) + { + _dbContext = dbContext; + _configuration = configuration; + _hostingEnvironment = hostingEnvironment; + + var config = new AmazonS3Config + { + ServiceURL = _configuration["MinIO:Endpoint"], + ForcePathStyle = true + }; + + _s3Client = new AmazonS3Client(_configuration["MinIO:AccessKey"], _configuration["MinIO:SecretKey"], config); + this._bucketName = _configuration["MinIO:BucketName"] ?? "bma-recruit"; + } + + #endregion + + #region " Methods " + + public async Task UploadFileAsync(IFormFile file, string newFileName = "") + { + var fileName = ""; + var fileExt = Path.GetExtension(file.FileName); + if (newFileName != "") + fileName = $"{newFileName}"; + else + fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"'); + + + var tmpDir = Path.Combine("tmp"); + if (!Directory.Exists(tmpDir)) + Directory.CreateDirectory(tmpDir); + + var tmpFile = Path.Combine(tmpDir, $"tmp_{DateTime.Now.ToString("ddMMyyyyHHmmss")}{fileExt}"); + + try + { + using (var ms = new MemoryStream()) + { + var id = Guid.NewGuid(); + file.CopyTo(ms); + var fileBytes = ms.ToArray(); + System.IO.MemoryStream filestream = new System.IO.MemoryStream(fileBytes); + + var request = new PutObjectRequest + { + BucketName = _bucketName, + Key = id.ToString("D"), + InputStream = filestream, + ContentType = file.ContentType, + CannedACL = S3CannedACL.PublicRead + }; + + await _s3Client.PutObjectAsync(request); + + // create document object + var doc = new Document() + { + FileName = fileName, + FileType = file.ContentType, + FileSize = Convert.ToInt32(file.Length), + ObjectRefId = id, + CreatedDate = DateTime.Now + }; + await _dbContext.Set().AddAsync(doc); + await _dbContext.SaveChangesAsync(); + + return doc; + } + } + catch + { + throw; + } + finally + { + File.Delete(tmpFile); + } + } + + public async Task DownloadFileAsync(Guid fileId) + { + try + { + var doc = await _dbContext.Set().AsQueryable() + .FirstOrDefaultAsync(x => x.Id == fileId); + + if (doc == null) + throw new Exception(GlobalMessages.FileNotFoundOnServer); + + using (var memoryStream = new MemoryStream()) + { + GetObjectRequest request = new GetObjectRequest + { + BucketName = _bucketName, + Key = doc.ObjectRefId.ToString("D") + }; + + using (GetObjectResponse response = await _s3Client.GetObjectAsync(request)) + { + using (Stream responseStream = response.ResponseStream) + { + responseStream.CopyTo(memoryStream); + } + } + + var fileContent = memoryStream.ToArray(); + + return new FileDownloadResponse + { + FileName = doc.FileName, + FileType = doc.FileType, + FileContent = fileContent + }; + }; + } + catch + { + throw; + } + } + + public async Task DeleteFileAsync(Guid fileId) + { + try + { + var doc = await _dbContext.Set().AsQueryable() + .FirstOrDefaultAsync(x => x.Id == fileId); + + if (doc == null) + throw new Exception(GlobalMessages.FileNotFoundOnServer); + else + { + DeleteObjectRequest request = new DeleteObjectRequest + { + BucketName = _bucketName, + Key = doc?.ObjectRefId.ToString("D") + }; + + // delete from minio + await _s3Client.DeleteObjectAsync(request); + + _dbContext.Set().Remove(doc); + await _dbContext.SaveChangesAsync(); + } + } + catch + { + throw; + } + } + + public async Task ImagesPath(Guid? fileId) + { + if (fileId == null) + return ""; + + var doc = await _dbContext.Set().AsQueryable() + .FirstOrDefaultAsync(x => x.Id == fileId); + + if (doc == null) + throw new Exception(GlobalMessages.FileNotFoundOnServer); + var config = new AmazonS3Config + { + ServiceURL = _configuration["MinIO:Endpoint"], + ForcePathStyle = true + }; + + DateTime expires = DateTime.UtcNow.AddHours(6); + var _protocol = _configuration["Protocol"]; + GetPreSignedUrlRequest request = new GetPreSignedUrlRequest + { + BucketName = _bucketName, + Key = doc?.ObjectRefId.ToString("D"), + Expires = expires, + Protocol = _protocol == "HTTPS" ? Protocol.HTTPS : Protocol.HTTP + }; + string path = _s3Client.GetPreSignedURL(request); + + return path; + } + + public async Task ImagesPathByName(string fileName) + { + var config = new AmazonS3Config + { + ServiceURL = _configuration["MinIO:Endpoint"], + ForcePathStyle = true + }; + + DateTime expires = DateTime.UtcNow.AddHours(6); + var _protocol = _configuration["Protocol"]; + GetPreSignedUrlRequest request = new GetPreSignedUrlRequest + { + BucketName = _bucketName, + Key = fileName, + Expires = expires, + Protocol = _protocol == "HTTPS" ? Protocol.HTTPS : Protocol.HTTP + }; + string path = _s3Client.GetPreSignedURL(request); + + return path; + } + + #endregion + + public List GetAllIdByRoot(Guid? id) + { + try + { + var ret = new List(); + if (id == null) + return ret; + + var oc = _dbContext.Set().FirstOrDefault(x => x.Id == id); + if (oc != null) + ret.Add(oc.Id); + + var child = _dbContext.Set().AsQueryable().Where(x => x.Parent != null && x.Parent.Id == id).ToList(); + if (child.Any()) + { + foreach (var item in child) + { + ret.AddRange(GetAllIdByRoot(item.Id)); + } + } + + return ret; + } + catch + { + throw; + } + } + + public async Task CheckBmaOfficer(string CitizenId) + { + var data = await _dbContext.Set().FirstOrDefaultAsync(x => x.CitizenId == CitizenId); + if (data == null) + return null; + if (data.ProfileType.Trim().ToUpper() == "OFFICER") + return "OFFICER"; + if (data.EmployeeClass.Trim().ToUpper() == "PERM") + return "EMPLOYEE_PERM"; + if (data.EmployeeClass.Trim().ToUpper() == "TEMP") + return "EMPLOYEE_TEMP"; + return "EMPLOYEE"; + } + + public async Task UploadFileAsyncTemp(string fileName, string subFolder) + { + try + { + var fileContents = File.ReadAllBytes(fileName); + System.IO.MemoryStream filestream = new System.IO.MemoryStream(fileContents); + //var fileNameWithoutExt = Path.GetFileNameWithoutExtension(fileName); + var fileExt = Path.GetExtension(fileName); + var fileType = MimeTypeMap.GetMimeType(fileExt); + var file_name = Path.GetFileName(fileName); + Console.WriteLine($"{_bucketName}{subFolder}"); + Console.WriteLine(fileName); + Console.WriteLine(file_name); + Console.WriteLine(filestream); + Console.WriteLine(fileType); + + var request = new PutObjectRequest + { + BucketName = $"{_bucketName}", + // BucketName = $"{_bucketName}{subFolder}", + Key = file_name, + InputStream = filestream, + ContentType = fileType, + CannedACL = S3CannedACL.PublicRead + }; + + await _s3Client.PutObjectAsync(request); + } + catch + { + throw; + } + } + + public async Task GenerateJsonFile(string json, string path, string fileName) + { + var tmpDir = Path.Combine("tmp"); + if (!Directory.Exists(tmpDir)) + Directory.CreateDirectory(tmpDir); + + var tmpFile = Path.Combine(tmpDir, $"{fileName}.json"); + + try + { + SaveToJsonFile(tmpFile, json); + await UploadFileAsyncTemp(tmpFile, path); + } + catch + { + throw; + } + finally + { + if (tmpFile != "") + { + if (System.IO.File.Exists(tmpFile)) + System.IO.File.Delete(tmpFile); + } + + } + } + + private void SaveToJsonFile(string fileName, string data) + { + TextWriter writer = null; + try + { + writer = new StreamWriter(fileName); + writer.Write(data); + } + catch + { + throw; + } + finally + { + if (writer != null) + writer.Close(); + } + } + + } +} \ No newline at end of file diff --git a/BMA.EHR.Application/Repositories/Reports/CandidateReportRepository.cs b/BMA.EHR.Application/Repositories/Reports/CandidateReportRepository.cs index fba0d7ca..2cb94e82 100644 --- a/BMA.EHR.Application/Repositories/Reports/CandidateReportRepository.cs +++ b/BMA.EHR.Application/Repositories/Reports/CandidateReportRepository.cs @@ -59,28 +59,37 @@ namespace BMA.EHR.Application.Repositories.Reports var monthDiff = 0; var dayDiff = 0; var sb = new StringBuilder(); - // foreach (var career in careers) - // { - // var rangeObj = career.DurationStart.CalculateBetweenDateV2Value(career.DurationEnd); - // yearDiff = yearDiff + rangeObj.years; - // monthDiff = monthDiff + rangeObj.months; - // dayDiff = dayDiff + rangeObj.days; - // if (dayDiff >= 30) - // { - // monthDiff = monthDiff + (int)(dayDiff / 30); - // dayDiff = dayDiff % 30; - // } - // if (monthDiff >= 12) - // { - // yearDiff = yearDiff + (int)(monthDiff / 12); - // monthDiff = monthDiff % 12; - // } - // sb.Clear(); - // sb.Append(yearDiff == 0 ? "" : $"{yearDiff} ปี "); - // sb.Append(monthDiff == 0 ? "" : $"{monthDiff} เดือน "); - // sb.Append(dayDiff == 0 ? "" : $"{dayDiff} วัน "); - // sb.ToString(); - // } + foreach (var career in careers) + { + if (career.DurationEnd < career.DurationStart) + { + var rangeObj = career.DurationEnd.CalculateBetweenDateV2Value(career.DurationStart); + yearDiff = yearDiff + rangeObj.years; + monthDiff = monthDiff + rangeObj.months; + dayDiff = dayDiff + rangeObj.days; + } + else + { + var rangeObj = career.DurationStart.CalculateBetweenDateV2Value(career.DurationEnd); + yearDiff = yearDiff + rangeObj.years; + monthDiff = monthDiff + rangeObj.months; + dayDiff = dayDiff + rangeObj.days; + } + if (dayDiff >= 30) + { + monthDiff = monthDiff + (int)(dayDiff / 30); + dayDiff = dayDiff % 30; + } + if (monthDiff >= 12) + { + yearDiff = yearDiff + (int)(monthDiff / 12); + monthDiff = monthDiff % 12; + } + sb.Clear(); + sb.Append(yearDiff == 0 ? "" : $"{yearDiff} ปี "); + sb.Append(monthDiff == 0 ? "" : $"{monthDiff} เดือน "); + sb.Append(dayDiff == 0 ? "" : $"{dayDiff} วัน "); + } var data = await _dbExamContext.Set().AsQueryable() .Where(x => x.Id == id) @@ -88,64 +97,65 @@ namespace BMA.EHR.Application.Repositories.Reports { p.Id, AvatarId = p.ProfileImg == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.ProfileImg.Id, - 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(), + ExamIdenNumber = p.ExamIdenNumber == null ? "-" : p.ExamIdenNumber, + PositionName = p.PositionExam == null ? "-" : p.PositionExam.PositionName, + PositionLevelName = p.PositionExam == null ? "-" : p.PositionExam.PositionLevelName, + 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, + Religion = p.ReligionName == null ? "-" : p.ReligionName, + Nationality = p.Nationality == null ? "-" : p.Nationality, + DateOfBirth = p.DateOfBirth == null ? "-" : p.DateOfBirth.Value.ToThaiFullDate2(), + Age = p.DateOfBirth == null ? "-" : p.DateOfBirth.Value.CalculateAgeStrV2(0, 0), + CitizenId = p.CitizenId == null ? "-" : 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, + 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.ToThaiFullDate2(), + 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, + OccupationPosition = p.OccupationPosition == null ? "-" : p.OccupationPosition, + OccupationSalary = p.OccupationSalary == null ? "-" : p.OccupationSalary.ToString(), + OccupationGroup = p.OccupationGroup == null ? "-" : p.OccupationGroup, + OccupationPile = p.OccupationPile == null ? "-" : p.OccupationPile, + OccupationOrg = p.OccupationOrg == null ? "-" : p.OccupationOrg, + OccupationTelephone = p.OccupationTelephone == null ? "-" : p.OccupationTelephone, - CareersTotal = sb, - Careers = p.Careers.Select(y => new - { - Position = y.Position, - Type = y.Type, - DurationStart = y.DurationStart.ToThaiShortDate2(), - DurationEnd = y.DurationEnd.ToThaiShortDate2(), - RangeDate = y.RangeDate, - }).ToList(), + CareersTotal = sb.ToString(), + // Careers = p.Careers.Select(y => new + // { + // Position = y.Position, + // Type = y.Type, + // DurationStart = y.DurationStart.ToThaiShortDate2(), + // DurationEnd = y.DurationEnd.ToThaiShortDate2(), + // RangeDate = y.RangeDate, + // }).ToList(), - 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, + RegistAddress = p.RegistAddress == null ? "-" : p.RegistAddress, + RegistProvinceName = p.RegistProvinceName == null ? "-" : p.RegistProvinceName, + RegistDistrictName = p.RegistDistrictName == null ? "-" : p.RegistDistrictName, + RegistSubDistrictName = p.RegistSubDistrictName == null ? "-" : p.RegistSubDistrictName, + RegistZipCode = p.RegistZipCode == null ? "-" : p.RegistZipCode, + CurrentAddress = p.CurrentAddress == null ? "-" : p.CurrentAddress, + CurrentProvinceName = p.CurrentProvinceName == null ? "-" : p.CurrentProvinceName, + CurrentSubDistrictName = p.CurrentSubDistrictName == null ? "-" : p.CurrentSubDistrictName, + CurrentDistrictName = p.CurrentDistrictName == null ? "-" : p.CurrentDistrictName, + CurrentZipCode = p.CurrentZipCode == null ? "-" : p.CurrentZipCode, + Telephone = p.Telephone == null ? "-" : p.Telephone, + Email = p.Email == null ? "-" : p.Email, ContactFullName = $"{p.ContactPrefixName}{p.ContactFirstname} {p.ContactLastname}", - ContactRelations = p.ContactRelations, - ContactTel = p.ContactTel, + ContactRelations = p.ContactRelations == null ? "-" : p.ContactRelations, + ContactTel = p.ContactTel == null ? "-" : p.ContactTel, - RegisterDate = p.RegisterDate == null ? "" : p.RegisterDate.Value.ToThaiFullDate(), + RegisterDate = p.RegisterDate == null ? "-" : p.RegisterDate.Value.ToThaiFullDate(), }) .FirstOrDefaultAsync(); @@ -155,7 +165,7 @@ namespace BMA.EHR.Application.Repositories.Reports } public async Task GetExamCareerCandidateAsync(Guid id) { - var data = await _dbExamContext.Set().AsQueryable() + var items = await _dbExamContext.Set().AsQueryable() .Where(x => x.Candidate != null) .Where(x => x.Candidate.Id == id) .Select(p => new @@ -167,6 +177,22 @@ namespace BMA.EHR.Application.Repositories.Reports RangeDate = p.RangeDate, }) .ToListAsync(); + int retVal = 1; + var data = new List(); + foreach (var item in items) + { + var _data = new + { + Position = item.Position, + Type = item.Type, + DurationStart = item.DurationStart, + DurationEnd = item.DurationEnd, + RangeDate = item.RangeDate, + Index = retVal, + }; + data.Add(_data); + retVal++; + } return data; } diff --git a/BMA.EHR.Domain/Extensions/DateTimeExtension.cs b/BMA.EHR.Domain/Extensions/DateTimeExtension.cs index 48fdfa28..43c41f51 100644 --- a/BMA.EHR.Domain/Extensions/DateTimeExtension.cs +++ b/BMA.EHR.Domain/Extensions/DateTimeExtension.cs @@ -330,10 +330,10 @@ namespace BMA.EHR.Domain.Extensions sb.Append(days == 0 ? "" : $"{days} วัน "); return sb.ToString(); } - public static CalculateBetweenDateV2ValueObj? CalculateBetweenDateV2Value(this DateTime startDate, DateTime endDate) + public static CalculateBetweenDateV2ValueObj CalculateBetweenDateV2Value(this DateTime startDate, DateTime endDate) { - if (startDate == null || endDate == null) - return null; + // if (startDate == null || endDate == null) + // return null; DateTime today = endDate; DateTime birthDate = Convert.ToDateTime(startDate).AddDays(-1); var years1 = birthDate; diff --git a/BMA.EHR.Report.Service/Controllers/CandidateReportController.cs b/BMA.EHR.Report.Service/Controllers/CandidateReportController.cs index a81ad505..b825ee69 100644 --- a/BMA.EHR.Report.Service/Controllers/CandidateReportController.cs +++ b/BMA.EHR.Report.Service/Controllers/CandidateReportController.cs @@ -22,15 +22,15 @@ namespace BMA.EHR.Report.Service.Controllers private readonly CandidateReportRepository _service; private readonly IWebHostEnvironment _hostingEnvironment; private readonly IConfiguration _configuration; - private readonly MinIOService _minIOService; + private readonly MinIOExamService _minIOExamService; public CandidateReportController(CandidateReportRepository service, IWebHostEnvironment hostingEnvironment, - MinIOService minIOService, IConfiguration configuration) + MinIOExamService minIOExamService, IConfiguration configuration) { _service = service; _hostingEnvironment = hostingEnvironment; _configuration = configuration; - _minIOService = minIOService; + _minIOExamService = minIOExamService; } #region ใบสมัคร @@ -44,6 +44,7 @@ namespace BMA.EHR.Report.Service.Controllers /// ไม่ได้ Login เข้าระบบ /// เมื่อเกิดข้อผิดพลาดในการทำงาน [HttpGet("{exportType}/{Id}")] + [AllowAnonymous] public async Task> GetExamCandidate([FromRoute] Guid Id, string exportType = "pdf") { var candidate = await _service.GetExamCandidateAsync(Id); @@ -71,14 +72,15 @@ namespace BMA.EHR.Report.Service.Controllers var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"]; tblData.DataSource = careers; + Console.WriteLine("000000"); if (avatar != Guid.Parse("00000000-0000-0000-0000-000000000000")) { try { // Get avatar Image - var picContent = (await _minIOService.DownloadFileAsync(avatar)).FileContent; + var picContent = await _minIOExamService.DownloadFileAsync(avatar); var pictureBox = (Telerik.Reporting.PictureBox)report.Items["detailSection1"].Items["picAvatar"]; - pictureBox.Value = Image.FromStream(new MemoryStream(picContent)); + pictureBox.Value = Image.FromStream(new MemoryStream(picContent.FileContent)); } catch { } } diff --git a/BMA.EHR.Report.Service/Reports/ผลสอบคัดเลือกรายบุคคล.trdp b/BMA.EHR.Report.Service/Reports/ผลสอบคัดเลือกรายบุคคล.trdp index 262e0304..db51ac98 100644 Binary files a/BMA.EHR.Report.Service/Reports/ผลสอบคัดเลือกรายบุคคล.trdp and b/BMA.EHR.Report.Service/Reports/ผลสอบคัดเลือกรายบุคคล.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/ผลสอบคัดเลือกรายบุคคล.trdp.bak b/BMA.EHR.Report.Service/Reports/ผลสอบคัดเลือกรายบุคคล.trdp.bak deleted file mode 100644 index 04fe7acf..00000000 Binary files a/BMA.EHR.Report.Service/Reports/ผลสอบคัดเลือกรายบุคคล.trdp.bak and /dev/null differ