retire add approve
This commit is contained in:
parent
8ce58201e9
commit
2b8713cbe0
19 changed files with 22944 additions and 43 deletions
556
BMA.EHR.Application/Repositories/RetirementEmployeeRepository.cs
Normal file
556
BMA.EHR.Application/Repositories/RetirementEmployeeRepository.cs
Normal file
|
|
@ -0,0 +1,556 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Models.Notifications;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories
|
||||
{
|
||||
public class RetirementEmployeeRepository : GenericRepository<Guid, RetirementPeriod>
|
||||
{
|
||||
private readonly IApplicationDBContext _dbContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly string URL = string.Empty;
|
||||
public RetirementEmployeeRepository(IApplicationDBContext dbContext,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
UserProfileRepository userProfileRepository,
|
||||
IConfiguration configuration) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_configuration = configuration;
|
||||
URL = _configuration["MAIN_PAGE"];
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
||||
//ปลดออก
|
||||
public async Task NotifyDischarge()
|
||||
{
|
||||
var cronjobNotis = await _dbContext.Set<RetirementDischarge>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
cronjobNoti.Profile.IsLeave = true;
|
||||
cronjobNoti.Profile.LeaveReason = "DISCHARGE";
|
||||
cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
//ไล่ออก
|
||||
public async Task NotifyExpulsion()
|
||||
{
|
||||
var cronjobNotis = await _dbContext.Set<RetirementExpulsion>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
cronjobNoti.Profile.IsLeave = true;
|
||||
cronjobNoti.Profile.LeaveReason = "DISMISS";
|
||||
cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
//ให้ออก
|
||||
public async Task NotifyOut()
|
||||
{
|
||||
var cronjobNotis = await _dbContext.Set<RetirementOut>()
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.Prefix)
|
||||
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
//เกษียณอายุราชการ
|
||||
//public async Task ExecuteRetirement()
|
||||
//{
|
||||
// var retirePeriodOfficer = await _dbContext.Set<RetirementPeriod>()
|
||||
// .Include(x => x.RetirementRawProfiles.Where(y => y.Remove != "REMOVE"))
|
||||
// .Where(x => x.Year == DateTime.Now.Year)
|
||||
// .Where(x => x.Type.Trim().ToUpper().Contains("OFFICER"))
|
||||
// .FirstOrDefaultAsync();
|
||||
|
||||
// if (retirePeriodOfficer == null)
|
||||
// return;
|
||||
|
||||
// var body = new
|
||||
// {
|
||||
// data = retirePeriodOfficer.RetirementRawProfiles
|
||||
// .Select(x => new
|
||||
// {
|
||||
// profileId = x.profileId
|
||||
// })
|
||||
// .ToList()
|
||||
// };
|
||||
|
||||
// //ข้าราชการ
|
||||
// //var apiUrl = $"{_configuration["API"]}/org/unauthorize/retirement";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
|
||||
// var jsonBody = JsonConvert.SerializeObject(body);
|
||||
// var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
|
||||
|
||||
// var _req = new HttpRequestMessage(HttpMethod.Patch, apiUrl)
|
||||
// {
|
||||
// Content = content
|
||||
// };
|
||||
// var response = await client.SendAsync(_req);
|
||||
// var responseContent = await response.Content.ReadAsStringAsync();
|
||||
// if (!response.IsSuccessStatusCode)
|
||||
// {
|
||||
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
public void TestMethod()
|
||||
{
|
||||
return;
|
||||
}
|
||||
public async Task<RetirementResignEmployee?> GetByIdAsync(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementResignEmployee>().AsQueryable()
|
||||
.AsNoTracking()
|
||||
.Include(x => x.Approvers)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
return data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<RetirementResignEmployee?> GetByIdWithTrackingAsync(Guid id)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementResignEmployee>().AsQueryable()
|
||||
//.AsNoTracking()
|
||||
.Include(x => x.Approvers)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
|
||||
return data;
|
||||
}
|
||||
public async Task OfficerApproveRetirementResignEmployee(Guid id)
|
||||
{
|
||||
var rawData = await GetByIdAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
rawData.Status = "PENDING";
|
||||
rawData.ApproveStep = "st2";
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
// TODO: Send notification to 1st Commander
|
||||
var firstCommander = rawData.Approvers
|
||||
.Where(x => x.ApproveType!.ToUpper() == "COMMANDER")
|
||||
.OrderBy(x => x.Seq)
|
||||
.FirstOrDefault();
|
||||
// Send Notification
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = firstCommander!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-employee-detail/{id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task CommanderApproveRetirementResignEmployee(Guid id, string reason)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
|
||||
var rawData = await GetByIdWithTrackingAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
if (rawData.ApproveStep != "st2")
|
||||
{
|
||||
throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||
}
|
||||
|
||||
// check commander approve
|
||||
//var approvers = await _dbContext.Set<RetirementResignEmployeeApprover>()
|
||||
// //.AsNoTracking()
|
||||
// .Include(x => x.RetirementResignEmployee)
|
||||
// .Where(x => x.RetirementResignEmployee.Id == id && x.ApproveType == "COMMANDER")
|
||||
// .OrderBy(x => x.Seq)
|
||||
// .ToListAsync();
|
||||
|
||||
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "COMMANDER").OrderBy(x => x.Seq).ToList();
|
||||
|
||||
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||
if (approver == null)
|
||||
{
|
||||
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||
}
|
||||
|
||||
// check prev approver มี action แล้วหรือไม่?
|
||||
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||
|
||||
if (prevApprover != null)
|
||||
{
|
||||
if (prevApprover.ApproveStatus == "PENDING")
|
||||
{
|
||||
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||
}
|
||||
}
|
||||
|
||||
var maxSeq = approvers.Max(x => x.Seq);
|
||||
|
||||
//var data = await _dbContext.Set<RetirementResignEmployeeApprover>()
|
||||
// .AsNoTracking()
|
||||
// .Include(x => x.RetirementResignEmployee)
|
||||
// .Where(x => x.RetirementResignEmployee.Id == id && x.KeycloakId == userId && x.ApproveType == "COMMANDER")
|
||||
// .FirstOrDefaultAsync();
|
||||
|
||||
//if(data != null)
|
||||
//{
|
||||
// data.ApproveStatus = "APPROVE";
|
||||
// data.Comment = reason;
|
||||
|
||||
// data.LastUpdatedAt = DateTime.Now;
|
||||
// data.LastUpdateUserId = userId.ToString("D");
|
||||
// data.LastUpdateFullName = FullName ?? "";
|
||||
|
||||
// await _dbContext.SaveChangesAsync();
|
||||
//}
|
||||
|
||||
approver.ApproveStatus = "APPROVE";
|
||||
approver.Comment = reason;
|
||||
|
||||
//await _dbContext.SaveChangesAsync();
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
rawData.Status = "PENDING";
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||
|
||||
// Send Noti
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = nextApprover!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-employee-detail/{id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.Status = "PENDING";
|
||||
// rawData.LeaveComment = reason;
|
||||
rawData.ApproveStep = "st3";
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
// TODO: Send notification to 1st Approver
|
||||
var firstCommander = rawData.Approvers
|
||||
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||
.OrderBy(x => x.Seq)
|
||||
.FirstOrDefault();
|
||||
|
||||
// Send Notification
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = firstCommander!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-employee-detail/{id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CommanderRejectRetirementResignEmployee(Guid id, string reason)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
|
||||
var rawData = await GetByIdWithTrackingAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
if (rawData.ApproveStep != "st2")
|
||||
{
|
||||
throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||
}
|
||||
|
||||
// check commander approve
|
||||
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "COMMANDER").OrderBy(x => x.Seq).ToList();
|
||||
|
||||
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||
if (approver == null)
|
||||
{
|
||||
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||
}
|
||||
|
||||
// check prev approver มี action แล้วหรือไม่?
|
||||
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||
|
||||
if (prevApprover != null)
|
||||
{
|
||||
if (prevApprover.ApproveStatus == "PENDING")
|
||||
{
|
||||
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var maxSeq = approvers.Max(x => x.Seq);
|
||||
|
||||
approver.ApproveStatus = "REJECT";
|
||||
approver.Comment = reason;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
|
||||
|
||||
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||
// Send Noti
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = nextApprover!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-employee-detail/{id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
rawData.Status = "PENDING";
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.Status = "PENDING";
|
||||
// rawData.LeaveComment = reason;
|
||||
rawData.ApproveStep = "st3";
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
// TODO: Send notification to 1st Approver
|
||||
var firstCommander = rawData.Approvers
|
||||
.Where(x => x.ApproveType!.ToUpper() == "APPROVER")
|
||||
.OrderBy(x => x.Seq)
|
||||
.FirstOrDefault();
|
||||
// Send Notification
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = firstCommander!.ProfileId,
|
||||
Type = "",
|
||||
Payload = $"{URL}/retirement/resign-employee-detail/{id}",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task ApproveRetirementResignEmployee(Guid id, string reason)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
var rawData = await GetByIdWithTrackingAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
if (rawData.ApproveStep != "st3")
|
||||
{
|
||||
throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||
}
|
||||
|
||||
// check commander approve
|
||||
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "APPROVER").OrderBy(x => x.Seq).ToList();
|
||||
|
||||
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||
if (approver == null)
|
||||
{
|
||||
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||
}
|
||||
|
||||
// check prev approver มี action แล้วหรือไม่?
|
||||
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||
|
||||
if (prevApprover != null)
|
||||
{
|
||||
if (prevApprover.ApproveStatus == "PENDING")
|
||||
{
|
||||
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var maxSeq = approvers.Max(x => x.Seq);
|
||||
|
||||
approver.ApproveStatus = "APPROVE";
|
||||
approver.Comment = reason;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||
// Send Noti
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = nextApprover!.ProfileId,
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.Status = "APPROVE";
|
||||
// rawData.LeaveDirectorComment = reason;
|
||||
rawData.ApproveStep = "st4";
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
// Send Noti
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณได้รับการอนุมัติ",
|
||||
ReceiverUserId = Guid.Parse(rawData.profileId),
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async Task RejectRetirementResignEmployee(Guid id, string reason)
|
||||
{
|
||||
// Get UserId from token
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
var rawData = await GetByIdWithTrackingAsync(id);
|
||||
if (rawData == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
if (rawData.ApproveStep != "st3")
|
||||
{
|
||||
throw new Exception("คำขอนี้ยังไม่ได้อยู่ในขั้นตอนที่สามารถอนุมัติได้ ไม่สามารถทำรายการได้");
|
||||
}
|
||||
|
||||
// check commander approve
|
||||
var approvers = rawData.Approvers.Where(x => x.ApproveType!.ToUpper() == "APPROVER").OrderBy(x => x.Seq).ToList();
|
||||
|
||||
var approver = approvers.FirstOrDefault(x => x.KeycloakId == userId);
|
||||
if (approver == null)
|
||||
{
|
||||
throw new Exception("คุณไม่มีสิทธิ์อนุมัติการลาออกในขั้นตอนนี้");
|
||||
}
|
||||
|
||||
// check prev approver มี action แล้วหรือไม่?
|
||||
var prevApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq - 1);
|
||||
|
||||
if (prevApprover != null)
|
||||
{
|
||||
if (prevApprover.ApproveStatus == "PENDING")
|
||||
{
|
||||
throw new Exception("ไม่สามารถทำการอนุมัติได้ เนื่องจากยังอยู่ระหว่างการพิจารณาโดยผู้บังคับบัญชารายก่อนหน้า");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var maxSeq = approvers.Max(x => x.Seq);
|
||||
|
||||
approver.ApproveStatus = "REJECT";
|
||||
approver.Comment = reason;
|
||||
|
||||
if (approver.Seq != maxSeq)
|
||||
{
|
||||
var nextApprover = approvers.FirstOrDefault(x => x.Seq == approver.Seq + 1);
|
||||
// Send Noti
|
||||
var noti1 = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณ {rawData.firstName} {rawData.lastName} รอรับการอนุมัติจากคุณ",
|
||||
ReceiverUserId = nextApprover!.ProfileId,
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti1);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
rawData.Status = "REJECT";
|
||||
// rawData.LeaveDirectorComment = reason;
|
||||
rawData.ApproveStep = "st5";
|
||||
|
||||
// Send Noti
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"การขอลาออกของคุณไม่ได้รับการอนุมัติ \r\nเนื่องจาก{reason}",
|
||||
ReceiverUserId = Guid.Parse(rawData.profileId),
|
||||
Type = "",
|
||||
Payload = "",
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue