Restucture Project
This commit is contained in:
parent
5a14843e31
commit
b2abfe9e87
177 changed files with 1231 additions and 869 deletions
49
Services/RecruitService.cs
Normal file
49
Services/RecruitService.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BMA.EHR.Recruit.Service.Data;
|
||||
using BMA.EHR.Recruit.Service.Models.Recruits;
|
||||
|
||||
namespace BMA.EHR.Recruit.Service.Services
|
||||
{
|
||||
public class RecruitService
|
||||
{
|
||||
private readonly ApplicationDbContext _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();
|
||||
|
||||
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