แก้ api พ้นราชการ
This commit is contained in:
parent
2a3a151f34
commit
63b02dcc4c
19 changed files with 54771 additions and 431 deletions
|
|
@ -835,10 +835,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
var report_data = (from r in raw_data
|
||||
join p in _dbContext.Set<RetirementResign>()
|
||||
.Include(p => p.Profile)
|
||||
.ThenInclude(p => p.Position)
|
||||
.Include(p => p.Profile)
|
||||
.ThenInclude(p => p.Salaries)
|
||||
//.Include(p => p.Profile)
|
||||
//.ThenInclude(p => p.Position)
|
||||
//.Include(p => p.Profile)
|
||||
//.ThenInclude(p => p.Salaries)
|
||||
on r.RefPlacementProfileId equals p.Id
|
||||
orderby r.Sequence
|
||||
select new CommandType17Response
|
||||
|
|
@ -846,7 +846,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||
CitizenId = r.CitizenId,
|
||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||
PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
|
||||
PositionName = p.position ?? "",
|
||||
Organization = p.OrganizationPositionOld ?? "",
|
||||
PositionLevel = p.PositionLevelOld ?? "",
|
||||
PositionType = p.PositionTypeOld ?? "",
|
||||
|
|
@ -1165,20 +1165,20 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
var report_data = (from r in raw_data
|
||||
join p in _dbContext.Set<RetirementResign>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Position)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PositionLevel)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PositionType)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PosNo)
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.Position)
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.PositionLevel)
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.PositionType)
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.PosNo)
|
||||
|
||||
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PositionEmployeePosition)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PositionEmployeeLevel)
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.PositionEmployeePosition)
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.PositionEmployeeLevel)
|
||||
//.Include(x => x.OrgEmployee)
|
||||
//.ThenInclude(x => x.OrganizationAgency)
|
||||
//.ThenInclude(x => x.OrganizationOrganization)
|
||||
|
|
@ -1197,7 +1197,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
CitizenId = r.CitizenId.ToThaiNumber(),
|
||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||
Organization = p.OrganizationPositionOld ?? "",
|
||||
PositionName = p.Profile.PositionEmployeePosition == null ? "" : p.Profile.PositionEmployeePosition.Name.ToThaiNumber(),
|
||||
PositionName = p.position ?? "",
|
||||
PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld.ToThaiNumber(),
|
||||
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld.ToThaiNumber(),
|
||||
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
||||
|
|
|
|||
|
|
@ -1249,13 +1249,13 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
// 2. Query
|
||||
var appointPeople = await _dbContext.Set<RetirementResign>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.Prefix)
|
||||
//.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
|
||||
.Where(x => !otherCommandReceivers.Contains(x.Profile!.CitizenId!))
|
||||
.Where(x => x.Profile.ProfileType == "officer")
|
||||
.Where(x => !otherCommandReceivers.Contains(x.citizenId))
|
||||
// .Where(x => x.Profile.ProfileType == "officer")
|
||||
.Where(x => x.Status.Trim().ToUpper() == "REPORT")
|
||||
.OrderBy(x => x.Profile!.CitizenId)
|
||||
.OrderBy(x => x.citizenId)
|
||||
.ToListAsync();
|
||||
|
||||
// 3. Create new Record
|
||||
|
|
@ -1265,10 +1265,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var receiver = new CommandReceiver
|
||||
{
|
||||
Sequence = seq,
|
||||
CitizenId = item.Profile!.CitizenId!,
|
||||
Prefix = item.Profile!.Prefix!.Name,
|
||||
FirstName = item.Profile!.FirstName!,
|
||||
LastName = item.Profile!.LastName!,
|
||||
CitizenId = item.citizenId,
|
||||
Prefix = item.prefix,
|
||||
FirstName = item.firstName,
|
||||
LastName = item.lastName,
|
||||
RefPlacementProfileId = item.Id,
|
||||
Amount = item.AmountOld,
|
||||
};
|
||||
|
|
@ -1691,13 +1691,13 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
// 2. Query
|
||||
var appointPeople = await _dbContext.Set<RetirementResign>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.Prefix)
|
||||
//.Where(x => x.OrganizationPosition!.Organization!.Id == command.OwnerGovId)
|
||||
.Where(x => !otherCommandReceivers.Contains(x.Profile!.CitizenId!))
|
||||
.Where(x => x.Profile.ProfileType == "employee")
|
||||
.Where(x => !otherCommandReceivers.Contains(x.citizenId))
|
||||
// .Where(x => x.Profile.ProfileType == "employee")
|
||||
.Where(x => x.Status.Trim().ToUpper() == "REPORT")
|
||||
.OrderBy(x => x.Profile!.CitizenId)
|
||||
.OrderBy(x => x.citizenId)
|
||||
.ToListAsync();
|
||||
|
||||
// 3. Create new Record
|
||||
|
|
@ -1707,10 +1707,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var receiver = new CommandReceiver
|
||||
{
|
||||
Sequence = seq,
|
||||
CitizenId = item.Profile!.CitizenId!,
|
||||
Prefix = item.Profile!.Prefix!.Name,
|
||||
FirstName = item.Profile!.FirstName!,
|
||||
LastName = item.Profile!.LastName!,
|
||||
CitizenId = item.citizenId,
|
||||
Prefix = item.prefix,
|
||||
FirstName = item.firstName,
|
||||
LastName = item.lastName,
|
||||
RefPlacementProfileId = item.Id,
|
||||
Amount = item.AmountOld,
|
||||
};
|
||||
|
|
@ -5644,7 +5644,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
//var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
//var order = 1;
|
||||
//if (lastSarary != null && lastSarary.Order != null)
|
||||
//order = lastSarary.Order.Value + 1;
|
||||
//order = lastSarary.Order.Value + 1;
|
||||
|
||||
// var salary = new ProfileSalary
|
||||
// {
|
||||
|
|
@ -6526,85 +6526,85 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
foreach (var recv in command.Receivers)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementResign>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Salaries)
|
||||
.ThenInclude(x => x.PositionLevel)
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.Salaries)
|
||||
//.ThenInclude(x => x.PositionLevel)
|
||||
|
||||
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
|
||||
data.Profile.IsActive = false;
|
||||
data.Profile.IsLeave = true;
|
||||
data.Profile.LeaveReason = "ลาออกจากราชการ";
|
||||
data.Profile.LeaveDate = command.CommandAffectDate;
|
||||
// data.Profile.IsActive = false;
|
||||
// data.Profile.IsLeave = true;
|
||||
// data.Profile.LeaveReason = "ลาออกจากราชการ";
|
||||
// data.Profile.LeaveDate = command.CommandAffectDate;
|
||||
|
||||
var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
var order = 1;
|
||||
if (lastSarary != null && lastSarary.Order != null)
|
||||
order = lastSarary.Order.Value + 1;
|
||||
// var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
// var order = 1;
|
||||
// if (lastSarary != null && lastSarary.Order != null)
|
||||
// order = lastSarary.Order.Value + 1;
|
||||
|
||||
var salary = new ProfileSalary
|
||||
{
|
||||
Order = order,
|
||||
Date = command.CommandAffectDate,
|
||||
Amount = lastSarary == null ? null : lastSarary.Amount,
|
||||
PositionSalaryAmount = lastSarary == null ? null : lastSarary.PositionSalaryAmount,
|
||||
MouthSalaryAmount = lastSarary == null ? null : lastSarary.MouthSalaryAmount,
|
||||
SalaryClass = "",
|
||||
SalaryRef = "คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
|
||||
// var salary = new ProfileSalary
|
||||
// {
|
||||
// Order = order,
|
||||
// Date = command.CommandAffectDate,
|
||||
// Amount = lastSarary == null ? null : lastSarary.Amount,
|
||||
// PositionSalaryAmount = lastSarary == null ? null : lastSarary.PositionSalaryAmount,
|
||||
// MouthSalaryAmount = lastSarary == null ? null : lastSarary.MouthSalaryAmount,
|
||||
// SalaryClass = "",
|
||||
// SalaryRef = "คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
|
||||
|
||||
OcId = lastSarary == null ? null : lastSarary.OcId,
|
||||
// OcId = lastSarary == null ? null : lastSarary.OcId,
|
||||
|
||||
PositionId = lastSarary == null ? null : lastSarary.PositionId,
|
||||
// PositionId = lastSarary == null ? null : lastSarary.PositionId,
|
||||
|
||||
PositionLevel = lastSarary == null ? null : lastSarary.PositionLevel,
|
||||
PositionLineId = lastSarary == null ? null : lastSarary.PositionLineId,
|
||||
PositionTypeId = lastSarary == null ? null : lastSarary.PositionTypeId,
|
||||
OrganizationShortNameId = lastSarary == null ? null : lastSarary.OrganizationShortNameId,
|
||||
PosNoId = lastSarary == null ? null : lastSarary.PosNoId,
|
||||
// PositionLevel = lastSarary == null ? null : lastSarary.PositionLevel,
|
||||
// PositionLineId = lastSarary == null ? null : lastSarary.PositionLineId,
|
||||
// PositionTypeId = lastSarary == null ? null : lastSarary.PositionTypeId,
|
||||
// OrganizationShortNameId = lastSarary == null ? null : lastSarary.OrganizationShortNameId,
|
||||
// PosNoId = lastSarary == null ? null : lastSarary.PosNoId,
|
||||
|
||||
CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||
RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||
CommandTypeName = command.CommandType.Name,
|
||||
// CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||
// RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||
// CommandTypeName = command.CommandType.Name,
|
||||
|
||||
|
||||
PositionEmployeeGroupId = null,
|
||||
PositionEmployeeLevelId = null,
|
||||
PositionEmployeePositionId = null,
|
||||
PositionEmployeePositionSideId = null,
|
||||
PosNoEmployee = "",
|
||||
// PositionEmployeeGroupId = null,
|
||||
// PositionEmployeeLevelId = null,
|
||||
// PositionEmployeePositionId = null,
|
||||
// PositionEmployeePositionSideId = null,
|
||||
// PosNoEmployee = "",
|
||||
|
||||
|
||||
//PositionPathSideId = lastSarary == null ? null : lastSarary.PositionPathSideId == null,
|
||||
PositionExecutiveId = lastSarary == null ? null : lastSarary.PositionExecutiveId,
|
||||
//PositionExecutiveSideId = lastSarary == null ? null : lastSarary.PositionExecutiveSideId,
|
||||
// //PositionPathSideId = lastSarary == null ? null : lastSarary.PositionPathSideId == null,
|
||||
// PositionExecutiveId = lastSarary == null ? null : lastSarary.PositionExecutiveId,
|
||||
// //PositionExecutiveSideId = lastSarary == null ? null : lastSarary.PositionExecutiveSideId,
|
||||
|
||||
IsActive = true,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
// IsActive = true,
|
||||
// CreatedAt = DateTime.Now,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
|
||||
};
|
||||
// };
|
||||
|
||||
if (lastSarary != null && lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId;
|
||||
if (lastSarary != null && lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId;
|
||||
// if (lastSarary != null && lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId;
|
||||
// if (lastSarary != null && lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId;
|
||||
|
||||
data.Profile.Salaries.Add(salary);
|
||||
// data.Profile.Salaries.Add(salary);
|
||||
|
||||
// remove profile position
|
||||
var profilePosition = await _dbContext.Set<ProfilePosition>()
|
||||
.Include(x => x.Profile)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.FirstOrDefaultAsync(x => x.Profile!.Id == data.Profile.Id);
|
||||
if (profilePosition != null)
|
||||
_dbContext.Set<ProfilePosition>().Remove(profilePosition);
|
||||
// // remove profile position
|
||||
// var profilePosition = await _dbContext.Set<ProfilePosition>()
|
||||
// .Include(x => x.Profile)
|
||||
// .Include(x => x.OrganizationPosition)
|
||||
// .FirstOrDefaultAsync(x => x.Profile!.Id == data.Profile.Id);
|
||||
// if (profilePosition != null)
|
||||
// _dbContext.Set<ProfilePosition>().Remove(profilePosition);
|
||||
|
||||
// update placementstatus
|
||||
// // update placementstatus
|
||||
data.Status = "DONE";
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
|
@ -6620,7 +6620,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คุณได้รับคำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = data.Profile.Id,
|
||||
KeycloakUserId = data.CreatedUserId,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
|
|
@ -6628,7 +6628,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var noti = new Notification
|
||||
{
|
||||
Body = $"คุณได้รับคำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = data.Profile.Id,
|
||||
KeycloakUserId = data.CreatedUserId,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
|
|
@ -6636,44 +6636,44 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// send cc noti inbox
|
||||
foreach (var cc in command.Deployments)
|
||||
{
|
||||
var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||
if (pf != null)
|
||||
{
|
||||
if (cc.IsSendInbox)
|
||||
{
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
}
|
||||
// // send cc noti inbox
|
||||
// foreach (var cc in command.Deployments)
|
||||
// {
|
||||
// var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||
// if (pf != null)
|
||||
// {
|
||||
// if (cc.IsSendInbox)
|
||||
// {
|
||||
// var inbox = new Inbox
|
||||
// {
|
||||
// Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
// Body = $"คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
// ReceiverUserId = pf.Id,
|
||||
// Payload = payload_str,
|
||||
// };
|
||||
// _dbContext.Set<Inbox>().Add(inbox);
|
||||
// }
|
||||
|
||||
if (cc.IsSendMail)
|
||||
{
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
// if (cc.IsSendMail)
|
||||
// {
|
||||
// // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// // Send noti inbox and email
|
||||
// var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
// var body = $"คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
// _emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
// }
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
}
|
||||
}
|
||||
// var noti = new Notification
|
||||
// {
|
||||
// Body = $"คำสั่งอนุญาตให้ข้าราชการลาออกจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
// ReceiverUserId = pf.Id,
|
||||
// Type = "LINK",
|
||||
// Payload = payload_str,
|
||||
// };
|
||||
// _dbContext.Set<Notification>().Add(noti);
|
||||
// }
|
||||
// }
|
||||
|
||||
// change command status
|
||||
var cmdStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(x => x.Sequence == 5);
|
||||
|
|
@ -7689,76 +7689,76 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
foreach (var recv in command.Receivers)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementResign>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Salaries)
|
||||
.ThenInclude(x => x.PositionLevel)
|
||||
//.Include(x => x.Profile)
|
||||
//.ThenInclude(x => x.Salaries)
|
||||
//.ThenInclude(x => x.PositionLevel)
|
||||
|
||||
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
|
||||
data.Profile.IsActive = false;
|
||||
data.Profile.IsLeave = true;
|
||||
data.Profile.LeaveReason = "ลาออกจากราชการ";
|
||||
data.Profile.LeaveDate = command.CommandAffectDate;
|
||||
// data.Profile.IsActive = false;
|
||||
// data.Profile.IsLeave = true;
|
||||
// data.Profile.LeaveReason = "ลาออกจากราชการ";
|
||||
// data.Profile.LeaveDate = command.CommandAffectDate;
|
||||
|
||||
var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
var order = 1;
|
||||
if (lastSarary != null && lastSarary.Order != null)
|
||||
order = lastSarary.Order.Value + 1;
|
||||
// var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
// var order = 1;
|
||||
// if (lastSarary != null && lastSarary.Order != null)
|
||||
// order = lastSarary.Order.Value + 1;
|
||||
|
||||
var salary = new ProfileSalary
|
||||
{
|
||||
Order = order,
|
||||
Date = command.CommandAffectDate,
|
||||
Amount = lastSarary == null ? null : lastSarary.Amount,
|
||||
PositionSalaryAmount = lastSarary == null ? null : lastSarary.PositionSalaryAmount,
|
||||
MouthSalaryAmount = lastSarary == null ? null : lastSarary.MouthSalaryAmount,
|
||||
SalaryClass = "",
|
||||
SalaryRef = "คำสั่งให้ลูกจ้างออกจากราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
|
||||
// var salary = new ProfileSalary
|
||||
// {
|
||||
// Order = order,
|
||||
// Date = command.CommandAffectDate,
|
||||
// Amount = lastSarary == null ? null : lastSarary.Amount,
|
||||
// PositionSalaryAmount = lastSarary == null ? null : lastSarary.PositionSalaryAmount,
|
||||
// MouthSalaryAmount = lastSarary == null ? null : lastSarary.MouthSalaryAmount,
|
||||
// SalaryClass = "",
|
||||
// SalaryRef = "คำสั่งให้ลูกจ้างออกจากราชการ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
|
||||
|
||||
OcId = lastSarary == null ? null : lastSarary.OcId,
|
||||
// OcId = lastSarary == null ? null : lastSarary.OcId,
|
||||
|
||||
|
||||
PositionLevel = lastSarary == null ? null : lastSarary.PositionLevel,
|
||||
PositionLineId = lastSarary == null ? null : lastSarary.PositionLineId,
|
||||
PositionTypeId = lastSarary == null ? null : lastSarary.PositionTypeId,
|
||||
OrganizationShortNameId = lastSarary == null ? null : lastSarary.OrganizationShortNameId,
|
||||
PosNoId = lastSarary == null ? null : lastSarary.PosNoId,
|
||||
// PositionLevel = lastSarary == null ? null : lastSarary.PositionLevel,
|
||||
// PositionLineId = lastSarary == null ? null : lastSarary.PositionLineId,
|
||||
// PositionTypeId = lastSarary == null ? null : lastSarary.PositionTypeId,
|
||||
// OrganizationShortNameId = lastSarary == null ? null : lastSarary.OrganizationShortNameId,
|
||||
// PosNoId = lastSarary == null ? null : lastSarary.PosNoId,
|
||||
|
||||
CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||
RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||
CommandTypeName = command.CommandType.Name,
|
||||
// CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||
// RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||
// CommandTypeName = command.CommandType.Name,
|
||||
|
||||
|
||||
PositionEmployeeGroupId = null,
|
||||
PositionEmployeeLevelId = null,
|
||||
PositionEmployeePositionId = null,
|
||||
PositionEmployeePositionSideId = null,
|
||||
PosNoEmployee = "",
|
||||
// PositionEmployeeGroupId = null,
|
||||
// PositionEmployeeLevelId = null,
|
||||
// PositionEmployeePositionId = null,
|
||||
// PositionEmployeePositionSideId = null,
|
||||
// PosNoEmployee = "",
|
||||
|
||||
|
||||
//PositionPathSideId = lastSarary == null ? null : lastSarary.PositionPathSideId == null,
|
||||
PositionExecutiveId = lastSarary == null ? null : lastSarary.PositionExecutiveId,
|
||||
//PositionExecutiveSideId = lastSarary == null ? null : lastSarary.PositionExecutiveSideId,
|
||||
// //PositionPathSideId = lastSarary == null ? null : lastSarary.PositionPathSideId == null,
|
||||
// PositionExecutiveId = lastSarary == null ? null : lastSarary.PositionExecutiveId,
|
||||
// //PositionExecutiveSideId = lastSarary == null ? null : lastSarary.PositionExecutiveSideId,
|
||||
|
||||
IsActive = true,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
// IsActive = true,
|
||||
// CreatedAt = DateTime.Now,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
|
||||
};
|
||||
// };
|
||||
|
||||
if (lastSarary != null && lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId;
|
||||
if (lastSarary != null && lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId;
|
||||
// if (lastSarary != null && lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId;
|
||||
// if (lastSarary != null && lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId;
|
||||
|
||||
data.Profile.Salaries.Add(salary);
|
||||
// data.Profile.Salaries.Add(salary);
|
||||
|
||||
// update placementstatus
|
||||
// // update placementstatus
|
||||
data.Status = "DONE";
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
|
@ -7774,7 +7774,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คุณได้รับคำสั่งให้ลูกจ้างออกจากราชการ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = data.Profile.Id,
|
||||
KeycloakUserId = data.CreatedUserId,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
|
|
@ -7782,7 +7782,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var noti = new Notification
|
||||
{
|
||||
Body = $"คุณได้รับคำสั่งให้ลูกจ้างออกจากราชการ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = data.Profile.Id,
|
||||
KeycloakUserId = data.CreatedUserId,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
|
|
@ -7790,44 +7790,44 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// send cc noti inbox
|
||||
foreach (var cc in command.Deployments)
|
||||
{
|
||||
var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||
if (pf != null)
|
||||
{
|
||||
if (cc.IsSendInbox)
|
||||
{
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งให้ลูกจ้างออกจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
}
|
||||
// // send cc noti inbox
|
||||
// foreach (var cc in command.Deployments)
|
||||
// {
|
||||
// var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||
// if (pf != null)
|
||||
// {
|
||||
// if (cc.IsSendInbox)
|
||||
// {
|
||||
// var inbox = new Inbox
|
||||
// {
|
||||
// Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
// Body = $"คำสั่งให้ลูกจ้างออกจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
// ReceiverUserId = pf.Id,
|
||||
// Payload = payload_str,
|
||||
// };
|
||||
// _dbContext.Set<Inbox>().Add(inbox);
|
||||
// }
|
||||
|
||||
if (cc.IsSendMail)
|
||||
{
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งให้ลูกจ้างออกจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
// if (cc.IsSendMail)
|
||||
// {
|
||||
// // TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// // Send noti inbox and email
|
||||
// var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
// var body = $"คำสั่งให้ลูกจ้างออกจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
// _emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
// }
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งให้ลูกจ้างออกจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
}
|
||||
}
|
||||
// var noti = new Notification
|
||||
// {
|
||||
// Body = $"คำสั่งให้ลูกจ้างออกจากราชการ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
// ReceiverUserId = pf.Id,
|
||||
// Type = "LINK",
|
||||
// Payload = payload_str,
|
||||
// };
|
||||
// _dbContext.Set<Notification>().Add(noti);
|
||||
// }
|
||||
// }
|
||||
|
||||
// change command status
|
||||
var cmdStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(x => x.Sequence == 5);
|
||||
|
|
|
|||
|
|
@ -342,11 +342,10 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
||||
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
|
||||
p.Profile.FirstName,
|
||||
p.Profile.LastName,
|
||||
ProfileId = p.Profile.Id,
|
||||
p.prefix,
|
||||
p.firstName,
|
||||
p.lastName,
|
||||
p.profileId,
|
||||
p.Location,
|
||||
p.SendDate,
|
||||
p.ActiveDate,
|
||||
|
|
@ -378,12 +377,12 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
var _data = new
|
||||
{
|
||||
data.Id,
|
||||
data.ProfileId,
|
||||
data.Prefix,
|
||||
data.FirstName,
|
||||
data.LastName,
|
||||
data.profileId,
|
||||
data.prefix,
|
||||
data.firstName,
|
||||
data.lastName,
|
||||
data.Location,
|
||||
FullName = $"{data.Prefix}{data.FirstName} {data.LastName}",
|
||||
FullName = $"{data.prefix}{data.firstName} {data.lastName}",
|
||||
SendDate = string.IsNullOrEmpty(data.SendDate.ToString()) ? string.Empty : DateTime.Parse(data.SendDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
ActiveDate = string.IsNullOrEmpty(data.ActiveDate.ToString()) ? string.Empty : DateTime.Parse(data.ActiveDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
data.Reason,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
public Guid ReceiverUserId { get; set; } = Guid.Empty;
|
||||
|
||||
public string KeycloakUserId { get; set; }
|
||||
public string? KeycloakUserId { get; set; }
|
||||
|
||||
public string Type { get; set; } = "TEXT";
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace BMA.EHR.Domain.Models.Notifications
|
|||
[Comment("รหัสผู้รับข้อความ")]
|
||||
public Guid ReceiverUserId { get; set; }
|
||||
|
||||
public string KeycloakUserId { get; set; }
|
||||
public string? KeycloakUserId { get; set; }
|
||||
|
||||
[Column(TypeName = "text"), Comment("สิงที่แนบมาด้วย")]
|
||||
public string Payload { get; set; }
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace BMA.EHR.Domain.Models.Notifications
|
|||
[Comment("รหัสผู้รับข้อความ")]
|
||||
public Guid ReceiverUserId { get; set; }
|
||||
|
||||
public string KeycloakUserId { get; set; }
|
||||
public string? KeycloakUserId { get; set; }
|
||||
|
||||
[Required, Comment("ประเภทการแจ้งเตือน")]
|
||||
public string Type { get; set; }
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ namespace BMA.EHR.Domain.Models.Retirement
|
|||
public DateTime? ActiveDate { get; set; }
|
||||
[Comment("เหตุผลที่ลาออกจากราชการ")]
|
||||
public string? Reason { get; set; } = string.Empty;
|
||||
[Comment("Id ผู้ลาออก")]
|
||||
public Profile Profile { get; set; }
|
||||
// [Comment("Id ผู้ลาออก")]
|
||||
// public Profile Profile { get; set; }
|
||||
[Comment("สังกัด")]
|
||||
public string? OrganizationPositionOld { get; set; }
|
||||
[Comment("ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")]
|
||||
|
|
@ -37,8 +37,12 @@ namespace BMA.EHR.Domain.Models.Retirement
|
|||
public string? ApproveReason { get; set; }
|
||||
[Comment("เหตุผลไม่อนุมัติ")]
|
||||
public string? RejectReason { get; set; }
|
||||
[Comment("เหตุผลยกเลิก")]
|
||||
public string? CancelReason { get; set; }
|
||||
[Comment("สถานะการใช้งาน")]
|
||||
public bool IsActive { get; set; } = true;
|
||||
[Comment("สถานะไม่เป็นหนี้สหกรณ์")]
|
||||
public bool IsNoDebt { get; set; } = false;
|
||||
[Comment("สถานะยับยั้งผู้ดูแล")]
|
||||
public bool? OligarchReject { get; set; }
|
||||
[Comment("เหตุผลอนุมัติผู้ดูแล")]
|
||||
|
|
@ -57,7 +61,70 @@ namespace BMA.EHR.Domain.Models.Retirement
|
|||
public DateTime? CommanderRejectDate { get; set; }
|
||||
[Comment("หมายเหตุแนวนอน")]
|
||||
public string? RemarkHorizontal { get; set; }
|
||||
[Comment("สังกัดเดิม")]
|
||||
public string? OrganizationOld { get; set; }
|
||||
[Comment("ตำแหน่งเดิม")]
|
||||
public string? PositionOld { get; set; }
|
||||
|
||||
|
||||
|
||||
[Comment("profile Id")]
|
||||
public string? profileId { get; set; }
|
||||
[Comment("คำนำหน้า")]
|
||||
public string? prefix { get; set; }
|
||||
[Comment("ชื่อ")]
|
||||
public string? firstName { get; set; }
|
||||
[Comment("นามสกุล")]
|
||||
public string? lastName { get; set; }
|
||||
[Comment("เลขบัตรประชาชน")]
|
||||
public string? citizenId { get; set; }
|
||||
[Comment("ชื่อหน่วยงาน root")]
|
||||
public string? root { get; set; }
|
||||
[Comment("id หน่วยงาน root")]
|
||||
public string? rootId { get; set; }
|
||||
[Comment("ชื่อย่อหน่วยงาน root")]
|
||||
public string? rootShortName { get; set; }
|
||||
[Comment("ชื่อหน่วยงาน child1")]
|
||||
public string? child1 { get; set; }
|
||||
[Comment("id หน่วยงาน child1")]
|
||||
public string? child1Id { get; set; }
|
||||
[Comment("ชื่อย่อหน่วยงาน child1")]
|
||||
public string? child1ShortName { get; set; }
|
||||
[Comment("ชื่อหน่วยงาน child2")]
|
||||
public string? child2 { get; set; }
|
||||
[Comment("id หน่วยงาน child2")]
|
||||
public string? child2Id { get; set; }
|
||||
[Comment("ชื่อย่อหน่วยงาน child2")]
|
||||
public string? child2ShortName { get; set; }
|
||||
[Comment("ชื่อหน่วยงาน child3")]
|
||||
public string? child3 { get; set; }
|
||||
[Comment("id หน่วยงาน child3")]
|
||||
public string? child3Id { get; set; }
|
||||
[Comment("ชื่อย่อหน่วยงาน child3")]
|
||||
public string? child3ShortName { get; set; }
|
||||
[Comment("ชื่อหน่วยงาน child4")]
|
||||
public string? child4 { get; set; }
|
||||
[Comment("id หน่วยงาน child4")]
|
||||
public string? child4Id { get; set; }
|
||||
[Comment("ชื่อย่อหน่วยงาน child4")]
|
||||
public string? child4ShortName { get; set; }
|
||||
// [Comment("id revision")]
|
||||
// public string? orgRevisionId { get; set; }
|
||||
[Comment("เลขที่ตำแหน่ง")]
|
||||
public int? posMasterNo { get; set; }
|
||||
[Comment("ชื่อตำแหน่งในสายงาน")]
|
||||
public string? position { get; set; }
|
||||
[Comment("id ประเภทตำแหน่ง")]
|
||||
public string? posTypeId { get; set; }
|
||||
[Comment("ชื่อประเภทตำแหน่ง")]
|
||||
public string? posTypeName { get; set; }
|
||||
[Comment("id ระดับตำแหน่ง")]
|
||||
public string? posLevelId { get; set; }
|
||||
[Comment("ชื่อระดับตำแหน่ง")]
|
||||
public string? posLevelName { get; set; }
|
||||
|
||||
|
||||
public virtual List<RetirementResignDoc> RetirementResignDocs { get; set; } = new List<RetirementResignDoc>();
|
||||
public virtual List<RetirementResignDebtDoc> RetirementResignDebtDocs { get; set; } = new List<RetirementResignDebtDoc>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
15
BMA.EHR.Domain/Models/Retirement/RetirementResignDebtDoc.cs
Normal file
15
BMA.EHR.Domain/Models/Retirement/RetirementResignDebtDoc.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.Documents;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Retirement
|
||||
{
|
||||
public class RetirementResignDebtDoc : EntityBase
|
||||
{
|
||||
[Required, Comment("อ้างอิงรหัสเอกสาร")]
|
||||
public Document Document { get; set; }
|
||||
[Required, Comment("อ้างอิงรับย้าย")]
|
||||
public virtual RetirementResign RetirementResign { get; set; }
|
||||
}
|
||||
}
|
||||
17748
BMA.EHR.Infrastructure/Migrations/20240521092004_update table RetirementResigns add child.Designer.cs
generated
Normal file
17748
BMA.EHR.Infrastructure/Migrations/20240521092004_update table RetirementResigns add child.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,397 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableRetirementResignsaddchild : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RetirementResigns_Profiles_ProfileId",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_RetirementResigns_ProfileId",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "ProfileId",
|
||||
table: "RetirementResigns",
|
||||
newName: "profileId");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "profileId",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "profile Id",
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "char(36)")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "OrganizationOld",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "สังกัดเดิม")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "PositionOld",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ตำแหน่งเดิม")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "child1",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อหน่วยงาน child1")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "child1Id",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "id หน่วยงาน child1")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "child1ShortName",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อย่อหน่วยงาน child1")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "child2",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อหน่วยงาน child2")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "child2Id",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "id หน่วยงาน child2")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "child2ShortName",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อย่อหน่วยงาน child2")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "child3",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อหน่วยงาน child3")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "child3Id",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "id หน่วยงาน child3")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "child3ShortName",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อย่อหน่วยงาน child3")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "child4",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อหน่วยงาน child4")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "child4Id",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "id หน่วยงาน child4")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "child4ShortName",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อย่อหน่วยงาน child4")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "citizenId",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "เลขบัตรประชาชน")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "firstName",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "lastName",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "นามสกุล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "posLevelId",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "id ระดับตำแหน่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "posLevelName",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อระดับตำแหน่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "posMasterNo",
|
||||
table: "RetirementResigns",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
comment: "เลขที่ตำแหน่ง");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "posTypeId",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "id ประเภทตำแหน่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "posTypeName",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อประเภทตำแหน่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "position",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อตำแหน่งในสายงาน")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "prefix",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "คำนำหน้า")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "root",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อหน่วยงาน root")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "rootId",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "id หน่วยงาน root")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "rootShortName",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "ชื่อย่อหน่วยงาน root")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OrganizationOld",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PositionOld",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "child1",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "child1Id",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "child1ShortName",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "child2",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "child2Id",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "child2ShortName",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "child3",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "child3Id",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "child3ShortName",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "child4",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "child4Id",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "child4ShortName",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "citizenId",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "firstName",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "lastName",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "posLevelId",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "posLevelName",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "posMasterNo",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "posTypeId",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "posTypeName",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "position",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "prefix",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "root",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "rootId",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "rootShortName",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "profileId",
|
||||
table: "RetirementResigns",
|
||||
newName: "ProfileId");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "ProfileId",
|
||||
table: "RetirementResigns",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true,
|
||||
oldComment: "profile Id")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RetirementResigns_ProfileId",
|
||||
table: "RetirementResigns",
|
||||
column: "ProfileId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RetirementResigns_Profiles_ProfileId",
|
||||
table: "RetirementResigns",
|
||||
column: "ProfileId",
|
||||
principalTable: "Profiles",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
17746
BMA.EHR.Infrastructure/Migrations/20240521095836_update table RetirementResigns add child1.Designer.cs
generated
Normal file
17746
BMA.EHR.Infrastructure/Migrations/20240521095836_update table RetirementResigns add child1.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,74 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableRetirementResignsaddchild1 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "KeycloakUserId",
|
||||
table: "Notifications",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "KeycloakUserId",
|
||||
table: "Inboxes",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Notifications",
|
||||
keyColumn: "KeycloakUserId",
|
||||
keyValue: null,
|
||||
column: "KeycloakUserId",
|
||||
value: "");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "KeycloakUserId",
|
||||
table: "Notifications",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.UpdateData(
|
||||
table: "Inboxes",
|
||||
keyColumn: "KeycloakUserId",
|
||||
keyValue: null,
|
||||
column: "KeycloakUserId",
|
||||
value: "");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "KeycloakUserId",
|
||||
table: "Inboxes",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "longtext",
|
||||
oldNullable: true)
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
}
|
||||
}
|
||||
17837
BMA.EHR.Infrastructure/Migrations/20240521115054_update table RetirementResigns add debt.Designer.cs
generated
Normal file
17837
BMA.EHR.Infrastructure/Migrations/20240521115054_update table RetirementResigns add debt.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,92 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableRetirementResignsadddebt : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "CancelReason",
|
||||
table: "RetirementResigns",
|
||||
type: "longtext",
|
||||
nullable: true,
|
||||
comment: "เหตุผลยกเลิก")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsNoDebt",
|
||||
table: "RetirementResigns",
|
||||
type: "tinyint(1)",
|
||||
nullable: false,
|
||||
defaultValue: false,
|
||||
comment: "สถานะไม่เป็นหนี้สหกรณ์");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RetirementResignDebtDocs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
RetirementResignId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RetirementResignDebtDocs", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_RetirementResignDebtDocs_Documents_DocumentId",
|
||||
column: x => x.DocumentId,
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_RetirementResignDebtDocs_RetirementResigns_RetirementResignId",
|
||||
column: x => x.RetirementResignId,
|
||||
principalTable: "RetirementResigns",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RetirementResignDebtDocs_DocumentId",
|
||||
table: "RetirementResignDebtDocs",
|
||||
column: "DocumentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RetirementResignDebtDocs_RetirementResignId",
|
||||
table: "RetirementResignDebtDocs",
|
||||
column: "RetirementResignId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "RetirementResignDebtDocs");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CancelReason",
|
||||
table: "RetirementResigns");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsNoDebt",
|
||||
table: "RetirementResigns");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9251,7 +9251,6 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasComment("เปิดอ่านแล้วหรือยัง");
|
||||
|
||||
b.Property<string>("KeycloakUserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
|
|
@ -9443,7 +9442,6 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasComment("เปิดอ่านแล้วหรือยัง");
|
||||
|
||||
b.Property<string>("KeycloakUserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
|
|
@ -15486,6 +15484,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("longtext")
|
||||
.HasComment("เหตุผลอนุมัติ");
|
||||
|
||||
b.Property<string>("CancelReason")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("เหตุผลยกเลิก");
|
||||
|
||||
b.Property<string>("CommanderApproveReason")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("เหตุผลอนุมัติผู้บังคับบัญชา");
|
||||
|
|
@ -15525,6 +15527,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("สถานะการใช้งาน");
|
||||
|
||||
b.Property<bool>("IsNoDebt")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("สถานะไม่เป็นหนี้สหกรณ์");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
|
|
@ -15564,6 +15570,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("longtext")
|
||||
.HasComment("เหตุผลยับยั้งผู้ดูแล");
|
||||
|
||||
b.Property<string>("OrganizationOld")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("สังกัดเดิม");
|
||||
|
||||
b.Property<string>("OrganizationPositionOld")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("สังกัด");
|
||||
|
|
@ -15576,13 +15586,14 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("longtext")
|
||||
.HasComment("ข้อมูลหน่วยงานเดิม เลขที่");
|
||||
|
||||
b.Property<string>("PositionOld")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ตำแหน่งเดิม");
|
||||
|
||||
b.Property<string>("PositionTypeOld")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท");
|
||||
|
||||
b.Property<Guid>("ProfileId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("เหตุผลที่ลาออกจากราชการ");
|
||||
|
|
@ -15603,13 +15614,177 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnType("longtext")
|
||||
.HasComment("สถานะลาออก");
|
||||
|
||||
b.Property<string>("child1")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อหน่วยงาน child1");
|
||||
|
||||
b.Property<string>("child1Id")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("id หน่วยงาน child1");
|
||||
|
||||
b.Property<string>("child1ShortName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อย่อหน่วยงาน child1");
|
||||
|
||||
b.Property<string>("child2")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อหน่วยงาน child2");
|
||||
|
||||
b.Property<string>("child2Id")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("id หน่วยงาน child2");
|
||||
|
||||
b.Property<string>("child2ShortName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อย่อหน่วยงาน child2");
|
||||
|
||||
b.Property<string>("child3")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อหน่วยงาน child3");
|
||||
|
||||
b.Property<string>("child3Id")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("id หน่วยงาน child3");
|
||||
|
||||
b.Property<string>("child3ShortName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อย่อหน่วยงาน child3");
|
||||
|
||||
b.Property<string>("child4")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อหน่วยงาน child4");
|
||||
|
||||
b.Property<string>("child4Id")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("id หน่วยงาน child4");
|
||||
|
||||
b.Property<string>("child4ShortName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อย่อหน่วยงาน child4");
|
||||
|
||||
b.Property<string>("citizenId")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("เลขบัตรประชาชน");
|
||||
|
||||
b.Property<string>("firstName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อ");
|
||||
|
||||
b.Property<string>("lastName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("นามสกุล");
|
||||
|
||||
b.Property<string>("posLevelId")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("id ระดับตำแหน่ง");
|
||||
|
||||
b.Property<string>("posLevelName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อระดับตำแหน่ง");
|
||||
|
||||
b.Property<int?>("posMasterNo")
|
||||
.HasColumnType("int")
|
||||
.HasComment("เลขที่ตำแหน่ง");
|
||||
|
||||
b.Property<string>("posTypeId")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("id ประเภทตำแหน่ง");
|
||||
|
||||
b.Property<string>("posTypeName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อประเภทตำแหน่ง");
|
||||
|
||||
b.Property<string>("position")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อตำแหน่งในสายงาน");
|
||||
|
||||
b.Property<string>("prefix")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("คำนำหน้า");
|
||||
|
||||
b.Property<string>("profileId")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("profile Id");
|
||||
|
||||
b.Property<string>("root")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อหน่วยงาน root");
|
||||
|
||||
b.Property<string>("rootId")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("id หน่วยงาน root");
|
||||
|
||||
b.Property<string>("rootShortName")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อย่อหน่วยงาน root");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ProfileId");
|
||||
|
||||
b.ToTable("RetirementResigns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResignDebtDoc", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<Guid>("DocumentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<Guid>("RetirementResignId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("RetirementResignId");
|
||||
|
||||
b.ToTable("RetirementResignDebtDocs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResignDoc", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
|
@ -17342,15 +17517,23 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Navigation("RetirementResign");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResign", b =>
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResignDebtDoc", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProfileId")
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Profile");
|
||||
b.HasOne("BMA.EHR.Domain.Models.Retirement.RetirementResign", "RetirementResign")
|
||||
.WithMany("RetirementResignDebtDocs")
|
||||
.HasForeignKey("RetirementResignId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("RetirementResign");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResignDoc", b =>
|
||||
|
|
@ -17641,6 +17824,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementResign", b =>
|
||||
{
|
||||
b.Navigation("RetirementResignDebtDocs");
|
||||
|
||||
b.Navigation("RetirementResignDocs");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
|
|
|
|||
|
|
@ -332,6 +332,7 @@ namespace BMA.EHR.Infrastructure.Persistence
|
|||
public DbSet<RetirementDeceasedNoti> RetirementDeceasedNotis { get; set; }
|
||||
public DbSet<RetirementResign> RetirementResigns { get; set; }
|
||||
public DbSet<RetirementResignDoc> RetirementResignDocs { get; set; }
|
||||
public DbSet<RetirementResignDebtDoc> RetirementResignDebtDocs { get; set; }
|
||||
public DbSet<RetirementOut> RetirementOuts { get; set; }
|
||||
public DbSet<RetirementDischarge> RetirementDischarges { get; set; }
|
||||
public DbSet<RetirementExpulsion> RetirementExpulsions { get; set; }
|
||||
|
|
|
|||
|
|
@ -572,10 +572,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
(org.result.child2 == null ? "" : org.result.child2 + "/") +
|
||||
(org.result.child1 == null ? "" : org.result.child1 + "/") +
|
||||
(org.result.root == null ? "" : org.result.root + "/");
|
||||
retirementDeceased.RetirementDeceasedNotis.Add(retirementDeceasedNoti);
|
||||
}
|
||||
|
||||
retirementDeceased.RetirementDeceasedNotis.Add(retirementDeceasedNoti);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
|
|
@ -30,18 +31,21 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public RetirementResignController(RetirementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
|
@ -49,63 +53,64 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
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
|
||||
private List<string> GetOcNameFullPath(Guid id, bool showRoot = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ocList = new List<string>();
|
||||
// private List<string> GetOcNameFullPath(Guid id, bool showRoot = false)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var ocList = new List<string>();
|
||||
|
||||
var oc = (from o in _context.Organizations.Include(x => x.Parent).Include(x => x.OrganizationOrganization).Where(x => x.OrganizationOrganization != null).AsQueryable()
|
||||
join oc_name in _context.OrganizationOrganizations.AsQueryable() on o.OrganizationOrganization.Id equals oc_name.Id
|
||||
where o.Parent != null
|
||||
select new
|
||||
{
|
||||
Id = o.Id,
|
||||
Name = oc_name.Name,
|
||||
o.IsActive,
|
||||
o.Parent
|
||||
}).FirstOrDefault(x => x.Id == id && x.IsActive);
|
||||
// var oc = (from o in _context.Organizations.Include(x => x.Parent).Include(x => x.OrganizationOrganization).Where(x => x.OrganizationOrganization != null).AsQueryable()
|
||||
// join oc_name in _context.OrganizationOrganizations.AsQueryable() on o.OrganizationOrganization.Id equals oc_name.Id
|
||||
// where o.Parent != null
|
||||
// select new
|
||||
// {
|
||||
// Id = o.Id,
|
||||
// Name = oc_name.Name,
|
||||
// o.IsActive,
|
||||
// o.Parent
|
||||
// }).FirstOrDefault(x => x.Id == id && x.IsActive);
|
||||
|
||||
if (oc == null)
|
||||
return ocList;
|
||||
// if (oc == null)
|
||||
// return ocList;
|
||||
|
||||
ocList.Add(oc.Name);
|
||||
// ocList.Add(oc.Name);
|
||||
|
||||
if (oc.Parent?.Id != null)
|
||||
{
|
||||
ocList.AddRange(GetOcNameFullPath(oc.Parent.Id, showRoot));
|
||||
}
|
||||
// if (oc.Parent?.Id != null)
|
||||
// {
|
||||
// ocList.AddRange(GetOcNameFullPath(oc.Parent.Id, showRoot));
|
||||
// }
|
||||
|
||||
return ocList;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
private string FindOCFullPath(Guid id, bool showRoot = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ocList = GetOcNameFullPath(id, showRoot);
|
||||
var ret = String.Empty;
|
||||
foreach (var oc in ocList)
|
||||
{
|
||||
ret = oc + "/" + ret;
|
||||
}
|
||||
// return ocList;
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// throw;
|
||||
// }
|
||||
// }
|
||||
// private string FindOCFullPath(Guid id, bool showRoot = false)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var ocList = GetOcNameFullPath(id, showRoot);
|
||||
// var ret = String.Empty;
|
||||
// foreach (var oc in ocList)
|
||||
// {
|
||||
// ret = oc + "/" + ret;
|
||||
// }
|
||||
|
||||
if (ret.Length > 2)
|
||||
ret = ret.Substring(0, ret.Length - 1);
|
||||
// if (ret.Length > 2)
|
||||
// ret = ret.Substring(0, ret.Length - 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
// return ret;
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// throw;
|
||||
// }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// list รายการลาออกของ User
|
||||
|
|
@ -118,29 +123,38 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
[HttpGet("user")]
|
||||
public async Task<ActionResult<ResponseObject>> GetListByProfile()
|
||||
{
|
||||
var profile = await _context.Profiles
|
||||
.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId));
|
||||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
var apiUrl = $"{_configuration["API"]}org/profile/keycloak/position";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
var retirementResigns = await _context.RetirementResigns.AsQueryable()
|
||||
.Where(x => x.Profile == profile)
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
p.Location,
|
||||
p.SendDate,
|
||||
p.ActiveDate,
|
||||
p.Reason,
|
||||
p.ApproveReason,
|
||||
p.RejectReason,
|
||||
p.Status,
|
||||
p.IsActive,
|
||||
})
|
||||
.ToListAsync();
|
||||
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||
|
||||
return Success(retirementResigns);
|
||||
if (org == null || org.result == null)
|
||||
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||
|
||||
var retirementResigns = await _context.RetirementResigns.AsQueryable()
|
||||
.Where(x => x.profileId == org.result.profileId)
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
p.Location,
|
||||
p.SendDate,
|
||||
p.ActiveDate,
|
||||
p.Reason,
|
||||
p.ApproveReason,
|
||||
p.RejectReason,
|
||||
p.Status,
|
||||
p.IsActive,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return Success(retirementResigns);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -160,10 +174,10 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
ProfileId = p.Profile.Id,
|
||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
||||
p.Profile.FirstName,
|
||||
p.Profile.LastName,
|
||||
p.profileId,
|
||||
p.prefix,
|
||||
p.firstName,
|
||||
p.lastName,
|
||||
p.Location,
|
||||
p.SendDate,
|
||||
p.ActiveDate,
|
||||
|
|
@ -202,11 +216,10 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.Select(p => new
|
||||
{
|
||||
p.Id,
|
||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
||||
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
|
||||
p.Profile.FirstName,
|
||||
p.Profile.LastName,
|
||||
ProfileId = p.Profile.Id,
|
||||
p.prefix,
|
||||
p.firstName,
|
||||
p.lastName,
|
||||
p.profileId,
|
||||
p.Location,
|
||||
p.SendDate,
|
||||
p.ActiveDate,
|
||||
|
|
@ -230,8 +243,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
p.CommanderRejectReason,
|
||||
p.CommanderRejectDate,
|
||||
p.RemarkHorizontal,
|
||||
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
||||
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
||||
RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
RetirementResignDebtDocs = p.RetirementResignDebtDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
|
|
@ -243,18 +257,30 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
var _doc = new
|
||||
{
|
||||
FileName = doc.FileName,
|
||||
PathName = await _documentService.ImagesPath(doc.Id)
|
||||
PathName = await _documentService.ImagesPath(doc.Id),
|
||||
doc.Id,
|
||||
};
|
||||
retirementResignDocs.Add(_doc);
|
||||
}
|
||||
var retirementResignDebtDocs = new List<dynamic>();
|
||||
foreach (var doc in data.RetirementResignDebtDocs)
|
||||
{
|
||||
var _doc = new
|
||||
{
|
||||
FileName = doc.FileName,
|
||||
PathName = await _documentService.ImagesPath(doc.Id),
|
||||
doc.Id,
|
||||
};
|
||||
retirementResignDebtDocs.Add(_doc);
|
||||
}
|
||||
var _data = new
|
||||
{
|
||||
data.Id,
|
||||
data.ProfileId,
|
||||
data.Prefix,
|
||||
data.PrefixId,
|
||||
data.FirstName,
|
||||
data.LastName,
|
||||
data.profileId,
|
||||
data.prefix,
|
||||
// data.PrefixId,
|
||||
data.firstName,
|
||||
data.lastName,
|
||||
data.Location,
|
||||
data.SendDate,
|
||||
data.ActiveDate,
|
||||
|
|
@ -278,8 +304,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
data.CommanderRejectReason,
|
||||
data.CommanderRejectDate,
|
||||
data.RemarkHorizontal,
|
||||
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignDocs,
|
||||
DocDebts = retirementResignDebtDocs,
|
||||
};
|
||||
|
||||
return Success(_data);
|
||||
|
|
@ -296,29 +323,29 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
[HttpPost()]
|
||||
public async Task<ActionResult<ResponseObject>> Post([FromForm] RetirementResignRequest req)
|
||||
{
|
||||
var profile = await _context.Profiles
|
||||
.Include(x => x.PositionLevel)
|
||||
.Include(x => x.PositionType)
|
||||
.Include(x => x.PosNo)
|
||||
.Include(x => x.Salaries)
|
||||
.Include(x => x.Position)
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId));
|
||||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
// var profile = await _context.Profiles
|
||||
// .Include(x => x.PositionLevel)
|
||||
// .Include(x => x.PositionType)
|
||||
// .Include(x => x.PosNo)
|
||||
// .Include(x => x.Salaries)
|
||||
// .Include(x => x.Position)
|
||||
// .Include(x => x.Prefix)
|
||||
// .FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId));
|
||||
// if (profile == null)
|
||||
// return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
var retirementResign = new RetirementResign
|
||||
{
|
||||
Profile = profile,
|
||||
// Profile = profile,
|
||||
Location = req.Location,
|
||||
SendDate = req.SendDate,
|
||||
ActiveDate = req.ActiveDate,
|
||||
Reason = req.Reason,
|
||||
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
||||
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
||||
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
||||
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
|
||||
// AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
// PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
||||
// PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
||||
// PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
||||
// OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
|
||||
Status = "WAITTING",
|
||||
IsActive = true,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
|
|
@ -328,6 +355,58 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
|
||||
var apiUrl = $"{_configuration["API"]}org/profile/keycloak/position";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
||||
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||
|
||||
if (org == null || org.result == null)
|
||||
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||
|
||||
retirementResign.profileId = org.result.profileId;
|
||||
retirementResign.prefix = org.result.prefix;
|
||||
retirementResign.firstName = org.result.firstName;
|
||||
retirementResign.lastName = org.result.lastName;
|
||||
retirementResign.citizenId = org.result.citizenId;
|
||||
retirementResign.root = org.result.root;
|
||||
retirementResign.rootId = org.result.rootId;
|
||||
retirementResign.rootShortName = org.result.rootShortName;
|
||||
retirementResign.child1 = org.result.child1;
|
||||
retirementResign.child1Id = org.result.child1Id;
|
||||
retirementResign.child1ShortName = org.result.child1ShortName;
|
||||
retirementResign.child2 = org.result.child2;
|
||||
retirementResign.child2Id = org.result.child2Id;
|
||||
retirementResign.child2ShortName = org.result.child2ShortName;
|
||||
retirementResign.child3 = org.result.child3;
|
||||
retirementResign.child3Id = org.result.child3Id;
|
||||
retirementResign.child3ShortName = org.result.child3ShortName;
|
||||
retirementResign.child4 = org.result.child4;
|
||||
retirementResign.child4Id = org.result.child4Id;
|
||||
retirementResign.child4ShortName = org.result.child4ShortName;
|
||||
retirementResign.posMasterNo = org.result.posMasterNo;
|
||||
retirementResign.position = org.result.position;
|
||||
retirementResign.posTypeId = org.result.posTypeId;
|
||||
retirementResign.posTypeName = org.result.posTypeName;
|
||||
retirementResign.posLevelId = org.result.posLevelId;
|
||||
retirementResign.posLevelName = org.result.posLevelName;
|
||||
|
||||
retirementResign.PositionOld = org.result.position;
|
||||
retirementResign.PositionLevelOld = org.result.posLevelName;
|
||||
retirementResign.PositionTypeOld = org.result.posTypeName;
|
||||
retirementResign.PositionNumberOld = org.result.nodeShortName + org.result.posMasterNo;
|
||||
retirementResign.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + "/") +
|
||||
(org.result.child3 == null ? "" : org.result.child3 + "/") +
|
||||
(org.result.child2 == null ? "" : org.result.child2 + "/") +
|
||||
(org.result.child1 == null ? "" : org.result.child1 + "/") +
|
||||
(org.result.root == null ? "" : org.result.root + "/");
|
||||
retirementResign.OrganizationPositionOld = org.result.position + "-" + retirementResign.OrganizationOld;
|
||||
}
|
||||
await _context.RetirementResigns.AddAsync(retirementResign);
|
||||
await _context.SaveChangesAsync();
|
||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
|
|
@ -358,8 +437,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dbc953-6268-4e2c-80a3-aca65eedc6d0"),
|
||||
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นขอลาออก",
|
||||
$"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นขอลาออก",
|
||||
$"{retirementResign.prefix}{retirementResign.firstName} {retirementResign.lastName} ได้ทำการยื่นขอลาออก",
|
||||
$"{retirementResign.prefix}{retirementResign.firstName} {retirementResign.lastName} ได้ทำการยื่นขอลาออก",
|
||||
"",
|
||||
true
|
||||
);
|
||||
|
|
@ -402,6 +481,108 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขรายการตรวจสอบเงื่อนไขต่าง ๆ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("debt/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> Debt([FromForm] RetirementResignDebtRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResigns.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
updated.IsNoDebt = req.IsNoDebt;
|
||||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
|
||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
{
|
||||
foreach (var file in Request.Form.Files)
|
||||
{
|
||||
var fileExtension = Path.GetExtension(file.FileName);
|
||||
|
||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
var _doc = await _context.Documents.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||
if (_doc != null)
|
||||
{
|
||||
var retirementResignDebtDoc = new RetirementResignDebtDoc
|
||||
{
|
||||
RetirementResign = updated,
|
||||
Document = _doc,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.RetirementResignDebtDocs.AddAsync(retirementResignDebtDoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขรายการตรวจสอบเงื่อนไขต่าง ๆ
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpDelete("debt/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> DebtDelete(Guid id)
|
||||
{
|
||||
var deleted = await _context.RetirementResignDocs.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Document.Id == id);
|
||||
if (deleted == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
_context.RetirementResignDocs.Remove(deleted);
|
||||
|
||||
var _deleted = await _context.Documents.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (_deleted == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
_context.Documents.Remove(_deleted);
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ยกเลิกลาออก
|
||||
/// </summary>
|
||||
/// <param name="id">Id ลาออก</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("cancel/{id:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> Cancel([FromBody] RetirementReasonRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResigns.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
updated.Status = "CANCEL";
|
||||
updated.CancelReason = req.Reason;
|
||||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ลบลาออก
|
||||
/// </summary>
|
||||
|
|
@ -439,7 +620,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public async Task<ActionResult<ResponseObject>> AdminConfirm([FromBody] RetirementReasonRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResigns
|
||||
.Include(x => x.Profile)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
|
@ -467,7 +647,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public async Task<ActionResult<ResponseObject>> AdminReject([FromBody] RetirementReasonRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResigns
|
||||
.Include(x => x.Profile)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
|
@ -495,8 +674,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public async Task<ActionResult<ResponseObject>> CommanderConfirm([FromBody] RetirementReasonRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResigns
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
|
@ -509,15 +686,15 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
|
||||
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
"",
|
||||
true
|
||||
);
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dbc953-61ac-47eb-82d7-0e72df7669b5"),
|
||||
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
"",
|
||||
true
|
||||
);
|
||||
|
|
@ -539,8 +716,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public async Task<ActionResult<ResponseObject>> CommanderReject([FromBody] RetirementReasonDateRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResigns
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
|
@ -555,15 +730,15 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
|
||||
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
"",
|
||||
true
|
||||
);
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dbc953-61ac-47eb-82d7-0e72df7669b5"),
|
||||
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
"",
|
||||
true
|
||||
);
|
||||
|
|
@ -584,8 +759,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public async Task<ActionResult<ResponseObject>> OligarchConfirm([FromBody] RetirementReasonRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResigns
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
|
@ -596,10 +769,10 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
updated.Profile.Id,
|
||||
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
await _repositoryNoti.PushNotificationAsyncV2(
|
||||
updated.CreatedUserId,
|
||||
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
"",
|
||||
true
|
||||
);
|
||||
|
|
@ -621,8 +794,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
public async Task<ActionResult<ResponseObject>> OligarchReject([FromBody] RetirementReasonDateRequest req, Guid id)
|
||||
{
|
||||
var updated = await _context.RetirementResigns
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||
|
|
@ -635,10 +806,10 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
updated.Profile.Id,
|
||||
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้มีอำนาจ",
|
||||
$"คำขอลาออกขอ {updated.Profile.Prefix?.Name}{updated.Profile.FirstName} {updated.Profile.LastName} ถูกยับยั้งจากผู้มีอำนาจ",
|
||||
await _repositoryNoti.PushNotificationAsyncV2(
|
||||
updated.CreatedUserId,
|
||||
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
|
||||
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
|
||||
"",
|
||||
true
|
||||
);
|
||||
|
|
@ -691,7 +862,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.Select(p => new
|
||||
{
|
||||
Id = p.Id,
|
||||
Fullname = $"{(p.RetirementResign.Profile.Prefix == null ? null : p.RetirementResign.Profile.Prefix.Name)}{p.RetirementResign.Profile.FirstName} {p.RetirementResign.Profile.LastName}",
|
||||
Fullname = $"{p.RetirementResign.prefix}{p.RetirementResign.firstName} {p.RetirementResign.lastName}",
|
||||
ReasonWork = p.ReasonWork == null ? p.ReasonWork : Newtonsoft.Json.JsonConvert.DeserializeObject(p.ReasonWork),
|
||||
ReasonWorkOther = p.ReasonWorkOther,
|
||||
TimeThink = p.TimeThink,
|
||||
|
|
@ -733,13 +904,12 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.Select(p => new
|
||||
{
|
||||
Id = p.Id,
|
||||
PrefixId = p.RetirementResign.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.RetirementResign.Profile.Prefix.Id,
|
||||
Position = p.RetirementResign.Profile.Position == null ? null : p.RetirementResign.Profile.Position.Name,
|
||||
PositionLevel = p.RetirementResign.Profile.PositionLevel == null ? null : p.RetirementResign.Profile.PositionLevel.Name,
|
||||
Org = p.RetirementResign.Profile.OcId == null ? null : p.RetirementResign.Profile.OcId,
|
||||
Fullname = $"{(p.RetirementResign.Profile.Prefix == null ? null : p.RetirementResign.Profile.Prefix.Name)}{p.RetirementResign.Profile.FirstName} {p.RetirementResign.Profile.LastName}",
|
||||
Prefix = p.RetirementResign.Profile.Prefix == null ? null : p.RetirementResign.Profile.Prefix.Name,
|
||||
Avatar = p.RetirementResign.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.RetirementResign.Profile.Avatar.Id,
|
||||
Prefix = p.RetirementResign.prefix,
|
||||
Position = p.RetirementResign.position,
|
||||
PositionLevel = p.RetirementResign.posLevelName,
|
||||
Org = p.RetirementResign.OrganizationOld,
|
||||
Fullname = $"{p.RetirementResign.prefix}{p.RetirementResign.firstName} {p.RetirementResign.lastName}",
|
||||
// Avatar = p.RetirementResign.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.RetirementResign.Profile.Avatar.Id,
|
||||
ReasonWork = p.ReasonWork == null ? p.ReasonWork : Newtonsoft.Json.JsonConvert.DeserializeObject(p.ReasonWork),
|
||||
ReasonWorkOther = p.ReasonWorkOther,
|
||||
TimeThink = p.TimeThink,
|
||||
|
|
@ -777,51 +947,51 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(GlobalMessages.RetirementQuestionNotFound, 404);
|
||||
var _data = new
|
||||
{
|
||||
data.Id,
|
||||
data.PrefixId,
|
||||
data.Position,
|
||||
data.PositionLevel,
|
||||
Org = data.Org == null ? null : FindOCFullPath(data.Org.Value, true),
|
||||
data.Fullname,
|
||||
data.Prefix,
|
||||
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
data.ReasonWork,
|
||||
data.ReasonWorkOther,
|
||||
data.TimeThink,
|
||||
data.ExitFactor,
|
||||
data.ExitFactorOther,
|
||||
data.Adjust,
|
||||
data.AdjustOther,
|
||||
data.RealReason,
|
||||
data.NotExitFactor,
|
||||
data.Havejob,
|
||||
data.HavejobReason,
|
||||
data.SuggestFriends,
|
||||
data.SuggestFriendsReason,
|
||||
data.FutureWork,
|
||||
data.FutureWorkReason,
|
||||
data.Suggestion,
|
||||
data.AppointDate,
|
||||
data.OrganizationPositionOld,
|
||||
data.LastUpdatedAt,
|
||||
data.CreatedAt,
|
||||
data.Score1,
|
||||
data.Score2,
|
||||
data.Score3,
|
||||
data.Score4,
|
||||
data.Score5,
|
||||
data.Score6,
|
||||
data.Score7,
|
||||
data.Score8,
|
||||
data.Score9,
|
||||
data.Score10,
|
||||
data.ScoreTotal,
|
||||
data.Comment,
|
||||
};
|
||||
// var _data = new
|
||||
// {
|
||||
// data.Id,
|
||||
// // data.PrefixId,
|
||||
// data.Position,
|
||||
// data.PositionLevel,
|
||||
// data.Org,
|
||||
// data.Fullname,
|
||||
// data.Prefix,
|
||||
// // Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
// data.ReasonWork,
|
||||
// data.ReasonWorkOther,
|
||||
// data.TimeThink,
|
||||
// data.ExitFactor,
|
||||
// data.ExitFactorOther,
|
||||
// data.Adjust,
|
||||
// data.AdjustOther,
|
||||
// data.RealReason,
|
||||
// data.NotExitFactor,
|
||||
// data.Havejob,
|
||||
// data.HavejobReason,
|
||||
// data.SuggestFriends,
|
||||
// data.SuggestFriendsReason,
|
||||
// data.FutureWork,
|
||||
// data.FutureWorkReason,
|
||||
// data.Suggestion,
|
||||
// data.AppointDate,
|
||||
// data.OrganizationPositionOld,
|
||||
// data.LastUpdatedAt,
|
||||
// data.CreatedAt,
|
||||
// data.Score1,
|
||||
// data.Score2,
|
||||
// data.Score3,
|
||||
// data.Score4,
|
||||
// data.Score5,
|
||||
// data.Score6,
|
||||
// data.Score7,
|
||||
// data.Score8,
|
||||
// data.Score9,
|
||||
// data.Score10,
|
||||
// data.ScoreTotal,
|
||||
// data.Comment,
|
||||
// };
|
||||
|
||||
return Success(_data);
|
||||
return Success(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -996,7 +1166,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
{
|
||||
var uppdated = await _context.RetirementQuestions.AsQueryable()
|
||||
.Include(x => x.RetirementResign)
|
||||
.ThenInclude(x => x.Profile)
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (uppdated == null)
|
||||
return Error(GlobalMessages.RetirementQuestionNotFound);
|
||||
|
|
@ -1005,8 +1174,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
uppdated.LastUpdatedAt = DateTime.Now;
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
uppdated.RetirementResign.Profile.Id,
|
||||
await _repositoryNoti.PushNotificationAsyncV2(
|
||||
uppdated.RetirementResign.CreatedUserId,
|
||||
$"การนัดสัมภาษณ์เหตุผลการลาออก {req.AppointDate.ToThaiFullDate()}",
|
||||
$"การนัดสัมภาษณ์เหตุผลการลาออก {req.AppointDate.ToThaiFullDate()}",
|
||||
"",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Retirement.Service.Requests
|
||||
{
|
||||
public class RetirementResignDebtRequest
|
||||
{
|
||||
public bool IsNoDebt { get; set; }
|
||||
public List<FormFile>? File { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue