Change REport
This commit is contained in:
parent
55a83a43ec
commit
4987f7c5ad
9 changed files with 224 additions and 24 deletions
65
Services/RecruitService.cs
Normal file
65
Services/RecruitService.cs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BMA.EHR.Recruit.Service.Models.Recruits;
|
||||
using BMA.EHR.Report.Service.Data;
|
||||
|
||||
namespace BMA.EHR.Recruit.Service.Services
|
||||
{
|
||||
public class RecruitService
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
||||
public RecruitService(ApplicationDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public int GetExamCount(string citizenId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var count = _context.Recruits.AsQueryable()
|
||||
.Where(x => x.CitizenId == citizenId)
|
||||
.Count();
|
||||
|
||||
return count;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
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 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