แจ้งหนังสือเวียนให้หัวหน้า
This commit is contained in:
parent
b4b9e59c31
commit
5280b71291
1 changed files with 40 additions and 0 deletions
|
|
@ -215,6 +215,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> Post([FromForm] RetirementDeceasedRequest req)
|
public async Task<ActionResult<ResponseObject>> Post([FromForm] RetirementDeceasedRequest req)
|
||||||
{
|
{
|
||||||
var profile = await _context.Profiles
|
var profile = await _context.Profiles
|
||||||
|
.Include(x => x.Prefix)
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.ProfileId);
|
.FirstOrDefaultAsync(x => x.Id == req.ProfileId);
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
@ -284,6 +285,45 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
var orgPos = await _context.ProfilePositions
|
||||||
|
.Include(x => x.Profile)
|
||||||
|
.ThenInclude(x => x!.Prefix)
|
||||||
|
.Include(x => x.OrganizationPosition)
|
||||||
|
.ThenInclude(x => x!.Organization)
|
||||||
|
.ThenInclude(x => x!.OrganizationOrganization)
|
||||||
|
.Include(x => x.OrganizationPosition)
|
||||||
|
.ThenInclude(x => x!.PositionMaster)
|
||||||
|
.ThenInclude(x => x!.PositionPath)
|
||||||
|
.Where(x => x.OrganizationPosition!.IsDirector! == true)
|
||||||
|
.Where(x => x.OrganizationPosition!.Organization!.Id == profile.OcId)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (orgPos != null)
|
||||||
|
{
|
||||||
|
if (orgPos.Profile != null)
|
||||||
|
{
|
||||||
|
retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti
|
||||||
|
{
|
||||||
|
CitizenId = orgPos!.Profile!.CitizenId!,
|
||||||
|
Prefix = orgPos!.Profile!.Prefix!.Name,
|
||||||
|
FirstName = orgPos!.Profile!.FirstName!,
|
||||||
|
LastName = orgPos!.Profile!.LastName!,
|
||||||
|
// IsSendMail = req.IsSendMail,
|
||||||
|
// IsSendInbox = req.IsSendInbox,
|
||||||
|
// IsSendNotification = req.IsSendNotification,
|
||||||
|
OrganizationName = orgPos!.OrganizationPosition!.Organization!.OrganizationOrganization!.Name,
|
||||||
|
PositionName = orgPos!.OrganizationPosition!.PositionMaster!.PositionPath!.Name,
|
||||||
|
ReceiveUser = profile,
|
||||||
|
CreatedUserId = FullName ?? "",
|
||||||
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue