This commit is contained in:
parent
0a58075428
commit
ec04665f39
21 changed files with 546 additions and 491 deletions
|
|
@ -129,11 +129,23 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
}
|
||||
|
||||
|
||||
int? node = profileAdmin?.Node;
|
||||
if (role == "OWNER")
|
||||
{
|
||||
|
|
@ -144,6 +156,11 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
resData = resData
|
||||
.Where(x => node == 4 ? x.Child4DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 1 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true)))))).ToList();
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
resData = resData
|
||||
.Where(x => node == 4 ? x.Child3DnaId == Guid.Parse(nodeId!) : (node == 3 ? x.Child2DnaId == Guid.Parse(nodeId!) : (node == 2 ? x.Child1DnaId == Guid.Parse(nodeId!) : (node == 1 || node == 0 ? x.RootDnaId == Guid.Parse(nodeId!) : (node == null ? true : true))))).ToList();
|
||||
}
|
||||
else if (role == "ROOT")
|
||||
{
|
||||
resData = resData
|
||||
|
|
@ -326,10 +343,10 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
item.Child1DnaId = profile.Child1DnaId;
|
||||
item.Child2DnaId = profile.Child2DnaId;
|
||||
item.Child3DnaId = profile.Child3DnaId;
|
||||
item.Child4DnaId = profile.Child4DnaId;
|
||||
item.Child4DnaId = profile.Child4DnaId;
|
||||
_context.LeaveBeginnings.Update(item);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
return Success("อัพเดทข้อมูลสำเร็จ");
|
||||
|
|
@ -439,7 +456,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
{
|
||||
return Error("ไม่สามารถบันทึกข้อมูล เนื่องจากมีข้อมูลในระบบแล้ว");
|
||||
}
|
||||
|
||||
|
||||
var leaveBeginning = new LeaveBeginning();
|
||||
leaveBeginning.LeaveTypeId = req.LeaveTypeId;
|
||||
leaveBeginning.LeaveYear = req.LeaveYear;
|
||||
|
|
|
|||
|
|
@ -1304,6 +1304,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROHTER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
|
|
@ -1600,6 +1612,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
|
|
@ -1834,6 +1858,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
|
|
@ -2077,6 +2113,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
|
|
@ -2437,6 +2485,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
|
|
|
|||
|
|
@ -920,6 +920,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
|
|
@ -940,7 +952,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
var count = 1;
|
||||
var employees = new List<dynamic>();
|
||||
// กรองตามที่ fe ส่งมา
|
||||
if ((role == "ROOT" || role == "OWNER" || role == "CHILD" || role == "PARENT") /*&& req.node > profileAdmin?.Node*/)
|
||||
if ((role == "ROOT" || role == "OWNER" || role == "CHILD" || role == "PARENT" || role == "BROTHER") /*&& req.node > profileAdmin?.Node*/)
|
||||
{
|
||||
profile = profile
|
||||
.Where(x => req.node == 4 ? x.OrgChild4Id == req.nodeId : req.node == 3 ? x.OrgChild3Id == req.nodeId : req.node == 2 ? x.OrgChild2Id == req.nodeId : req.node == 1 ? x.OrgChild1Id == req.nodeId : req.node == 0 ? x.OrgRootId == req.nodeId : true)
|
||||
|
|
@ -1332,7 +1344,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
var profile = new List<GetProfileByKeycloakIdRootDto>();
|
||||
profile = await _userProfileRepository.GetProfileWithKeycloakAllOfficerRetireFilterAndRevisionAndDate(AccessToken, req.node, req.nodeId, jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD", req.isRetirement ?? true, req.revisionId, req.StartDate, req.EndDate);
|
||||
profile = await _userProfileRepository.GetProfileWithKeycloakAllOfficerRetireFilterAndRevisionAndDate(AccessToken, req.node, req.nodeId, jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD" || jsonData["result"] == "BROTHER", req.isRetirement ?? true, req.revisionId, req.StartDate, req.EndDate);
|
||||
|
||||
// get leave day
|
||||
var leaveDays = await _leaveRequestRepository.GetSumApproveLeaveByTypeAndRange(req.StartDate, req.EndDate);
|
||||
|
|
@ -1537,6 +1549,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
|
|
@ -1611,7 +1635,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
var workTotal = 0;
|
||||
var seminarTotal = 0;
|
||||
// กรองตามที่ fe ส่งมา
|
||||
if ((role == "ROOT" || role == "OWNER" || role == "CHILD" || role == "PARENT") /*&& req.node > profileAdmin?.Node*/)
|
||||
if ((role == "ROOT" || role == "OWNER" || role == "CHILD" || role == "PARENT" || role == "BROTHER") /*&& req.node > profileAdmin?.Node*/)
|
||||
{
|
||||
profile = profile
|
||||
.Where(x => req.node == 4 ? x.OrgChild4Id == req.nodeId : req.node == 3 ? x.OrgChild3Id == req.nodeId : req.node == 2 ? x.OrgChild2Id == req.nodeId : req.node == 1 ? x.OrgChild1Id == req.nodeId : req.node == 0 ? x.OrgRootId == req.nodeId : true)
|
||||
|
|
@ -1863,6 +1887,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
|
|
@ -1877,7 +1913,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
profile = await _userProfileRepository.GetEmployeeByAdminRole(AccessToken, profileAdmin?.Node, nodeId, role, req.revisionId, req.node, req.nodeId);
|
||||
}
|
||||
// Child กรองตามที่ fe ส่งมาอีกชั้น
|
||||
if ((role == "ROOT" || role == "OWNER" || role == "CHILD" || role == "PARENT") /*&& req.node > profileAdmin?.Node*/)
|
||||
if ((role == "ROOT" || role == "OWNER" || role == "CHILD" || role == "PARENT" || role == "BROTHER") /*&& req.node > profileAdmin?.Node*/)
|
||||
{
|
||||
profile = profile
|
||||
.Where(x => req.node == 4 ? x.OrgChild4Id == req.nodeId : req.node == 3 ? x.OrgChild3Id == req.nodeId : req.node == 2 ? x.OrgChild2Id == req.nodeId : req.node == 1 ? x.OrgChild1Id == req.nodeId : req.node == 0 ? x.OrgRootId == req.nodeId : true)
|
||||
|
|
@ -2281,6 +2317,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
|
|
@ -2390,6 +2438,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
|
|
|
|||
|
|
@ -1227,7 +1227,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
var data = await _leaveRequestRepository.GetLeaveRequestByYearAsync(req.Year, userId);
|
||||
|
||||
var resultData = (from d in data
|
||||
//join p in profileList on d.KeycloakUserId equals p.Keycloak
|
||||
//join p in profileList on d.KeycloakUserId equals p.Keycloak
|
||||
select new GetLeaveRequestCalendarResultDto
|
||||
{
|
||||
Id = d.Id,
|
||||
|
|
@ -1286,6 +1286,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
|
|
@ -1665,6 +1677,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
|
|
@ -1850,6 +1874,18 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "BROTHER")
|
||||
{
|
||||
nodeId = profileAdmin?.Node == 4
|
||||
? profileAdmin?.Child3DnaId
|
||||
: profileAdmin?.Node == 3
|
||||
? profileAdmin?.Child2DnaId
|
||||
: profileAdmin?.Node == 2
|
||||
? profileAdmin?.Child1DnaId
|
||||
: profileAdmin?.Node == 1 || profileAdmin?.Node == 0
|
||||
? profileAdmin?.RootDnaId
|
||||
: "";
|
||||
}
|
||||
else if (role == "ROOT" || role == "PARENT")
|
||||
{
|
||||
nodeId = profileAdmin?.RootDnaId;
|
||||
|
|
@ -2008,7 +2044,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue