แก้บัค หนังสือเวียน
This commit is contained in:
parent
5280b71291
commit
1147011980
3 changed files with 36 additions and 32 deletions
|
|
@ -440,7 +440,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPut("detail/{id:length(36)}")]
|
[HttpPut("detail/{id:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> UpdateDetail([FromForm] RetirementDeceasedAddNotiRequest req, Guid id)
|
public async Task<ActionResult<ResponseObject>> UpdateDetail([FromBody] RetirementDeceasedAddNotiPersonRequest req, Guid id)
|
||||||
{
|
{
|
||||||
var retirementDeceased = await _context.RetirementDeceaseds.AsQueryable()
|
var retirementDeceased = await _context.RetirementDeceaseds.AsQueryable()
|
||||||
.Include(x => x.RetirementDeceasedNotis)
|
.Include(x => x.RetirementDeceasedNotis)
|
||||||
|
|
@ -448,33 +448,36 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
if (retirementDeceased == null)
|
if (retirementDeceased == null)
|
||||||
return Error(GlobalMessages.RetirementDeceasedNotFound, 404);
|
return Error(GlobalMessages.RetirementDeceasedNotFound, 404);
|
||||||
|
|
||||||
var profile = await _context.Profiles.AsQueryable()
|
foreach (var item in req.Persons)
|
||||||
.Include(x => x.Prefix)
|
|
||||||
.Include(x => x.Position)
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.ProfileId);
|
|
||||||
if (profile == null)
|
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
|
||||||
|
|
||||||
retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti
|
|
||||||
{
|
{
|
||||||
CitizenId = profile.CitizenId == null ? "" : profile.CitizenId,
|
var profile = await _context.Profiles.AsQueryable()
|
||||||
Prefix = profile.Prefix == null ? "" : profile.Prefix.Name,
|
.Include(x => x.Prefix)
|
||||||
FirstName = profile.FirstName == null ? "" : profile.FirstName,
|
.Include(x => x.Position)
|
||||||
LastName = profile.LastName == null ? "" : profile.LastName,
|
.FirstOrDefaultAsync(x => x.Id == item.ProfileId);
|
||||||
// IsSendMail = req.IsSendMail,
|
if (profile == null)
|
||||||
// IsSendInbox = req.IsSendInbox,
|
continue;
|
||||||
// IsSendNotification = req.IsSendNotification,
|
|
||||||
OrganizationName = profile.OrganizationOrganization == null ? "" : profile.OrganizationOrganization,
|
retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti
|
||||||
PositionName = profile.Position == null ? null : profile.Position.Name,
|
{
|
||||||
ReceiveUser = profile,
|
CitizenId = profile.CitizenId == null ? "" : profile.CitizenId,
|
||||||
CreatedUserId = FullName ?? "",
|
Prefix = profile.Prefix == null ? "" : profile.Prefix.Name,
|
||||||
CreatedFullName = UserId ?? "System Administrator",
|
FirstName = profile.FirstName == null ? "" : profile.FirstName,
|
||||||
CreatedAt = DateTime.Now,
|
LastName = profile.LastName == null ? "" : profile.LastName,
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
IsSendMail = item.IsSendMail,
|
||||||
LastUpdateUserId = UserId ?? "",
|
IsSendInbox = item.IsSendInbox,
|
||||||
LastUpdatedAt = DateTime.Now,
|
IsSendNotification = item.IsSendNotification,
|
||||||
});
|
OrganizationName = profile.OrganizationOrganization == null ? "" : profile.OrganizationOrganization,
|
||||||
await _context.SaveChangesAsync();
|
PositionName = profile.Position == null ? null : profile.Position.Name,
|
||||||
|
ReceiveUser = profile,
|
||||||
|
CreatedUserId = FullName ?? "",
|
||||||
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
});
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
@ -510,7 +513,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPut("noti/{id:length(36)}")]
|
[HttpPut("noti/{id:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> NotiDeceased([FromForm] RetirementDeceasedAddNotiPersonRequest req, Guid id)
|
public async Task<ActionResult<ResponseObject>> NotiDeceased([FromBody] RetirementDeceasedAddNotiPersonRequest req, Guid id)
|
||||||
{
|
{
|
||||||
var items = await _context.RetirementDeceasedNotis.AsQueryable()
|
var items = await _context.RetirementDeceasedNotis.AsQueryable()
|
||||||
.Include(x => x.ReceiveUser)
|
.Include(x => x.ReceiveUser)
|
||||||
|
|
@ -522,7 +525,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
var prefix = item.RetirementDeceased.Profile.Prefix == null ? "" : item.RetirementDeceased.Profile.Prefix.Name;
|
var prefix = item.RetirementDeceased.Profile.Prefix == null ? "" : item.RetirementDeceased.Profile.Prefix.Name;
|
||||||
var profile = req.Person.FirstOrDefault(x => x.ProfileId == item.ReceiveUser.Id);
|
var profile = req.Persons.FirstOrDefault(x => x.ProfileId == item.ReceiveUser.Id);
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
if (profile.IsSendInbox == true)
|
if (profile.IsSendInbox == true)
|
||||||
|
|
@ -547,6 +550,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
};
|
};
|
||||||
_context.Notifications.Add(noti);
|
_context.Notifications.Add(noti);
|
||||||
}
|
}
|
||||||
|
item.IsSendMail = profile.IsSendMail;
|
||||||
item.IsSendInbox = profile.IsSendInbox;
|
item.IsSendInbox = profile.IsSendInbox;
|
||||||
item.IsSendNotification = profile.IsSendNotification;
|
item.IsSendNotification = profile.IsSendNotification;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -514,7 +514,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (updated == null)
|
if (updated == null)
|
||||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||||
if ((DateTime.Now - updated.CreatedAt).TotalDays > 90)
|
if ((DateTime.Now - updated.CreatedAt).TotalDays >= 90)
|
||||||
return Error("สามารถยับยั้งได้ไม่เกิน 90 วัน");
|
return Error("สามารถยับยั้งได้ไม่เกิน 90 วัน");
|
||||||
// updated.Status = "REJECT";
|
// updated.Status = "REJECT";
|
||||||
updated.CommanderReject = true;
|
updated.CommanderReject = true;
|
||||||
|
|
@ -571,7 +571,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (updated == null)
|
if (updated == null)
|
||||||
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
return Error(GlobalMessages.RetirementResignNotFound, 404);
|
||||||
if ((DateTime.Now - updated.CreatedAt).TotalDays > 90)
|
if ((DateTime.Now - updated.CreatedAt).TotalDays >= 90)
|
||||||
return Error("สามารถยับยั้งได้ไม่เกิน 90 วัน");
|
return Error("สามารถยับยั้งได้ไม่เกิน 90 วัน");
|
||||||
updated.Status = "REJECT";
|
updated.Status = "REJECT";
|
||||||
updated.OligarchReject = true;
|
updated.OligarchReject = true;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ namespace BMA.EHR.Retirement.Service.Requests
|
||||||
{
|
{
|
||||||
public class RetirementDeceasedAddNotiPersonRequest
|
public class RetirementDeceasedAddNotiPersonRequest
|
||||||
{
|
{
|
||||||
public List<RetirementDeceasedAddNotiPerson> Person { get; set; }
|
public List<RetirementDeceasedAddNotiPerson> Persons { get; set; }
|
||||||
}
|
}
|
||||||
public class RetirementDeceasedAddNotiPerson
|
public class RetirementDeceasedAddNotiPerson
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue