แก้บั้กออกคำสั่งบรรจุ

This commit is contained in:
Suphonchai Phoonsawat 2023-08-20 11:07:18 +07:00
parent 7d88274dae
commit 99485f64e0
4 changed files with 33 additions and 10 deletions

View file

@ -211,6 +211,10 @@ namespace BMA.EHR.Application.Repositories.Commands
.ThenInclude(x => x.PositionMaster)
.ThenInclude(x => x.PositionLine)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.ThenInclude(x => x.OrganizationOrganization)
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
if (placementProfile == null)
@ -233,6 +237,8 @@ namespace BMA.EHR.Application.Repositories.Commands
ReligionId = placementProfile.Religion == null ? Guid.Empty : placementProfile.Religion.Id,
BloodGroupId = placementProfile.BloodGroup == null ? Guid.Empty : placementProfile.BloodGroup.Id,
DateAppoint = placementProfile.RecruitDate == null ? null : placementProfile.RecruitDate.Value,
DateStart = placementProfile.RecruitDate == null ? null : placementProfile.RecruitDate.Value,
RegistrationAddress = placementProfile.RegistAddress,
RegistrationSubDistrictId = placementProfile.RegistSubDistrict == null ? Guid.Empty : placementProfile.RegistSubDistrict!.Id,
@ -263,7 +269,11 @@ namespace BMA.EHR.Application.Repositories.Commands
PositionPathSideId = placementProfile.PositionPathSide == null ? Guid.Empty : placementProfile.PositionPathSide.Id,
PositionType = placementProfile.PositionType,
PositionLevel = placementProfile.PositionLevel,
PositionEmployeeLevelId = placementProfile.PositionLevel!.Id,
PositionLineId = placementProfile.PositionLine == null ? Guid.Empty : placementProfile.PositionLine.Id,
PositionLine = placementProfile.PositionLine == null ? "" : placementProfile.PositionLine.Name,
PosNo = placementProfile.OrganizationPosition!.PositionNumber,
IsVerified = true,
IsProbation = true,
Physical = "",
@ -292,6 +302,14 @@ namespace BMA.EHR.Application.Repositories.Commands
LastUpdatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
// organization
OrganizationShortNameId = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Id,
OrganizationShortName = placementProfile.OrganizationPosition!.Organization!.OrganizationShortName!.Name,
OrganizationOrganizationId = placementProfile.OrganizationPosition!.Organization!.OrganizationOrganization!.Id,
OcId = placementProfile.OrganizationPosition!.Organization!.Id,
Oc = _organizationCommonRepository.GetOrganizationNameFullPath(placementProfile.OrganizationPosition!.Organization!.Id, false, false, "/"),
};
// add profile education
@ -1290,7 +1308,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Name = $"{x.Profile!.Prefix!.Name}{x.Profile!.FirstName} {x.Profile!.LastName}",
PositionName = x.OrganizationPosition!.PositionMaster!.PositionExecutive != null ?
x.OrganizationPosition!.PositionMaster!.PositionExecutive!.Name
:
:
x.OrganizationPosition!.PositionMaster!.PositionPath == null ? "" : x.OrganizationPosition!.PositionMaster!.PositionPath!.Name
})
.ToListAsync();

View file

@ -28,7 +28,7 @@ namespace BMA.EHR.Application.Repositories
#region " Methods "
public string GetOrganizationNameFullPath(Guid id, bool showRoot = false, bool descending = false)
public string GetOrganizationNameFullPath(Guid id, bool showRoot = false, bool descending = false,string seperator = " ")
{
try
{
@ -39,7 +39,7 @@ namespace BMA.EHR.Application.Repositories
var ret = String.Empty;
foreach (var oc in ocList)
{
ret = oc.Name + " " + ret;
ret = oc.Name + seperator + ret;
}
if (ret.Length > 2)
ret = ret.Substring(0, ret.Length - 1);
@ -65,7 +65,7 @@ namespace BMA.EHR.Application.Repositories
{
Id = x.Id,
Name = x.OrganizationOrganization!.Name,
ParentId = x.Parent!.Id
ParentId = x.Parent == null ? Guid.Empty : x.Parent!.Id
})
.FirstOrDefault(x => x.Id == id);
@ -81,7 +81,7 @@ namespace BMA.EHR.Application.Repositories
//else
// ocList.Add(new OrganizationItem { Id = oc.OCId, Name = oc.OrganizationName });
if (ocData.ParentId != null)
if (ocData.ParentId != Guid.Empty)
{
ocList.AddRange(GetOCWithFullPath(ocData.ParentId, showRoot));
}