แก้ขอโอนกับทะเบียนใหม่

This commit is contained in:
Kittapath 2024-05-17 18:12:45 +07:00
parent 94c43e5479
commit 2a17eff17d
10 changed files with 18654 additions and 347 deletions

View file

@ -1018,12 +1018,10 @@ namespace BMA.EHR.Application.Repositories.Commands
// 2. Query
var appointPeople = await _dbContext.Set<PlacementTransfer>()
.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 => !otherCommandReceivers.Contains(x.citizenId))
.Where(x => x.Status.Trim().ToUpper() == "REPORT")
.OrderBy(x => x.Profile!.CitizenId)
.OrderBy(x => x.citizenId)
.ToListAsync();
// 3. Create new Record
@ -1033,10 +1031,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,
};
@ -5633,154 +5631,150 @@ namespace BMA.EHR.Application.Repositories.Commands
foreach (var recv in command.Receivers)
{
var data = await _dbContext.Set<PlacementTransfer>()
.Include(x => x.Profile)
.ThenInclude(x => x.Salaries)
.Include(x => x.Profile)
.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.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.Id);
// if (profilePosition != null)
// _dbContext.Set<ProfilePosition>().Remove(profilePosition);
// update placementstatus
//data.Status = "DONE";
// // update placementstatus
data.Status = "DONE";
await _dbContext.SaveChangesAsync();
// await _dbContext.SaveChangesAsync();
// 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");
// // 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 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 = data.Id,
Payload = payload_str,
};
_dbContext.Set<Inbox>().Add(inbox);
// 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 = data.Id,
// Payload = payload_str,
// };
// _dbContext.Set<Inbox>().Add(inbox);
var noti = new Notification
{
Body = $"คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
ReceiverUserId = data.Id,
Type = "LINK",
Payload = payload_str,
};
_dbContext.Set<Notification>().Add(noti);
await _dbContext.SaveChangesAsync();
// var noti = new Notification
// {
// Body = $"คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
// ReceiverUserId = data.Id,
// Type = "LINK",
// Payload = payload_str,
// };
// _dbContext.Set<Notification>().Add(noti);
// 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);
}
// 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);

View file

@ -32,19 +32,13 @@ namespace BMA.EHR.Application.Repositories.Reports
public async Task<dynamic> GetData1Transfer(Guid id)
{
var data = await _dbContext.Set<PlacementTransfer>().AsQueryable()
.Include(x => x.Profile)
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
var profile = await _dbContext.Set<Profile>().AsQueryable()
.Include(x => x.Prefix)
.Where(x => x.Id == data.Profile.Id).FirstOrDefaultAsync();
var prefix = string.IsNullOrEmpty(profile.Prefix.Name) ? string.Empty : profile.Prefix.Name;
return new
{
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
Name = $"{prefix}{data.Profile.FirstName} {data.Profile.LastName}",
Name = $"{data.prefix}{data.firstName} {data.lastName}",
};
}
#endregion
@ -53,20 +47,14 @@ namespace BMA.EHR.Application.Repositories.Reports
public async Task<dynamic> GetData2Transfer(Guid id)
{
var data = await _dbContext.Set<PlacementTransfer>().AsQueryable()
.Include(x => x.Profile)
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
var profile = await _dbContext.Set<Profile>().AsQueryable()
.Include(x => x.Prefix)
.Where(x => x.Id == data.Profile.Id).FirstOrDefaultAsync();
var prefix = string.IsNullOrEmpty(profile.Prefix.Name) ? string.Empty : profile.Prefix.Name;
return new
{
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
Subject = $"ข้าราชการกรุงเทพมหานครสามัญขอโอน",
Name = $"{prefix}{data.Profile.FirstName} {data.Profile.LastName}",
Name = $"{data.prefix}{data.firstName} {data.lastName}",
};
}
#endregion
@ -75,20 +63,13 @@ namespace BMA.EHR.Application.Repositories.Reports
public async Task<dynamic> GetData3Transfer(Guid id)
{
var data = await _dbContext.Set<PlacementTransfer>().AsQueryable()
.Include(x => x.Profile)
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
var profile = await _dbContext.Set<Profile>().AsQueryable()
.Include(x => x.Prefix)
.Where(x => x.Id == data.Profile.Id).FirstOrDefaultAsync();
var prefix = string.IsNullOrEmpty(profile.Prefix.Name) ? string.Empty : profile.Prefix.Name;
return new
{
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
Subject = $"ข้าราชการขอโอน",
Name = $"{prefix}{data.Profile.FirstName} {data.Profile.LastName}",
Name = $"{data.prefix}{data.firstName} {data.lastName}",
};
}
#endregion
@ -97,15 +78,9 @@ namespace BMA.EHR.Application.Repositories.Reports
public async Task<dynamic> GetData4Transfer(Guid id)
{
var data = await _dbContext.Set<PlacementTransfer>().AsQueryable()
.Include(x => x.Profile)
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
var profile = await _dbContext.Set<Profile>().AsQueryable()
.Include(x => x.Prefix)
.Where(x => x.Id == data.Profile.Id).FirstOrDefaultAsync();
var prefix = string.IsNullOrEmpty(profile.Prefix.Name) ? string.Empty : profile.Prefix.Name;
return new
{
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
@ -113,9 +88,9 @@ namespace BMA.EHR.Application.Repositories.Reports
Subject2 = $"ตรวจสอบหนี้สิน และภาระผูกพันกับกรุงเทพมหานครของข้าราชการ",
Subject3 = $"ตรวจสอบหนี้สินและภาระผูกพันของข้าราชการ",
Location = $"สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร 173 ถนนดินสอ กทม. 10200",
Name = $"{prefix}{data.Profile.FirstName} {data.Profile.LastName}",
Position = $"{data.Profile.Position}",
OrganizationOrganization = $"{data.Profile.OrganizationOrganization}",
Name = $"{data.prefix}{data.firstName} {data.lastName}",
Position = $"{data.position}",
OrganizationOrganization = $"{data.Organization}",
};
}
#endregion
@ -124,15 +99,9 @@ namespace BMA.EHR.Application.Repositories.Reports
public async Task<dynamic> GetData5Transfer(Guid id)
{
var data = await _dbContext.Set<PlacementTransfer>().AsQueryable()
.Include(x => x.Profile)
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
var profile = await _dbContext.Set<Profile>().AsQueryable()
.Include(x => x.Prefix)
.Where(x => x.Id == data.Profile.Id).FirstOrDefaultAsync();
var prefix = string.IsNullOrEmpty(profile.Prefix.Name) ? string.Empty : profile.Prefix.Name;
return new
{
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
@ -140,9 +109,9 @@ namespace BMA.EHR.Application.Repositories.Reports
Subject2 = $"ตรวจสอบพฤติการณ์ทางวินัย และภาระหนี้สิน (เงินกู้สวัสดิการข้าราชการ) ของข้าราชการ",
Subject3 = $"ตรวจสอบภาระผูกพันกับกรุงเทพมหานครเกี่ยวกับการลาศึกษา อบรม ของข้าราชการ",
Location = $"สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร 173 ถนนดินสอ กทม. 10200",
Name = $"{prefix}{data.Profile.FirstName} {data.Profile.LastName}",
Position = $"{data.Profile.Position}",
OrganizationOrganization = $"{data.Profile.OrganizationOrganization}",
Name = $"{data.prefix}{data.firstName} {data.lastName}",
Position = $"{data.position}",
OrganizationOrganization = $"{data.Organization}",
};
}
#endregion
@ -151,15 +120,9 @@ namespace BMA.EHR.Application.Repositories.Reports
public async Task<dynamic> GetData6Transfer(Guid id)
{
var data = await _dbContext.Set<PlacementTransfer>().AsQueryable()
.Include(x => x.Profile)
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
var profile = await _dbContext.Set<Profile>().AsQueryable()
.Include(x => x.Prefix)
.Where(x => x.Id == data.Profile.Id).FirstOrDefaultAsync();
var prefix = string.IsNullOrEmpty(profile.Prefix.Name) ? string.Empty : profile.Prefix.Name;
return new
{
CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM")).ToThaiFullDate().ToString().ToThaiNumber().Remove(0, 15),
@ -169,9 +132,9 @@ namespace BMA.EHR.Application.Repositories.Reports
Subject4 = $"ตรวจสอบหนี้สิน และภาระผูกพันกับกรุงเทพมหานครของข้าราชการ",
Subject5 = $"ตรวจสอบหนี้สินและภาระผูกพันของข้าราชการ",
Location = $"สำนักงานคณะกรรมการข้าราชการกรุงเทพมหานคร 173 ถนนดินสอ กทม. 10200",
Name = $"{prefix}{data.Profile.FirstName} {data.Profile.LastName}",
Position = $"{data.Profile.Position}",
OrganizationOrganization = $"{data.Profile.OrganizationOrganization}",
Name = $"{data.prefix}{data.firstName} {data.lastName}",
Position = $"{data.position}",
OrganizationOrganization = $"{data.Organization}",
};
}
#endregion

View file

@ -29,8 +29,8 @@ namespace BMA.EHR.Domain.Models.Placement
public string? OrganizationPositionOld { get; set; }
[Comment("สังกัดเดิม")]
public string? OrganizationOld { get; set; }
[Comment("ตำแหน่งเดิม")]
public string? PositionOld { get; set; }
// [Comment("ตำแหน่งเดิม")]
// public string? PositionOld { get; set; }
[Comment("ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")]
public string? PositionTypeOld { get; set; }
[Comment("ข้อมูลหน่วยงานเดิม ระดับ")]

View file

@ -9,14 +9,16 @@ namespace BMA.EHR.Domain.Models.Placement
{
public class PlacementTransfer : EntityBase
{
[Required, Comment("Id User")]
public Profile Profile { get; set; }
[Comment("หน่วยงานที่ขอโอนไป")]
[Comment("หน่วยงานที่ส่งตัวกลับไป")]
public string? Organization { get; set; } = string.Empty;
[Comment("เหตุผล")]
public string? Reason { get; set; } = string.Empty;
[Comment("สังกัด")]
public string? OrganizationPositionOld { get; set; }
[Comment("สังกัดเดิม")]
public string? OrganizationOld { get; set; }
[Comment("ตำแหน่งเดิม")]
public string? PositionOld { get; set; }
[Comment("ตั้งแต่วันที่")]
public DateTime? Date { get; set; }
[Comment("ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")]
@ -31,6 +33,61 @@ namespace BMA.EHR.Domain.Models.Placement
public string Status { get; set; } = "WAITTING";
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
[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<PlacementTransferDoc> PlacementTransferDocs { get; set; } = new List<PlacementTransferDoc>();
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,435 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableplacementtranAddchild : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PlacementTransfers_Profiles_ProfileId",
table: "PlacementTransfers");
migrationBuilder.DropIndex(
name: "IX_PlacementTransfers_ProfileId",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "PositionOld",
table: "PlacementAppointments");
migrationBuilder.RenameColumn(
name: "ProfileId",
table: "PlacementTransfers",
newName: "profileId");
migrationBuilder.AlterColumn<string>(
name: "profileId",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "profile Id",
oldClrType: typeof(Guid),
oldType: "char(36)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<string>(
name: "Organization",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "หน่วยงานที่ส่งตัวกลับไป",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "หน่วยงานที่ขอโอนไป")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OrganizationOld",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "สังกัดเดิม")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PositionOld",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ตำแหน่งเดิม")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child1",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน child1")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child1Id",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child1")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child1ShortName",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน child1")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child2",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน child2")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child2Id",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child2")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child2ShortName",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน child2")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child3",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน child3")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child3Id",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child3")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child3ShortName",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน child3")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child4",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน child4")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child4Id",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน child4")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "child4ShortName",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน child4")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "citizenId",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "เลขบัตรประชาชน")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "firstName",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "lastName",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "นามสกุล")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posLevelId",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "id ระดับตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posLevelName",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อระดับตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "posMasterNo",
table: "PlacementTransfers",
type: "int",
nullable: true,
comment: "เลขที่ตำแหน่ง");
migrationBuilder.AddColumn<string>(
name: "posTypeId",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "id ประเภทตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "posTypeName",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อประเภทตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "position",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อตำแหน่งในสายงาน")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "prefix",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "คำนำหน้า")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "root",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน root")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "rootId",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "id หน่วยงาน root")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "rootShortName",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "ชื่อย่อหน่วยงาน root")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "OrganizationOld",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "PositionOld",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "child1",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "child1Id",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "child1ShortName",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "child2",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "child2Id",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "child2ShortName",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "child3",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "child3Id",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "child3ShortName",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "child4",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "child4Id",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "child4ShortName",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "citizenId",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "firstName",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "lastName",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "posLevelId",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "posLevelName",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "posMasterNo",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "posTypeId",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "posTypeName",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "position",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "prefix",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "root",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "rootId",
table: "PlacementTransfers");
migrationBuilder.DropColumn(
name: "rootShortName",
table: "PlacementTransfers");
migrationBuilder.RenameColumn(
name: "profileId",
table: "PlacementTransfers",
newName: "ProfileId");
migrationBuilder.AlterColumn<Guid>(
name: "ProfileId",
table: "PlacementTransfers",
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.AlterColumn<string>(
name: "Organization",
table: "PlacementTransfers",
type: "longtext",
nullable: true,
comment: "หน่วยงานที่ขอโอนไป",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "หน่วยงานที่ส่งตัวกลับไป")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PositionOld",
table: "PlacementAppointments",
type: "longtext",
nullable: true,
comment: "ตำแหน่งเดิม")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_PlacementTransfers_ProfileId",
table: "PlacementTransfers",
column: "ProfileId");
migrationBuilder.AddForeignKey(
name: "FK_PlacementTransfers_Profiles_ProfileId",
table: "PlacementTransfers",
column: "ProfileId",
principalTable: "Profiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View file

@ -11155,10 +11155,6 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("ข้อมูลหน่วยงานเดิม เลขที่");
b.Property<string>("PositionOld")
.HasColumnType("longtext")
.HasComment("ตำแหน่งเดิม");
b.Property<string>("PositionTypeOld")
.HasColumnType("longtext")
.HasComment("ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท");
@ -13522,7 +13518,11 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Property<string>("Organization")
.HasColumnType("longtext")
.HasComment("หน่วยงานที่ขอโอนไป");
.HasComment("หน่วยงานที่ส่งตัวกลับไป");
b.Property<string>("OrganizationOld")
.HasColumnType("longtext")
.HasComment("สังกัดเดิม");
b.Property<string>("OrganizationPositionOld")
.HasColumnType("longtext")
@ -13536,13 +13536,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("เหตุผล");
@ -13552,9 +13553,111 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("สถานะคำขอ");
b.HasKey("Id");
b.Property<string>("child1")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน child1");
b.HasIndex("ProfileId");
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.ToTable("PlacementTransfers");
});
@ -17070,17 +17173,6 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("PlacementRelocation");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementTransfer", b =>
{
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
.WithMany()
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Profile");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementTransferDoc", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")

View file

@ -146,7 +146,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.AmountOld,
p.OrganizationOld,
p.posmasterId,
p.PositionOld,
p.positionOld,
p.CreatedAt,
p.typeCommand,
})
@ -241,7 +241,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.PositionDate,
p.AmountOld,
p.OrganizationOld,
p.PositionOld,
p.positionOld,
// PlacementAppointmentDocs = p.PlacementAppointmentDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
p.typeCommand,
p.posmasterId,
@ -336,7 +336,7 @@ namespace BMA.EHR.Placement.Service.Controllers
data.PositionDate,
data.AmountOld,
data.OrganizationOld,
data.PositionOld,
data.positionOld,
// Docs = placementAppointmentDocs,
data.typeCommand,
data.posmasterId,
@ -430,7 +430,7 @@ namespace BMA.EHR.Placement.Service.Controllers
// placementAppointment.EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}";
// placementAppointment.AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount;
placementAppointment.PositionOld = org.result.position;
placementAppointment.positionOld = org.result.position;
placementAppointment.PositionLevelOld = org.result.posLevelName;
placementAppointment.PositionTypeOld = org.result.posTypeName;
placementAppointment.PositionNumberOld = org.result.nodeShortName + org.result.posMasterNo;

View file

@ -146,7 +146,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.AmountOld,
p.OrganizationOld,
p.posmasterId,
p.PositionOld,
p.positionOld,
p.CreatedAt,
p.typeCommand,
})
@ -239,7 +239,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.PositionDate,
p.AmountOld,
p.OrganizationOld,
p.PositionOld,
p.positionOld,
// PlacementAppointmentDocs = p.PlacementAppointmentDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
p.typeCommand,
})
@ -333,7 +333,7 @@ namespace BMA.EHR.Placement.Service.Controllers
data.PositionDate,
data.AmountOld,
data.OrganizationOld,
data.PositionOld,
data.positionOld,
// Docs = placementAppointmentDocs,
data.typeCommand,
};
@ -426,7 +426,7 @@ namespace BMA.EHR.Placement.Service.Controllers
// placementAppointment.EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}";
// placementAppointment.AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount;
placementAppointment.PositionOld = org.result.position;
placementAppointment.positionOld = org.result.position;
placementAppointment.PositionLevelOld = org.result.posLevelName;
placementAppointment.PositionTypeOld = org.result.posTypeName;
placementAppointment.PositionNumberOld = org.result.nodeShortName + org.result.posMasterNo;

View file

@ -8,7 +8,9 @@ using BMA.EHR.Placement.Service.Requests;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using Swashbuckle.AspNetCore.Annotations;
using System.Net.Http.Headers;
using System.Security.Claims;
namespace BMA.EHR.Placement.Service.Controllers
@ -26,18 +28,21 @@ namespace BMA.EHR.Placement.Service.Controllers
private readonly ApplicationDBContext _context;
private readonly MinIOService _documentService;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IConfiguration _configuration;
public PlacementTransferController(PlacementRepository 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 "
@ -45,6 +50,7 @@ namespace BMA.EHR.Placement.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"];
private bool? PlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
@ -61,36 +67,58 @@ namespace BMA.EHR.Placement.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 placementTransfers = await _context.PlacementTransfers.AsQueryable()
.Where(x => x.Profile == profile)
.OrderByDescending(x => x.CreatedAt)
.Select(p => new
{
p.Id,
position = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.Position == null ? null : p.Profile.Position.Name) : (p.Profile.PositionEmployeePosition == null ? null : p.Profile.PositionEmployeePosition.Name),
posNo = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PosNo == null ? null : p.Profile.PosNo.Name) : p.Profile.PosNoEmployee,
positionLevel = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name) : (p.Profile.PositionEmployeeLevel == null ? null : p.Profile.PositionEmployeeLevel.Name),
// salary = p.Profile.Salaries.Count() == 0 ? null : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
p.CreatedAt,
p.Organization,
p.Reason,
p.Status,
p.Date,
salary = p.AmountOld,
p.PositionTypeOld,
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.IsActive,
})
.ToListAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
return Success(placementTransfers);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
var placementTransfers = await _context.PlacementTransfers.AsQueryable()
.Where(x => x.profileId == org.result.profileId)
.OrderByDescending(x => x.CreatedAt)
.Select(p => new
{
p.Id,
p.profileId,
p.prefix,
p.firstName,
p.lastName,
p.root,
p.rootShortName,
p.child1,
p.child1ShortName,
p.child2,
p.child2ShortName,
p.child3,
p.child3ShortName,
p.child4,
p.child4ShortName,
p.posMasterNo,
p.position,
p.posLevelName,
p.posTypeName,
p.CreatedAt,
p.Organization,
p.Reason,
p.Status,
p.Date,
salary = p.AmountOld,
p.PositionTypeOld,
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.IsActive,
})
.ToListAsync();
return Success(placementTransfers);
}
}
/// <summary>
@ -104,36 +132,69 @@ namespace BMA.EHR.Placement.Service.Controllers
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
{
var rootId = "";
var child1Id = "";
var child2Id = "";
var child3Id = "";
var child4Id = "";
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 placementTransfers = await _context.PlacementTransfers.AsQueryable()
.OrderByDescending(x => x.CreatedAt)
.Select(p => new
{
p.Id,
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
p.Profile.FirstName,
p.Profile.LastName,
position = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.Position == null ? null : p.Profile.Position.Name) : (p.Profile.PositionEmployeePosition == null ? null : p.Profile.PositionEmployeePosition.Name),
posNo = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PosNo == null ? null : p.Profile.PosNo.Name) : p.Profile.PosNoEmployee,
positionLevel = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name) : (p.Profile.PositionEmployeeLevel == null ? null : p.Profile.PositionEmployeeLevel.Name),
// salary = p.Profile.Salaries.Count() == 0 ? null : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
p.CreatedAt,
p.Organization,
p.Reason,
p.Status,
p.Date,
salary = p.AmountOld,
p.PositionTypeOld,
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.IsActive,
})
.ToListAsync();
if (PlacementAdmin == true)
placementTransfers = placementTransfers.Where(x => !x.Status.Trim().ToUpper().Contains("WAITTING")).ToList();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
return Success(placementTransfers);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
rootId = org.result.rootId == null ? "" : org.result.rootId;
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
var placementTransfers = await _context.PlacementTransfers.AsQueryable()
.OrderByDescending(x => x.CreatedAt)
.Where(x => PlacementAdmin == true ? true : (rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))))
.Select(p => new
{
p.Id,
p.profileId,
p.prefix,
p.firstName,
p.lastName,
p.root,
p.rootShortName,
p.child1,
p.child1ShortName,
p.child2,
p.child2ShortName,
p.child3,
p.child3ShortName,
p.child4,
p.child4ShortName,
p.posMasterNo,
p.position,
p.posLevelName,
p.posTypeName,
p.CreatedAt,
p.Organization,
p.Reason,
p.Status,
p.Date,
salary = p.AmountOld,
p.PositionTypeOld,
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.IsActive,
})
.ToListAsync();
return Success(placementTransfers);
}
}
/// <summary>
@ -150,19 +211,27 @@ namespace BMA.EHR.Placement.Service.Controllers
{
var data = await _context.PlacementTransfers.AsQueryable()
.Where(x => x.Id == id)
.Where(x => x.Profile != null)
.Select(p => new
{
p.Id,
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
p.Profile.FirstName,
p.Profile.LastName,
ProfileId = p.Profile.Id,
position = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.Position == null ? null : p.Profile.Position.Name) : (p.Profile.PositionEmployeePosition == null ? null : p.Profile.PositionEmployeePosition.Name),
posNo = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PosNo == null ? null : p.Profile.PosNo.Name) : p.Profile.PosNoEmployee,
positionLevel = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name) : (p.Profile.PositionEmployeeLevel == null ? null : p.Profile.PositionEmployeeLevel.Name),
organizationOrganization = p.Profile.OrganizationOrganization,
p.profileId,
p.prefix,
p.firstName,
p.lastName,
p.root,
p.rootShortName,
p.child1,
p.child1ShortName,
p.child2,
p.child2ShortName,
p.child3,
p.child3ShortName,
p.child4,
p.child4ShortName,
p.posMasterNo,
p.position,
p.posLevelName,
p.posTypeName,
p.Reason,
p.Status,
p.Organization,
@ -173,7 +242,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
p.PositionOld,
PlacementTransferDocs = p.PlacementTransferDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
})
.FirstOrDefaultAsync();
@ -193,26 +262,35 @@ namespace BMA.EHR.Placement.Service.Controllers
var _data = new
{
data.Id,
data.ProfileId,
data.PrefixId,
data.Prefix,
data.FirstName,
data.LastName,
data.profileId,
data.prefix,
data.firstName,
data.lastName,
data.root,
data.rootShortName,
data.child1,
data.child1ShortName,
data.child2,
data.child2ShortName,
data.child3,
data.child3ShortName,
data.child4,
data.child4ShortName,
data.posMasterNo,
data.position,
data.posNo,
data.positionLevel,
data.organizationOrganization,
data.posLevelName,
data.posTypeName,
data.Reason,
data.Status,
data.Organization,
data.CreatedAt,
data.Date,
data.salary,
data.CreatedAt,
data.PositionTypeOld,
data.PositionLevelOld,
data.PositionNumberOld,
data.OrganizationPositionOld,
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
data.PositionOld,
Docs = placementTransferDocs,
};
@ -233,20 +311,27 @@ namespace BMA.EHR.Placement.Service.Controllers
{
var data = await _context.PlacementTransfers.AsQueryable()
.Where(x => x.Id == id)
.Where(x => x.Profile != null)
.Select(p => new
{
p.Id,
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
AvatarId = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
p.Profile.FirstName,
p.Profile.LastName,
ProfileId = p.Profile.Id,
position = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.Position == null ? null : p.Profile.Position.Name) : (p.Profile.PositionEmployeePosition == null ? null : p.Profile.PositionEmployeePosition.Name),
posNo = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PosNo == null ? null : p.Profile.PosNo.Name) : p.Profile.PosNoEmployee,
positionLevel = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name) : (p.Profile.PositionEmployeeLevel == null ? null : p.Profile.PositionEmployeeLevel.Name),
organizationOrganization = p.Profile.OrganizationOrganization,
p.profileId,
p.prefix,
p.firstName,
p.lastName,
p.root,
p.rootShortName,
p.child1,
p.child1ShortName,
p.child2,
p.child2ShortName,
p.child3,
p.child3ShortName,
p.child4,
p.child4ShortName,
p.posMasterNo,
p.position,
p.posLevelName,
p.posTypeName,
p.Reason,
p.Status,
p.Organization,
@ -257,6 +342,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.PositionOld,
PlacementTransferDocs = p.PlacementTransferDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
})
.FirstOrDefaultAsync();
@ -276,26 +362,35 @@ namespace BMA.EHR.Placement.Service.Controllers
var _data = new
{
data.Id,
data.ProfileId,
AvataPath = data.AvatarId == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.AvatarId),
data.PrefixId,
data.Prefix,
data.FirstName,
data.LastName,
data.profileId,
data.prefix,
data.firstName,
data.lastName,
data.root,
data.rootShortName,
data.child1,
data.child1ShortName,
data.child2,
data.child2ShortName,
data.child3,
data.child3ShortName,
data.child4,
data.child4ShortName,
data.posMasterNo,
data.position,
data.posNo,
data.positionLevel,
data.organizationOrganization,
data.posLevelName,
data.posTypeName,
data.Reason,
data.Status,
data.Organization,
data.CreatedAt,
data.Date,
data.salary,
data.CreatedAt,
data.PositionTypeOld,
data.PositionLevelOld,
data.PositionNumberOld,
data.OrganizationPositionOld,
data.PositionOld,
Docs = placementTransferDocs,
};
@ -313,28 +408,10 @@ namespace BMA.EHR.Placement.Service.Controllers
[HttpPost()]
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementTransferRequest 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 placementTransfer = new PlacementTransfer
{
Profile = profile,
Organization = req.Organization,
Reason = req.Reason,
Date = req.Date,
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",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
@ -343,6 +420,57 @@ namespace BMA.EHR.Placement.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);
placementTransfer.profileId = org.result.profileId;
placementTransfer.prefix = org.result.prefix;
placementTransfer.firstName = org.result.firstName;
placementTransfer.lastName = org.result.lastName;
placementTransfer.citizenId = org.result.citizenId;
placementTransfer.root = org.result.root;
placementTransfer.rootId = org.result.rootId;
placementTransfer.rootShortName = org.result.rootShortName;
placementTransfer.child1 = org.result.child1;
placementTransfer.child1Id = org.result.child1Id;
placementTransfer.child1ShortName = org.result.child1ShortName;
placementTransfer.child2 = org.result.child2;
placementTransfer.child2Id = org.result.child2Id;
placementTransfer.child2ShortName = org.result.child2ShortName;
placementTransfer.child3 = org.result.child3;
placementTransfer.child3Id = org.result.child3Id;
placementTransfer.child3ShortName = org.result.child3ShortName;
placementTransfer.child4 = org.result.child4;
placementTransfer.child4Id = org.result.child4Id;
placementTransfer.child4ShortName = org.result.child4ShortName;
placementTransfer.posMasterNo = org.result.posMasterNo;
placementTransfer.position = org.result.position;
placementTransfer.posTypeId = org.result.posTypeId;
placementTransfer.posTypeName = org.result.posTypeName;
placementTransfer.posLevelId = org.result.posLevelId;
placementTransfer.posLevelName = org.result.posLevelName;
placementTransfer.PositionOld = org.result.position;
placementTransfer.PositionLevelOld = org.result.posLevelName;
placementTransfer.PositionTypeOld = org.result.posTypeName;
placementTransfer.PositionNumberOld = org.result.nodeShortName + org.result.posMasterNo;
placementTransfer.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 + "/");
placementTransfer.OrganizationPositionOld = org.result.position + "-" + placementTransfer.OrganizationOld;
}
await _context.PlacementTransfers.AddAsync(placementTransfer);
await _context.SaveChangesAsync();
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
@ -372,13 +500,13 @@ namespace BMA.EHR.Placement.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} ได้ทำการยื่นคำขอโอนไปยัง {req.Organization}",
"",
true
);
// await _repositoryNoti.PushNotificationAsync(
// Guid.Parse("08dbc953-6268-4e2c-80a3-aca65eedc6d0"),
// $"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำขอโอน",
// $"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำขอโอนไปยัง {req.Organization}",
// "",
// true
// );
await _context.SaveChangesAsync();
return Success();
@ -429,8 +557,6 @@ namespace BMA.EHR.Placement.Service.Controllers
public async Task<ActionResult<ResponseObject>> AdminConfirm(Guid id)
{
var uppdated = await _context.PlacementTransfers
.Include(x => x.Profile)
.ThenInclude(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == id);
if (uppdated == null)
return Error(GlobalMessages.PlacementTransferNotFound, 404);
@ -439,20 +565,20 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08dbc953-6268-4e2c-80a3-aca65eedc6d0"),
$"{uppdated.Profile.Prefix?.Name}{uppdated.Profile.FirstName} {uppdated.Profile.LastName} ได้ทำการยื่นคำขอโอนได้รับการอนุมัติ",
$"{uppdated.Profile.Prefix?.Name}{uppdated.Profile.FirstName} {uppdated.Profile.LastName} ได้ทำการยื่นคำขอโอนไปยัง {uppdated.Organization}ได้รับการอนุมัติ",
"",
true
);
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
$"{uppdated.Profile.Prefix?.Name}{uppdated.Profile.FirstName} {uppdated.Profile.LastName} ได้ทำการยื่นคำขอโอน",
$"{uppdated.Profile.Prefix?.Name}{uppdated.Profile.FirstName} {uppdated.Profile.LastName} ได้ทำการยื่นคำขอโอนไปยัง {uppdated.Organization}ได้รับการอนุมัติ",
"",
true
);
// await _repositoryNoti.PushNotificationAsync(
// Guid.Parse("08dbc953-6268-4e2c-80a3-aca65eedc6d0"),
// $"{uppdated.Profile.Prefix?.Name}{uppdated.Profile.FirstName} {uppdated.Profile.LastName} ได้ทำการยื่นคำขอโอนได้รับการอนุมัติ",
// $"{uppdated.Profile.Prefix?.Name}{uppdated.Profile.FirstName} {uppdated.Profile.LastName} ได้ทำการยื่นคำขอโอนไปยัง {uppdated.Organization}ได้รับการอนุมัติ",
// "",
// true
// );
// await _repositoryNoti.PushNotificationAsync(
// Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
// $"{uppdated.Profile.Prefix?.Name}{uppdated.Profile.FirstName} {uppdated.Profile.LastName} ได้ทำการยื่นคำขอโอน",
// $"{uppdated.Profile.Prefix?.Name}{uppdated.Profile.FirstName} {uppdated.Profile.LastName} ได้ทำการยื่นคำขอโอนไปยัง {uppdated.Organization}ได้รับการอนุมัติ",
// "",
// true
// );
await _context.SaveChangesAsync();
return Success();