fix defect 25-04-2023
This commit is contained in:
parent
de70220236
commit
2bd62de015
26 changed files with 3131 additions and 155 deletions
|
|
@ -8,42 +8,58 @@ using BMA.EHR.Recruit.Service.Models.Recruits;
|
|||
|
||||
namespace BMA.EHR.Recruit.Service.Services
|
||||
{
|
||||
public class RecruitService
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
public class RecruitService
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public RecruitService(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
public RecruitService(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<string> GetExamAttributeAsync(Guid period, Guid exam)
|
||||
{
|
||||
try
|
||||
{
|
||||
var payment = await _context.RecruitPayments.AsQueryable()
|
||||
.Include(x => x.Recruit)
|
||||
.ThenInclude(x => x.RecruitImport)
|
||||
.Where(x => x.Recruit.Id == exam)
|
||||
.Where(x => x.Recruit.RecruitImport.Id == period)
|
||||
.FirstOrDefaultAsync();
|
||||
public int GetExamCount(string citizenId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var count = _context.Recruits.AsQueryable()
|
||||
.Where(x => x.CitizenId == citizenId)
|
||||
.Count();
|
||||
|
||||
return payment != null ? "มีคุณสมบัติ" : "ไม่มีคุณสมบัติ";
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CheckValidCertificate(DateTime certDate, int nextYear = 5)
|
||||
{
|
||||
var valid = true;
|
||||
if (DateTime.Now.Date > certDate.Date.AddYears(nextYear))
|
||||
valid = false;
|
||||
public async Task<string> GetExamAttributeAsync(Guid period, Guid exam)
|
||||
{
|
||||
try
|
||||
{
|
||||
var payment = await _context.RecruitPayments.AsQueryable()
|
||||
.Include(x => x.Recruit)
|
||||
.ThenInclude(x => x.RecruitImport)
|
||||
.Where(x => x.Recruit.Id == exam)
|
||||
.Where(x => x.Recruit.RecruitImport.Id == period)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return valid;
|
||||
}
|
||||
return payment != null ? "มีคุณสมบัติ" : "ไม่มีคุณสมบัติ";
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public bool CheckValidCertificate(DateTime certDate, int nextYear = 5)
|
||||
{
|
||||
var valid = true;
|
||||
if (DateTime.Now.Date > certDate.Date.AddYears(nextYear))
|
||||
valid = false;
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue