no message

This commit is contained in:
Kittapath 2023-09-23 20:44:28 +07:00
parent ab4c5988e8
commit ec38ac5af1

View file

@ -13,6 +13,7 @@ using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using OfficeOpenXml; using OfficeOpenXml;
using BMA.EHR.Domain.Models.Placement; using BMA.EHR.Domain.Models.Placement;
using OfficeOpenXml.Style;
namespace BMA.EHR.Recurit.Exam.Service.Services namespace BMA.EHR.Recurit.Exam.Service.Services
{ {
@ -1074,6 +1075,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.OrderBy(x => x.ExamIdenNumber) .OrderBy(x => x.ExamIdenNumber)
.Where(x => x.PeriodExam == periodExam) .Where(x => x.PeriodExam == periodExam)
.Where(x => x.Status != "waiver") .Where(x => x.Status != "waiver")
.Where(x => x.Status != "register")
.ToListAsync(); .ToListAsync();
} }
else else
@ -1082,6 +1084,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.AsQueryable() .AsQueryable()
.OrderBy(x => x.ExamIdenNumber) .OrderBy(x => x.ExamIdenNumber)
.Where(x => x.PeriodExam == periodExam) .Where(x => x.PeriodExam == periodExam)
.Where(x => x.Status != "register")
.ToListAsync(); .ToListAsync();
} }
@ -1306,6 +1309,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.AsQueryable() .AsQueryable()
.OrderBy(x => x.ExamIdenNumber) .OrderBy(x => x.ExamIdenNumber)
.Where(x => x.PeriodExam == periodExam) .Where(x => x.PeriodExam == periodExam)
.Where(x => x.Status != "register")
.Select(c => new .Select(c => new
{ {
Id = c.Id, 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.DateEnd.Date)
.Where(x => x.CreatedAt.Date >= item.DateStart.Date) .Where(x => x.CreatedAt.Date >= item.DateStart.Date)
.Where(x => x.PeriodExam == periodExam) .Where(x => x.PeriodExam == periodExam)
.Where(x => x.Status != "register")
.Select(c => new .Select(c => new
{ {
Id = c.Id, Id = c.Id,
@ -1694,6 +1699,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
// summarySheet.DefaultRowHeight = 17; // summarySheet.DefaultRowHeight = 17;
summarySheet.Column(1).Style.Font.Bold = true; summarySheet.Column(1).Style.Font.Bold = true;
summarySheet.Row(5).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.Row(6).Style.Font.Bold = true;
summarySheet.Cells[1, 3].Style.Font.Bold = true; summarySheet.Cells[1, 3].Style.Font.Bold = true;
int rowName = 2; int rowName = 2;
@ -1708,7 +1714,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[3, 1].Value = "ครั้งที่"; summarySheet.Cells[3, 1].Value = "ครั้งที่";
summarySheet.Cells[3, 2].Value = $"{periodExam.Round}/{periodExam.Year + 543}"; summarySheet.Cells[3, 2].Value = $"{periodExam.Round}/{periodExam.Year + 543}";
summarySheet.Cells[4, 1].Value = "จำนวนผู้สมัคร"; summarySheet.Cells[4, 1].Value = "จำนวนผู้สมัคร";
summarySheet.Cells[4, 2].Value = candidates.Count(); summarySheet.Cells[4, 2].Value = candidates.Count().ToString();
if (candidates.Count() > 0) if (candidates.Count() > 0)
{ {
summarySheet.Cells[7, 1].Value = "จำนวน"; summarySheet.Cells[7, 1].Value = "จำนวน";
@ -1738,9 +1744,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
rowName++; rowName++;
rowCount++; rowCount++;
} }
summarySheet.Cells[5, fixMerge, 5, rowName].Value = "วุฒิการศึกษา"; if (educations.Count() != 0)
summarySheet.Cells[5, fixMerge, 5, rowName].Merge = true; {
fixMerge = rowCount; summarySheet.Cells[5, fixMerge, 5, rowName - 1].Value = "วุฒิการศึกษา";
summarySheet.Cells[5, fixMerge, 5, rowName - 1].Merge = true;
fixMerge = rowCount;
}
var careers = await _context.Careers var careers = await _context.Careers
.AsQueryable() .AsQueryable()
.Where(x => x.Candidate.PeriodExam == periodExam) .Where(x => x.Candidate.PeriodExam == periodExam)
@ -1760,9 +1769,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
rowName++; rowName++;
rowCount++; rowCount++;
} }
summarySheet.Cells[5, fixMerge, 5, rowName].Value = "สถานที่ทำงาน/ฝึกงาน"; if (careers.Count() != 0)
summarySheet.Cells[5, fixMerge, 5, rowName].Merge = true; {
fixMerge = rowCount; 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[6, rowName].Value = "อายุ 1-20 ปี";
summarySheet.Cells[7, rowCount].Value = candidates.Where(x => x.Age >= 1 && x.Age <= 20).Count(); summarySheet.Cells[7, rowCount].Value = candidates.Where(x => x.Age >= 1 && x.Age <= 20).Count();
rowName++; rowName++;
@ -1787,8 +1799,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
summarySheet.Cells[7, rowCount].Value = candidates.Where(x => x.Age >= 81).Count(); summarySheet.Cells[7, rowCount].Value = candidates.Where(x => x.Age >= 81).Count();
rowName++; rowName++;
rowCount++; rowCount++;
summarySheet.Cells[5, fixMerge, 5, rowName].Value = "ช่วงอายุ"; summarySheet.Cells[5, fixMerge, 5, rowName - 1].Value = "ช่วงอายุ";
summarySheet.Cells[5, fixMerge, 5, rowName].Merge = true; summarySheet.Cells[5, fixMerge, 5, rowName - 1].Merge = true;
} }
else else
{ {
@ -1814,6 +1826,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var candidates = await _context.Candidates var candidates = await _context.Candidates
.AsQueryable() .AsQueryable()
.Where(x => x.PeriodExam == periodExam) .Where(x => x.PeriodExam == periodExam)
.Where(x => x.Status != "register")
.Select(c => new .Select(c => new
{ {
CitizenId = c.CitizenId, CitizenId = c.CitizenId,