api ยกเลิกรอจัดที่นั่ง

This commit is contained in:
Kittapath 2023-10-20 15:09:00 +07:00
parent 57a52ef866
commit 17576eeb7a
3 changed files with 61 additions and 2 deletions

View file

@ -803,6 +803,32 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
}
}
/// <summary>
/// เจ้าหน้าที่ย้อนสถานะเป็นตรวจสอบข้อมูล
/// </summary>
/// <param name="candidateId">รหัสใบสมัคร</param>
/// <returns></returns>
/// <response code="200">เมื่อเจ้าหน้าที่ตรวจคุณสมบัติผู้สมัครสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("reject/check-register/{candidateId:length(36)}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> AdminRejectToCheckCandidateService(Guid candidateId, RequestReject item)
{
try
{
await _candidateService.AdminRejectToCheckCandidateService(candidateId, item.Reason);
return Success();
}
catch (Exception ex)
{
return Error(ex);
}
}
/// <summary>
/// เจ้าหน้าที่ตรวจคุณสมบัติผู้สมัครไม่ผ่านและให้สมัครใหม่
/// </summary>

9
Request/RequestReject.cs Normal file
View file

@ -0,0 +1,9 @@
using System.Net;
namespace BMA.EHR.Recurit.Exam.Service.Request
{
public class RequestReject
{
public string? Reason { get; set; }
}
}

View file

@ -2004,6 +2004,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
}
candidate.Status = status;
candidate.RejectDetail = null;
await _context.SaveChangesAsync();
}
@ -2039,7 +2040,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
candidate.RejectDetail = item.Reason;
}
if (status == "rejectPayment")
else if (status == "rejectPayment")
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " มีหลักฐานชำระเงินไม่ถูกต้องกรุณาตรวจสอบข้อมูล เนื่องจาก: " + item.Reason;
@ -2052,6 +2053,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: ได้รับใบสมัครแล้ว";
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
candidate.Status = "checkSeat";
candidate.RejectDetail = null;
// var num = periodExam.Count() + 1;
// candidate.ExamIdenNumber = candidate.PositionExam == null ? num.ToString() : candidate.PositionExam.Code + num;
}
@ -2060,8 +2062,9 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: รอชำระค่าสมัครสอบ";
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
candidate.RejectDetail = null;
}
else if (candidate.Status == "checkSeat")
else if (status == "checkSeat")
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
var body = candidate.FirstName + " " + candidate.LastName + " สถานะการสมัครสอบ: ได้ชำระค่าสมัครสอบแล้ว";
@ -2069,6 +2072,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
// var num = periodExam.Count() + 1;
// candidate.ExamIdenNumber = candidate.PositionExam == null ? num.ToString() : candidate.PositionExam.Code + num;
candidate.PaymentDate = DateTime.Now;
candidate.RejectDetail = null;
}
}
else
@ -2111,6 +2115,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
throw new Exception(GlobalMessages.ExamNotFound);
candidate.Status = "payment";
candidate.RejectDetail = null;
if (candidate.PeriodExam.Fee == 0)
{
var subject = "แจ้งผลการสมัครสอบคัดเลือก " + candidate.PeriodExam.Name;
@ -2134,6 +2139,24 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
public async Task AdminRejectToCheckCandidateService(Guid candidateId, string? reason)
{
var candidate = await _context.Candidates.AsQueryable()
.Include(x => x.PeriodExam)
.Include(x => x.PositionExam)
.FirstOrDefaultAsync(x => x.Id == candidateId);
if (candidate == null)
throw new Exception(GlobalMessages.CandidateNotFound);
if (candidate.Status.Trim().ToUpper() != "PAYMENT" && candidate.Status.Trim().ToUpper() != "CHECKSEAT")
return;
candidate.RejectDetail = reason;
candidate.Status = "checkRegister";
await _context.SaveChangesAsync();
}
public async Task AdminPassCandidateService(string candidateId, string status)
{
@ -2160,6 +2183,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
if (candidate.Email != null && candidate.Email != "") _mailService.SendMailToUser(subject, body, candidate.Email);
}
candidate.Status = status;
candidate.RejectDetail = null;
await _context.SaveChangesAsync();
}