เพิ่ม user ใน บรรจุ
This commit is contained in:
parent
d5ffd5cb08
commit
824c8267ef
24 changed files with 45466 additions and 16 deletions
|
|
@ -352,11 +352,11 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
|||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
var organizationEmployee = await _context.OrganizationEmployees
|
||||
.Where(x => x.Profile == null || (x.Profile != null && x.Profile == profile))
|
||||
.Where(x => x.OrganizationEmployeeProfiles.Count() == 0 || (x.OrganizationEmployeeProfiles.Count() > 0 && x.OrganizationEmployeeProfiles.FirstOrDefault().Profile == profile))
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,
|
||||
Use = x.Profile == null ? false : (x.Profile == profile ? true : false),
|
||||
Use = x.OrganizationEmployeeProfiles.Count() == 0 ? false : (x.OrganizationEmployeeProfiles.FirstOrDefault().Profile == profile ? true : false),
|
||||
Agency = x.Agency,
|
||||
ConditionNote = x.ConditionNote,
|
||||
Department = x.Department,
|
||||
|
|
@ -432,7 +432,22 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
|||
.FirstOrDefaultAsync(x => x.Profile == profile);
|
||||
if (organizationEmployeeProfile != null)
|
||||
organizationEmployeeProfile.Profile = null;
|
||||
organizationEmployee.Profile = profile;
|
||||
|
||||
var data = new OrganizationEmployeeProfile
|
||||
{
|
||||
OrgEmployee = organizationEmployee,
|
||||
Profile = profile,
|
||||
Status = "PENDING",
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.OrganizationEmployeeProfiles.AddAsync(data);
|
||||
// organizationEmployee.Profile = profile;
|
||||
// organizationEmployee.IsPublic = false;
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
|
|
@ -510,5 +525,33 @@ namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
|||
|
||||
return Success(organizationEmployee);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// สั่งรายชื่อไปออกคำสั่ง
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("report")]
|
||||
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] OrganizationEmployeeProfileRequest req)
|
||||
{
|
||||
foreach (var item in req.Id)
|
||||
{
|
||||
var uppdated = await _context.OrganizationEmployeeProfiles
|
||||
.FirstOrDefaultAsync(x => x.Profile.Id == item);
|
||||
if (uppdated == null)
|
||||
continue;
|
||||
uppdated.Status = "REPORT";
|
||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
uppdated.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.OrganizationEmployee.Service.Requests
|
||||
{
|
||||
public class OrganizationEmployeeProfileRequest
|
||||
{
|
||||
public List<Guid> Id { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue