From ec38ac5af1d538d75a59f8be8b35fa12e0f2530f Mon Sep 17 00:00:00 2001 From: Kittapath Date: Sat, 23 Sep 2023 20:44:28 +0700 Subject: [PATCH] no message --- Services/PeriodExamService.cs | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/Services/PeriodExamService.cs b/Services/PeriodExamService.cs index 883d867..05b0325 100644 --- a/Services/PeriodExamService.cs +++ b/Services/PeriodExamService.cs @@ -13,6 +13,7 @@ using Microsoft.EntityFrameworkCore; using Newtonsoft.Json.Linq; using OfficeOpenXml; using BMA.EHR.Domain.Models.Placement; +using OfficeOpenXml.Style; namespace BMA.EHR.Recurit.Exam.Service.Services { @@ -1074,6 +1075,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services .OrderBy(x => x.ExamIdenNumber) .Where(x => x.PeriodExam == periodExam) .Where(x => x.Status != "waiver") + .Where(x => x.Status != "register") .ToListAsync(); } else @@ -1082,6 +1084,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services .AsQueryable() .OrderBy(x => x.ExamIdenNumber) .Where(x => x.PeriodExam == periodExam) + .Where(x => x.Status != "register") .ToListAsync(); } @@ -1306,6 +1309,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services .AsQueryable() .OrderBy(x => x.ExamIdenNumber) .Where(x => x.PeriodExam == periodExam) + .Where(x => x.Status != "register") .Select(c => new { Id = c.Id, @@ -1627,6 +1631,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services .Where(x => x.CreatedAt.Date <= item.DateEnd.Date) .Where(x => x.CreatedAt.Date >= item.DateStart.Date) .Where(x => x.PeriodExam == periodExam) + .Where(x => x.Status != "register") .Select(c => new { Id = c.Id, @@ -1694,6 +1699,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services // summarySheet.DefaultRowHeight = 17; summarySheet.Column(1).Style.Font.Bold = true; summarySheet.Row(5).Style.Font.Bold = true; + summarySheet.Row(5).Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; summarySheet.Row(6).Style.Font.Bold = true; summarySheet.Cells[1, 3].Style.Font.Bold = true; int rowName = 2; @@ -1708,7 +1714,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services summarySheet.Cells[3, 1].Value = "ครั้งที่"; summarySheet.Cells[3, 2].Value = $"{periodExam.Round}/{periodExam.Year + 543}"; summarySheet.Cells[4, 1].Value = "จำนวนผู้สมัคร"; - summarySheet.Cells[4, 2].Value = candidates.Count(); + summarySheet.Cells[4, 2].Value = candidates.Count().ToString(); if (candidates.Count() > 0) { summarySheet.Cells[7, 1].Value = "จำนวน"; @@ -1738,9 +1744,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services rowName++; rowCount++; } - summarySheet.Cells[5, fixMerge, 5, rowName].Value = "วุฒิการศึกษา"; - summarySheet.Cells[5, fixMerge, 5, rowName].Merge = true; - fixMerge = rowCount; + if (educations.Count() != 0) + { + summarySheet.Cells[5, fixMerge, 5, rowName - 1].Value = "วุฒิการศึกษา"; + summarySheet.Cells[5, fixMerge, 5, rowName - 1].Merge = true; + fixMerge = rowCount; + } var careers = await _context.Careers .AsQueryable() .Where(x => x.Candidate.PeriodExam == periodExam) @@ -1760,9 +1769,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services rowName++; rowCount++; } - summarySheet.Cells[5, fixMerge, 5, rowName].Value = "สถานที่ทำงาน/ฝึกงาน"; - summarySheet.Cells[5, fixMerge, 5, rowName].Merge = true; - fixMerge = rowCount; + if (careers.Count() != 0) + { + summarySheet.Cells[5, fixMerge, 5, rowName - 1].Value = "สถานที่ทำงาน/ฝึกงาน"; + summarySheet.Cells[5, fixMerge, 5, rowName - 1].Merge = true; + fixMerge = rowCount; + } summarySheet.Cells[6, rowName].Value = "อายุ 1-20 ปี"; summarySheet.Cells[7, rowCount].Value = candidates.Where(x => x.Age >= 1 && x.Age <= 20).Count(); rowName++; @@ -1787,8 +1799,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services summarySheet.Cells[7, rowCount].Value = candidates.Where(x => x.Age >= 81).Count(); rowName++; rowCount++; - summarySheet.Cells[5, fixMerge, 5, rowName].Value = "ช่วงอายุ"; - summarySheet.Cells[5, fixMerge, 5, rowName].Merge = true; + summarySheet.Cells[5, fixMerge, 5, rowName - 1].Value = "ช่วงอายุ"; + summarySheet.Cells[5, fixMerge, 5, rowName - 1].Merge = true; } else { @@ -1814,6 +1826,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services var candidates = await _context.Candidates .AsQueryable() .Where(x => x.PeriodExam == periodExam) + .Where(x => x.Status != "register") .Select(c => new { CitizenId = c.CitizenId,