แก้ระบบบรรจุผูกโครงสร้างใหม่
This commit is contained in:
parent
57164f5d45
commit
18d75f4b04
37 changed files with 79295 additions and 3904 deletions
36
.github/workflows/release_Retirement.yaml
vendored
36
.github/workflows/release_Retirement.yaml
vendored
|
|
@ -68,21 +68,21 @@ jobs:
|
||||||
docker compose pull
|
docker compose pull
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||||
- uses: snow-actions/line-notify@v1.1.0
|
# - uses: snow-actions/line-notify@v1.1.0
|
||||||
if: success()
|
# if: success()
|
||||||
with:
|
# with:
|
||||||
access_token: ${{ env.TOKEN_LINE }}
|
# access_token: ${{ env.TOKEN_LINE }}
|
||||||
message: |
|
# message: |
|
||||||
-Success✅✅✅
|
# -Success✅✅✅
|
||||||
Image: ${{env.IMAGE_NAME}}
|
# Image: ${{env.IMAGE_NAME}}
|
||||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||||
By: ${{secrets.DOCKER_USER}}
|
# By: ${{secrets.DOCKER_USER}}
|
||||||
- uses: snow-actions/line-notify@v1.1.0
|
# - uses: snow-actions/line-notify@v1.1.0
|
||||||
if: failure()
|
# if: failure()
|
||||||
with:
|
# with:
|
||||||
access_token: ${{ env.TOKEN_LINE }}
|
# access_token: ${{ env.TOKEN_LINE }}
|
||||||
message: |
|
# message: |
|
||||||
-Failure❌❌❌
|
# -Failure❌❌❌
|
||||||
Image: ${{env.IMAGE_NAME}}
|
# Image: ${{env.IMAGE_NAME}}
|
||||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||||
By: ${{secrets.DOCKER_USER}}
|
# By: ${{secrets.DOCKER_USER}}
|
||||||
|
|
|
||||||
|
|
@ -304,21 +304,21 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
var report_data = (from r in raw_data
|
var report_data = (from r in raw_data
|
||||||
join p in _dbContext.Set<PlacementAppointment>()
|
join p in _dbContext.Set<PlacementAppointment>()
|
||||||
.Include(x => x.OrganizationPosition)
|
// .Include(x => x.OrganizationPosition)
|
||||||
.ThenInclude(x => x.Organization)
|
// .ThenInclude(x => x.Organization)
|
||||||
.Include(x => x.PositionPath)
|
// .Include(x => x.PositionPath)
|
||||||
.Include(x => x.PositionLevel)
|
// .Include(x => x.PositionLevel)
|
||||||
.Include(x => x.PositionNumber)
|
// .Include(x => x.PositionNumber)
|
||||||
.Include(x => x.PositionType)
|
// .Include(x => x.PositionType)
|
||||||
on r.RefPlacementProfileId equals p.Id
|
on r.RefPlacementProfileId equals p.Id
|
||||||
join pf in _dbContext.Set<Profile>()
|
// join pf in _dbContext.Set<Profile>()
|
||||||
.Include(x => x.Position)
|
// .Include(x => x.Position)
|
||||||
.Include(x => x.PositionLevel)
|
// .Include(x => x.PositionLevel)
|
||||||
.Include(x => x.PositionType)
|
// .Include(x => x.PositionType)
|
||||||
.Include(x => x.PosNo)
|
// .Include(x => x.PosNo)
|
||||||
.Include(x => x.Salaries)
|
// .Include(x => x.Salaries)
|
||||||
.Include(x => x.Educations)
|
// .Include(x => x.Educations)
|
||||||
on r.CitizenId equals pf.CitizenId
|
// on r.CitizenId equals pf.CitizenId
|
||||||
orderby r.Sequence
|
orderby r.Sequence
|
||||||
select new CommandType03Response
|
select new CommandType03Response
|
||||||
{
|
{
|
||||||
|
|
@ -328,19 +328,19 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
Seq = r.Sequence.ToString().ToThaiNumber(),
|
Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||||
CitizenId = r.CitizenId,
|
CitizenId = r.CitizenId,
|
||||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
|
// OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
|
||||||
OldPositionName = pf.Position == null ? "" : pf.Position.Name,
|
// OldPositionName = pf.Position == null ? "" : pf.Position.Name,
|
||||||
OldPositionLevel = pf.PositionLevel == null ? "" : pf.PositionLevel.Name,
|
// OldPositionLevel = pf.PositionLevel == null ? "" : pf.PositionLevel.Name,
|
||||||
OldPositionType = pf.PositionType == null ? "" : pf.PositionType.Name,
|
// OldPositionType = pf.PositionType == null ? "" : pf.PositionType.Name,
|
||||||
OldPositionNumber = pf.PosNo == null ? "" : pf.PosNo.Name.ToThaiNumber(),
|
// OldPositionNumber = pf.PosNo == null ? "" : pf.PosNo.Name.ToThaiNumber(),
|
||||||
// OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
// OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
OldSalaryDate = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Date.Value.ToThaiShortDate2().ToThaiNumber(),
|
// OldSalaryDate = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Date.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
||||||
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
|
// NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
|
||||||
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
// NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
||||||
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
// NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
||||||
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
|
// NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
|
||||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
Reason = p.Reason == null ? "-" : p.Reason,
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
|
|
@ -370,21 +370,21 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
var report_data = (from r in raw_data
|
var report_data = (from r in raw_data
|
||||||
join p in _dbContext.Set<PlacementAppointment>()
|
join p in _dbContext.Set<PlacementAppointment>()
|
||||||
.Include(x => x.OrganizationPosition)
|
// .Include(x => x.OrganizationPosition)
|
||||||
.ThenInclude(x => x.Organization)
|
// .ThenInclude(x => x.Organization)
|
||||||
.Include(x => x.PositionPath)
|
// .Include(x => x.PositionPath)
|
||||||
.Include(x => x.PositionLevel)
|
// .Include(x => x.PositionLevel)
|
||||||
.Include(x => x.PositionNumber)
|
// .Include(x => x.PositionNumber)
|
||||||
.Include(x => x.PositionType)
|
// .Include(x => x.PositionType)
|
||||||
on r.RefPlacementProfileId equals p.Id
|
on r.RefPlacementProfileId equals p.Id
|
||||||
join pf in _dbContext.Set<Profile>()
|
// join pf in _dbContext.Set<Profile>()
|
||||||
.Include(x => x.Position)
|
// .Include(x => x.Position)
|
||||||
.Include(x => x.PositionLevel)
|
// .Include(x => x.PositionLevel)
|
||||||
.Include(x => x.PositionType)
|
// .Include(x => x.PositionType)
|
||||||
.Include(x => x.PosNo)
|
// .Include(x => x.PosNo)
|
||||||
.Include(x => x.Salaries)
|
// .Include(x => x.Salaries)
|
||||||
.Include(x => x.Educations)
|
// .Include(x => x.Educations)
|
||||||
on r.CitizenId equals pf.CitizenId
|
// on r.CitizenId equals pf.CitizenId
|
||||||
orderby r.Sequence
|
orderby r.Sequence
|
||||||
select new CommandType03Response
|
select new CommandType03Response
|
||||||
{
|
{
|
||||||
|
|
@ -394,18 +394,18 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
Seq = r.Sequence.ToString().ToThaiNumber(),
|
Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||||
CitizenId = r.CitizenId,
|
CitizenId = r.CitizenId,
|
||||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
|
// OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
|
||||||
OldPositionName = pf.Position == null ? "" : pf.Position.Name,
|
// OldPositionName = pf.Position == null ? "" : pf.Position.Name,
|
||||||
OldPositionLevel = pf.PositionLevel == null ? "" : pf.PositionLevel.Name,
|
// OldPositionLevel = pf.PositionLevel == null ? "" : pf.PositionLevel.Name,
|
||||||
OldPositionType = pf.PositionType == null ? "" : pf.PositionType.Name,
|
// OldPositionType = pf.PositionType == null ? "" : pf.PositionType.Name,
|
||||||
OldPositionNumber = pf.PosNo == null ? "" : pf.PosNo.Name.ToThaiNumber(),
|
// OldPositionNumber = pf.PosNo == null ? "" : pf.PosNo.Name.ToThaiNumber(),
|
||||||
// OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
// OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
||||||
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
|
// NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
|
||||||
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
// NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
||||||
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
// NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
||||||
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
|
// NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
|
||||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
Reason = p.Reason == null ? "-" : p.Reason,
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
|
|
@ -435,24 +435,24 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
var report_data = (from r in raw_data
|
var report_data = (from r in raw_data
|
||||||
join p in _dbContext.Set<RetirementOther>()
|
join p in _dbContext.Set<RetirementOther>()
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.Salaries)
|
// .ThenInclude(x => x.Salaries)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.Position)
|
// .ThenInclude(x => x.Position)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.PositionLevel)
|
// .ThenInclude(x => x.PositionLevel)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.PositionType)
|
// .ThenInclude(x => x.PositionType)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.PosNo)
|
// .ThenInclude(x => x.PosNo)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.Educations)
|
// .ThenInclude(x => x.Educations)
|
||||||
.Include(x => x.OrganizationPosition)
|
// .Include(x => x.OrganizationPosition)
|
||||||
.ThenInclude(x => x.Organization)
|
// .ThenInclude(x => x.Organization)
|
||||||
.Include(x => x.PositionPath)
|
// .Include(x => x.PositionPath)
|
||||||
.Include(x => x.PositionLevel)
|
// .Include(x => x.PositionLevel)
|
||||||
.Include(x => x.PositionNumber)
|
// .Include(x => x.PositionNumber)
|
||||||
.Include(x => x.PositionType)
|
// .Include(x => x.PositionType)
|
||||||
on r.RefPlacementProfileId equals p.Id
|
on r.RefPlacementProfileId equals p.Id
|
||||||
orderby r.Sequence
|
orderby r.Sequence
|
||||||
select new CommandType03Response
|
select new CommandType03Response
|
||||||
|
|
@ -463,21 +463,21 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
Seq = r.Sequence.ToString().ToThaiNumber(),
|
Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||||
CitizenId = r.CitizenId,
|
CitizenId = r.CitizenId,
|
||||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
OldOc = p.Profile.Oc == null ? "" : p.Profile.Oc.Replace("/", " "),
|
// OldOc = p.Profile.Oc == null ? "" : p.Profile.Oc.Replace("/", " "),
|
||||||
OldPositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
|
// OldPositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
|
||||||
OldPositionLevel = p.Profile.PositionLevel == null ? "" : p.Profile.PositionLevel.Name,
|
// OldPositionLevel = p.Profile.PositionLevel == null ? "" : p.Profile.PositionLevel.Name,
|
||||||
OldPositionType = p.Profile.PositionType == null ? "" : p.Profile.PositionType.Name,
|
// OldPositionType = p.Profile.PositionType == null ? "" : p.Profile.PositionType.Name,
|
||||||
OldPositionNumber = p.Profile.PosNo == null ? "" : p.Profile.PosNo.Name.ToThaiNumber(),
|
// OldPositionNumber = p.Profile.PosNo == null ? "" : p.Profile.PosNo.Name.ToThaiNumber(),
|
||||||
// OldSalary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
// OldSalary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
||||||
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
|
// NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
|
||||||
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
// NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
||||||
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
// NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
||||||
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
|
// NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
|
||||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
LeaveDate = p.Profile.LeaveDate == null ? "" : p.Profile.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
// LeaveDate = p.Profile.LeaveDate == null ? "" : p.Profile.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
Reason = p.Reason == null ? "-" : p.Reason,
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
@ -505,24 +505,24 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
var report_data = (from r in raw_data
|
var report_data = (from r in raw_data
|
||||||
join p in _dbContext.Set<RetirementOther>()
|
join p in _dbContext.Set<RetirementOther>()
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.Salaries)
|
// .ThenInclude(x => x.Salaries)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.Position)
|
// .ThenInclude(x => x.Position)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.PositionLevel)
|
// .ThenInclude(x => x.PositionLevel)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.PositionType)
|
// .ThenInclude(x => x.PositionType)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.PosNo)
|
// .ThenInclude(x => x.PosNo)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.Educations)
|
// .ThenInclude(x => x.Educations)
|
||||||
.Include(x => x.OrganizationPosition)
|
// .Include(x => x.OrganizationPosition)
|
||||||
.ThenInclude(x => x.Organization)
|
// .ThenInclude(x => x.Organization)
|
||||||
.Include(x => x.PositionPath)
|
// .Include(x => x.PositionPath)
|
||||||
.Include(x => x.PositionLevel)
|
// .Include(x => x.PositionLevel)
|
||||||
.Include(x => x.PositionNumber)
|
// .Include(x => x.PositionNumber)
|
||||||
.Include(x => x.PositionType)
|
// .Include(x => x.PositionType)
|
||||||
on r.RefPlacementProfileId equals p.Id
|
on r.RefPlacementProfileId equals p.Id
|
||||||
orderby r.Sequence
|
orderby r.Sequence
|
||||||
select new CommandType03Response
|
select new CommandType03Response
|
||||||
|
|
@ -533,21 +533,21 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
Seq = r.Sequence.ToString().ToThaiNumber(),
|
Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||||
CitizenId = r.CitizenId,
|
CitizenId = r.CitizenId,
|
||||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
OldOc = p.Profile.Oc == null ? "" : p.Profile.Oc.Replace("/", " "),
|
// OldOc = p.Profile.Oc == null ? "" : p.Profile.Oc.Replace("/", " "),
|
||||||
OldPositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
|
// OldPositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
|
||||||
OldPositionLevel = p.Profile.PositionLevel == null ? "" : p.Profile.PositionLevel.Name,
|
// OldPositionLevel = p.Profile.PositionLevel == null ? "" : p.Profile.PositionLevel.Name,
|
||||||
OldPositionType = p.Profile.PositionType == null ? "" : p.Profile.PositionType.Name,
|
// OldPositionType = p.Profile.PositionType == null ? "" : p.Profile.PositionType.Name,
|
||||||
OldPositionNumber = p.Profile.PosNo == null ? "" : p.Profile.PosNo.Name.ToThaiNumber(),
|
// OldPositionNumber = p.Profile.PosNo == null ? "" : p.Profile.PosNo.Name.ToThaiNumber(),
|
||||||
// OldSalary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
// OldSalary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
||||||
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
|
// NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
|
||||||
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
// NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
||||||
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
// NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
||||||
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
|
// NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
|
||||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
LeaveDate = p.Profile.LeaveDate == null ? "" : p.Profile.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
// LeaveDate = p.Profile.LeaveDate == null ? "" : p.Profile.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
MilitaryDate = p.MilitaryDate == null ? "" : p.MilitaryDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
MilitaryDate = p.MilitaryDate == null ? "" : p.MilitaryDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
Reason = p.Reason == null ? "-" : p.Reason,
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
})
|
})
|
||||||
|
|
@ -696,12 +696,12 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
var report_data = (from r in raw_data
|
var report_data = (from r in raw_data
|
||||||
join p in _dbContext.Set<PlacementReceive>()
|
join p in _dbContext.Set<PlacementReceive>()
|
||||||
.Include(x => x.OrganizationPosition)
|
// .Include(x => x.OrganizationPosition)
|
||||||
.ThenInclude(x => x.Organization)
|
// .ThenInclude(x => x.Organization)
|
||||||
.Include(x => x.PositionPath)
|
// .Include(x => x.PositionPath)
|
||||||
.Include(x => x.PositionLevel)
|
// .Include(x => x.PositionLevel)
|
||||||
.Include(x => x.PositionNumber)
|
// .Include(x => x.PositionNumber)
|
||||||
.Include(x => x.PositionType)
|
// .Include(x => x.PositionType)
|
||||||
on r.RefPlacementProfileId equals p.Id
|
on r.RefPlacementProfileId equals p.Id
|
||||||
orderby r.Sequence
|
orderby r.Sequence
|
||||||
select new CommandType03Response
|
select new CommandType03Response
|
||||||
|
|
@ -716,11 +716,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
OldPositionType = p.PositionTypeOld ?? "",
|
OldPositionType = p.PositionTypeOld ?? "",
|
||||||
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
||||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
||||||
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
|
// NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
|
||||||
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
// NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
|
||||||
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
// NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
|
||||||
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
|
// NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
|
||||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
||||||
Reason = p.Reason == null ? "-" : p.Reason,
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
|
|
@ -745,8 +745,8 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
var report_data = (from r in raw_data
|
var report_data = (from r in raw_data
|
||||||
join p in _dbContext.Set<PlacementOfficer>()
|
join p in _dbContext.Set<PlacementOfficer>()
|
||||||
.Include(p => p.Profile)
|
//.Include(p => p.Profile)
|
||||||
.ThenInclude(p => p.Position)
|
//.ThenInclude(p => p.Position)
|
||||||
on r.RefPlacementProfileId equals p.Id
|
on r.RefPlacementProfileId equals p.Id
|
||||||
orderby r.Sequence
|
orderby r.Sequence
|
||||||
select new CommandType15Response
|
select new CommandType15Response
|
||||||
|
|
@ -786,12 +786,12 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
var report_data = (from r in raw_data
|
var report_data = (from r in raw_data
|
||||||
join p in _dbContext.Set<PlacementRepatriation>()
|
join p in _dbContext.Set<PlacementRepatriation>()
|
||||||
.Include(p => p.Profile)
|
//.Include(p => p.Profile)
|
||||||
.ThenInclude(p => p.Position)
|
//.ThenInclude(p => p.Position)
|
||||||
.Include(p => p.Profile)
|
//.Include(p => p.Profile)
|
||||||
.ThenInclude(p => p.Salaries)
|
//.ThenInclude(p => p.Salaries)
|
||||||
.Include(p => p.Profile)
|
//.Include(p => p.Profile)
|
||||||
.ThenInclude(p => p.Prefix)
|
//.ThenInclude(p => p.Prefix)
|
||||||
on r.RefPlacementProfileId equals p.Id
|
on r.RefPlacementProfileId equals p.Id
|
||||||
orderby r.Sequence
|
orderby r.Sequence
|
||||||
select new CommandType16Response
|
select new CommandType16Response
|
||||||
|
|
@ -807,7 +807,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
r.Command.GovAidCommandDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
r.Command.GovAidCommandDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||||
StartDate = p.Date == null ? "" : p.Date.Value.ToThaiFullDate3().ToThaiNumber(),
|
StartDate = p.Date == null ? "" : p.Date.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||||
ActiveDate = p.DateRepatriation == null ? "" : p.DateRepatriation.Value.ToThaiFullDate3().ToThaiNumber(),
|
ActiveDate = p.DateRepatriation == null ? "" : p.DateRepatriation.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||||
FullName = $"{p.Profile.Prefix!.Name}{p.Profile.FirstName!} {p.Profile.LastName!}",
|
FullName = $"{p.prefix}{p.firstName!} {p.lastName!}",
|
||||||
Subject = $"เรื่อง {r.Command.CommandSubject}",
|
Subject = $"เรื่อง {r.Command.CommandSubject}",
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
@ -882,10 +882,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
var report_data = (from r in raw_data
|
var report_data = (from r in raw_data
|
||||||
join p in _dbContext.Set<RetirementOut>()
|
join p in _dbContext.Set<RetirementOut>()
|
||||||
.Include(p => p.Profile)
|
// .Include(p => p.Profile)
|
||||||
.ThenInclude(p => p.Position)
|
// .ThenInclude(p => p.Position)
|
||||||
.Include(p => p.Profile)
|
// .Include(p => p.Profile)
|
||||||
.ThenInclude(p => p.Salaries)
|
// .ThenInclude(p => p.Salaries)
|
||||||
on r.RefPlacementProfileId equals p.Id
|
on r.RefPlacementProfileId equals p.Id
|
||||||
orderby r.Sequence
|
orderby r.Sequence
|
||||||
select new CommandType18Response
|
select new CommandType18Response
|
||||||
|
|
@ -898,7 +898,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
AuthorizedPosition = r.Command.AuthorizedPosition,
|
AuthorizedPosition = r.Command.AuthorizedPosition,
|
||||||
CitizenId = r.CitizenId,
|
CitizenId = r.CitizenId,
|
||||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
|
// PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
|
||||||
Organization = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
|
Organization = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
|
||||||
PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
|
PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
|
||||||
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
|
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
|
||||||
|
|
@ -1104,24 +1104,24 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
var report_data = (from r in raw_data
|
var report_data = (from r in raw_data
|
||||||
join p in _dbContext.Set<PlacementAppointment>()
|
join p in _dbContext.Set<PlacementAppointment>()
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.Position)
|
// .ThenInclude(x => x.Position)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.PositionLevel)
|
// .ThenInclude(x => x.PositionLevel)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.PositionType)
|
// .ThenInclude(x => x.PositionType)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.PosNo)
|
// .ThenInclude(x => x.PosNo)
|
||||||
.Include(x => x.OrgEmployee)
|
// .Include(x => x.OrgEmployee)
|
||||||
.ThenInclude(x => x.OrganizationAgency)
|
// .ThenInclude(x => x.OrganizationAgency)
|
||||||
.ThenInclude(x => x.OrganizationOrganization)
|
// .ThenInclude(x => x.OrganizationOrganization)
|
||||||
//.Include(x => x.OrgEmployee)
|
// //.Include(x => x.OrgEmployee)
|
||||||
//.ThenInclude(x => x.PosNo)
|
// //.ThenInclude(x => x.PosNo)
|
||||||
.Include(x => x.OrgEmployee)
|
// .Include(x => x.OrgEmployee)
|
||||||
.ThenInclude(x => x.PositionEmployeePosition)
|
// .ThenInclude(x => x.PositionEmployeePosition)
|
||||||
.Include(x => x.OrgEmployee)
|
// .Include(x => x.OrgEmployee)
|
||||||
.ThenInclude(x => x.OrganizationPositionEmployeeLevels)
|
// .ThenInclude(x => x.OrganizationPositionEmployeeLevels)
|
||||||
.ThenInclude(x => x.PositionEmployeeLevel)
|
// .ThenInclude(x => x.PositionEmployeeLevel)
|
||||||
on r.RefPlacementProfileId equals p.Id
|
on r.RefPlacementProfileId equals p.Id
|
||||||
orderby r.Sequence
|
orderby r.Sequence
|
||||||
select new CommandType22Response
|
select new CommandType22Response
|
||||||
|
|
@ -1134,9 +1134,9 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
OldPositionNumber = p.PositionNumberOld == null ? null : p.PositionNumberOld.ToThaiNumber(),
|
OldPositionNumber = p.PositionNumberOld == null ? null : p.PositionNumberOld.ToThaiNumber(),
|
||||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
||||||
NewPositionName = p.OrgEmployee == null || p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name,
|
// NewPositionName = p.OrgEmployee == null || p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name,
|
||||||
NewPositionLevel = p.OrgEmployee == null || p.OrgEmployee.OrganizationPositionEmployeeLevels == null || p.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel.Name,
|
// NewPositionLevel = p.OrgEmployee == null || p.OrgEmployee.OrganizationPositionEmployeeLevels == null || p.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel.Name,
|
||||||
NewPositionNumber = p.OrgEmployee == null || p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
|
// NewPositionNumber = p.OrgEmployee == null || p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
|
||||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
Reason = p.Reason == null ? "-" : p.Reason,
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
})
|
})
|
||||||
|
|
@ -1231,24 +1231,24 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
|
|
||||||
var report_data = (from r in raw_data
|
var report_data = (from r in raw_data
|
||||||
join p in _dbContext.Set<PlacementAppointment>()
|
join p in _dbContext.Set<PlacementAppointment>()
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.Position)
|
// .ThenInclude(x => x.Position)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.PositionLevel)
|
// .ThenInclude(x => x.PositionLevel)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.PositionType)
|
// .ThenInclude(x => x.PositionType)
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.PosNo)
|
// .ThenInclude(x => x.PosNo)
|
||||||
.Include(x => x.OrgEmployee)
|
// .Include(x => x.OrgEmployee)
|
||||||
.ThenInclude(x => x.OrganizationAgency)
|
// .ThenInclude(x => x.OrganizationAgency)
|
||||||
.ThenInclude(x => x.OrganizationOrganization)
|
// .ThenInclude(x => x.OrganizationOrganization)
|
||||||
//.Include(x => x.OrgEmployee)
|
// //.Include(x => x.OrgEmployee)
|
||||||
//.ThenInclude(x => x.PosNo)
|
// //.ThenInclude(x => x.PosNo)
|
||||||
.Include(x => x.OrgEmployee)
|
// .Include(x => x.OrgEmployee)
|
||||||
.ThenInclude(x => x.PositionEmployeePosition)
|
// .ThenInclude(x => x.PositionEmployeePosition)
|
||||||
.Include(x => x.OrgEmployee)
|
// .Include(x => x.OrgEmployee)
|
||||||
.ThenInclude(x => x.OrganizationPositionEmployeeLevels)
|
// .ThenInclude(x => x.OrganizationPositionEmployeeLevels)
|
||||||
.ThenInclude(x => x.PositionEmployeeLevel)
|
// .ThenInclude(x => x.PositionEmployeeLevel)
|
||||||
on r.RefPlacementProfileId equals p.Id
|
on r.RefPlacementProfileId equals p.Id
|
||||||
orderby r.Sequence
|
orderby r.Sequence
|
||||||
select new CommandType22Response
|
select new CommandType22Response
|
||||||
|
|
@ -1261,9 +1261,9 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
OldPositionNumber = p.PositionNumberOld == null ? null : p.PositionNumberOld.ToThaiNumber(),
|
OldPositionNumber = p.PositionNumberOld == null ? null : p.PositionNumberOld.ToThaiNumber(),
|
||||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
||||||
NewPositionName = p.OrgEmployee == null || p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name,
|
// NewPositionName = p.OrgEmployee == null || p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name,
|
||||||
NewPositionLevel = p.OrgEmployee == null || p.OrgEmployee.OrganizationPositionEmployeeLevels == null || p.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel.Name,
|
// NewPositionLevel = p.OrgEmployee == null || p.OrgEmployee.OrganizationPositionEmployeeLevels == null || p.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel.Name,
|
||||||
NewPositionNumber = p.OrgEmployee == null || p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
|
// NewPositionNumber = p.OrgEmployee == null || p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
|
||||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||||
Reason = p.Reason == null ? "-" : p.Reason,
|
Reason = p.Reason == null ? "-" : p.Reason,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -189,23 +189,41 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
ProfileId = p.Profile.Id,
|
p.prefix,
|
||||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
p.profileId,
|
||||||
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
|
p.firstName,
|
||||||
p.Profile.FirstName,
|
p.lastName,
|
||||||
p.Profile.LastName,
|
p.root,
|
||||||
Position = p.Profile.Position == null ? null : p.Profile.Position.Name,
|
p.rootShortName,
|
||||||
PositionId = p.Profile.Position == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Position.Id,
|
p.child1,
|
||||||
PositionType = p.Profile.PositionType == null ? null : p.Profile.PositionType.Name,
|
p.child1ShortName,
|
||||||
PositionTypeId = p.Profile.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionType.Id,
|
p.child2,
|
||||||
p.Profile.PositionLine,
|
p.child2ShortName,
|
||||||
p.Profile.PositionLineId,
|
p.child3,
|
||||||
PositionLevel = p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name,
|
p.child3ShortName,
|
||||||
PositionLevelId = p.Profile.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionLevel.Id,
|
p.child4,
|
||||||
p.Profile.PositionExecutive,
|
p.child4ShortName,
|
||||||
p.Profile.PositionExecutiveId,
|
p.posMasterNo,
|
||||||
Organization = p.Profile.Oc,
|
p.posLevelName,
|
||||||
OrganizationId = p.Profile.OcId,
|
p.posTypeName,
|
||||||
|
|
||||||
|
// ProfileId = p.Profile.Id,
|
||||||
|
// Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
||||||
|
// PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
|
||||||
|
// p.Profile.FirstName,
|
||||||
|
// p.Profile.LastName,
|
||||||
|
// Position = p.Profile.Position == null ? null : p.Profile.Position.Name,
|
||||||
|
// PositionId = p.Profile.Position == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Position.Id,
|
||||||
|
// PositionType = p.Profile.PositionType == null ? null : p.Profile.PositionType.Name,
|
||||||
|
// PositionTypeId = p.Profile.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionType.Id,
|
||||||
|
// p.Profile.PositionLine,
|
||||||
|
// p.Profile.PositionLineId,
|
||||||
|
// PositionLevel = p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name,
|
||||||
|
// PositionLevelId = p.Profile.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionLevel.Id,
|
||||||
|
// p.Profile.PositionExecutive,
|
||||||
|
// p.Profile.PositionExecutiveId,
|
||||||
|
// Organization = p.Profile.Oc,
|
||||||
|
// OrganizationId = p.Profile.OcId,
|
||||||
p.Number,
|
p.Number,
|
||||||
p.Date,
|
p.Date,
|
||||||
p.Location,
|
p.Location,
|
||||||
|
|
@ -216,29 +234,34 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
string Prefix = string.IsNullOrEmpty(data.Prefix.ToString()) ? string.Empty : data.Prefix.ToString();
|
// string Prefix = string.IsNullOrEmpty(data.Prefix.ToString()) ? string.Empty : data.Prefix.ToString();
|
||||||
string FirstName = string.IsNullOrEmpty(data.FirstName.ToString()) ? string.Empty : data.FirstName.ToString();
|
// string FirstName = string.IsNullOrEmpty(data.FirstName.ToString()) ? string.Empty : data.FirstName.ToString();
|
||||||
string LastName = string.IsNullOrEmpty(data.LastName.ToString()) ? string.Empty : data.LastName.ToString();
|
// string LastName = string.IsNullOrEmpty(data.LastName.ToString()) ? string.Empty : data.LastName.ToString();
|
||||||
string FullName = $"{Prefix} {FirstName} {LastName}";
|
// string FullName = $"{Prefix} {FirstName} {LastName}";
|
||||||
string Date = string.IsNullOrEmpty(data.Date.ToString()) ? "วันที่ - เดือน - พ.ศ. -" : DateTime.Parse(data.Date.ToString()).ToThaiFullDate().ToString().ToThaiNumber();
|
string Date = string.IsNullOrEmpty(data.Date.ToString()) ? "วันที่ - เดือน - พ.ศ. -" : DateTime.Parse(data.Date.ToString()).ToThaiFullDate().ToString().ToThaiNumber();
|
||||||
string CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate().ToString().ToThaiNumber();
|
string CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate().ToString().ToThaiNumber();
|
||||||
return new
|
return new
|
||||||
{
|
{
|
||||||
FullName,
|
FullName = $"{data.prefix} {data.firstName} {data.lastName}",
|
||||||
Date,
|
Date,
|
||||||
CurrentDate,
|
CurrentDate,
|
||||||
data.Position,
|
data.profileId,
|
||||||
data.PositionExecutive,
|
data.prefix,
|
||||||
data.PositionType,
|
data.firstName,
|
||||||
data.PositionLine,
|
data.lastName,
|
||||||
data.PositionLevel,
|
data.root,
|
||||||
data.Organization,
|
data.rootShortName,
|
||||||
data.PositionId,
|
data.child1,
|
||||||
data.PositionExecutiveId,
|
data.child1ShortName,
|
||||||
data.PositionTypeId,
|
data.child2,
|
||||||
data.PositionLineId,
|
data.child2ShortName,
|
||||||
data.PositionLevelId,
|
data.child3,
|
||||||
data.OrganizationId,
|
data.child3ShortName,
|
||||||
|
data.child4,
|
||||||
|
data.child4ShortName,
|
||||||
|
data.posMasterNo,
|
||||||
|
data.posLevelName,
|
||||||
|
data.posTypeName,
|
||||||
data.Number,
|
data.Number,
|
||||||
data.Location,
|
data.Location,
|
||||||
data.Reason,
|
data.Reason,
|
||||||
|
|
@ -250,7 +273,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
public async Task<dynamic> GetHeadRetirementDeceasedAsync(Guid id)
|
public async Task<dynamic> GetHeadRetirementDeceasedAsync(Guid id)
|
||||||
{
|
{
|
||||||
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
|
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.Where(x => x.Id == id)
|
.Where(x => x.Id == id)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
var oc = "";
|
var oc = "";
|
||||||
|
|
@ -264,28 +287,28 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
Send = "หัวหน้าสำนักงาน ก.ก.",
|
Send = "หัวหน้าสำนักงาน ก.ก.",
|
||||||
};
|
};
|
||||||
|
|
||||||
if (data.Profile.OcId != null)
|
// if (data.Profile.OcId != null)
|
||||||
{
|
// {
|
||||||
var organization = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
// var organization = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
||||||
.Where(x => x.Id == data.Profile.OcId)
|
// .Where(x => x.Id == data.Profile.OcId)
|
||||||
.FirstOrDefaultAsync();
|
// .FirstOrDefaultAsync();
|
||||||
if (organization != null)
|
// if (organization != null)
|
||||||
{
|
// {
|
||||||
var organizationAgency = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
// var organizationAgency = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
||||||
.Where(x => x.Id == organization.OrganizationAgencyId)
|
// .Where(x => x.Id == organization.OrganizationAgencyId)
|
||||||
.FirstOrDefaultAsync();
|
// .FirstOrDefaultAsync();
|
||||||
if (organizationAgency != null)
|
// if (organizationAgency != null)
|
||||||
{
|
// {
|
||||||
var agency = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
// var agency = await _dbContext.Set<OrganizationEntity>().AsQueryable()
|
||||||
.Where(x => x.Id == organizationAgency.Id)
|
// .Where(x => x.Id == organizationAgency.Id)
|
||||||
.FirstOrDefaultAsync();
|
// .FirstOrDefaultAsync();
|
||||||
if (agency != null)
|
// if (agency != null)
|
||||||
{
|
// {
|
||||||
oc = agency.OrganizationOrganization?.Name;
|
// oc = agency.OrganizationOrganization?.Name;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return new
|
return new
|
||||||
{
|
{
|
||||||
|
|
@ -302,7 +325,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
public async Task UploadFileRetirementDeceasedAsync(Guid id, Domain.Models.Documents.Document file)
|
public async Task UploadFileRetirementDeceasedAsync(Guid id, Domain.Models.Documents.Document file)
|
||||||
{
|
{
|
||||||
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
|
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
|
||||||
.Include(x => x.Profile)
|
// .Include(x => x.Profile)
|
||||||
.Where(x => x.Id == id)
|
.Where(x => x.Id == id)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (data != null)
|
if (data != null)
|
||||||
|
|
@ -361,8 +384,8 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
data.LastName,
|
data.LastName,
|
||||||
data.Location,
|
data.Location,
|
||||||
FullName = $"{data.Prefix}{data.FirstName} {data.LastName}",
|
FullName = $"{data.Prefix}{data.FirstName} {data.LastName}",
|
||||||
SendDate = string.IsNullOrEmpty(data.SendDate.ToString())? string.Empty : DateTime.Parse(data.SendDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
|
SendDate = string.IsNullOrEmpty(data.SendDate.ToString()) ? string.Empty : DateTime.Parse(data.SendDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
|
||||||
ActiveDate = string.IsNullOrEmpty(data.ActiveDate.ToString())? string.Empty : DateTime.Parse(data.ActiveDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
|
ActiveDate = string.IsNullOrEmpty(data.ActiveDate.ToString()) ? string.Empty : DateTime.Parse(data.ActiveDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
|
||||||
data.Reason,
|
data.Reason,
|
||||||
data.Status,
|
data.Status,
|
||||||
data.salary,
|
data.salary,
|
||||||
|
|
@ -376,7 +399,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
data.CreatedAt,
|
data.CreatedAt,
|
||||||
data.OligarchReject,
|
data.OligarchReject,
|
||||||
data.OligarchApproveReason,
|
data.OligarchApproveReason,
|
||||||
data.OligarchRejectReason,
|
data.OligarchRejectReason,
|
||||||
OligarchRejectDate = string.IsNullOrEmpty(data.OligarchRejectDate.ToString()) ? string.Empty : DateTime.Parse(data.OligarchRejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
|
OligarchRejectDate = string.IsNullOrEmpty(data.OligarchRejectDate.ToString()) ? string.Empty : DateTime.Parse(data.OligarchRejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
|
||||||
data.CommanderReject,
|
data.CommanderReject,
|
||||||
data.CommanderApproveReason,
|
data.CommanderApproveReason,
|
||||||
|
|
|
||||||
|
|
@ -70,16 +70,16 @@ namespace BMA.EHR.Application.Repositories
|
||||||
public async Task NotifyOut()
|
public async Task NotifyOut()
|
||||||
{
|
{
|
||||||
var cronjobNotis = await _dbContext.Set<RetirementOut>()
|
var cronjobNotis = await _dbContext.Set<RetirementOut>()
|
||||||
.Include(x => x.Profile)
|
//.Include(x => x.Profile)
|
||||||
.ThenInclude(x => x.Prefix)
|
//.ThenInclude(x => x.Prefix)
|
||||||
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
|
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
|
||||||
.AsQueryable()
|
.AsQueryable()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
foreach (var cronjobNoti in cronjobNotis)
|
foreach (var cronjobNoti in cronjobNotis)
|
||||||
{
|
{
|
||||||
cronjobNoti.Profile.IsLeave = true;
|
//cronjobNoti.Profile.IsLeave = true;
|
||||||
cronjobNoti.Profile.LeaveReason = "LAYOFF";
|
//cronjobNoti.Profile.LeaveReason = "LAYOFF";
|
||||||
cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
//cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||||
// await _repositoryNoti.PushNotificationAsync(
|
// await _repositoryNoti.PushNotificationAsync(
|
||||||
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
||||||
|
|
|
||||||
|
|
@ -11,56 +11,58 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
{
|
{
|
||||||
public class PlacementAppointment : EntityBase
|
public class PlacementAppointment : EntityBase
|
||||||
{
|
{
|
||||||
[Required, Comment("Id User")]
|
// [Required, Comment("Id User")]
|
||||||
public Profile Profile { get; set; }
|
// public Profile Profile { get; set; }
|
||||||
[Required, MaxLength(20), Comment("เลขประจำตัวประชาชน")]
|
// [Required, MaxLength(20), Comment("เลขประจำตัวประชาชน")]
|
||||||
public string? CitizenId { get; set; }
|
// public string? CitizenId { get; set; }
|
||||||
[Required, Comment("คำนำหน้า")]
|
// [Required, Comment("คำนำหน้า")]
|
||||||
public Prefix? Prefix { get; set; }
|
// public Prefix? Prefix { get; set; }
|
||||||
[Required, Comment("ชื่อ")]
|
// [Required, Comment("ชื่อ")]
|
||||||
public string? Firstname { get; set; }
|
// public string? Firstname { get; set; }
|
||||||
[Required, Comment("นามสกุล")]
|
// [Required, Comment("นามสกุล")]
|
||||||
public string? Lastname { get; set; }
|
// public string? Lastname { get; set; }
|
||||||
[MaxLength(40), Comment("วันเกิด")]
|
// [MaxLength(40), Comment("วันเกิด")]
|
||||||
public DateTime DateOfBirth { get; set; }
|
// public DateTime DateOfBirth { get; set; }
|
||||||
[Comment("Id เพศ")]
|
// [Comment("Id เพศ")]
|
||||||
public Gender? Gender { get; set; }
|
// public Gender? Gender { get; set; }
|
||||||
[MaxLength(100), Comment("สัญชาติ")]
|
// [MaxLength(100), Comment("สัญชาติ")]
|
||||||
public string? Nationality { get; set; }
|
// public string? Nationality { get; set; }
|
||||||
[MaxLength(100), Comment("เชื้อชาติ")]
|
// [MaxLength(100), Comment("เชื้อชาติ")]
|
||||||
public string? Race { get; set; }
|
// public string? Race { get; set; }
|
||||||
[Comment("Id ศาสนา")]
|
// [Comment("Id ศาสนา")]
|
||||||
public Religion? Religion { get; set; }
|
// public Religion? Religion { get; set; }
|
||||||
[Comment("Id กลุ่มเลือด")]
|
// [Comment("Id กลุ่มเลือด")]
|
||||||
public BloodGroup? BloodGroup { get; set; }
|
// public BloodGroup? BloodGroup { get; set; }
|
||||||
[Comment("Id สถานะภาพ")]
|
// [Comment("Id สถานะภาพ")]
|
||||||
public Relationship? Relationship { get; set; }
|
// public Relationship? Relationship { get; set; }
|
||||||
[MaxLength(50), Comment("เบอร์โทร")]
|
// [MaxLength(50), Comment("เบอร์โทร")]
|
||||||
public string? TelephoneNumber { get; set; }
|
// public string? TelephoneNumber { get; set; }
|
||||||
[Comment("สถานะคำขอ")]
|
[Comment("สถานะคำขอ")]
|
||||||
public string Status { get; set; } = "WAITTING";
|
public string Status { get; set; } = "WAITTING";
|
||||||
[Comment("Id เลขที่ตำแหน่ง")]
|
// [Comment("Id เลขที่ตำแหน่ง")]
|
||||||
public OrganizationPositionEntity? OrganizationPosition { get; set; }
|
// public OrganizationPositionEntity? OrganizationPosition { get; set; }
|
||||||
[Comment("วันที่บรรจุ")]
|
[Comment("วันที่บรรจุ")]
|
||||||
public DateTime? RecruitDate { get; set; }
|
public DateTime? RecruitDate { get; set; }
|
||||||
|
|
||||||
[Comment("Id ตำแหน่งเลขที่")]
|
// [Comment("Id ตำแหน่งเลขที่")]
|
||||||
public PositionNumberEntity? PositionNumber { get; set; }
|
// public PositionNumberEntity? PositionNumber { get; set; }
|
||||||
|
|
||||||
[Comment("Id ตำแหน่ง")]
|
// [Comment("Id ตำแหน่ง")]
|
||||||
public PositionPath? PositionPath { get; set; }
|
// public PositionPath? PositionPath { get; set; }
|
||||||
|
|
||||||
[Comment("Id ด้าน/สาขา")]
|
// [Comment("Id ด้าน/สาขา")]
|
||||||
public PositionPathSide? PositionPathSide { get; set; }
|
// public PositionPathSide? PositionPathSide { get; set; }
|
||||||
|
|
||||||
[Comment("Id ประเภทตำแหน่ง")]
|
// [Comment("Id ประเภทตำแหน่ง")]
|
||||||
public PositionType? PositionType { get; set; }
|
// public PositionType? PositionType { get; set; }
|
||||||
|
|
||||||
[Comment("Id สายงาน")]
|
// [Comment("Id สายงาน")]
|
||||||
public PositionLine? PositionLine { get; set; }
|
// public PositionLine? PositionLine { get; set; }
|
||||||
|
|
||||||
[Comment("Id ระดับ")]
|
// [Comment("Id ระดับ")]
|
||||||
public PositionLevel? PositionLevel { get; set; }
|
// public PositionLevel? PositionLevel { get; set; }
|
||||||
|
[Comment("ประเภทราชการ")]
|
||||||
|
public string? type { get; set; }
|
||||||
[Comment("เงินเดือน")]
|
[Comment("เงินเดือน")]
|
||||||
public double? Amount { get; set; }
|
public double? Amount { get; set; }
|
||||||
[Comment("เหตุผลที่รับย้ายราชการ")]
|
[Comment("เหตุผลที่รับย้ายราชการ")]
|
||||||
|
|
@ -83,10 +85,127 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
public CommandType? CommandType { get; set; }
|
public CommandType? CommandType { get; set; }
|
||||||
[Comment("ดำรงตำแหน่งในระดับปัจจุบันเมื่อ")]
|
[Comment("ดำรงตำแหน่งในระดับปัจจุบันเมื่อ")]
|
||||||
public DateTime? PositionDate { get; set; }
|
public DateTime? PositionDate { get; set; }
|
||||||
public OrgEmployee? OrgEmployee { get; set; }
|
|
||||||
public PositionEmployeeStatus? PositionEmployeeStatus { get; set; }
|
|
||||||
public PositionEmployeeLine? PositionEmployeeLine { get; set; }
|
[Comment("profile Id")]
|
||||||
public PositionEmployeePosition? PositionEmployeePosition { get; set; }
|
public string? profileId { get; set; }
|
||||||
|
[Comment("คำนำหน้า")]
|
||||||
|
public string? prefix { get; set; }
|
||||||
|
[Comment("ชื่อ")]
|
||||||
|
public string? firstName { get; set; }
|
||||||
|
[Comment("นามสกุล")]
|
||||||
|
public string? lastName { get; set; }
|
||||||
|
[Comment("เลขบัตรประชาชน")]
|
||||||
|
public string? citizenId { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน root")]
|
||||||
|
public string? root { get; set; }
|
||||||
|
[Comment("id หน่วยงาน root")]
|
||||||
|
public string? rootId { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน root")]
|
||||||
|
public string? rootShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child1")]
|
||||||
|
public string? child1 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child1")]
|
||||||
|
public string? child1Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child1")]
|
||||||
|
public string? child1ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child2")]
|
||||||
|
public string? child2 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child2")]
|
||||||
|
public string? child2Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child2")]
|
||||||
|
public string? child2ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child3")]
|
||||||
|
public string? child3 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child3")]
|
||||||
|
public string? child3Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child3")]
|
||||||
|
public string? child3ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child4")]
|
||||||
|
public string? child4 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child4")]
|
||||||
|
public string? child4Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child4")]
|
||||||
|
public string? child4ShortName { get; set; }
|
||||||
|
[Comment("ระดับโครงสร้าง")]
|
||||||
|
public int? node { get; set; }
|
||||||
|
|
||||||
|
[Comment("id โครงสร้าง")]
|
||||||
|
public Guid? nodeId { get; set; }
|
||||||
|
[Comment("id อัตรากำลัง")]
|
||||||
|
public string? posmasterId { get; set; }
|
||||||
|
[Comment("id revision")]
|
||||||
|
public string? orgRevisionId { get; set; }
|
||||||
|
[Comment("id ตำแหน่ง")]
|
||||||
|
public string? positionId { get; set; }
|
||||||
|
[Comment("สายงาน")]
|
||||||
|
public string? positionField { get; set; }
|
||||||
|
[Comment("เลขที่ตำแหน่ง")]
|
||||||
|
public int? posMasterNo { get; set; }
|
||||||
|
[Comment("ชื่อตำแหน่งในสายงาน")]
|
||||||
|
public string? positionName { get; set; }
|
||||||
|
[Comment("id ประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeId { get; set; }
|
||||||
|
[Comment("ชื่อประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeName { get; set; }
|
||||||
|
[Comment("id ระดับตำแหน่ง")]
|
||||||
|
public string? posLevelId { get; set; }
|
||||||
|
[Comment("ชื่อระดับตำแหน่ง")]
|
||||||
|
public string? posLevelName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Comment("ชื่อหน่วยงาน root old")]
|
||||||
|
public string? rootOld { get; set; }
|
||||||
|
[Comment("id หน่วยงาน root old")]
|
||||||
|
public string? rootOldId { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน root old")]
|
||||||
|
public string? rootShortNameOld { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child1 old")]
|
||||||
|
public string? child1Old { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child1 old")]
|
||||||
|
public string? child1OldId { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child1 old")]
|
||||||
|
public string? child1ShortNameOld { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child2 old")]
|
||||||
|
public string? child2Old { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child2 old")]
|
||||||
|
public string? child2OldId { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child2 old")]
|
||||||
|
public string? child2ShortNameOld { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child3 old")]
|
||||||
|
public string? child3Old { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child3 old")]
|
||||||
|
public string? child3OldId { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child3 old")]
|
||||||
|
public string? child3ShortNameOld { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child4 old")]
|
||||||
|
public string? child4Old { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child4 old")]
|
||||||
|
public string? child4OldId { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child4 old")]
|
||||||
|
public string? child4ShortNameOld { get; set; }
|
||||||
|
// [Comment("id revision old")]
|
||||||
|
// public string? orgRevisionId { get; set; }
|
||||||
|
[Comment("เลขที่ตำแหน่ง old")]
|
||||||
|
public int? posMasterNoOld { get; set; }
|
||||||
|
[Comment("ชื่อตำแหน่งในสายงาน old")]
|
||||||
|
public string? positionOld { get; set; }
|
||||||
|
[Comment("id ประเภทตำแหน่ง old")]
|
||||||
|
public string? posTypeOldId { get; set; }
|
||||||
|
[Comment("ชื่อประเภทตำแหน่ง old")]
|
||||||
|
public string? posTypeNameOld { get; set; }
|
||||||
|
[Comment("id ระดับตำแหน่ง old")]
|
||||||
|
public string? posLevelOldId { get; set; }
|
||||||
|
[Comment("ชื่อระดับตำแหน่ง old")]
|
||||||
|
public string? posLevelNameOld { get; set; }
|
||||||
|
|
||||||
|
// public OrgEmployee? OrgEmployee { get; set; }
|
||||||
|
// public PositionEmployeeStatus? PositionEmployeeStatus { get; set; }
|
||||||
|
// public PositionEmployeeLine? PositionEmployeeLine { get; set; }
|
||||||
|
// public PositionEmployeePosition? PositionEmployeePosition { get; set; }
|
||||||
public virtual List<PlacementAppointmentDoc> PlacementAppointmentDocs { get; set; } = new List<PlacementAppointmentDoc>();
|
public virtual List<PlacementAppointmentDoc> PlacementAppointmentDocs { get; set; } = new List<PlacementAppointmentDoc>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
{
|
{
|
||||||
public class PlacementOfficer : EntityBase
|
public class PlacementOfficer : EntityBase
|
||||||
{
|
{
|
||||||
[Comment("Id User")]
|
// [Comment("Id User")]
|
||||||
public Profile? Profile { get; set; }
|
// public Profile? Profile { get; set; }
|
||||||
[Comment("เหตุผล")]
|
[Comment("เหตุผล")]
|
||||||
public string? Reason { get; set; } = string.Empty;
|
public string? Reason { get; set; } = string.Empty;
|
||||||
[Comment("ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")]
|
[Comment("ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")]
|
||||||
|
|
@ -33,6 +33,63 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
public DateTime? DateEnd { get; set; }
|
public DateTime? DateEnd { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Comment("profile Id")]
|
||||||
|
public string? profileId { get; set; }
|
||||||
|
[Comment("คำนำหน้า")]
|
||||||
|
public string? prefix { get; set; }
|
||||||
|
[Comment("ชื่อ")]
|
||||||
|
public string? firstName { get; set; }
|
||||||
|
[Comment("นามสกุล")]
|
||||||
|
public string? lastName { get; set; }
|
||||||
|
[Comment("เลขบัตรประชาชน")]
|
||||||
|
public string? citizenId { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน root")]
|
||||||
|
public string? root { get; set; }
|
||||||
|
[Comment("id หน่วยงาน root")]
|
||||||
|
public string? rootId { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน root")]
|
||||||
|
public string? rootShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child1")]
|
||||||
|
public string? child1 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child1")]
|
||||||
|
public string? child1Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child1")]
|
||||||
|
public string? child1ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child2")]
|
||||||
|
public string? child2 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child2")]
|
||||||
|
public string? child2Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child2")]
|
||||||
|
public string? child2ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child3")]
|
||||||
|
public string? child3 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child3")]
|
||||||
|
public string? child3Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child3")]
|
||||||
|
public string? child3ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child4")]
|
||||||
|
public string? child4 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child4")]
|
||||||
|
public string? child4Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child4")]
|
||||||
|
public string? child4ShortName { get; set; }
|
||||||
|
// [Comment("id revision")]
|
||||||
|
// public string? orgRevisionId { get; set; }
|
||||||
|
[Comment("เลขที่ตำแหน่ง")]
|
||||||
|
public int? posMasterNo { get; set; }
|
||||||
|
[Comment("ชื่อตำแหน่งในสายงาน")]
|
||||||
|
public string? position { get; set; }
|
||||||
|
[Comment("id ประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeId { get; set; }
|
||||||
|
[Comment("ชื่อประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeName { get; set; }
|
||||||
|
[Comment("id ระดับตำแหน่ง")]
|
||||||
|
public string? posLevelId { get; set; }
|
||||||
|
[Comment("ชื่อระดับตำแหน่ง")]
|
||||||
|
public string? posLevelName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[Comment("สถานะคำขอ")]
|
[Comment("สถานะคำขอ")]
|
||||||
public string Status { get; set; } = "WAITTING";
|
public string Status { get; set; } = "WAITTING";
|
||||||
[Comment("สถานะการใช้งาน")]
|
[Comment("สถานะการใช้งาน")]
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,14 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
// public Profile Profile { get; set; }
|
// public Profile Profile { get; set; }
|
||||||
[Comment("Fk Table Document")]
|
[Comment("Fk Table Document")]
|
||||||
public Document? Avatar { get; set; }
|
public Document? Avatar { get; set; }
|
||||||
[Required, MaxLength(20), Comment("เลขประจำตัวประชาชน")]
|
// [Required, MaxLength(20), Comment("เลขประจำตัวประชาชน")]
|
||||||
public string CitizenId { get; set; }
|
// public string CitizenId { get; set; }
|
||||||
[Required, Comment("คำนำหน้า")]
|
// [Required, Comment("คำนำหน้า")]
|
||||||
public Prefix Prefix { get; set; }
|
// public Prefix Prefix { get; set; }
|
||||||
[Required, Comment("ชื่อ")]
|
// [Required, Comment("ชื่อ")]
|
||||||
public string Firstname { get; set; }
|
// public string Firstname { get; set; }
|
||||||
[Required, Comment("นามสกุล")]
|
// [Required, Comment("นามสกุล")]
|
||||||
public string Lastname { get; set; }
|
// public string Lastname { get; set; }
|
||||||
[MaxLength(40), Comment("วันเกิด")]
|
[MaxLength(40), Comment("วันเกิด")]
|
||||||
public DateTime DateOfBirth { get; set; }
|
public DateTime DateOfBirth { get; set; }
|
||||||
[Comment("Id เพศ")]
|
[Comment("Id เพศ")]
|
||||||
|
|
@ -40,30 +40,30 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
public string? TelephoneNumber { get; set; }
|
public string? TelephoneNumber { get; set; }
|
||||||
[Comment("สถานะคำขอ")]
|
[Comment("สถานะคำขอ")]
|
||||||
public string Status { get; set; } = "WAITTING";
|
public string Status { get; set; } = "WAITTING";
|
||||||
[Comment("Id เลขที่ตำแหน่ง")]
|
// [Comment("Id เลขที่ตำแหน่ง")]
|
||||||
public OrganizationPositionEntity? OrganizationPosition { get; set; }
|
// public OrganizationPositionEntity? OrganizationPosition { get; set; }
|
||||||
[Comment("เงินเดือน")]
|
[Comment("เงินเดือน")]
|
||||||
public double? Amount { get; set; }
|
public double? Amount { get; set; }
|
||||||
[Comment("วันที่บรรจุ")]
|
[Comment("วันที่บรรจุ")]
|
||||||
public DateTime? RecruitDate { get; set; }
|
public DateTime? RecruitDate { get; set; }
|
||||||
|
|
||||||
[Comment("Id ตำแหน่งเลขที่")]
|
// [Comment("Id ตำแหน่งเลขที่")]
|
||||||
public PositionNumberEntity? PositionNumber { get; set; }
|
// public PositionNumberEntity? PositionNumber { get; set; }
|
||||||
|
|
||||||
[Comment("Id ตำแหน่ง")]
|
// [Comment("Id ตำแหน่ง")]
|
||||||
public PositionPath? PositionPath { get; set; }
|
// public PositionPath? PositionPath { get; set; }
|
||||||
|
|
||||||
[Comment("Id ด้าน/สาขา")]
|
// [Comment("Id ด้าน/สาขา")]
|
||||||
public PositionPathSide? PositionPathSide { get; set; }
|
// public PositionPathSide? PositionPathSide { get; set; }
|
||||||
|
|
||||||
[Comment("Id ประเภทตำแหน่ง")]
|
// [Comment("Id ประเภทตำแหน่ง")]
|
||||||
public PositionType? PositionType { get; set; }
|
// public PositionType? PositionType { get; set; }
|
||||||
|
|
||||||
[Comment("Id สายงาน")]
|
// [Comment("Id สายงาน")]
|
||||||
public PositionLine? PositionLine { get; set; }
|
// public PositionLine? PositionLine { get; set; }
|
||||||
|
|
||||||
[Comment("Id ระดับ")]
|
// [Comment("Id ระดับ")]
|
||||||
public PositionLevel? PositionLevel { get; set; }
|
// public PositionLevel? PositionLevel { get; set; }
|
||||||
[Comment("เหตุผลที่รับโอนราชการ")]
|
[Comment("เหตุผลที่รับโอนราชการ")]
|
||||||
public string? Reason { get; set; }
|
public string? Reason { get; set; }
|
||||||
[Comment("วุฒิ/สาขาเดิม")]
|
[Comment("วุฒิ/สาขาเดิม")]
|
||||||
|
|
@ -78,6 +78,75 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
public string? PositionNumberOld { get; set; }
|
public string? PositionNumberOld { get; set; }
|
||||||
[Comment("ข้อมูลหน่วยงานเดิม เงินเดือน")]
|
[Comment("ข้อมูลหน่วยงานเดิม เงินเดือน")]
|
||||||
public double? AmountOld { get; set; }
|
public double? AmountOld { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[Comment("profile Id")]
|
||||||
|
public string? profileId { get; set; }
|
||||||
|
[Comment("คำนำหน้า")]
|
||||||
|
public string? prefix { get; set; }
|
||||||
|
[Comment("ชื่อ")]
|
||||||
|
public string? firstName { get; set; }
|
||||||
|
[Comment("นามสกุล")]
|
||||||
|
public string? lastName { get; set; }
|
||||||
|
[Comment("เลขบัตรประชาชน")]
|
||||||
|
public string? citizenId { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน root")]
|
||||||
|
public string? root { get; set; }
|
||||||
|
[Comment("id หน่วยงาน root")]
|
||||||
|
public string? rootId { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน root")]
|
||||||
|
public string? rootShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child1")]
|
||||||
|
public string? child1 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child1")]
|
||||||
|
public string? child1Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child1")]
|
||||||
|
public string? child1ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child2")]
|
||||||
|
public string? child2 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child2")]
|
||||||
|
public string? child2Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child2")]
|
||||||
|
public string? child2ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child3")]
|
||||||
|
public string? child3 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child3")]
|
||||||
|
public string? child3Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child3")]
|
||||||
|
public string? child3ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child4")]
|
||||||
|
public string? child4 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child4")]
|
||||||
|
public string? child4Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child4")]
|
||||||
|
public string? child4ShortName { get; set; }
|
||||||
|
[Comment("ระดับโครงสร้าง")]
|
||||||
|
public int? node { get; set; }
|
||||||
|
|
||||||
|
[Comment("id โครงสร้าง")]
|
||||||
|
public Guid? nodeId { get; set; }
|
||||||
|
[Comment("id อัตรากำลัง")]
|
||||||
|
public string? posmasterId { get; set; }
|
||||||
|
[Comment("id revision")]
|
||||||
|
public string? orgRevisionId { get; set; }
|
||||||
|
[Comment("id ตำแหน่ง")]
|
||||||
|
public string? positionId { get; set; }
|
||||||
|
[Comment("สายงาน")]
|
||||||
|
public string? positionField { get; set; }
|
||||||
|
[Comment("เลขที่ตำแหน่ง")]
|
||||||
|
public int? posMasterNo { get; set; }
|
||||||
|
[Comment("ชื่อตำแหน่งในสายงาน")]
|
||||||
|
public string? positionName { get; set; }
|
||||||
|
[Comment("id ประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeId { get; set; }
|
||||||
|
[Comment("ชื่อประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeName { get; set; }
|
||||||
|
[Comment("id ระดับตำแหน่ง")]
|
||||||
|
public string? posLevelId { get; set; }
|
||||||
|
[Comment("ชื่อระดับตำแหน่ง")]
|
||||||
|
public string? posLevelName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[Comment("สถานะการใช้งาน")]
|
[Comment("สถานะการใช้งาน")]
|
||||||
public bool IsActive { get; set; } = true;
|
public bool IsActive { get; set; } = true;
|
||||||
public virtual List<PlacementReceiveDoc> PlacementReceiveDocs { get; set; } = new List<PlacementReceiveDoc>();
|
public virtual List<PlacementReceiveDoc> PlacementReceiveDocs { get; set; } = new List<PlacementReceiveDoc>();
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
{
|
{
|
||||||
public class PlacementRepatriation : EntityBase
|
public class PlacementRepatriation : EntityBase
|
||||||
{
|
{
|
||||||
[Required, Comment("Id User")]
|
|
||||||
public Profile Profile { get; set; }
|
|
||||||
[Comment("หน่วยงานที่ส่งตัวกลับไป")]
|
[Comment("หน่วยงานที่ส่งตัวกลับไป")]
|
||||||
public string? Organization { get; set; } = string.Empty;
|
public string? Organization { get; set; } = string.Empty;
|
||||||
[Comment("เหตุผล")]
|
[Comment("เหตุผล")]
|
||||||
|
|
@ -33,5 +31,61 @@ namespace BMA.EHR.Domain.Models.Placement
|
||||||
public bool IsActive { get; set; } = true;
|
public bool IsActive { get; set; } = true;
|
||||||
[Comment("ส่งตัวกลับตั้งแต่วันที่")]
|
[Comment("ส่งตัวกลับตั้งแต่วันที่")]
|
||||||
public DateTime? DateRepatriation { get; set; }
|
public DateTime? DateRepatriation { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[Comment("profile Id")]
|
||||||
|
public string? profileId { get; set; }
|
||||||
|
[Comment("คำนำหน้า")]
|
||||||
|
public string? prefix { get; set; }
|
||||||
|
[Comment("ชื่อ")]
|
||||||
|
public string? firstName { get; set; }
|
||||||
|
[Comment("นามสกุล")]
|
||||||
|
public string? lastName { get; set; }
|
||||||
|
[Comment("เลขบัตรประชาชน")]
|
||||||
|
public string? citizenId { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน root")]
|
||||||
|
public string? root { get; set; }
|
||||||
|
[Comment("id หน่วยงาน root")]
|
||||||
|
public string? rootId { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน root")]
|
||||||
|
public string? rootShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child1")]
|
||||||
|
public string? child1 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child1")]
|
||||||
|
public string? child1Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child1")]
|
||||||
|
public string? child1ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child2")]
|
||||||
|
public string? child2 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child2")]
|
||||||
|
public string? child2Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child2")]
|
||||||
|
public string? child2ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child3")]
|
||||||
|
public string? child3 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child3")]
|
||||||
|
public string? child3Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child3")]
|
||||||
|
public string? child3ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child4")]
|
||||||
|
public string? child4 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child4")]
|
||||||
|
public string? child4Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child4")]
|
||||||
|
public string? child4ShortName { get; set; }
|
||||||
|
// [Comment("id revision")]
|
||||||
|
// public string? orgRevisionId { get; set; }
|
||||||
|
[Comment("เลขที่ตำแหน่ง")]
|
||||||
|
public int? posMasterNo { get; set; }
|
||||||
|
[Comment("ชื่อตำแหน่งในสายงาน")]
|
||||||
|
public string? position { get; set; }
|
||||||
|
[Comment("id ประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeId { get; set; }
|
||||||
|
[Comment("ชื่อประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeName { get; set; }
|
||||||
|
[Comment("id ระดับตำแหน่ง")]
|
||||||
|
public string? posLevelId { get; set; }
|
||||||
|
[Comment("ชื่อระดับตำแหน่ง")]
|
||||||
|
public string? posLevelName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,64 @@ namespace BMA.EHR.Domain.Models.Retirement
|
||||||
public string? Location { get; set; } = string.Empty;
|
public string? Location { get; set; } = string.Empty;
|
||||||
[Comment("เหตุผลการเสียชีวิต")]
|
[Comment("เหตุผลการเสียชีวิต")]
|
||||||
public string? Reason { get; set; } = string.Empty;
|
public string? Reason { get; set; } = string.Empty;
|
||||||
[Comment("Id ผู้ถึงแก่กรรม")]
|
|
||||||
public Profile Profile { get; set; }
|
|
||||||
|
|
||||||
|
[Comment("profile Id")]
|
||||||
|
public string? profileId { get; set; }
|
||||||
|
[Comment("คำนำหน้า")]
|
||||||
|
public string? prefix { get; set; }
|
||||||
|
[Comment("ชื่อ")]
|
||||||
|
public string? firstName { get; set; }
|
||||||
|
[Comment("นามสกุล")]
|
||||||
|
public string? lastName { get; set; }
|
||||||
|
[Comment("เลขบัตรประชาชน")]
|
||||||
|
public string? citizenId { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน root")]
|
||||||
|
public string? root { get; set; }
|
||||||
|
[Comment("id หน่วยงาน root")]
|
||||||
|
public string? rootId { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน root")]
|
||||||
|
public string? rootShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child1")]
|
||||||
|
public string? child1 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child1")]
|
||||||
|
public string? child1Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child1")]
|
||||||
|
public string? child1ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child2")]
|
||||||
|
public string? child2 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child2")]
|
||||||
|
public string? child2Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child2")]
|
||||||
|
public string? child2ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child3")]
|
||||||
|
public string? child3 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child3")]
|
||||||
|
public string? child3Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child3")]
|
||||||
|
public string? child3ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child4")]
|
||||||
|
public string? child4 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child4")]
|
||||||
|
public string? child4Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child4")]
|
||||||
|
public string? child4ShortName { get; set; }
|
||||||
|
// [Comment("id revision")]
|
||||||
|
// public string? orgRevisionId { get; set; }
|
||||||
|
[Comment("เลขที่ตำแหน่ง")]
|
||||||
|
public int? posMasterNo { get; set; }
|
||||||
|
[Comment("ชื่อตำแหน่งในสายงาน")]
|
||||||
|
public string? position { get; set; }
|
||||||
|
[Comment("id ประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeId { get; set; }
|
||||||
|
[Comment("ชื่อประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeName { get; set; }
|
||||||
|
[Comment("id ระดับตำแหน่ง")]
|
||||||
|
public string? posLevelId { get; set; }
|
||||||
|
[Comment("ชื่อระดับตำแหน่ง")]
|
||||||
|
public string? posLevelName { get; set; }
|
||||||
|
|
||||||
[Comment("สถานะการใช้งาน")]
|
[Comment("สถานะการใช้งาน")]
|
||||||
public bool IsActive { get; set; } = true;
|
public bool IsActive { get; set; } = true;
|
||||||
public virtual List<RetirementDeceasedNoti> RetirementDeceasedNotis { get; set; } = new List<RetirementDeceasedNoti>();
|
public virtual List<RetirementDeceasedNoti> RetirementDeceasedNotis { get; set; } = new List<RetirementDeceasedNoti>();
|
||||||
|
|
|
||||||
|
|
@ -10,56 +10,11 @@ namespace BMA.EHR.Domain.Models.Retirement
|
||||||
{
|
{
|
||||||
public class RetirementOther : EntityBase
|
public class RetirementOther : EntityBase
|
||||||
{
|
{
|
||||||
[Required, Comment("Id User")]
|
|
||||||
public Profile Profile { get; set; }
|
|
||||||
[Required, MaxLength(20), Comment("เลขประจำตัวประชาชน")]
|
|
||||||
public string? CitizenId { get; set; }
|
|
||||||
[Required, Comment("คำนำหน้า")]
|
|
||||||
public Prefix? Prefix { get; set; }
|
|
||||||
[Required, Comment("ชื่อ")]
|
|
||||||
public string? Firstname { get; set; }
|
|
||||||
[Required, Comment("นามสกุล")]
|
|
||||||
public string? Lastname { get; set; }
|
|
||||||
[MaxLength(40), Comment("วันเกิด")]
|
|
||||||
public DateTime DateOfBirth { get; set; }
|
|
||||||
[Comment("Id เพศ")]
|
|
||||||
public Gender? Gender { get; set; }
|
|
||||||
[MaxLength(100), Comment("สัญชาติ")]
|
|
||||||
public string? Nationality { get; set; }
|
|
||||||
[MaxLength(100), Comment("เชื้อชาติ")]
|
|
||||||
public string? Race { get; set; }
|
|
||||||
[Comment("Id ศาสนา")]
|
|
||||||
public Religion? Religion { get; set; }
|
|
||||||
[Comment("Id กลุ่มเลือด")]
|
|
||||||
public BloodGroup? BloodGroup { get; set; }
|
|
||||||
[Comment("Id สถานะภาพ")]
|
|
||||||
public Relationship? Relationship { get; set; }
|
|
||||||
[MaxLength(50), Comment("เบอร์โทร")]
|
|
||||||
public string? TelephoneNumber { get; set; }
|
|
||||||
[Comment("สถานะคำขอ")]
|
[Comment("สถานะคำขอ")]
|
||||||
public string Status { get; set; } = "WAITTING";
|
public string Status { get; set; } = "WAITTING";
|
||||||
[Comment("Id เลขที่ตำแหน่ง")]
|
|
||||||
public OrganizationPositionEntity? OrganizationPosition { get; set; }
|
|
||||||
[Comment("วันที่บรรจุ")]
|
[Comment("วันที่บรรจุ")]
|
||||||
public DateTime? RecruitDate { get; set; }
|
public DateTime? RecruitDate { get; set; }
|
||||||
|
|
||||||
[Comment("Id ตำแหน่งเลขที่")]
|
|
||||||
public PositionNumberEntity? PositionNumber { get; set; }
|
|
||||||
|
|
||||||
[Comment("Id ตำแหน่ง")]
|
|
||||||
public PositionPath? PositionPath { get; set; }
|
|
||||||
|
|
||||||
[Comment("Id ด้าน/สาขา")]
|
|
||||||
public PositionPathSide? PositionPathSide { get; set; }
|
|
||||||
|
|
||||||
[Comment("Id ประเภทตำแหน่ง")]
|
|
||||||
public PositionType? PositionType { get; set; }
|
|
||||||
|
|
||||||
[Comment("Id สายงาน")]
|
|
||||||
public PositionLine? PositionLine { get; set; }
|
|
||||||
|
|
||||||
[Comment("Id ระดับ")]
|
|
||||||
public PositionLevel? PositionLevel { get; set; }
|
|
||||||
[Comment("เงินเดือน")]
|
[Comment("เงินเดือน")]
|
||||||
public double? Amount { get; set; }
|
public double? Amount { get; set; }
|
||||||
[Comment("เหตุผลที่รับย้ายราชการ")]
|
[Comment("เหตุผลที่รับย้ายราชการ")]
|
||||||
|
|
@ -84,6 +39,64 @@ namespace BMA.EHR.Domain.Models.Retirement
|
||||||
public DateTime? PositionDate { get; set; }
|
public DateTime? PositionDate { get; set; }
|
||||||
[Comment("วันที่พ้นจากราชการทหาร")]
|
[Comment("วันที่พ้นจากราชการทหาร")]
|
||||||
public DateTime? MilitaryDate { get; set; }
|
public DateTime? MilitaryDate { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[Comment("profile Id")]
|
||||||
|
public string? profileId { get; set; }
|
||||||
|
[Comment("คำนำหน้า")]
|
||||||
|
public string? prefix { get; set; }
|
||||||
|
[Comment("ชื่อ")]
|
||||||
|
public string? firstName { get; set; }
|
||||||
|
[Comment("นามสกุล")]
|
||||||
|
public string? lastName { get; set; }
|
||||||
|
[Comment("เลขบัตรประชาชน")]
|
||||||
|
public string? citizenId { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน root")]
|
||||||
|
public string? root { get; set; }
|
||||||
|
[Comment("id หน่วยงาน root")]
|
||||||
|
public string? rootId { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน root")]
|
||||||
|
public string? rootShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child1")]
|
||||||
|
public string? child1 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child1")]
|
||||||
|
public string? child1Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child1")]
|
||||||
|
public string? child1ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child2")]
|
||||||
|
public string? child2 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child2")]
|
||||||
|
public string? child2Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child2")]
|
||||||
|
public string? child2ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child3")]
|
||||||
|
public string? child3 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child3")]
|
||||||
|
public string? child3Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child3")]
|
||||||
|
public string? child3ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child4")]
|
||||||
|
public string? child4 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child4")]
|
||||||
|
public string? child4Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child4")]
|
||||||
|
public string? child4ShortName { get; set; }
|
||||||
|
// [Comment("id revision")]
|
||||||
|
// public string? orgRevisionId { get; set; }
|
||||||
|
[Comment("เลขที่ตำแหน่ง")]
|
||||||
|
public int? posMasterNo { get; set; }
|
||||||
|
[Comment("ชื่อตำแหน่งในสายงาน")]
|
||||||
|
public string? position { get; set; }
|
||||||
|
[Comment("id ประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeId { get; set; }
|
||||||
|
[Comment("ชื่อประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeName { get; set; }
|
||||||
|
[Comment("id ระดับตำแหน่ง")]
|
||||||
|
public string? posLevelId { get; set; }
|
||||||
|
[Comment("ชื่อระดับตำแหน่ง")]
|
||||||
|
public string? posLevelName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public virtual List<RetirementOtherDoc> RetirementOtherDocs { get; set; } = new List<RetirementOtherDoc>();
|
public virtual List<RetirementOtherDoc> RetirementOtherDocs { get; set; } = new List<RetirementOtherDoc>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@ namespace BMA.EHR.Domain.Models.Retirement
|
||||||
{
|
{
|
||||||
public class RetirementOut : EntityBase
|
public class RetirementOut : EntityBase
|
||||||
{
|
{
|
||||||
[Required, Comment("Id User")]
|
|
||||||
public Profile Profile { get; set; }
|
|
||||||
[Comment("หน่วยงานที่ให้ออกไป")]
|
[Comment("หน่วยงานที่ให้ออกไป")]
|
||||||
public string? Organization { get; set; } = string.Empty;
|
public string? Organization { get; set; } = string.Empty;
|
||||||
[Comment("เหตุผล")]
|
[Comment("เหตุผล")]
|
||||||
|
|
@ -29,6 +27,64 @@ namespace BMA.EHR.Domain.Models.Retirement
|
||||||
public double? AmountOld { get; set; }
|
public double? AmountOld { get; set; }
|
||||||
[Comment("สถานะคำขอ")]
|
[Comment("สถานะคำขอ")]
|
||||||
public string Status { get; set; } = "WAITTING";
|
public string Status { get; set; } = "WAITTING";
|
||||||
|
|
||||||
|
|
||||||
|
[Comment("profile Id")]
|
||||||
|
public string? profileId { get; set; }
|
||||||
|
[Comment("คำนำหน้า")]
|
||||||
|
public string? prefix { get; set; }
|
||||||
|
[Comment("ชื่อ")]
|
||||||
|
public string? firstName { get; set; }
|
||||||
|
[Comment("นามสกุล")]
|
||||||
|
public string? lastName { get; set; }
|
||||||
|
[Comment("เลขบัตรประชาชน")]
|
||||||
|
public string? citizenId { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน root")]
|
||||||
|
public string? root { get; set; }
|
||||||
|
[Comment("id หน่วยงาน root")]
|
||||||
|
public string? rootId { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน root")]
|
||||||
|
public string? rootShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child1")]
|
||||||
|
public string? child1 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child1")]
|
||||||
|
public string? child1Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child1")]
|
||||||
|
public string? child1ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child2")]
|
||||||
|
public string? child2 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child2")]
|
||||||
|
public string? child2Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child2")]
|
||||||
|
public string? child2ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child3")]
|
||||||
|
public string? child3 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child3")]
|
||||||
|
public string? child3Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child3")]
|
||||||
|
public string? child3ShortName { get; set; }
|
||||||
|
[Comment("ชื่อหน่วยงาน child4")]
|
||||||
|
public string? child4 { get; set; }
|
||||||
|
[Comment("id หน่วยงาน child4")]
|
||||||
|
public string? child4Id { get; set; }
|
||||||
|
[Comment("ชื่อย่อหน่วยงาน child4")]
|
||||||
|
public string? child4ShortName { get; set; }
|
||||||
|
// [Comment("id revision")]
|
||||||
|
// public string? orgRevisionId { get; set; }
|
||||||
|
[Comment("เลขที่ตำแหน่ง")]
|
||||||
|
public int? posMasterNo { get; set; }
|
||||||
|
[Comment("ชื่อตำแหน่งในสายงาน")]
|
||||||
|
public string? position { get; set; }
|
||||||
|
[Comment("id ประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeId { get; set; }
|
||||||
|
[Comment("ชื่อประเภทตำแหน่ง")]
|
||||||
|
public string? posTypeName { get; set; }
|
||||||
|
[Comment("id ระดับตำแหน่ง")]
|
||||||
|
public string? posLevelId { get; set; }
|
||||||
|
[Comment("ชื่อระดับตำแหน่ง")]
|
||||||
|
public string? posLevelName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[Comment("สถานะการใช้งาน")]
|
[Comment("สถานะการใช้งาน")]
|
||||||
public bool IsActive { get; set; } = true;
|
public bool IsActive { get; set; } = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
17351
BMA.EHR.Infrastructure/Migrations/20240501075245_update table PlacementOfficer add child1.Designer.cs
generated
Normal file
17351
BMA.EHR.Infrastructure/Migrations/20240501075245_update table PlacementOfficer add child1.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,373 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class updatetablePlacementOfficeraddchild1 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
// migrationBuilder.DropForeignKey(
|
||||||
|
// name: "FK_PlacementOfficers_Profiles_ProfileId",
|
||||||
|
// table: "PlacementOfficers");
|
||||||
|
|
||||||
|
// migrationBuilder.DropIndex(
|
||||||
|
// name: "IX_PlacementOfficers_ProfileId",
|
||||||
|
// table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "ProfileId",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
newName: "profileId");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "profileId",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "profile Id",
|
||||||
|
oldClrType: typeof(Guid),
|
||||||
|
oldType: "char(36)")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child1",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน child1")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child1Id",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน child1")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child1ShortName",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน child1")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child2",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน child2")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child2Id",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน child2")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child2ShortName",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน child2")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child3",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน child3")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child3Id",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน child3")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child3ShortName",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน child3")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child4",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน child4")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child4Id",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน child4")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child4ShortName",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน child4")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "citizenId",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "เลขบัตรประชาชน")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "firstName",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "lastName",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "นามสกุล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "posLevelId",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id ระดับตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "posLevelName",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อระดับตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "posMasterNo",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
comment: "เลขที่ตำแหน่ง");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "posTypeId",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id ประเภทตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "posTypeName",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อประเภทตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "position",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อตำแหน่งในสายงาน")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "prefix",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "คำนำหน้า")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "root",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน root")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "rootId",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน root")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "rootShortName",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน root")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child1",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child1Id",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child1ShortName",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child2",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child2Id",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child2ShortName",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child3",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child3Id",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child3ShortName",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child4",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child4Id",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child4ShortName",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "citizenId",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "firstName",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "lastName",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posLevelId",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posLevelName",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posMasterNo",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posTypeId",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posTypeName",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "position",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "prefix",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "root",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "rootId",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "rootShortName",
|
||||||
|
table: "PlacementOfficers");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "profileId",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
newName: "ProfileId");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<Guid>(
|
||||||
|
name: "ProfileId",
|
||||||
|
table: "PlacementOfficers",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||||
|
collation: "ascii_general_ci",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true,
|
||||||
|
oldComment: "profile Id")
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
// migrationBuilder.CreateIndex(
|
||||||
|
// name: "IX_PlacementOfficers_ProfileId",
|
||||||
|
// table: "PlacementOfficers",
|
||||||
|
// column: "ProfileId");
|
||||||
|
|
||||||
|
// migrationBuilder.AddForeignKey(
|
||||||
|
// name: "FK_PlacementOfficers_Profiles_ProfileId",
|
||||||
|
// table: "PlacementOfficers",
|
||||||
|
// column: "ProfileId",
|
||||||
|
// principalTable: "Profiles",
|
||||||
|
// principalColumn: "Id",
|
||||||
|
// onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17439
BMA.EHR.Infrastructure/Migrations/20240501085812_update table PlacementRepatriation add child1.Designer.cs
generated
Normal file
17439
BMA.EHR.Infrastructure/Migrations/20240501085812_update table PlacementRepatriation add child1.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,373 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class updatetablePlacementRepatriationaddchild1 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_PlacementRepatriations_Profiles_ProfileId",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_PlacementRepatriations_ProfileId",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "ProfileId",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
newName: "profileId");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "profileId",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "profile Id",
|
||||||
|
oldClrType: typeof(Guid),
|
||||||
|
oldType: "char(36)")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child1",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน child1")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child1Id",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน child1")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child1ShortName",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน child1")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child2",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน child2")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child2Id",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน child2")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child2ShortName",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน child2")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child3",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน child3")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child3Id",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน child3")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child3ShortName",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน child3")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child4",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน child4")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child4Id",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน child4")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child4ShortName",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน child4")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "citizenId",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "เลขบัตรประชาชน")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "firstName",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "lastName",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "นามสกุล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "posLevelId",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id ระดับตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "posLevelName",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อระดับตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "posMasterNo",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
comment: "เลขที่ตำแหน่ง");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "posTypeId",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id ประเภทตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "posTypeName",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อประเภทตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "position",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อตำแหน่งในสายงาน")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "prefix",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "คำนำหน้า")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "root",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน root")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "rootId",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน root")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "rootShortName",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน root")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child1",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child1Id",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child1ShortName",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child2",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child2Id",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child2ShortName",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child3",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child3Id",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child3ShortName",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child4",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child4Id",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child4ShortName",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "citizenId",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "firstName",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "lastName",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posLevelId",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posLevelName",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posMasterNo",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posTypeId",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posTypeName",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "position",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "prefix",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "root",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "rootId",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "rootShortName",
|
||||||
|
table: "PlacementRepatriations");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "profileId",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
newName: "ProfileId");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<Guid>(
|
||||||
|
name: "ProfileId",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||||
|
collation: "ascii_general_ci",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true,
|
||||||
|
oldComment: "profile Id")
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlacementRepatriations_ProfileId",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
column: "ProfileId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PlacementRepatriations_Profiles_ProfileId",
|
||||||
|
table: "PlacementRepatriations",
|
||||||
|
column: "ProfileId",
|
||||||
|
principalTable: "Profiles",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17528
BMA.EHR.Infrastructure/Migrations/20240501145515_update table PlacementOut add child1.Designer.cs
generated
Normal file
17528
BMA.EHR.Infrastructure/Migrations/20240501145515_update table PlacementOut add child1.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
17550
BMA.EHR.Infrastructure/Migrations/20240501164708_update table PlacementRecive add child1.Designer.cs
generated
Normal file
17550
BMA.EHR.Infrastructure/Migrations/20240501164708_update table PlacementRecive add child1.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,743 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class updatetablePlacementReciveaddchild1 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_PlacementReceives_OrganizationPositions_OrganizationPosition~",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_PlacementReceives_PositionLevels_PositionLevelId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_PlacementReceives_PositionLines_PositionLineId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_PlacementReceives_PositionNumbers_PositionNumberId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_PlacementReceives_PositionPathSides_PositionPathSideId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_PlacementReceives_PositionPaths_PositionPathId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_PlacementReceives_PositionTypes_PositionTypeId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_PlacementReceives_Prefixes_PrefixId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_PlacementReceives_OrganizationPositionId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_PlacementReceives_PositionLevelId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_PlacementReceives_PositionLineId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_PlacementReceives_PositionNumberId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_PlacementReceives_PositionPathId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_PlacementReceives_PositionPathSideId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_PlacementReceives_PositionTypeId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_PlacementReceives_PrefixId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "OrganizationPositionId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PositionLevelId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PositionLineId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PositionNumberId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PositionPathId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PositionPathSideId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PositionTypeId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "PrefixId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Lastname",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
newName: "lastName");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "Firstname",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
newName: "firstName");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "CitizenId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
newName: "citizenId");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "lastName",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "นามสกุล",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldComment: "นามสกุล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "firstName",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อ",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldComment: "ชื่อ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "citizenId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "เลขบัตรประชาชน",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "varchar(20)",
|
||||||
|
oldMaxLength: 20,
|
||||||
|
oldComment: "เลขประจำตัวประชาชน")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child1",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน child1")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child1Id",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน child1")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child1ShortName",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน child1")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child2",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน child2")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child2Id",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน child2")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child2ShortName",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน child2")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child3",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน child3")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child3Id",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน child3")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child3ShortName",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน child3")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child4",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน child4")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child4Id",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน child4")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "child4ShortName",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน child4")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "node",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ระดับโครงสร้าง");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "nodeId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id โครงสร้าง",
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "orgRevisionId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id revision")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "posLevelId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id ระดับตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "posLevelName",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อระดับตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "posMasterNo",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
comment: "เลขที่ตำแหน่ง");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "posTypeId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id ประเภทตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "posTypeName",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อประเภทตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "positionField",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "สายงาน")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "positionId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id ตำแหน่ง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "positionName",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อตำแหน่งในสายงาน")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "posmasterId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id อัตรากำลัง")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "prefix",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "คำนำหน้า")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "profileId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "profile Id")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "root",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อหน่วยงาน root")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "rootId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "id หน่วยงาน root")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "rootShortName",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ชื่อย่อหน่วยงาน root")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child1",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child1Id",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child1ShortName",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child2",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child2Id",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child2ShortName",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child3",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child3Id",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child3ShortName",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child4",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child4Id",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "child4ShortName",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "node",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "nodeId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "orgRevisionId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posLevelId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posLevelName",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posMasterNo",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posTypeId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posTypeName",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "positionField",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "positionId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "positionName",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "posmasterId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "prefix",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "profileId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "root",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "rootId",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "rootShortName",
|
||||||
|
table: "PlacementReceives");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "lastName",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
newName: "Lastname");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "firstName",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
newName: "Firstname");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "citizenId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
newName: "CitizenId");
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "PlacementReceives",
|
||||||
|
keyColumn: "Lastname",
|
||||||
|
keyValue: null,
|
||||||
|
column: "Lastname",
|
||||||
|
value: "");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Lastname",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
comment: "นามสกุล",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true,
|
||||||
|
oldComment: "นามสกุล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "PlacementReceives",
|
||||||
|
keyColumn: "Firstname",
|
||||||
|
keyValue: null,
|
||||||
|
column: "Firstname",
|
||||||
|
value: "");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "Firstname",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: false,
|
||||||
|
comment: "ชื่อ",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true,
|
||||||
|
oldComment: "ชื่อ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "PlacementReceives",
|
||||||
|
keyColumn: "CitizenId",
|
||||||
|
keyValue: null,
|
||||||
|
column: "CitizenId",
|
||||||
|
value: "");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<string>(
|
||||||
|
name: "CitizenId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "varchar(20)",
|
||||||
|
maxLength: 20,
|
||||||
|
nullable: false,
|
||||||
|
comment: "เลขประจำตัวประชาชน",
|
||||||
|
oldClrType: typeof(string),
|
||||||
|
oldType: "longtext",
|
||||||
|
oldNullable: true,
|
||||||
|
oldComment: "เลขบัตรประชาชน")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4")
|
||||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "OrganizationPositionId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "PositionLevelId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "PositionLineId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "PositionNumberId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "PositionPathId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "PositionPathSideId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "PositionTypeId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "PrefixId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlacementReceives_OrganizationPositionId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "OrganizationPositionId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlacementReceives_PositionLevelId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PositionLevelId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlacementReceives_PositionLineId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PositionLineId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlacementReceives_PositionNumberId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PositionNumberId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlacementReceives_PositionPathId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PositionPathId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlacementReceives_PositionPathSideId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PositionPathSideId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlacementReceives_PositionTypeId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PositionTypeId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PlacementReceives_PrefixId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PrefixId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PlacementReceives_OrganizationPositions_OrganizationPosition~",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "OrganizationPositionId",
|
||||||
|
principalTable: "OrganizationPositions",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PlacementReceives_PositionLevels_PositionLevelId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PositionLevelId",
|
||||||
|
principalTable: "PositionLevels",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PlacementReceives_PositionLines_PositionLineId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PositionLineId",
|
||||||
|
principalTable: "PositionLines",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PlacementReceives_PositionNumbers_PositionNumberId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PositionNumberId",
|
||||||
|
principalTable: "PositionNumbers",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PlacementReceives_PositionPathSides_PositionPathSideId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PositionPathSideId",
|
||||||
|
principalTable: "PositionPathSides",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PlacementReceives_PositionPaths_PositionPathId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PositionPathId",
|
||||||
|
principalTable: "PositionPaths",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PlacementReceives_PositionTypes_PositionTypeId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PositionTypeId",
|
||||||
|
principalTable: "PositionTypes",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_PlacementReceives_Prefixes_PrefixId",
|
||||||
|
table: "PlacementReceives",
|
||||||
|
column: "PrefixId",
|
||||||
|
principalTable: "Prefixes",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -8,7 +8,9 @@ using BMA.EHR.Placement.Service.Requests;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace BMA.EHR.Placement.Service.Controllers
|
namespace BMA.EHR.Placement.Service.Controllers
|
||||||
|
|
@ -26,18 +28,21 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
|
|
||||||
public PlacementAppointmentController(PlacementRepository repository,
|
public PlacementAppointmentController(PlacementRepository repository,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -45,6 +50,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
private bool? PlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
private bool? PlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
||||||
|
|
||||||
|
|
@ -63,35 +69,48 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
|
|
||||||
var placementAppointments = await _context.PlacementAppointments.AsQueryable()
|
var placementAppointments = await _context.PlacementAppointments.AsQueryable()
|
||||||
.Where(x => x.Profile.ProfileType == "officer")
|
.Where(x => x.type == "OFFICER")
|
||||||
.OrderByDescending(x => x.CreatedAt)
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
p.CitizenId,
|
p.prefix,
|
||||||
Prefix = p.Prefix == null ? null : p.Prefix.Name,
|
p.firstName,
|
||||||
p.Firstname,
|
p.lastName,
|
||||||
p.Lastname,
|
p.root,
|
||||||
p.DateOfBirth,
|
p.rootShortName,
|
||||||
Gender = p.Gender == null ? null : p.Gender.Name,
|
p.child1,
|
||||||
|
p.child1ShortName,
|
||||||
|
p.child2,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4ShortName,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.positionName,
|
||||||
|
p.posLevelName,
|
||||||
|
p.posTypeName,
|
||||||
|
|
||||||
|
p.rootOld,
|
||||||
|
p.rootShortNameOld,
|
||||||
|
p.child1Old,
|
||||||
|
p.child1ShortNameOld,
|
||||||
|
p.child2Old,
|
||||||
|
p.child2ShortNameOld,
|
||||||
|
p.child3Old,
|
||||||
|
p.child3ShortNameOld,
|
||||||
|
p.child4Old,
|
||||||
|
p.child4ShortNameOld,
|
||||||
|
p.posMasterNoOld,
|
||||||
|
p.positionOld,
|
||||||
|
p.posLevelNameOld,
|
||||||
|
p.posTypeNameOld,
|
||||||
|
|
||||||
p.Status,
|
p.Status,
|
||||||
p.Amount,
|
p.Amount,
|
||||||
p.RecruitDate,
|
p.RecruitDate,
|
||||||
PositionNumber = p.PositionNumber == null ? null : p.PositionNumber.Name,
|
|
||||||
PositionPath = p.PositionPath == null ? null : p.PositionPath.Name,
|
|
||||||
PositionPathSide = p.PositionPathSide == null ? null : p.PositionPathSide.Name,
|
|
||||||
PositionType = p.PositionType == null ? null : p.PositionType.Name,
|
|
||||||
PositionLine = p.PositionLine == null ? null : p.PositionLine.Name,
|
|
||||||
PositionLevel = p.PositionLevel == null ? null : p.PositionLevel.Name,
|
|
||||||
PosNoId = p.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionNumber.Id,
|
|
||||||
PositionId = p.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPath.Id,
|
|
||||||
PositionPathSideId = p.PositionPathSide == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPathSide.Id,
|
|
||||||
PositionTypeId = p.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionType.Id,
|
|
||||||
PositionLineId = p.PositionLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLine.Id,
|
|
||||||
PositionLevelId = p.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLevel.Id,
|
|
||||||
OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
|
|
||||||
OrganizationName = p.OrganizationPosition == null ? null : (p.OrganizationPosition.Organization == null ? null : (p.OrganizationPosition.Organization.OrganizationOrganization == null ? null : p.OrganizationPosition.Organization.OrganizationOrganization.Name)),////
|
|
||||||
OrganizationShortName = p.OrganizationPosition == null ? null : (p.OrganizationPosition.Organization == null ? null : (p.OrganizationPosition.Organization.OrganizationShortName == null ? null : p.OrganizationPosition.Organization.OrganizationShortName.Name)),////
|
|
||||||
p.IsActive,
|
p.IsActive,
|
||||||
p.PositionDate,
|
p.PositionDate,
|
||||||
p.Reason,
|
p.Reason,
|
||||||
|
|
@ -105,8 +124,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
CommandType = p.CommandType == null ? null : p.CommandType.Name,
|
CommandType = p.CommandType == null ? null : p.CommandType.Name,
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
if (PlacementAdmin == true)
|
// if (PlacementAdmin == true)
|
||||||
placementAppointments.Where(x => x.Status.Trim().ToUpper().Contains("PENDING"));
|
// placementAppointments.Where(x => x.Status.Trim().ToUpper().Contains("PENDING"));
|
||||||
|
|
||||||
return Success(placementAppointments);
|
return Success(placementAppointments);
|
||||||
}
|
}
|
||||||
|
|
@ -124,35 +143,49 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> GetDetailByUser(Guid id)
|
public async Task<ActionResult<ResponseObject>> GetDetailByUser(Guid id)
|
||||||
{
|
{
|
||||||
var data = await _context.PlacementAppointments.AsQueryable()
|
var data = await _context.PlacementAppointments.AsQueryable()
|
||||||
.Where(x => x.Profile.ProfileType == "officer")
|
.Where(x => x.type == "OFFICER")
|
||||||
.Where(x => x.Id == id)
|
.Where(x => x.Id == id)
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
ProfileId = p.Profile.Id,
|
p.profileId,
|
||||||
p.CitizenId,
|
p.prefix,
|
||||||
Prefix = p.Prefix == null ? null : p.Prefix.Name,
|
p.firstName,
|
||||||
PrefixId = p.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Prefix.Id,
|
p.lastName,
|
||||||
p.Firstname,
|
p.root,
|
||||||
p.Lastname,
|
p.rootShortName,
|
||||||
p.DateOfBirth,
|
p.child1,
|
||||||
Gender = p.Gender == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Gender.Id,
|
p.child1ShortName,
|
||||||
p.Nationality,
|
p.child2,
|
||||||
p.Race,
|
p.child2ShortName,
|
||||||
Religion = p.Religion == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Religion.Id,
|
p.child3,
|
||||||
BloodGroup = p.BloodGroup == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.BloodGroup.Id,
|
p.child3ShortName,
|
||||||
Relationship = p.Relationship == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Relationship.Id,
|
p.child4,
|
||||||
p.TelephoneNumber,
|
p.child4ShortName,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.positionName,
|
||||||
|
p.posLevelName,
|
||||||
|
p.posTypeName,
|
||||||
|
|
||||||
|
p.rootOld,
|
||||||
|
p.rootShortNameOld,
|
||||||
|
p.child1Old,
|
||||||
|
p.child1ShortNameOld,
|
||||||
|
p.child2Old,
|
||||||
|
p.child2ShortNameOld,
|
||||||
|
p.child3Old,
|
||||||
|
p.child3ShortNameOld,
|
||||||
|
p.child4Old,
|
||||||
|
p.child4ShortNameOld,
|
||||||
|
p.posMasterNoOld,
|
||||||
|
p.positionOld,
|
||||||
|
p.posLevelNameOld,
|
||||||
|
p.posTypeNameOld,
|
||||||
|
|
||||||
p.Status,
|
p.Status,
|
||||||
p.Amount,
|
p.Amount,
|
||||||
p.RecruitDate,
|
p.RecruitDate,
|
||||||
PosNoId = p.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionNumber.Id,
|
|
||||||
PositionId = p.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPath.Id,
|
|
||||||
PositionPathSideId = p.PositionPathSide == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPathSide.Id,
|
|
||||||
PositionTypeId = p.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionType.Id,
|
|
||||||
PositionLineId = p.PositionLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLine.Id,
|
|
||||||
PositionLevelId = p.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLevel.Id,
|
|
||||||
OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
|
|
||||||
p.CreatedAt,
|
p.CreatedAt,
|
||||||
p.Reason,
|
p.Reason,
|
||||||
p.EducationOld,
|
p.EducationOld,
|
||||||
|
|
@ -162,66 +195,78 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
p.PositionNumberOld,
|
p.PositionNumberOld,
|
||||||
p.OrganizationPositionOld,
|
p.OrganizationPositionOld,
|
||||||
p.PositionDate,
|
p.PositionDate,
|
||||||
PlacementAppointmentDocs = p.PlacementAppointmentDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
// PlacementAppointmentDocs = p.PlacementAppointmentDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||||
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
|
||||||
CommandType = p.CommandType == null ? null : p.CommandType.Name,
|
CommandType = p.CommandType == null ? null : p.CommandType.Name,
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
var placementAppointmentDocs = new List<dynamic>();
|
// var placementAppointmentDocs = new List<dynamic>();
|
||||||
foreach (var doc in data.PlacementAppointmentDocs)
|
// foreach (var doc in data.PlacementAppointmentDocs)
|
||||||
{
|
// {
|
||||||
var _doc = new
|
// var _doc = new
|
||||||
{
|
// {
|
||||||
doc.FileName,
|
// doc.FileName,
|
||||||
PathName = await _documentService.ImagesPath(doc.Id)
|
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||||
};
|
// };
|
||||||
placementAppointmentDocs.Add(_doc);
|
// placementAppointmentDocs.Add(_doc);
|
||||||
}
|
// }
|
||||||
var _data = new
|
// var _data = new
|
||||||
{
|
// {
|
||||||
data.Id,
|
// data.Id,
|
||||||
data.ProfileId,
|
// data.profileId,
|
||||||
data.CitizenId,
|
// data.prefix,
|
||||||
data.Prefix,
|
// data.firstName,
|
||||||
data.PrefixId,
|
// data.lastName,
|
||||||
data.Firstname,
|
// data.root,
|
||||||
data.Lastname,
|
// data.rootShortName,
|
||||||
data.DateOfBirth,
|
// data.child1,
|
||||||
data.Gender,
|
// data.child1ShortName,
|
||||||
data.Nationality,
|
// data.child2,
|
||||||
data.Race,
|
// data.child2ShortName,
|
||||||
data.Religion,
|
// data.child3,
|
||||||
data.BloodGroup,
|
// data.child3ShortName,
|
||||||
data.Relationship,
|
// data.child4,
|
||||||
data.TelephoneNumber,
|
// data.child4ShortName,
|
||||||
data.Status,
|
// data.posMasterNo,
|
||||||
data.Amount,
|
// data.positionName,
|
||||||
data.RecruitDate,
|
// data.posLevelName,
|
||||||
data.PosNoId,
|
// data.posTypeName,
|
||||||
data.PositionId,
|
|
||||||
data.PositionPathSideId,
|
|
||||||
data.PositionTypeId,
|
|
||||||
data.PositionLineId,
|
|
||||||
data.PositionLevelId,
|
|
||||||
data.OrganizationPositionId,
|
|
||||||
data.CreatedAt,
|
|
||||||
data.Reason,
|
|
||||||
data.EducationOld,
|
|
||||||
data.salary,
|
|
||||||
data.PositionTypeOld,
|
|
||||||
data.PositionLevelOld,
|
|
||||||
data.PositionNumberOld,
|
|
||||||
data.OrganizationPositionOld,
|
|
||||||
data.PositionDate,
|
|
||||||
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
|
||||||
Docs = placementAppointmentDocs,
|
|
||||||
data.CommandType,
|
|
||||||
};
|
|
||||||
|
|
||||||
return Success(_data);
|
// data.rootOld,
|
||||||
|
// data.rootShortNameOld,
|
||||||
|
// data.child1Old,
|
||||||
|
// data.child1ShortNameOld,
|
||||||
|
// data.child2Old,
|
||||||
|
// data.child2ShortNameOld,
|
||||||
|
// data.child3Old,
|
||||||
|
// data.child3ShortNameOld,
|
||||||
|
// data.child4Old,
|
||||||
|
// data.child4ShortNameOld,
|
||||||
|
// data.posMasterNoOld,
|
||||||
|
// data.positionOld,
|
||||||
|
// data.posLevelNameOld,
|
||||||
|
// data.posTypeNameOld,
|
||||||
|
|
||||||
|
// data.Status,
|
||||||
|
// data.Amount,
|
||||||
|
// data.RecruitDate,
|
||||||
|
|
||||||
|
// data.CreatedAt,
|
||||||
|
// data.Reason,
|
||||||
|
// data.EducationOld,
|
||||||
|
// data.salary,
|
||||||
|
// data.PositionTypeOld,
|
||||||
|
// data.PositionLevelOld,
|
||||||
|
// data.PositionNumberOld,
|
||||||
|
// data.OrganizationPositionOld,
|
||||||
|
// data.PositionDate,
|
||||||
|
// Docs = placementAppointmentDocs,
|
||||||
|
// data.CommandType,
|
||||||
|
// };
|
||||||
|
|
||||||
|
return Success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -235,42 +280,29 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
[HttpPost()]
|
[HttpPost()]
|
||||||
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementAddProfileRequest req)
|
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementAddProfileRequest req)
|
||||||
{
|
{
|
||||||
var profile = await _context.Profiles
|
|
||||||
.Include(x => x.PositionLevel)
|
|
||||||
.Include(x => x.PositionType)
|
|
||||||
.Include(x => x.PosNo)
|
|
||||||
.Include(x => x.Salaries)
|
|
||||||
.Include(x => x.Educations)
|
|
||||||
.Include(x => x.Position)
|
|
||||||
.Include(x => x.Gender)
|
|
||||||
.Include(x => x.Prefix)
|
|
||||||
.Where(x => x.ProfileType == "officer")
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.Id);
|
|
||||||
if (profile == null)
|
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
|
||||||
|
|
||||||
var placementAppointment = new PlacementAppointment
|
var placementAppointment = new PlacementAppointment
|
||||||
{
|
{
|
||||||
Profile = profile,
|
// Profile = profile,
|
||||||
CitizenId = profile.CitizenId,
|
// CitizenId = profile.CitizenId,
|
||||||
Prefix = profile.Prefix,
|
// Prefix = profile.Prefix,
|
||||||
Firstname = profile.FirstName,
|
// Firstname = profile.FirstName,
|
||||||
Lastname = profile.LastName,
|
// Lastname = profile.LastName,
|
||||||
DateOfBirth = profile.BirthDate,
|
// DateOfBirth = profile.BirthDate,
|
||||||
Gender = profile.Gender,
|
// Gender = profile.Gender,
|
||||||
Nationality = profile.Nationality,
|
// Nationality = profile.Nationality,
|
||||||
Race = profile.Race,
|
// Race = profile.Race,
|
||||||
Religion = await _context.Religions.FindAsync(profile.ReligionId),
|
// Religion = await _context.Religions.FindAsync(profile.ReligionId),
|
||||||
BloodGroup = await _context.BloodGroups.FindAsync(profile.BloodGroupId),
|
// BloodGroup = await _context.BloodGroups.FindAsync(profile.BloodGroupId),
|
||||||
Relationship = await _context.Relationships.FindAsync(profile.RelationshipId),
|
// Relationship = await _context.Relationships.FindAsync(profile.RelationshipId),
|
||||||
TelephoneNumber = profile.TelephoneNumber,
|
// TelephoneNumber = profile.TelephoneNumber,
|
||||||
EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}",
|
// EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}",
|
||||||
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
// AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||||
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
// PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
||||||
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
// PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
||||||
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
// PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
||||||
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
|
// OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
|
||||||
PositionDate = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Date,
|
// PositionDate = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Date,
|
||||||
|
type = "OFFICER",
|
||||||
Status = "WAITTING",
|
Status = "WAITTING",
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
CreatedUserId = UserId ?? "",
|
||||||
|
|
@ -279,35 +311,75 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
var apiUrl = $"{_configuration["API"]}org/profile/profileid/position/{req.Id}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
|
||||||
|
placementAppointment.profileId = org.result.profileId;
|
||||||
|
placementAppointment.prefix = org.result.prefix;
|
||||||
|
placementAppointment.firstName = org.result.firstName;
|
||||||
|
placementAppointment.lastName = org.result.lastName;
|
||||||
|
placementAppointment.citizenId = org.result.citizenId;
|
||||||
|
placementAppointment.rootOld = org.result.root;
|
||||||
|
placementAppointment.rootOldId = org.result.rootId;
|
||||||
|
placementAppointment.rootShortNameOld = org.result.rootShortName;
|
||||||
|
placementAppointment.child1Old = org.result.child1;
|
||||||
|
placementAppointment.child1OldId = org.result.child1Id;
|
||||||
|
placementAppointment.child1ShortNameOld = org.result.child1ShortName;
|
||||||
|
placementAppointment.child2Old = org.result.child2;
|
||||||
|
placementAppointment.child2OldId = org.result.child2Id;
|
||||||
|
placementAppointment.child2ShortNameOld = org.result.child2ShortName;
|
||||||
|
placementAppointment.child3Old = org.result.child3;
|
||||||
|
placementAppointment.child3OldId = org.result.child3Id;
|
||||||
|
placementAppointment.child3ShortNameOld = org.result.child3ShortName;
|
||||||
|
placementAppointment.child4Old = org.result.child4;
|
||||||
|
placementAppointment.child4OldId = org.result.child4Id;
|
||||||
|
placementAppointment.child4ShortNameOld = org.result.child4ShortName;
|
||||||
|
placementAppointment.posMasterNoOld = org.result.posMasterNo;
|
||||||
|
placementAppointment.positionOld = org.result.position;
|
||||||
|
placementAppointment.posTypeOldId = org.result.posTypeId;
|
||||||
|
placementAppointment.posTypeNameOld = org.result.posTypeName;
|
||||||
|
placementAppointment.posLevelOldId = org.result.posLevelId;
|
||||||
|
placementAppointment.posLevelNameOld = org.result.posLevelName;
|
||||||
|
}
|
||||||
await _context.PlacementAppointments.AddAsync(placementAppointment);
|
await _context.PlacementAppointments.AddAsync(placementAppointment);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
// if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||||
{
|
// {
|
||||||
foreach (var file in Request.Form.Files)
|
// foreach (var file in Request.Form.Files)
|
||||||
{
|
// {
|
||||||
var fileExtension = Path.GetExtension(file.FileName);
|
// var fileExtension = Path.GetExtension(file.FileName);
|
||||||
|
|
||||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
// var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||||
var _doc = await _context.Documents.AsQueryable()
|
// var _doc = await _context.Documents.AsQueryable()
|
||||||
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
// .FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||||
if (_doc != null)
|
// if (_doc != null)
|
||||||
{
|
// {
|
||||||
var placementAppointmentDoc = new PlacementAppointmentDoc
|
// var placementAppointmentDoc = new PlacementAppointmentDoc
|
||||||
{
|
// {
|
||||||
PlacementAppointment = placementAppointment,
|
// PlacementAppointment = placementAppointment,
|
||||||
Document = _doc,
|
// Document = _doc,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
// CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
// CreatedUserId = UserId ?? "",
|
||||||
CreatedAt = DateTime.Now,
|
// CreatedAt = DateTime.Now,
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
LastUpdateUserId = UserId ?? "",
|
// LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
// LastUpdatedAt = DateTime.Now,
|
||||||
};
|
// };
|
||||||
await _context.PlacementAppointmentDocs.AddAsync(placementAppointmentDoc);
|
// await _context.PlacementAppointmentDocs.AddAsync(placementAppointmentDoc);
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
|
|
@ -326,63 +398,56 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> UpdatePositionPlacementAppointment([FromBody] PersonSelectPositionAppointmentRequest req, Guid id)
|
public async Task<ActionResult<ResponseObject>> UpdatePositionPlacementAppointment([FromBody] PersonSelectPositionAppointmentRequest req, Guid id)
|
||||||
{
|
{
|
||||||
var uppdated = await _context.PlacementAppointments
|
var uppdated = await _context.PlacementAppointments
|
||||||
.Where(x => x.Profile.ProfileType == "officer")
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
return Error(GlobalMessages.PlacementAppointmentNotFound, 404);
|
return Error(GlobalMessages.PlacementAppointmentNotFound, 404);
|
||||||
if (req.PosNoId != null)
|
|
||||||
{
|
|
||||||
var save_posNo = await _context.PositionNumbers.FindAsync(req.PosNoId);
|
|
||||||
if (save_posNo == null)
|
|
||||||
return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
|
||||||
uppdated.PositionNumber = save_posNo;
|
|
||||||
|
|
||||||
var save_orgPosition = await _context.OrganizationPositions.FirstOrDefaultAsync(x => x.PositionNumber == save_posNo);
|
var apiUrl = $"{_configuration["API"]}org/find/all";
|
||||||
if (save_orgPosition == null)
|
|
||||||
return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
using (var client = new HttpClient())
|
||||||
uppdated.OrganizationPosition = save_orgPosition;
|
{
|
||||||
}
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
if (req.PositionId != null)
|
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||||
{
|
{
|
||||||
var save = await _context.PositionPaths.FindAsync(req.PositionId);
|
node = req.node,
|
||||||
if (save == null)
|
nodeId = req.nodeId,
|
||||||
return Error(GlobalMessages.PositionPathNotFound, 404);
|
});
|
||||||
uppdated.PositionPath = save;
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
}
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
if (req.PositionLevelId != null)
|
if (org == null || org.result == null)
|
||||||
{
|
return Error("ไม่พบหน่วยงานนี้ในระบบ", 404);
|
||||||
var save = await _context.PositionLevels.FindAsync(req.PositionLevelId);
|
|
||||||
if (save == null)
|
uppdated.root = org.result.root;
|
||||||
return Error(GlobalMessages.PositionLevelNotFound, 404);
|
uppdated.rootId = org.result.rootId;
|
||||||
uppdated.PositionLevel = save;
|
uppdated.rootShortName = org.result.rootShortName;
|
||||||
}
|
uppdated.child1 = req.node <= 0 ? null : org.result.child1;
|
||||||
|
uppdated.child1Id = req.node <= 0 ? null : org.result.child1Id;
|
||||||
if (req.PositionLineId != null)
|
uppdated.child1ShortName = req.node <= 0 ? null : org.result.child1ShortName;
|
||||||
{
|
uppdated.child2 = req.node <= 1 ? null : org.result.child2;
|
||||||
var save = await _context.PositionLines.FindAsync(req.PositionLineId);
|
uppdated.child2Id = req.node <= 1 ? null : org.result.child2Id;
|
||||||
if (save == null)
|
uppdated.child2ShortName = req.node <= 1 ? null : org.result.child2ShortName;
|
||||||
return Error(GlobalMessages.PositionLineNotFound, 404);
|
uppdated.child3 = req.node <= 2 ? null : org.result.child3;
|
||||||
uppdated.PositionLine = save;
|
uppdated.child3Id = req.node <= 2 ? null : org.result.child3Id;
|
||||||
}
|
uppdated.child3ShortName = req.node <= 2 ? null : org.result.child3ShortName;
|
||||||
|
uppdated.child4 = req.node <= 3 ? null : org.result.child4;
|
||||||
if (req.PositionPathSideId != null)
|
uppdated.child4Id = req.node <= 3 ? null : org.result.child4Id;
|
||||||
{
|
uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName;
|
||||||
var save = await _context.PositionPathSides.FindAsync(req.PositionPathSideId);
|
|
||||||
if (save == null)
|
|
||||||
return Error(GlobalMessages.PositionPathSideNotFound, 404);
|
|
||||||
uppdated.PositionPathSide = save;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (req.PositionTypeId != null)
|
|
||||||
{
|
|
||||||
var save = await _context.PositionTypes.FindAsync(req.PositionTypeId);
|
|
||||||
if (save == null)
|
|
||||||
return Error(GlobalMessages.PositionTypeNotFound, 404);
|
|
||||||
uppdated.PositionType = save;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uppdated.posmasterId = req.posmasterId;
|
||||||
|
uppdated.node = req.node;
|
||||||
|
uppdated.nodeId = req.nodeId;
|
||||||
|
uppdated.orgRevisionId = req.orgRevisionId;
|
||||||
|
uppdated.positionId = req.positionId;
|
||||||
|
uppdated.posMasterNo = req.posMasterNo;
|
||||||
|
uppdated.positionName = req.positionName;
|
||||||
|
uppdated.positionField = req.positionField;
|
||||||
|
uppdated.posTypeId = req.posTypeId;
|
||||||
|
uppdated.posTypeName = req.posTypeName;
|
||||||
|
uppdated.posLevelId = req.posLevelId;
|
||||||
|
uppdated.posLevelName = req.posLevelName;
|
||||||
uppdated.Amount = req.Amount;
|
uppdated.Amount = req.Amount;
|
||||||
uppdated.RecruitDate = req.RecruitDate;
|
uppdated.RecruitDate = req.RecruitDate;
|
||||||
uppdated.Status = "PENDING";
|
uppdated.Status = "PENDING";
|
||||||
|
|
@ -406,58 +471,22 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> Put([FromBody] PlacementAppointmentEditRequest req, Guid id)
|
public async Task<ActionResult<ResponseObject>> Put([FromBody] PlacementAppointmentEditRequest req, Guid id)
|
||||||
{
|
{
|
||||||
var uppdated = await _context.PlacementAppointments
|
var uppdated = await _context.PlacementAppointments
|
||||||
.Where(x => x.Profile.ProfileType == "officer")
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
return Error(GlobalMessages.PlacementAppointmentNotFound, 404);
|
return Error(GlobalMessages.PlacementAppointmentNotFound, 404);
|
||||||
|
|
||||||
|
|
||||||
if (req.PrefixId != null)
|
// if (req.PrefixId != null)
|
||||||
{
|
|
||||||
var save = await _context.Prefixes.FindAsync(req.PrefixId);
|
|
||||||
if (save == null)
|
|
||||||
return Error(GlobalMessages.PrefixNotFound, 404);
|
|
||||||
uppdated.Prefix = save;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (req.RelationshipId != null)
|
|
||||||
// {
|
// {
|
||||||
// var save = await _context.Relationships.FindAsync(req.RelationshipId);
|
// var save = await _context.Prefixes.FindAsync(req.PrefixId);
|
||||||
// if (save == null)
|
// if (save == null)
|
||||||
// return Error(GlobalMessages.RelationshipNotFound, 404);
|
// return Error(GlobalMessages.PrefixNotFound, 404);
|
||||||
// uppdated.Relationship = save;
|
// uppdated.Prefix = save;
|
||||||
// }
|
// }
|
||||||
|
// uppdated.CitizenId = req.CitizenId;
|
||||||
|
// uppdated.Firstname = req.Firstname;
|
||||||
|
// uppdated.Lastname = req.Lastname;
|
||||||
|
|
||||||
// if (req.ReligionId != null)
|
|
||||||
// {
|
|
||||||
// var save = await _context.Religions.FindAsync(req.ReligionId);
|
|
||||||
// if (save == null)
|
|
||||||
// return Error(GlobalMessages.ReligionNotFound, 404);
|
|
||||||
// uppdated.Religion = save;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (req.BloodGroupId != null)
|
|
||||||
// {
|
|
||||||
// var save = await _context.BloodGroups.FindAsync(req.BloodGroupId);
|
|
||||||
// if (save == null)
|
|
||||||
// return Error(GlobalMessages.BloodGroupNotFound, 404);
|
|
||||||
// uppdated.BloodGroup = save;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (req.GenderId != null)
|
|
||||||
// {
|
|
||||||
// var save = await _context.Genders.FindAsync(req.GenderId);
|
|
||||||
// if (save == null)
|
|
||||||
// return Error(GlobalMessages.GenderNotFound, 404);
|
|
||||||
// uppdated.Gender = save;
|
|
||||||
// }
|
|
||||||
uppdated.CitizenId = req.CitizenId;
|
|
||||||
uppdated.Firstname = req.Firstname;
|
|
||||||
uppdated.Lastname = req.Lastname;
|
|
||||||
// uppdated.DateOfBirth = req.DateOfBirth;
|
|
||||||
// uppdated.Nationality = req.Nationality;
|
|
||||||
// uppdated.Race = req.Race;
|
|
||||||
// uppdated.TelephoneNumber = req.TelephoneNumber;
|
|
||||||
uppdated.EducationOld = req.EducationOld;
|
uppdated.EducationOld = req.EducationOld;
|
||||||
uppdated.Reason = req.Reason;
|
uppdated.Reason = req.Reason;
|
||||||
uppdated.OrganizationPositionOld = req.OrganizationPositionOld;
|
uppdated.OrganizationPositionOld = req.OrganizationPositionOld;
|
||||||
|
|
@ -489,25 +518,24 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
var deleted = await _context.PlacementAppointments.AsQueryable()
|
var deleted = await _context.PlacementAppointments.AsQueryable()
|
||||||
.Include(x => x.PlacementAppointmentDocs)
|
.Include(x => x.PlacementAppointmentDocs)
|
||||||
.ThenInclude(x => x.Document)
|
.ThenInclude(x => x.Document)
|
||||||
.Where(x => x.Profile.ProfileType == "officer")
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (deleted == null)
|
if (deleted == null)
|
||||||
return NotFound();
|
return NotFound();
|
||||||
var placementAppointmentDocs = new List<dynamic>();
|
// var placementAppointmentDocs = new List<dynamic>();
|
||||||
foreach (var doc in deleted.PlacementAppointmentDocs)
|
// foreach (var doc in deleted.PlacementAppointmentDocs)
|
||||||
{
|
// {
|
||||||
if (doc.Document != null)
|
// if (doc.Document != null)
|
||||||
placementAppointmentDocs.Add(doc.Document.Id);
|
// placementAppointmentDocs.Add(doc.Document.Id);
|
||||||
}
|
// }
|
||||||
_context.PlacementAppointmentDocs.RemoveRange(deleted.PlacementAppointmentDocs);
|
_context.PlacementAppointmentDocs.RemoveRange(deleted.PlacementAppointmentDocs);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
_context.PlacementAppointments.Remove(deleted);
|
// _context.PlacementAppointments.Remove(deleted);
|
||||||
foreach (var doc in placementAppointmentDocs)
|
// foreach (var doc in placementAppointmentDocs)
|
||||||
{
|
// {
|
||||||
if (doc != null)
|
// if (doc != null)
|
||||||
await _documentService.DeleteFileAsync(doc);
|
// await _documentService.DeleteFileAsync(doc);
|
||||||
}
|
// }
|
||||||
await _context.SaveChangesAsync();
|
// await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
@ -526,7 +554,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
foreach (var item in req.Id)
|
foreach (var item in req.Id)
|
||||||
{
|
{
|
||||||
var uppdated = await _context.PlacementAppointments
|
var uppdated = await _context.PlacementAppointments
|
||||||
.Where(x => x.Profile.ProfileType == "officer")
|
// .Where(x => x.Profile.ProfileType == "officer")
|
||||||
.FirstOrDefaultAsync(x => x.Id == item);
|
.FirstOrDefaultAsync(x => x.Id == item);
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -543,24 +571,24 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// หน่วยงานที่ถูกเลือกไปแล้ว
|
// /// หน่วยงานที่ถูกเลือกไปแล้ว
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
/// <response code="200"></response>
|
// /// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("use")]
|
// [HttpGet("use")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetAppointmentsUse()
|
// public async Task<ActionResult<ResponseObject>> GetAppointmentsUse()
|
||||||
{
|
// {
|
||||||
var appointments = await _context.PlacementAppointments
|
// var appointments = await _context.PlacementAppointments
|
||||||
.Where(x => x.PositionNumber != null)
|
// // .Where(x => x.PositionNumber != null)
|
||||||
.Where(x => x.Profile.ProfileType == "officer")
|
// // .Where(x => x.Profile.ProfileType == "officer")
|
||||||
.Select(x => x.PositionNumber.Id)
|
// // .Select(x => x.PositionNumber.Id)
|
||||||
.ToListAsync();
|
// .ToListAsync();
|
||||||
|
|
||||||
return Success(appointments);
|
// return Success(appointments);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ using BMA.EHR.Placement.Service.Requests;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace BMA.EHR.Placement.Service.Controllers
|
namespace BMA.EHR.Placement.Service.Controllers
|
||||||
|
|
@ -26,18 +28,21 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
|
|
||||||
public PlacementAppointmentEmployeeController(PlacementRepository repository,
|
public PlacementAppointmentEmployeeController(PlacementRepository repository,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -45,6 +50,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
private bool? PlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
private bool? PlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
||||||
|
|
||||||
|
|
@ -63,47 +69,48 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
|
|
||||||
var placementAppointments = await _context.PlacementAppointments.AsQueryable()
|
var placementAppointments = await _context.PlacementAppointments.AsQueryable()
|
||||||
|
.Where(x => x.type == "EMPLOYEE")
|
||||||
.OrderByDescending(x => x.CreatedAt)
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
.Where(x => x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm")
|
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
p.CitizenId,
|
p.prefix,
|
||||||
Prefix = p.Prefix == null ? null : p.Prefix.Name,
|
p.firstName,
|
||||||
p.Firstname,
|
p.lastName,
|
||||||
p.Lastname,
|
p.root,
|
||||||
p.DateOfBirth,
|
p.rootShortName,
|
||||||
Gender = p.Gender == null ? null : p.Gender.Name,
|
p.child1,
|
||||||
|
p.child1ShortName,
|
||||||
|
p.child2,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4ShortName,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.positionName,
|
||||||
|
p.posLevelName,
|
||||||
|
p.posTypeName,
|
||||||
|
|
||||||
|
p.rootOld,
|
||||||
|
p.rootShortNameOld,
|
||||||
|
p.child1Old,
|
||||||
|
p.child1ShortNameOld,
|
||||||
|
p.child2Old,
|
||||||
|
p.child2ShortNameOld,
|
||||||
|
p.child3Old,
|
||||||
|
p.child3ShortNameOld,
|
||||||
|
p.child4Old,
|
||||||
|
p.child4ShortNameOld,
|
||||||
|
p.posMasterNoOld,
|
||||||
|
p.positionOld,
|
||||||
|
p.posLevelNameOld,
|
||||||
|
p.posTypeNameOld,
|
||||||
|
|
||||||
p.Status,
|
p.Status,
|
||||||
p.Amount,
|
p.Amount,
|
||||||
p.RecruitDate,
|
p.RecruitDate,
|
||||||
|
|
||||||
// PositionNumber = p.PositionNumber == null ? null : p.PositionNumber.Name,
|
|
||||||
// PositionPath = p.PositionPath == null ? null : p.PositionPath.Name,
|
|
||||||
// PositionPathSide = p.PositionPathSide == null ? null : p.PositionPathSide.Name,
|
|
||||||
// PositionType = p.PositionType == null ? null : p.PositionType.Name,
|
|
||||||
// PositionLine = p.PositionLine == null ? null : p.PositionLine.Name,
|
|
||||||
// PositionLevel = p.PositionLevel == null ? null : p.PositionLevel.Name,
|
|
||||||
// PosNoId = p.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionNumber.Id,
|
|
||||||
// PositionId = p.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPath.Id,
|
|
||||||
// PositionPathSideId = p.PositionPathSide == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPathSide.Id,
|
|
||||||
// PositionTypeId = p.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionType.Id,
|
|
||||||
// PositionLineId = p.PositionLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLine.Id,
|
|
||||||
// PositionLevelId = p.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLevel.Id,
|
|
||||||
|
|
||||||
OrgEmployeeId = p.OrgEmployee == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrgEmployee.Id,
|
|
||||||
PositionEmployeeStatusId = p.PositionEmployeeStatus == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionEmployeeStatus.Id,
|
|
||||||
PositionEmployeeLineId = p.PositionEmployeeLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionEmployeeLine.Id,
|
|
||||||
PositionEmployeePositionId = p.PositionEmployeePosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionEmployeePosition.Id,
|
|
||||||
PositionEmployeeStatus = p.PositionEmployeeStatus == null ? null : p.PositionEmployeeStatus.Name,
|
|
||||||
PositionEmployeeLine = p.PositionEmployeeLine == null ? null : p.PositionEmployeeLine.Name,
|
|
||||||
PositionEmployeePosition = p.PositionEmployeePosition == null ? null : p.PositionEmployeePosition.Name,
|
|
||||||
|
|
||||||
// OrganizationShortName = x.OrganizationShortName == null ? null : x.OrganizationShortName.Name,
|
|
||||||
OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
|
|
||||||
// OrganizationName = p.OrganizationPosition == null ? null : (p.OrganizationPosition.Organization == null ? null : (p.OrganizationPosition.Organization.OrganizationOrganization == null ? null : p.OrganizationPosition.Organization.OrganizationOrganization.Name)),////
|
|
||||||
OrganizationName = p.OrgEmployee == null ? null : (p.OrgEmployee.OrganizationOrganization == null ? null : p.OrgEmployee.OrganizationOrganization.Name),
|
|
||||||
OrganizationShortName = p.OrgEmployee == null ? null : (p.OrgEmployee.OrganizationShortName == null ? null : p.OrgEmployee.OrganizationShortName.Name),
|
|
||||||
p.IsActive,
|
p.IsActive,
|
||||||
p.PositionDate,
|
p.PositionDate,
|
||||||
p.Reason,
|
p.Reason,
|
||||||
|
|
@ -117,8 +124,6 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
CommandType = p.CommandType == null ? null : p.CommandType.Name,
|
CommandType = p.CommandType == null ? null : p.CommandType.Name,
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
if (PlacementAdmin == true)
|
|
||||||
placementAppointments.Where(x => x.Status.Trim().ToUpper().Contains("PENDING"));
|
|
||||||
|
|
||||||
return Success(placementAppointments);
|
return Success(placementAppointments);
|
||||||
}
|
}
|
||||||
|
|
@ -136,36 +141,49 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> GetDetailByUser(Guid id)
|
public async Task<ActionResult<ResponseObject>> GetDetailByUser(Guid id)
|
||||||
{
|
{
|
||||||
var data = await _context.PlacementAppointments.AsQueryable()
|
var data = await _context.PlacementAppointments.AsQueryable()
|
||||||
|
.Where(x => x.type == "EMPLOYEE")
|
||||||
.Where(x => x.Id == id)
|
.Where(x => x.Id == id)
|
||||||
.Where(x => x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm")
|
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
ProfileId = p.Profile.Id,
|
p.profileId,
|
||||||
p.CitizenId,
|
p.prefix,
|
||||||
Prefix = p.Prefix == null ? null : p.Prefix.Name,
|
p.firstName,
|
||||||
PrefixId = p.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Prefix.Id,
|
p.lastName,
|
||||||
p.Firstname,
|
p.root,
|
||||||
p.Lastname,
|
p.rootShortName,
|
||||||
p.DateOfBirth,
|
p.child1,
|
||||||
Gender = p.Gender == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Gender.Id,
|
p.child1ShortName,
|
||||||
p.Nationality,
|
p.child2,
|
||||||
p.Race,
|
p.child2ShortName,
|
||||||
Religion = p.Religion == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Religion.Id,
|
p.child3,
|
||||||
BloodGroup = p.BloodGroup == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.BloodGroup.Id,
|
p.child3ShortName,
|
||||||
Relationship = p.Relationship == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Relationship.Id,
|
p.child4,
|
||||||
p.TelephoneNumber,
|
p.child4ShortName,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.positionName,
|
||||||
|
p.posLevelName,
|
||||||
|
p.posTypeName,
|
||||||
|
|
||||||
|
p.rootOld,
|
||||||
|
p.rootShortNameOld,
|
||||||
|
p.child1Old,
|
||||||
|
p.child1ShortNameOld,
|
||||||
|
p.child2Old,
|
||||||
|
p.child2ShortNameOld,
|
||||||
|
p.child3Old,
|
||||||
|
p.child3ShortNameOld,
|
||||||
|
p.child4Old,
|
||||||
|
p.child4ShortNameOld,
|
||||||
|
p.posMasterNoOld,
|
||||||
|
p.positionOld,
|
||||||
|
p.posLevelNameOld,
|
||||||
|
p.posTypeNameOld,
|
||||||
|
|
||||||
p.Status,
|
p.Status,
|
||||||
p.Amount,
|
p.Amount,
|
||||||
p.RecruitDate,
|
p.RecruitDate,
|
||||||
OrgEmployeeId = p.OrgEmployee == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrgEmployee.Id,
|
|
||||||
PositionEmployeeStatusId = p.PositionEmployeeStatus == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionEmployeeStatus.Id,
|
|
||||||
PositionEmployeeLineId = p.PositionEmployeeLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionEmployeeLine.Id,
|
|
||||||
PositionEmployeePositionId = p.PositionEmployeePosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionEmployeePosition.Id,
|
|
||||||
// PositionTypeId = p.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionType.Id,
|
|
||||||
// PositionLineId = p.PositionLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLine.Id,
|
|
||||||
// PositionLevelId = p.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLevel.Id,
|
|
||||||
OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
|
|
||||||
p.CreatedAt,
|
p.CreatedAt,
|
||||||
p.Reason,
|
p.Reason,
|
||||||
p.EducationOld,
|
p.EducationOld,
|
||||||
|
|
@ -175,67 +193,78 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
p.PositionNumberOld,
|
p.PositionNumberOld,
|
||||||
p.OrganizationPositionOld,
|
p.OrganizationPositionOld,
|
||||||
p.PositionDate,
|
p.PositionDate,
|
||||||
PlacementAppointmentDocs = p.PlacementAppointmentDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
// PlacementAppointmentDocs = p.PlacementAppointmentDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||||
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
|
||||||
CommandType = p.CommandType == null ? null : p.CommandType.Name,
|
CommandType = p.CommandType == null ? null : p.CommandType.Name,
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
var placementAppointmentDocs = new List<dynamic>();
|
// var placementAppointmentDocs = new List<dynamic>();
|
||||||
foreach (var doc in data.PlacementAppointmentDocs)
|
// foreach (var doc in data.PlacementAppointmentDocs)
|
||||||
{
|
// {
|
||||||
var _doc = new
|
// var _doc = new
|
||||||
{
|
// {
|
||||||
doc.FileName,
|
// doc.FileName,
|
||||||
PathName = await _documentService.ImagesPath(doc.Id)
|
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||||
};
|
// };
|
||||||
placementAppointmentDocs.Add(_doc);
|
// placementAppointmentDocs.Add(_doc);
|
||||||
}
|
// }
|
||||||
var _data = new
|
// var _data = new
|
||||||
{
|
// {
|
||||||
data.Id,
|
// data.Id,
|
||||||
data.ProfileId,
|
// data.profileId,
|
||||||
data.CitizenId,
|
// data.prefix,
|
||||||
data.Prefix,
|
// data.firstName,
|
||||||
data.PrefixId,
|
// data.lastName,
|
||||||
data.Firstname,
|
// data.root,
|
||||||
data.Lastname,
|
// data.rootShortName,
|
||||||
data.DateOfBirth,
|
// data.child1,
|
||||||
data.Gender,
|
// data.child1ShortName,
|
||||||
data.Nationality,
|
// data.child2,
|
||||||
data.Race,
|
// data.child2ShortName,
|
||||||
data.Religion,
|
// data.child3,
|
||||||
data.BloodGroup,
|
// data.child3ShortName,
|
||||||
data.Relationship,
|
// data.child4,
|
||||||
data.TelephoneNumber,
|
// data.child4ShortName,
|
||||||
data.Status,
|
// data.posMasterNo,
|
||||||
data.Amount,
|
// data.positionName,
|
||||||
data.RecruitDate,
|
// data.posLevelName,
|
||||||
// data.PosNoId,
|
// data.posTypeName,
|
||||||
// data.PositionId,
|
|
||||||
// data.PositionPathSideId,
|
|
||||||
data.OrgEmployeeId,
|
|
||||||
data.PositionEmployeeStatusId,
|
|
||||||
data.PositionEmployeeLineId,
|
|
||||||
data.PositionEmployeePositionId,
|
|
||||||
data.OrganizationPositionId,
|
|
||||||
data.CreatedAt,
|
|
||||||
data.Reason,
|
|
||||||
data.EducationOld,
|
|
||||||
data.salary,
|
|
||||||
data.PositionTypeOld,
|
|
||||||
data.PositionLevelOld,
|
|
||||||
data.PositionNumberOld,
|
|
||||||
data.OrganizationPositionOld,
|
|
||||||
data.PositionDate,
|
|
||||||
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
|
||||||
Docs = placementAppointmentDocs,
|
|
||||||
data.CommandType,
|
|
||||||
};
|
|
||||||
|
|
||||||
return Success(_data);
|
// data.rootOld,
|
||||||
|
// data.rootShortNameOld,
|
||||||
|
// data.child1Old,
|
||||||
|
// data.child1ShortNameOld,
|
||||||
|
// data.child2Old,
|
||||||
|
// data.child2ShortNameOld,
|
||||||
|
// data.child3Old,
|
||||||
|
// data.child3ShortNameOld,
|
||||||
|
// data.child4Old,
|
||||||
|
// data.child4ShortNameOld,
|
||||||
|
// data.posMasterNoOld,
|
||||||
|
// data.positionOld,
|
||||||
|
// data.posLevelNameOld,
|
||||||
|
// data.posTypeNameOld,
|
||||||
|
|
||||||
|
// data.Status,
|
||||||
|
// data.Amount,
|
||||||
|
// data.RecruitDate,
|
||||||
|
|
||||||
|
// data.CreatedAt,
|
||||||
|
// data.Reason,
|
||||||
|
// data.EducationOld,
|
||||||
|
// data.salary,
|
||||||
|
// data.PositionTypeOld,
|
||||||
|
// data.PositionLevelOld,
|
||||||
|
// data.PositionNumberOld,
|
||||||
|
// data.OrganizationPositionOld,
|
||||||
|
// data.PositionDate,
|
||||||
|
// Docs = placementAppointmentDocs,
|
||||||
|
// data.CommandType,
|
||||||
|
// };
|
||||||
|
|
||||||
|
return Success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -249,42 +278,29 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
[HttpPost()]
|
[HttpPost()]
|
||||||
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementAddProfileRequest req)
|
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementAddProfileRequest req)
|
||||||
{
|
{
|
||||||
var profile = await _context.Profiles
|
|
||||||
.Include(x => x.PositionLevel)
|
|
||||||
.Include(x => x.PositionType)
|
|
||||||
.Include(x => x.PosNo)
|
|
||||||
.Include(x => x.Salaries)
|
|
||||||
.Include(x => x.Educations)
|
|
||||||
.Include(x => x.Position)
|
|
||||||
.Include(x => x.Gender)
|
|
||||||
.Include(x => x.Prefix)
|
|
||||||
.Where(x => x.ProfileType == "employee" && x.EmployeeClass == "perm")
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.Id);
|
|
||||||
if (profile == null)
|
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
|
||||||
|
|
||||||
var placementAppointment = new PlacementAppointment
|
var placementAppointment = new PlacementAppointment
|
||||||
{
|
{
|
||||||
Profile = profile,
|
// Profile = profile,
|
||||||
CitizenId = profile.CitizenId,
|
// CitizenId = profile.CitizenId,
|
||||||
Prefix = profile.Prefix,
|
// Prefix = profile.Prefix,
|
||||||
Firstname = profile.FirstName,
|
// Firstname = profile.FirstName,
|
||||||
Lastname = profile.LastName,
|
// Lastname = profile.LastName,
|
||||||
DateOfBirth = profile.BirthDate,
|
// DateOfBirth = profile.BirthDate,
|
||||||
Gender = profile.Gender,
|
// Gender = profile.Gender,
|
||||||
Nationality = profile.Nationality,
|
// Nationality = profile.Nationality,
|
||||||
Race = profile.Race,
|
// Race = profile.Race,
|
||||||
Religion = await _context.Religions.FindAsync(profile.ReligionId),
|
// Religion = await _context.Religions.FindAsync(profile.ReligionId),
|
||||||
BloodGroup = await _context.BloodGroups.FindAsync(profile.BloodGroupId),
|
// BloodGroup = await _context.BloodGroups.FindAsync(profile.BloodGroupId),
|
||||||
Relationship = await _context.Relationships.FindAsync(profile.RelationshipId),
|
// Relationship = await _context.Relationships.FindAsync(profile.RelationshipId),
|
||||||
TelephoneNumber = profile.TelephoneNumber,
|
// TelephoneNumber = profile.TelephoneNumber,
|
||||||
EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}",
|
// EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}",
|
||||||
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
// AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||||
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
// PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
||||||
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
// PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
||||||
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
// PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
||||||
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
|
// OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
|
||||||
PositionDate = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Date,
|
// PositionDate = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Date,
|
||||||
|
type = "EMPLOYEE",
|
||||||
Status = "WAITTING",
|
Status = "WAITTING",
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
CreatedUserId = UserId ?? "",
|
||||||
|
|
@ -293,36 +309,76 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
var apiUrl = $"{_configuration["API"]}org/profile/profileempid/position/{req.Id}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
|
||||||
|
placementAppointment.profileId = org.result.profileId;
|
||||||
|
placementAppointment.prefix = org.result.prefix;
|
||||||
|
placementAppointment.firstName = org.result.firstName;
|
||||||
|
placementAppointment.lastName = org.result.lastName;
|
||||||
|
placementAppointment.citizenId = org.result.citizenId;
|
||||||
|
placementAppointment.rootOld = org.result.root;
|
||||||
|
placementAppointment.rootOldId = org.result.rootId;
|
||||||
|
placementAppointment.rootShortNameOld = org.result.rootShortName;
|
||||||
|
placementAppointment.child1Old = org.result.child1;
|
||||||
|
placementAppointment.child1OldId = org.result.child1Id;
|
||||||
|
placementAppointment.child1ShortNameOld = org.result.child1ShortName;
|
||||||
|
placementAppointment.child2Old = org.result.child2;
|
||||||
|
placementAppointment.child2OldId = org.result.child2Id;
|
||||||
|
placementAppointment.child2ShortNameOld = org.result.child2ShortName;
|
||||||
|
placementAppointment.child3Old = org.result.child3;
|
||||||
|
placementAppointment.child3OldId = org.result.child3Id;
|
||||||
|
placementAppointment.child3ShortNameOld = org.result.child3ShortName;
|
||||||
|
placementAppointment.child4Old = org.result.child4;
|
||||||
|
placementAppointment.child4OldId = org.result.child4Id;
|
||||||
|
placementAppointment.child4ShortNameOld = org.result.child4ShortName;
|
||||||
|
placementAppointment.posMasterNoOld = org.result.posMasterNo;
|
||||||
|
placementAppointment.positionOld = org.result.position;
|
||||||
|
placementAppointment.posTypeOldId = org.result.posTypeId;
|
||||||
|
placementAppointment.posTypeNameOld = org.result.posTypeName;
|
||||||
|
placementAppointment.posLevelOldId = org.result.posLevelId;
|
||||||
|
placementAppointment.posLevelNameOld = org.result.posLevelName;
|
||||||
|
}
|
||||||
await _context.PlacementAppointments.AddAsync(placementAppointment);
|
await _context.PlacementAppointments.AddAsync(placementAppointment);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
// if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||||
{
|
// {
|
||||||
foreach (var file in Request.Form.Files)
|
// foreach (var file in Request.Form.Files)
|
||||||
{
|
// {
|
||||||
var fileExtension = Path.GetExtension(file.FileName);
|
// var fileExtension = Path.GetExtension(file.FileName);
|
||||||
|
|
||||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
// var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||||
var _doc = await _context.Documents.AsQueryable()
|
// var _doc = await _context.Documents.AsQueryable()
|
||||||
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
// .FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||||
if (_doc != null)
|
// if (_doc != null)
|
||||||
{
|
// {
|
||||||
var placementAppointmentDoc = new PlacementAppointmentDoc
|
// var placementAppointmentDoc = new PlacementAppointmentDoc
|
||||||
{
|
// {
|
||||||
PlacementAppointment = placementAppointment,
|
// PlacementAppointment = placementAppointment,
|
||||||
Document = _doc,
|
// Document = _doc,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
// CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
// CreatedUserId = UserId ?? "",
|
||||||
CreatedAt = DateTime.Now,
|
// CreatedAt = DateTime.Now,
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
LastUpdateUserId = UserId ?? "",
|
// LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
// LastUpdatedAt = DateTime.Now,
|
||||||
};
|
// };
|
||||||
await _context.PlacementAppointmentDocs.AddAsync(placementAppointmentDoc);
|
// await _context.PlacementAppointmentDocs.AddAsync(placementAppointmentDoc);
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
await _context.SaveChangesAsync();
|
// await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
@ -340,76 +396,58 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> UpdatePositionPlacementAppointment([FromBody] PersonSelectPositionAppointmentEmployeeRequest req, Guid id)
|
public async Task<ActionResult<ResponseObject>> UpdatePositionPlacementAppointment([FromBody] PersonSelectPositionAppointmentEmployeeRequest req, Guid id)
|
||||||
{
|
{
|
||||||
var uppdated = await _context.PlacementAppointments
|
var uppdated = await _context.PlacementAppointments
|
||||||
.Where(x => x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm")
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
return Error(GlobalMessages.PlacementAppointmentNotFound, 404);
|
return Error(GlobalMessages.PlacementAppointmentNotFound, 404);
|
||||||
// if (req.PosNoId != null)
|
|
||||||
// {
|
|
||||||
// var save_posNo = await _context.PositionNumbers.FindAsync(req.PosNoId);
|
|
||||||
// if (save_posNo == null)
|
|
||||||
// return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
|
||||||
// uppdated.PositionNumber = save_posNo;
|
|
||||||
|
|
||||||
// var save_orgPosition = await _context.OrganizationPositions.FirstOrDefaultAsync(x => x.PositionNumber == save_posNo);
|
var apiUrl = $"{_configuration["API"]}org/find/all";
|
||||||
// if (save_orgPosition == null)
|
|
||||||
// return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
|
||||||
// uppdated.OrganizationPosition = save_orgPosition;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (req.PositionId != null)
|
using (var client = new HttpClient())
|
||||||
// {
|
{
|
||||||
// var save = await _context.PositionPaths.FindAsync(req.PositionId);
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
// if (save == null)
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
// return Error(GlobalMessages.PositionPathNotFound, 404);
|
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||||
// uppdated.PositionPath = save;
|
{
|
||||||
// }
|
node = req.node,
|
||||||
|
nodeId = req.nodeId,
|
||||||
|
});
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
// if (req.PositionLevelId != null)
|
if (org == null || org.result == null)
|
||||||
// {
|
return Error("ไม่พบหน่วยงานนี้ในระบบ", 404);
|
||||||
// var save = await _context.PositionLevels.FindAsync(req.PositionLevelId);
|
|
||||||
// if (save == null)
|
|
||||||
// return Error(GlobalMessages.PositionLevelNotFound, 404);
|
|
||||||
// uppdated.PositionLevel = save;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (req.PositionLineId != null)
|
uppdated.root = org.result.root;
|
||||||
// {
|
uppdated.rootId = org.result.rootId;
|
||||||
// var save = await _context.PositionLines.FindAsync(req.PositionLineId);
|
uppdated.rootShortName = org.result.rootShortName;
|
||||||
// if (save == null)
|
uppdated.child1 = req.node <= 0 ? null : org.result.child1;
|
||||||
// return Error(GlobalMessages.PositionLineNotFound, 404);
|
uppdated.child1Id = req.node <= 0 ? null : org.result.child1Id;
|
||||||
// uppdated.PositionLine = save;
|
uppdated.child1ShortName = req.node <= 0 ? null : org.result.child1ShortName;
|
||||||
// }
|
uppdated.child2 = req.node <= 1 ? null : org.result.child2;
|
||||||
|
uppdated.child2Id = req.node <= 1 ? null : org.result.child2Id;
|
||||||
|
uppdated.child2ShortName = req.node <= 1 ? null : org.result.child2ShortName;
|
||||||
|
uppdated.child3 = req.node <= 2 ? null : org.result.child3;
|
||||||
|
uppdated.child3Id = req.node <= 2 ? null : org.result.child3Id;
|
||||||
|
uppdated.child3ShortName = req.node <= 2 ? null : org.result.child3ShortName;
|
||||||
|
uppdated.child4 = req.node <= 3 ? null : org.result.child4;
|
||||||
|
uppdated.child4Id = req.node <= 3 ? null : org.result.child4Id;
|
||||||
|
uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName;
|
||||||
|
}
|
||||||
|
|
||||||
// if (req.PositionPathSideId != null)
|
uppdated.posmasterId = req.posmasterId;
|
||||||
// {
|
uppdated.node = req.node;
|
||||||
// var save = await _context.PositionPathSides.FindAsync(req.PositionPathSideId);
|
uppdated.nodeId = req.nodeId;
|
||||||
// if (save == null)
|
uppdated.orgRevisionId = req.orgRevisionId;
|
||||||
// return Error(GlobalMessages.PositionPathSideNotFound, 404);
|
uppdated.positionId = req.positionId;
|
||||||
// uppdated.PositionPathSide = save;
|
uppdated.posMasterNo = req.posMasterNo;
|
||||||
// }
|
uppdated.positionName = req.positionName;
|
||||||
|
uppdated.positionField = req.positionField;
|
||||||
// if (req.PositionTypeId != null)
|
uppdated.posTypeId = req.posTypeId;
|
||||||
// {
|
uppdated.posTypeName = req.posTypeName;
|
||||||
// var save = await _context.PositionTypes.FindAsync(req.PositionTypeId);
|
uppdated.posLevelId = req.posLevelId;
|
||||||
// if (save == null)
|
uppdated.posLevelName = req.posLevelName;
|
||||||
// return Error(GlobalMessages.PositionTypeNotFound, 404);
|
uppdated.Amount = req.Amount;
|
||||||
// uppdated.PositionType = save;
|
uppdated.RecruitDate = req.RecruitDate;
|
||||||
// }
|
|
||||||
var organizationEmployee = await _context.OrganizationEmployees
|
|
||||||
.Include(x => x.PositionEmployeeStatus)
|
|
||||||
.Include(x => x.PositionEmployeeLine)
|
|
||||||
.Include(x => x.PositionEmployeePosition)
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.OrganizationEmployeeId);
|
|
||||||
if (organizationEmployee == null)
|
|
||||||
return Error(GlobalMessages.OrganizationEmployeeNotFound, 404);
|
|
||||||
|
|
||||||
uppdated.OrgEmployee = organizationEmployee;
|
|
||||||
uppdated.PositionEmployeeStatus = organizationEmployee.PositionEmployeeStatus;
|
|
||||||
uppdated.PositionEmployeeLine = organizationEmployee.PositionEmployeeLine;
|
|
||||||
uppdated.PositionEmployeePosition = organizationEmployee.PositionEmployeePosition;
|
|
||||||
// uppdated.Amount = req.Amount;
|
|
||||||
// uppdated.RecruitDate = req.RecruitDate;
|
|
||||||
uppdated.Status = "PENDING";
|
uppdated.Status = "PENDING";
|
||||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
uppdated.LastUpdateUserId = UserId ?? "";
|
uppdated.LastUpdateUserId = UserId ?? "";
|
||||||
|
|
@ -431,58 +469,11 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
public async Task<ActionResult<ResponseObject>> Put([FromBody] PlacementAppointmentEditRequest req, Guid id)
|
public async Task<ActionResult<ResponseObject>> Put([FromBody] PlacementAppointmentEditRequest req, Guid id)
|
||||||
{
|
{
|
||||||
var uppdated = await _context.PlacementAppointments
|
var uppdated = await _context.PlacementAppointments
|
||||||
.Where(x => x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm")
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
return Error(GlobalMessages.PlacementAppointmentNotFound, 404);
|
return Error(GlobalMessages.PlacementAppointmentNotFound, 404);
|
||||||
|
|
||||||
|
|
||||||
if (req.PrefixId != null)
|
|
||||||
{
|
|
||||||
var save = await _context.Prefixes.FindAsync(req.PrefixId);
|
|
||||||
if (save == null)
|
|
||||||
return Error(GlobalMessages.PrefixNotFound, 404);
|
|
||||||
uppdated.Prefix = save;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (req.RelationshipId != null)
|
|
||||||
// {
|
|
||||||
// var save = await _context.Relationships.FindAsync(req.RelationshipId);
|
|
||||||
// if (save == null)
|
|
||||||
// return Error(GlobalMessages.RelationshipNotFound, 404);
|
|
||||||
// uppdated.Relationship = save;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (req.ReligionId != null)
|
|
||||||
// {
|
|
||||||
// var save = await _context.Religions.FindAsync(req.ReligionId);
|
|
||||||
// if (save == null)
|
|
||||||
// return Error(GlobalMessages.ReligionNotFound, 404);
|
|
||||||
// uppdated.Religion = save;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (req.BloodGroupId != null)
|
|
||||||
// {
|
|
||||||
// var save = await _context.BloodGroups.FindAsync(req.BloodGroupId);
|
|
||||||
// if (save == null)
|
|
||||||
// return Error(GlobalMessages.BloodGroupNotFound, 404);
|
|
||||||
// uppdated.BloodGroup = save;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (req.GenderId != null)
|
|
||||||
// {
|
|
||||||
// var save = await _context.Genders.FindAsync(req.GenderId);
|
|
||||||
// if (save == null)
|
|
||||||
// return Error(GlobalMessages.GenderNotFound, 404);
|
|
||||||
// uppdated.Gender = save;
|
|
||||||
// }
|
|
||||||
uppdated.CitizenId = req.CitizenId;
|
|
||||||
uppdated.Firstname = req.Firstname;
|
|
||||||
uppdated.Lastname = req.Lastname;
|
|
||||||
// uppdated.DateOfBirth = req.DateOfBirth;
|
|
||||||
// uppdated.Nationality = req.Nationality;
|
|
||||||
// uppdated.Race = req.Race;
|
|
||||||
// uppdated.TelephoneNumber = req.TelephoneNumber;
|
|
||||||
uppdated.EducationOld = req.EducationOld;
|
uppdated.EducationOld = req.EducationOld;
|
||||||
uppdated.Reason = req.Reason;
|
uppdated.Reason = req.Reason;
|
||||||
uppdated.OrganizationPositionOld = req.OrganizationPositionOld;
|
uppdated.OrganizationPositionOld = req.OrganizationPositionOld;
|
||||||
|
|
@ -514,25 +505,24 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
var deleted = await _context.PlacementAppointments.AsQueryable()
|
var deleted = await _context.PlacementAppointments.AsQueryable()
|
||||||
.Include(x => x.PlacementAppointmentDocs)
|
.Include(x => x.PlacementAppointmentDocs)
|
||||||
.ThenInclude(x => x.Document)
|
.ThenInclude(x => x.Document)
|
||||||
.Where(x => x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm")
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (deleted == null)
|
if (deleted == null)
|
||||||
return NotFound();
|
return NotFound();
|
||||||
var placementAppointmentDocs = new List<dynamic>();
|
// var placementAppointmentDocs = new List<dynamic>();
|
||||||
foreach (var doc in deleted.PlacementAppointmentDocs)
|
// foreach (var doc in deleted.PlacementAppointmentDocs)
|
||||||
{
|
// {
|
||||||
if (doc.Document != null)
|
// if (doc.Document != null)
|
||||||
placementAppointmentDocs.Add(doc.Document.Id);
|
// placementAppointmentDocs.Add(doc.Document.Id);
|
||||||
}
|
// }
|
||||||
_context.PlacementAppointmentDocs.RemoveRange(deleted.PlacementAppointmentDocs);
|
_context.PlacementAppointmentDocs.RemoveRange(deleted.PlacementAppointmentDocs);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
_context.PlacementAppointments.Remove(deleted);
|
// _context.PlacementAppointments.Remove(deleted);
|
||||||
foreach (var doc in placementAppointmentDocs)
|
// foreach (var doc in placementAppointmentDocs)
|
||||||
{
|
// {
|
||||||
if (doc != null)
|
// if (doc != null)
|
||||||
await _documentService.DeleteFileAsync(doc);
|
// await _documentService.DeleteFileAsync(doc);
|
||||||
}
|
// }
|
||||||
await _context.SaveChangesAsync();
|
// await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
@ -551,7 +541,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
foreach (var item in req.Id)
|
foreach (var item in req.Id)
|
||||||
{
|
{
|
||||||
var uppdated = await _context.PlacementAppointments
|
var uppdated = await _context.PlacementAppointments
|
||||||
.Where(x => x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm")
|
// .Where(x => x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm")
|
||||||
.FirstOrDefaultAsync(x => x.Id == item);
|
.FirstOrDefaultAsync(x => x.Id == item);
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -568,24 +558,24 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// หน่วยงานที่ถูกเลือกไปแล้ว
|
// /// หน่วยงานที่ถูกเลือกไปแล้ว
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
/// <response code="200"></response>
|
// /// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("use")]
|
// [HttpGet("use")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetAppointmentsUse()
|
// public async Task<ActionResult<ResponseObject>> GetAppointmentsUse()
|
||||||
{
|
// {
|
||||||
var appointments = await _context.PlacementAppointments
|
// var appointments = await _context.PlacementAppointments
|
||||||
.Where(x => x.PositionNumber != null)
|
// .Where(x => x.PositionNumber != null)
|
||||||
.Where(x => x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm")
|
// .Where(x => x.Profile.ProfileType == "employee" && x.Profile.EmployeeClass == "perm")
|
||||||
.Select(x => x.PositionNumber.Id)
|
// .Select(x => x.PositionNumber.Id)
|
||||||
.ToListAsync();
|
// .ToListAsync();
|
||||||
|
|
||||||
return Success(appointments);
|
// return Success(appointments);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
private string? token => _httpContextAccessor.HttpContext.Request.Headers["Authorization"];
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
private bool? PlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
private bool? PlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
||||||
|
|
||||||
|
|
@ -67,141 +67,6 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
[HttpGet()]
|
[HttpGet()]
|
||||||
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
|
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
|
||||||
{
|
{
|
||||||
|
|
||||||
var placementOfficers = await _context.PlacementOfficers.AsQueryable()
|
|
||||||
.OrderByDescending(x => x.CreatedAt)
|
|
||||||
.Select(p => new
|
|
||||||
{
|
|
||||||
p.Id,
|
|
||||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
|
||||||
p.Profile.FirstName,
|
|
||||||
p.Profile.LastName,
|
|
||||||
position = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.Position == null ? null : p.Profile.Position.Name) : (p.Profile.PositionEmployeePosition == null ? null : p.Profile.PositionEmployeePosition.Name),
|
|
||||||
posNo = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PosNo == null ? null : p.Profile.PosNo.Name) : p.Profile.PosNoEmployee,
|
|
||||||
positionLevel = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name) : (p.Profile.PositionEmployeeLevel == null ? null : p.Profile.PositionEmployeeLevel.Name),
|
|
||||||
p.CreatedAt,
|
|
||||||
p.Organization,
|
|
||||||
p.Reason,
|
|
||||||
p.Status,
|
|
||||||
p.DateStart,
|
|
||||||
p.DateEnd,
|
|
||||||
salary = p.AmountOld,
|
|
||||||
p.PositionTypeOld,
|
|
||||||
p.PositionLevelOld,
|
|
||||||
p.PositionNumberOld,
|
|
||||||
p.OrganizationPositionOld,
|
|
||||||
p.IsActive,
|
|
||||||
})
|
|
||||||
.ToListAsync();
|
|
||||||
if (PlacementAdmin == true)
|
|
||||||
placementOfficers.Where(x => x.Status.Trim().ToUpper().Contains("APPROVE"));
|
|
||||||
|
|
||||||
return Success(placementOfficers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// get รายละเอียดช่วยราชการเจ้าหน้าที่
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id">Id ช่วยราชการ</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <response code="200"></response>
|
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
||||||
[HttpGet("{id:length(36)}")]
|
|
||||||
public async Task<ActionResult<ResponseObject>> GetDetailAdmin(Guid id)
|
|
||||||
{
|
|
||||||
var data = await _context.PlacementOfficers.AsQueryable()
|
|
||||||
.Where(x => x.Id == id)
|
|
||||||
.Where(x => x.Profile != null)
|
|
||||||
.Select(p => new
|
|
||||||
{
|
|
||||||
p.Id,
|
|
||||||
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
|
|
||||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
|
||||||
p.Profile.FirstName,
|
|
||||||
p.Profile.LastName,
|
|
||||||
ProfileId = p.Profile.Id,
|
|
||||||
position = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.Position == null ? null : p.Profile.Position.Name) : (p.Profile.PositionEmployeePosition == null ? null : p.Profile.PositionEmployeePosition.Name),
|
|
||||||
posNo = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PosNo == null ? null : p.Profile.PosNo.Name) : p.Profile.PosNoEmployee,
|
|
||||||
positionLevel = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name) : (p.Profile.PositionEmployeeLevel == null ? null : p.Profile.PositionEmployeeLevel.Name),
|
|
||||||
organizationOrganization = p.Profile.OrganizationOrganization,
|
|
||||||
p.Reason,
|
|
||||||
p.Status,
|
|
||||||
p.Organization,
|
|
||||||
p.DateStart,
|
|
||||||
p.DateEnd,
|
|
||||||
salary = p.AmountOld,
|
|
||||||
p.CreatedAt,
|
|
||||||
p.PositionTypeOld,
|
|
||||||
p.PositionLevelOld,
|
|
||||||
p.PositionNumberOld,
|
|
||||||
p.OrganizationPositionOld,
|
|
||||||
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
|
||||||
})
|
|
||||||
.FirstOrDefaultAsync();
|
|
||||||
if (data == null)
|
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
|
||||||
var _data = new
|
|
||||||
{
|
|
||||||
data.Id,
|
|
||||||
data.PrefixId,
|
|
||||||
data.Prefix,
|
|
||||||
data.FirstName,
|
|
||||||
data.LastName,
|
|
||||||
data.ProfileId,
|
|
||||||
data.position,
|
|
||||||
data.posNo,
|
|
||||||
data.positionLevel,
|
|
||||||
data.organizationOrganization,
|
|
||||||
data.Reason,
|
|
||||||
data.Status,
|
|
||||||
data.Organization,
|
|
||||||
data.DateStart,
|
|
||||||
data.DateEnd,
|
|
||||||
data.salary,
|
|
||||||
data.CreatedAt,
|
|
||||||
data.PositionTypeOld,
|
|
||||||
data.PositionLevelOld,
|
|
||||||
data.PositionNumberOld,
|
|
||||||
data.OrganizationPositionOld,
|
|
||||||
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
|
||||||
};
|
|
||||||
|
|
||||||
return Success(_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// สร้างช่วยราชการ
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <response code="200"></response>
|
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
||||||
[HttpPost()]
|
|
||||||
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementAddProfileRequest req)
|
|
||||||
{
|
|
||||||
var placementOfficer = new PlacementOfficer
|
|
||||||
{
|
|
||||||
// Profile = profile,
|
|
||||||
Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
|
|
||||||
Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
|
|
||||||
// Date = req.Date,
|
|
||||||
// AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
|
||||||
// PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
|
||||||
// PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
|
||||||
// PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
|
||||||
// OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
|
|
||||||
|
|
||||||
Status = "WAITTING",
|
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
|
||||||
CreatedUserId = UserId ?? "",
|
|
||||||
CreatedAt = DateTime.Now,
|
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
|
||||||
LastUpdateUserId = UserId ?? "",
|
|
||||||
LastUpdatedAt = DateTime.Now,
|
|
||||||
};
|
|
||||||
var rootId = "";
|
var rootId = "";
|
||||||
var child1Id = "";
|
var child1Id = "";
|
||||||
var child2Id = "";
|
var child2Id = "";
|
||||||
|
|
@ -219,7 +84,142 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
|
|
||||||
if (org == null || org.result == null)
|
if (org == null || org.result == null)
|
||||||
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
rootId = org.result.rootId == null ? "" : org.result.rootId;
|
||||||
|
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
|
||||||
|
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
|
||||||
|
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
|
||||||
|
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
|
||||||
|
|
||||||
|
var placementOfficers = await _context.PlacementOfficers.AsQueryable()
|
||||||
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
|
.Where(x => PlacementAdmin == true ? true : (rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))))
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
p.Id,
|
||||||
|
p.prefix,
|
||||||
|
p.firstName,
|
||||||
|
p.lastName,
|
||||||
|
p.root,
|
||||||
|
p.rootShortName,
|
||||||
|
p.child1,
|
||||||
|
p.child1ShortName,
|
||||||
|
p.child2,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4ShortName,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.position,
|
||||||
|
p.posLevelName,
|
||||||
|
p.posTypeName,
|
||||||
|
p.CreatedAt,
|
||||||
|
p.Reason,
|
||||||
|
p.Status,
|
||||||
|
p.DateStart,
|
||||||
|
p.DateEnd,
|
||||||
|
p.Organization,
|
||||||
|
p.OrganizationPositionOld,
|
||||||
|
p.IsActive,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return Success(placementOfficers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// get รายละเอียดช่วยราชการเจ้าหน้าที่
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">Id ช่วยราชการ</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("{id:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetDetailAdmin(Guid id)
|
||||||
|
{
|
||||||
|
var data = await _context.PlacementOfficers.AsQueryable()
|
||||||
|
.Where(x => x.Id == id)
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
p.Id,
|
||||||
|
p.profileId,
|
||||||
|
p.prefix,
|
||||||
|
p.firstName,
|
||||||
|
p.lastName,
|
||||||
|
p.root,
|
||||||
|
p.rootShortName,
|
||||||
|
p.child1,
|
||||||
|
p.child1ShortName,
|
||||||
|
p.child2,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4ShortName,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.position,
|
||||||
|
p.posLevelName,
|
||||||
|
p.posTypeName,
|
||||||
|
p.CreatedAt,
|
||||||
|
p.Reason,
|
||||||
|
p.Status,
|
||||||
|
p.DateStart,
|
||||||
|
p.DateEnd,
|
||||||
|
p.Organization,
|
||||||
|
p.OrganizationPositionOld,
|
||||||
|
p.IsActive,
|
||||||
|
})
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (data == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// สร้างช่วยราชการ
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPost()]
|
||||||
|
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementAddProfileRequest req)
|
||||||
|
{
|
||||||
|
var placementOfficer = new PlacementOfficer
|
||||||
|
{
|
||||||
|
Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
|
||||||
|
Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
|
||||||
|
Status = "WAITTING",
|
||||||
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
CreatedUserId = UserId ?? "",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
};
|
||||||
|
var apiUrl = $"{_configuration["API"]}org/profile/profileid/position/{req.Id}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
|
||||||
|
placementOfficer.profileId = org.result.profileId;
|
||||||
|
placementOfficer.prefix = org.result.prefix;
|
||||||
|
placementOfficer.firstName = org.result.firstName;
|
||||||
|
placementOfficer.lastName = org.result.lastName;
|
||||||
|
placementOfficer.citizenId = org.result.citizenId;
|
||||||
placementOfficer.root = org.result.root;
|
placementOfficer.root = org.result.root;
|
||||||
placementOfficer.rootId = org.result.rootId;
|
placementOfficer.rootId = org.result.rootId;
|
||||||
placementOfficer.rootShortName = org.result.rootShortName;
|
placementOfficer.rootShortName = org.result.rootShortName;
|
||||||
|
|
@ -235,6 +235,12 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
placementOfficer.child4 = org.result.child4;
|
placementOfficer.child4 = org.result.child4;
|
||||||
placementOfficer.child4Id = org.result.child4Id;
|
placementOfficer.child4Id = org.result.child4Id;
|
||||||
placementOfficer.child4ShortName = org.result.child4ShortName;
|
placementOfficer.child4ShortName = org.result.child4ShortName;
|
||||||
|
placementOfficer.posMasterNo = org.result.posMasterNo;
|
||||||
|
placementOfficer.position = org.result.position;
|
||||||
|
placementOfficer.posTypeId = org.result.posTypeId;
|
||||||
|
placementOfficer.posTypeName = org.result.posTypeName;
|
||||||
|
placementOfficer.posLevelId = org.result.posLevelId;
|
||||||
|
placementOfficer.posLevelName = org.result.posLevelName;
|
||||||
}
|
}
|
||||||
await _context.PlacementOfficers.AddAsync(placementOfficer);
|
await _context.PlacementOfficers.AddAsync(placementOfficer);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ using BMA.EHR.Placement.Service.Requests;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace BMA.EHR.Placement.Service.Controllers
|
namespace BMA.EHR.Placement.Service.Controllers
|
||||||
|
|
@ -26,18 +28,21 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
|
|
||||||
public PlacementReceiveController(PlacementRepository repository,
|
public PlacementReceiveController(PlacementRepository repository,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -45,6 +50,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
private bool? PlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
private bool? PlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
||||||
|
|
||||||
|
|
@ -61,51 +67,84 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
[HttpGet()]
|
[HttpGet()]
|
||||||
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
|
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
|
||||||
{
|
{
|
||||||
|
var rootId = "";
|
||||||
|
var child1Id = "";
|
||||||
|
var child2Id = "";
|
||||||
|
var child3Id = "";
|
||||||
|
var child4Id = "";
|
||||||
|
var apiUrl = $"{_configuration["API"]}org/profile/keycloak/position";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
var placementReceives = await _context.PlacementReceives.AsQueryable()
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
.OrderByDescending(x => x.CreatedAt)
|
|
||||||
.Select(p => new
|
|
||||||
{
|
|
||||||
p.Id,
|
|
||||||
p.CitizenId,
|
|
||||||
Prefix = p.Prefix.Name,
|
|
||||||
p.Firstname,
|
|
||||||
p.Lastname,
|
|
||||||
p.DateOfBirth,
|
|
||||||
Gender = p.Gender == null ? null : p.Gender.Name,
|
|
||||||
p.Status,
|
|
||||||
p.Amount,
|
|
||||||
p.RecruitDate,
|
|
||||||
PositionNumber = p.PositionNumber == null ? null : p.PositionNumber.Name,
|
|
||||||
PositionPath = p.PositionPath == null ? null : p.PositionPath.Name,
|
|
||||||
PositionPathSide = p.PositionPathSide == null ? null : p.PositionPathSide.Name,
|
|
||||||
PositionType = p.PositionType == null ? null : p.PositionType.Name,
|
|
||||||
PositionLine = p.PositionLine == null ? null : p.PositionLine.Name,
|
|
||||||
PositionLevel = p.PositionLevel == null ? null : p.PositionLevel.Name,
|
|
||||||
PosNoId = p.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionNumber.Id,
|
|
||||||
PositionId = p.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPath.Id,
|
|
||||||
PositionPathSideId = p.PositionPathSide == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPathSide.Id,
|
|
||||||
PositionTypeId = p.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionType.Id,
|
|
||||||
PositionLineId = p.PositionLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLine.Id,
|
|
||||||
PositionLevelId = p.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLevel.Id,
|
|
||||||
OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
|
|
||||||
OrganizationName = p.OrganizationPosition == null ? null : (p.OrganizationPosition.Organization == null ? null : (p.OrganizationPosition.Organization.OrganizationOrganization == null ? null : p.OrganizationPosition.Organization.OrganizationOrganization.Name)),////
|
|
||||||
OrganizationShortName = p.OrganizationPosition == null ? null : (p.OrganizationPosition.Organization == null ? null : (p.OrganizationPosition.Organization.OrganizationShortName == null ? null : p.OrganizationPosition.Organization.OrganizationShortName.Name)),////
|
|
||||||
p.IsActive,
|
|
||||||
p.Reason,
|
|
||||||
p.EducationOld,
|
|
||||||
p.AmountOld,
|
|
||||||
p.PositionTypeOld,
|
|
||||||
p.PositionLevelOld,
|
|
||||||
p.PositionNumberOld,
|
|
||||||
p.OrganizationPositionOld,
|
|
||||||
p.CreatedAt,
|
|
||||||
})
|
|
||||||
.ToListAsync();
|
|
||||||
if (PlacementAdmin == true)
|
|
||||||
placementReceives.Where(x => x.Status.Trim().ToUpper().Contains("PENDING"));
|
|
||||||
|
|
||||||
return Success(placementReceives);
|
if (org == null || org.result == null)
|
||||||
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
rootId = org.result.rootId == null ? "" : org.result.rootId;
|
||||||
|
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
|
||||||
|
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
|
||||||
|
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
|
||||||
|
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
|
||||||
|
|
||||||
|
var placementReceives = await _context.PlacementReceives.AsQueryable()
|
||||||
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
|
.Where(x => PlacementAdmin == true ? true : (rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))))
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
p.Id,
|
||||||
|
p.citizenId,
|
||||||
|
p.prefix,
|
||||||
|
p.firstName,
|
||||||
|
p.lastName,
|
||||||
|
p.DateOfBirth,
|
||||||
|
Gender = p.Gender == null ? null : p.Gender.Name,
|
||||||
|
p.Status,
|
||||||
|
p.Amount,
|
||||||
|
p.RecruitDate,
|
||||||
|
p.root,
|
||||||
|
p.rootId,
|
||||||
|
p.rootShortName,
|
||||||
|
p.child1,
|
||||||
|
p.child1Id,
|
||||||
|
p.child1ShortName,
|
||||||
|
p.child2,
|
||||||
|
p.child2Id,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3Id,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4Id,
|
||||||
|
p.child4ShortName,
|
||||||
|
p.orgRevisionId,
|
||||||
|
p.positionId,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.positionName,
|
||||||
|
p.positionField,
|
||||||
|
p.posTypeId,
|
||||||
|
p.posTypeName,
|
||||||
|
p.posLevelId,
|
||||||
|
p.posLevelName,
|
||||||
|
p.IsActive,
|
||||||
|
p.Reason,
|
||||||
|
p.EducationOld,
|
||||||
|
p.AmountOld,
|
||||||
|
p.PositionTypeOld,
|
||||||
|
p.PositionLevelOld,
|
||||||
|
p.PositionNumberOld,
|
||||||
|
p.OrganizationPositionOld,
|
||||||
|
p.CreatedAt,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
// if (PlacementAdmin == true)
|
||||||
|
// placementReceives.Where(x => x.Status.Trim().ToUpper().Contains("PENDING"));
|
||||||
|
|
||||||
|
return Success(placementReceives);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -126,11 +165,10 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
// ProfileId = p.Profile.Id,
|
// ProfileId = p.Profile.Id,
|
||||||
p.CitizenId,
|
p.citizenId,
|
||||||
Prefix = p.Prefix.Name,
|
p.prefix,
|
||||||
PrefixId = p.Prefix.Id,
|
p.firstName,
|
||||||
p.Firstname,
|
p.lastName,
|
||||||
p.Lastname,
|
|
||||||
p.DateOfBirth,
|
p.DateOfBirth,
|
||||||
Gender = p.Gender == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Gender.Id,
|
Gender = p.Gender == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Gender.Id,
|
||||||
p.Nationality,
|
p.Nationality,
|
||||||
|
|
@ -142,13 +180,30 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
p.Status,
|
p.Status,
|
||||||
p.Amount,
|
p.Amount,
|
||||||
p.RecruitDate,
|
p.RecruitDate,
|
||||||
PosNoId = p.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionNumber.Id,
|
p.root,
|
||||||
PositionId = p.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPath.Id,
|
p.rootId,
|
||||||
PositionPathSideId = p.PositionPathSide == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPathSide.Id,
|
p.rootShortName,
|
||||||
PositionTypeId = p.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionType.Id,
|
p.child1,
|
||||||
PositionLineId = p.PositionLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLine.Id,
|
p.child1Id,
|
||||||
PositionLevelId = p.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLevel.Id,
|
p.child1ShortName,
|
||||||
OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
|
p.child2,
|
||||||
|
p.child2Id,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3Id,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4Id,
|
||||||
|
p.child4ShortName,
|
||||||
|
p.orgRevisionId,
|
||||||
|
p.positionId,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.positionName,
|
||||||
|
p.positionField,
|
||||||
|
p.posTypeId,
|
||||||
|
p.posTypeName,
|
||||||
|
p.posLevelId,
|
||||||
|
p.posLevelName,
|
||||||
p.CreatedAt,
|
p.CreatedAt,
|
||||||
p.Reason,
|
p.Reason,
|
||||||
p.EducationOld,
|
p.EducationOld,
|
||||||
|
|
@ -157,7 +212,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
p.PositionLevelOld,
|
p.PositionLevelOld,
|
||||||
p.PositionNumberOld,
|
p.PositionNumberOld,
|
||||||
p.OrganizationPositionOld,
|
p.OrganizationPositionOld,
|
||||||
Avatar = p.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Avatar.Id,
|
// Avatar = p.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Avatar.Id,
|
||||||
PlacementReceiveDocs = p.PlacementReceiveDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
PlacementReceiveDocs = p.PlacementReceiveDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
@ -178,11 +233,10 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
data.Id,
|
data.Id,
|
||||||
// data.ProfileId,
|
// data.ProfileId,
|
||||||
data.CitizenId,
|
data.citizenId,
|
||||||
data.Prefix,
|
data.prefix,
|
||||||
data.PrefixId,
|
data.firstName,
|
||||||
data.Firstname,
|
data.lastName,
|
||||||
data.Lastname,
|
|
||||||
data.DateOfBirth,
|
data.DateOfBirth,
|
||||||
data.Gender,
|
data.Gender,
|
||||||
data.Nationality,
|
data.Nationality,
|
||||||
|
|
@ -194,13 +248,30 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
data.Status,
|
data.Status,
|
||||||
data.Amount,
|
data.Amount,
|
||||||
data.RecruitDate,
|
data.RecruitDate,
|
||||||
data.PosNoId,
|
data.root,
|
||||||
data.PositionId,
|
data.rootId,
|
||||||
data.PositionPathSideId,
|
data.rootShortName,
|
||||||
data.PositionTypeId,
|
data.child1,
|
||||||
data.PositionLineId,
|
data.child1Id,
|
||||||
data.PositionLevelId,
|
data.child1ShortName,
|
||||||
data.OrganizationPositionId,
|
data.child2,
|
||||||
|
data.child2Id,
|
||||||
|
data.child2ShortName,
|
||||||
|
data.child3,
|
||||||
|
data.child3Id,
|
||||||
|
data.child3ShortName,
|
||||||
|
data.child4,
|
||||||
|
data.child4Id,
|
||||||
|
data.child4ShortName,
|
||||||
|
data.orgRevisionId,
|
||||||
|
data.positionId,
|
||||||
|
data.posMasterNo,
|
||||||
|
data.positionName,
|
||||||
|
data.positionField,
|
||||||
|
data.posTypeId,
|
||||||
|
data.posTypeName,
|
||||||
|
data.posLevelId,
|
||||||
|
data.posLevelName,
|
||||||
data.CreatedAt,
|
data.CreatedAt,
|
||||||
data.Reason,
|
data.Reason,
|
||||||
data.EducationOld,
|
data.EducationOld,
|
||||||
|
|
@ -209,7 +280,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
data.PositionLevelOld,
|
data.PositionLevelOld,
|
||||||
data.PositionNumberOld,
|
data.PositionNumberOld,
|
||||||
data.OrganizationPositionOld,
|
data.OrganizationPositionOld,
|
||||||
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||||
Docs = placementReceiveDocs,
|
Docs = placementReceiveDocs,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -227,17 +298,13 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
[HttpPost()]
|
[HttpPost()]
|
||||||
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementReceiveRequest req)
|
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementReceiveRequest req)
|
||||||
{
|
{
|
||||||
var prefix = await _context.Prefixes.FindAsync(req.Prefix);
|
|
||||||
if (prefix == null)
|
|
||||||
return Error(GlobalMessages.PrefixNotFound, 404);
|
|
||||||
|
|
||||||
var placementReceive = new PlacementReceive
|
var placementReceive = new PlacementReceive
|
||||||
{
|
{
|
||||||
// Profile = profile,
|
// Profile = profile,
|
||||||
CitizenId = req.CitizenId,
|
citizenId = req.citizenId,
|
||||||
Prefix = prefix,
|
prefix = req.prefix,
|
||||||
Firstname = req.Firstname,
|
firstName = req.firstName,
|
||||||
Lastname = req.Lastname,
|
lastName = req.lastName,
|
||||||
DateOfBirth = req.BirthDate,
|
DateOfBirth = req.BirthDate,
|
||||||
Gender = await _context.Genders.FindAsync(req.GenderId),
|
Gender = await _context.Genders.FindAsync(req.GenderId),
|
||||||
Nationality = req.Nationality,
|
Nationality = req.Nationality,
|
||||||
|
|
@ -254,30 +321,28 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
var profile = await _context.Profiles
|
// var profile = await _context.Profiles
|
||||||
.Include(x => x.PositionLevel)
|
// .Include(x => x.PositionLevel)
|
||||||
.Include(x => x.PositionType)
|
// .Include(x => x.PositionType)
|
||||||
.Include(x => x.PosNo)
|
// .Include(x => x.PosNo)
|
||||||
.Include(x => x.Salaries)
|
// .Include(x => x.Salaries)
|
||||||
.Include(x => x.Educations)
|
// .Include(x => x.Educations)
|
||||||
.Include(x => x.Position)
|
// .Include(x => x.Position)
|
||||||
.FirstOrDefaultAsync(x => x.CitizenId == req.CitizenId);
|
// .FirstOrDefaultAsync(x => x.CitizenId == req.CitizenId);
|
||||||
if (profile != null)
|
// if (profile != null)
|
||||||
{
|
// {
|
||||||
placementReceive.EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}";
|
// placementReceive.EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}";
|
||||||
placementReceive.AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount;
|
// placementReceive.AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount;
|
||||||
placementReceive.PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name;
|
// placementReceive.PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name;
|
||||||
placementReceive.PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name;
|
// placementReceive.PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name;
|
||||||
placementReceive.PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name;
|
// placementReceive.PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name;
|
||||||
placementReceive.OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}";
|
// placementReceive.OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}";
|
||||||
}
|
// }
|
||||||
|
|
||||||
await _context.PlacementReceives.AddAsync(placementReceive);
|
await _context.PlacementReceives.AddAsync(placementReceive);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||||
{
|
{
|
||||||
// foreach (var file in Request.Form.Files)
|
|
||||||
// {
|
|
||||||
var file = Request.Form.Files[0];
|
var file = Request.Form.Files[0];
|
||||||
var fileExtension = Path.GetExtension(file.FileName);
|
var fileExtension = Path.GetExtension(file.FileName);
|
||||||
|
|
||||||
|
|
@ -286,21 +351,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||||
if (_doc != null)
|
if (_doc != null)
|
||||||
{
|
{
|
||||||
// var placementReceiveDoc = new PlacementReceiveDoc
|
|
||||||
// {
|
|
||||||
// PlacementReceive = placementReceive,
|
|
||||||
// Document = _doc,
|
|
||||||
// CreatedFullName = FullName ?? "System Administrator",
|
|
||||||
// CreatedUserId = UserId ?? "",
|
|
||||||
// CreatedAt = DateTime.Now,
|
|
||||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
|
||||||
// LastUpdateUserId = UserId ?? "",
|
|
||||||
// LastUpdatedAt = DateTime.Now,
|
|
||||||
// };
|
|
||||||
// await _context.PlacementReceiveDocs.AddAsync(placementReceiveDoc);
|
|
||||||
placementReceive.Avatar = _doc;
|
placementReceive.Avatar = _doc;
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
@ -385,59 +437,54 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
return Error(GlobalMessages.PlacementReceiveNotFound, 404);
|
return Error(GlobalMessages.PlacementReceiveNotFound, 404);
|
||||||
if (req.PosNoId != null)
|
|
||||||
{
|
|
||||||
var save_posNo = await _context.PositionNumbers.FindAsync(req.PosNoId);
|
|
||||||
if (save_posNo == null)
|
|
||||||
return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
|
||||||
uppdated.PositionNumber = save_posNo;
|
|
||||||
|
|
||||||
var save_orgPosition = await _context.OrganizationPositions.FirstOrDefaultAsync(x => x.PositionNumber == save_posNo);
|
var apiUrl = $"{_configuration["API"]}org/find/all";
|
||||||
if (save_orgPosition == null)
|
|
||||||
return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
using (var client = new HttpClient())
|
||||||
uppdated.OrganizationPosition = save_orgPosition;
|
{
|
||||||
}
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||||
if (req.PositionId != null)
|
var _res = await client.PostAsJsonAsync(apiUrl, new
|
||||||
{
|
{
|
||||||
var save = await _context.PositionPaths.FindAsync(req.PositionId);
|
node = req.node,
|
||||||
if (save == null)
|
nodeId = req.nodeId,
|
||||||
return Error(GlobalMessages.PositionPathNotFound, 404);
|
});
|
||||||
uppdated.PositionPath = save;
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
}
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
if (req.PositionLevelId != null)
|
if (org == null || org.result == null)
|
||||||
{
|
return Error("ไม่พบหน่วยงานนี้ในระบบ", 404);
|
||||||
var save = await _context.PositionLevels.FindAsync(req.PositionLevelId);
|
|
||||||
if (save == null)
|
uppdated.root = org.result.root;
|
||||||
return Error(GlobalMessages.PositionLevelNotFound, 404);
|
uppdated.rootId = org.result.rootId;
|
||||||
uppdated.PositionLevel = save;
|
uppdated.rootShortName = org.result.rootShortName;
|
||||||
}
|
uppdated.child1 = req.node <= 0 ? null : org.result.child1;
|
||||||
|
uppdated.child1Id = req.node <= 0 ? null : org.result.child1Id;
|
||||||
if (req.PositionLineId != null)
|
uppdated.child1ShortName = req.node <= 0 ? null : org.result.child1ShortName;
|
||||||
{
|
uppdated.child2 = req.node <= 1 ? null : org.result.child2;
|
||||||
var save = await _context.PositionLines.FindAsync(req.PositionLineId);
|
uppdated.child2Id = req.node <= 1 ? null : org.result.child2Id;
|
||||||
if (save == null)
|
uppdated.child2ShortName = req.node <= 1 ? null : org.result.child2ShortName;
|
||||||
return Error(GlobalMessages.PositionLineNotFound, 404);
|
uppdated.child3 = req.node <= 2 ? null : org.result.child3;
|
||||||
uppdated.PositionLine = save;
|
uppdated.child3Id = req.node <= 2 ? null : org.result.child3Id;
|
||||||
}
|
uppdated.child3ShortName = req.node <= 2 ? null : org.result.child3ShortName;
|
||||||
|
uppdated.child4 = req.node <= 3 ? null : org.result.child4;
|
||||||
if (req.PositionPathSideId != null)
|
uppdated.child4Id = req.node <= 3 ? null : org.result.child4Id;
|
||||||
{
|
uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName;
|
||||||
var save = await _context.PositionPathSides.FindAsync(req.PositionPathSideId);
|
|
||||||
if (save == null)
|
|
||||||
return Error(GlobalMessages.PositionPathSideNotFound, 404);
|
|
||||||
uppdated.PositionPathSide = save;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (req.PositionTypeId != null)
|
|
||||||
{
|
|
||||||
var save = await _context.PositionTypes.FindAsync(req.PositionTypeId);
|
|
||||||
if (save == null)
|
|
||||||
return Error(GlobalMessages.PositionTypeNotFound, 404);
|
|
||||||
uppdated.PositionType = save;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uppdated.posmasterId = req.posmasterId;
|
||||||
|
uppdated.node = req.node;
|
||||||
|
uppdated.nodeId = req.nodeId;
|
||||||
|
uppdated.orgRevisionId = req.orgRevisionId;
|
||||||
|
uppdated.positionId = req.positionId;
|
||||||
|
uppdated.posMasterNo = req.posMasterNo;
|
||||||
|
uppdated.positionName = req.positionName;
|
||||||
|
uppdated.positionField = req.positionField;
|
||||||
|
uppdated.posTypeId = req.posTypeId;
|
||||||
|
uppdated.posTypeName = req.posTypeName;
|
||||||
|
uppdated.posLevelId = req.posLevelId;
|
||||||
|
uppdated.posLevelName = req.posLevelName;
|
||||||
|
uppdated.Amount = req.Amount;
|
||||||
uppdated.RecruitDate = req.RecruitDate;
|
uppdated.RecruitDate = req.RecruitDate;
|
||||||
uppdated.Status = "PENDING";
|
uppdated.Status = "PENDING";
|
||||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
|
@ -464,14 +511,6 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
return Error(GlobalMessages.PlacementReceiveNotFound, 404);
|
return Error(GlobalMessages.PlacementReceiveNotFound, 404);
|
||||||
|
|
||||||
if (req.PrefixId != null)
|
|
||||||
{
|
|
||||||
var save = await _context.Prefixes.FindAsync(req.PrefixId);
|
|
||||||
if (save == null)
|
|
||||||
return Error(GlobalMessages.PrefixNotFound, 404);
|
|
||||||
uppdated.Prefix = save;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (req.RelationshipId != null)
|
if (req.RelationshipId != null)
|
||||||
{
|
{
|
||||||
var save = await _context.Relationships.FindAsync(req.RelationshipId);
|
var save = await _context.Relationships.FindAsync(req.RelationshipId);
|
||||||
|
|
@ -503,9 +542,10 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
return Error(GlobalMessages.GenderNotFound, 404);
|
return Error(GlobalMessages.GenderNotFound, 404);
|
||||||
uppdated.Gender = save;
|
uppdated.Gender = save;
|
||||||
}
|
}
|
||||||
uppdated.CitizenId = req.CitizenId;
|
uppdated.citizenId = req.citizenId;
|
||||||
uppdated.Firstname = req.Firstname;
|
uppdated.prefix = req.prefix;
|
||||||
uppdated.Lastname = req.Lastname;
|
uppdated.firstName = req.firstName;
|
||||||
|
uppdated.lastName = req.lastName;
|
||||||
uppdated.DateOfBirth = req.DateOfBirth;
|
uppdated.DateOfBirth = req.DateOfBirth;
|
||||||
uppdated.Nationality = req.Nationality;
|
uppdated.Nationality = req.Nationality;
|
||||||
uppdated.Race = req.Race;
|
uppdated.Race = req.Race;
|
||||||
|
|
@ -591,23 +631,23 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// หน่วยงานที่ถูกเลือกไปแล้ว
|
// /// หน่วยงานที่ถูกเลือกไปแล้ว
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
/// <response code="200"></response>
|
// /// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("use")]
|
// [HttpGet("use")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetReceiveUse()
|
// public async Task<ActionResult<ResponseObject>> GetReceiveUse()
|
||||||
{
|
// {
|
||||||
var receives = await _context.PlacementReceives
|
// var receives = await _context.PlacementReceives
|
||||||
.Where(x => x.PositionNumber != null)
|
// .Where(x => x.PositionNumber != null)
|
||||||
.Select(x => x.PositionNumber.Id)
|
// .Select(x => x.PositionNumber.Id)
|
||||||
.ToListAsync();
|
// .ToListAsync();
|
||||||
|
|
||||||
return Success(receives);
|
// return Success(receives);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ using BMA.EHR.Placement.Service.Requests;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace BMA.EHR.Placement.Service.Controllers
|
namespace BMA.EHR.Placement.Service.Controllers
|
||||||
|
|
@ -26,18 +28,21 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
|
|
||||||
public PlacementRepatriationController(PlacementRepository repository,
|
public PlacementRepatriationController(PlacementRepository repository,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -45,6 +50,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
private bool? PlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
private bool? PlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
||||||
|
|
||||||
|
|
@ -61,36 +67,70 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
[HttpGet()]
|
[HttpGet()]
|
||||||
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
|
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
|
||||||
{
|
{
|
||||||
|
var rootId = "";
|
||||||
|
var child1Id = "";
|
||||||
|
var child2Id = "";
|
||||||
|
var child3Id = "";
|
||||||
|
var child4Id = "";
|
||||||
|
var apiUrl = $"{_configuration["API"]}org/profile/keycloak/position";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
var placementRepatriations = await _context.PlacementRepatriations.AsQueryable()
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
.OrderByDescending(x => x.CreatedAt)
|
|
||||||
.Select(p => new
|
|
||||||
{
|
|
||||||
p.Id,
|
|
||||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
|
||||||
p.Profile.FirstName,
|
|
||||||
p.Profile.LastName,
|
|
||||||
position = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.Position == null ? null : p.Profile.Position.Name) : (p.Profile.PositionEmployeePosition == null ? null : p.Profile.PositionEmployeePosition.Name),
|
|
||||||
posNo = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PosNo == null ? null : p.Profile.PosNo.Name) : p.Profile.PosNoEmployee,
|
|
||||||
positionLevel = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name) : (p.Profile.PositionEmployeeLevel == null ? null : p.Profile.PositionEmployeeLevel.Name),
|
|
||||||
p.CreatedAt,
|
|
||||||
p.Organization,
|
|
||||||
p.Reason,
|
|
||||||
p.Status,
|
|
||||||
p.Date,
|
|
||||||
salary = p.AmountOld,
|
|
||||||
p.PositionTypeOld,
|
|
||||||
p.PositionLevelOld,
|
|
||||||
p.PositionNumberOld,
|
|
||||||
p.OrganizationPositionOld,
|
|
||||||
p.IsActive,
|
|
||||||
p.DateRepatriation,
|
|
||||||
})
|
|
||||||
.ToListAsync();
|
|
||||||
if (PlacementAdmin == true)
|
|
||||||
placementRepatriations.Where(x => x.Status.Trim().ToUpper().Contains("APPROVE"));
|
|
||||||
|
|
||||||
return Success(placementRepatriations);
|
if (org == null || org.result == null)
|
||||||
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
rootId = org.result.rootId == null ? "" : org.result.rootId;
|
||||||
|
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
|
||||||
|
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
|
||||||
|
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
|
||||||
|
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
|
||||||
|
|
||||||
|
var placementRepatriations = await _context.PlacementRepatriations.AsQueryable()
|
||||||
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
|
.Where(x => PlacementAdmin == true ? true : (rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))))
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
p.Id,
|
||||||
|
p.profileId,
|
||||||
|
p.prefix,
|
||||||
|
p.firstName,
|
||||||
|
p.lastName,
|
||||||
|
p.root,
|
||||||
|
p.rootShortName,
|
||||||
|
p.child1,
|
||||||
|
p.child1ShortName,
|
||||||
|
p.child2,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4ShortName,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.position,
|
||||||
|
p.posLevelName,
|
||||||
|
p.posTypeName,
|
||||||
|
p.CreatedAt,
|
||||||
|
p.Organization,
|
||||||
|
p.Reason,
|
||||||
|
p.Status,
|
||||||
|
p.Date,
|
||||||
|
salary = p.AmountOld,
|
||||||
|
p.PositionTypeOld,
|
||||||
|
p.PositionLevelOld,
|
||||||
|
p.PositionNumberOld,
|
||||||
|
p.OrganizationPositionOld,
|
||||||
|
p.IsActive,
|
||||||
|
p.DateRepatriation,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return Success(placementRepatriations);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -107,19 +147,27 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
var data = await _context.PlacementRepatriations.AsQueryable()
|
var data = await _context.PlacementRepatriations.AsQueryable()
|
||||||
.Where(x => x.Id == id)
|
.Where(x => x.Id == id)
|
||||||
.Where(x => x.Profile != null)
|
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
|
p.profileId,
|
||||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
p.prefix,
|
||||||
p.Profile.FirstName,
|
p.firstName,
|
||||||
p.Profile.LastName,
|
p.lastName,
|
||||||
ProfileId = p.Profile.Id,
|
p.root,
|
||||||
position = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.Position == null ? null : p.Profile.Position.Name) : (p.Profile.PositionEmployeePosition == null ? null : p.Profile.PositionEmployeePosition.Name),
|
p.rootShortName,
|
||||||
posNo = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PosNo == null ? null : p.Profile.PosNo.Name) : p.Profile.PosNoEmployee,
|
p.child1,
|
||||||
positionLevel = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name) : (p.Profile.PositionEmployeeLevel == null ? null : p.Profile.PositionEmployeeLevel.Name),
|
p.child1ShortName,
|
||||||
organizationOrganization = p.Profile.OrganizationOrganization,
|
p.child2,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4ShortName,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.position,
|
||||||
|
p.posLevelName,
|
||||||
|
p.posTypeName,
|
||||||
p.Reason,
|
p.Reason,
|
||||||
p.Status,
|
p.Status,
|
||||||
p.Organization,
|
p.Organization,
|
||||||
|
|
@ -131,38 +179,12 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
p.PositionNumberOld,
|
p.PositionNumberOld,
|
||||||
p.OrganizationPositionOld,
|
p.OrganizationPositionOld,
|
||||||
p.DateRepatriation,
|
p.DateRepatriation,
|
||||||
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
var _data = new
|
|
||||||
{
|
|
||||||
data.Id,
|
|
||||||
data.PrefixId,
|
|
||||||
data.Prefix,
|
|
||||||
data.FirstName,
|
|
||||||
data.LastName,
|
|
||||||
data.ProfileId,
|
|
||||||
data.position,
|
|
||||||
data.posNo,
|
|
||||||
data.positionLevel,
|
|
||||||
data.organizationOrganization,
|
|
||||||
data.Reason,
|
|
||||||
data.Status,
|
|
||||||
data.Organization,
|
|
||||||
data.Date,
|
|
||||||
data.salary,
|
|
||||||
data.CreatedAt,
|
|
||||||
data.PositionTypeOld,
|
|
||||||
data.PositionLevelOld,
|
|
||||||
data.PositionNumberOld,
|
|
||||||
data.OrganizationPositionOld,
|
|
||||||
data.DateRepatriation,
|
|
||||||
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
|
||||||
};
|
|
||||||
|
|
||||||
return Success(_data);
|
return Success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -176,27 +198,10 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
[HttpPost()]
|
[HttpPost()]
|
||||||
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementAddProfileRequest req)
|
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementAddProfileRequest req)
|
||||||
{
|
{
|
||||||
var profile = await _context.Profiles
|
|
||||||
.Include(x => x.PositionLevel)
|
|
||||||
.Include(x => x.PositionType)
|
|
||||||
.Include(x => x.PosNo)
|
|
||||||
.Include(x => x.Salaries)
|
|
||||||
.Include(x => x.Position)
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.Id);
|
|
||||||
if (profile == null)
|
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
|
||||||
|
|
||||||
var placementRepatriation = new PlacementRepatriation
|
var placementRepatriation = new PlacementRepatriation
|
||||||
{
|
{
|
||||||
Profile = profile,
|
|
||||||
Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
|
Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
|
||||||
Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
|
Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
|
||||||
// Date = req.Date,
|
|
||||||
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
|
||||||
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
|
||||||
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
|
||||||
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
|
||||||
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
|
|
||||||
Status = "WAITTING",
|
Status = "WAITTING",
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
CreatedUserId = UserId ?? "",
|
||||||
|
|
@ -205,6 +210,46 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
var apiUrl = $"{_configuration["API"]}org/profile/profileid/position/{req.Id}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
|
||||||
|
placementRepatriation.profileId = org.result.profileId;
|
||||||
|
placementRepatriation.prefix = org.result.prefix;
|
||||||
|
placementRepatriation.firstName = org.result.firstName;
|
||||||
|
placementRepatriation.lastName = org.result.lastName;
|
||||||
|
placementRepatriation.citizenId = org.result.citizenId;
|
||||||
|
placementRepatriation.root = org.result.root;
|
||||||
|
placementRepatriation.rootId = org.result.rootId;
|
||||||
|
placementRepatriation.rootShortName = org.result.rootShortName;
|
||||||
|
placementRepatriation.child1 = org.result.child1;
|
||||||
|
placementRepatriation.child1Id = org.result.child1Id;
|
||||||
|
placementRepatriation.child1ShortName = org.result.child1ShortName;
|
||||||
|
placementRepatriation.child2 = org.result.child2;
|
||||||
|
placementRepatriation.child2Id = org.result.child2Id;
|
||||||
|
placementRepatriation.child2ShortName = org.result.child2ShortName;
|
||||||
|
placementRepatriation.child3 = org.result.child3;
|
||||||
|
placementRepatriation.child3Id = org.result.child3Id;
|
||||||
|
placementRepatriation.child3ShortName = org.result.child3ShortName;
|
||||||
|
placementRepatriation.child4 = org.result.child4;
|
||||||
|
placementRepatriation.child4Id = org.result.child4Id;
|
||||||
|
placementRepatriation.child4ShortName = org.result.child4ShortName;
|
||||||
|
placementRepatriation.posMasterNo = org.result.posMasterNo;
|
||||||
|
placementRepatriation.position = org.result.position;
|
||||||
|
placementRepatriation.posTypeId = org.result.posTypeId;
|
||||||
|
placementRepatriation.posTypeName = org.result.posTypeName;
|
||||||
|
placementRepatriation.posLevelId = org.result.posLevelId;
|
||||||
|
placementRepatriation.posLevelName = org.result.posLevelName;
|
||||||
|
}
|
||||||
await _context.PlacementRepatriations.AddAsync(placementRepatriation);
|
await _context.PlacementRepatriations.AddAsync(placementRepatriation);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,11 @@ namespace BMA.EHR.Placement.Service.Requests
|
||||||
}
|
}
|
||||||
public class OrgRequestData
|
public class OrgRequestData
|
||||||
{
|
{
|
||||||
|
public string? profileId { get; set; }
|
||||||
|
public string? prefix { get; set; }
|
||||||
|
public string? firstName { get; set; }
|
||||||
|
public string? lastName { get; set; }
|
||||||
|
public string? citizenId { get; set; }
|
||||||
public string? root { get; set; }
|
public string? root { get; set; }
|
||||||
public string? rootId { get; set; }
|
public string? rootId { get; set; }
|
||||||
public string? rootShortName { get; set; }
|
public string? rootShortName { get; set; }
|
||||||
|
|
@ -24,5 +29,11 @@ namespace BMA.EHR.Placement.Service.Requests
|
||||||
public string? child4 { get; set; }
|
public string? child4 { get; set; }
|
||||||
public string? child4Id { get; set; }
|
public string? child4Id { get; set; }
|
||||||
public string? child4ShortName { get; set; }
|
public string? child4ShortName { get; set; }
|
||||||
|
public int? posMasterNo { get; set; }
|
||||||
|
public string? position { get; set; }
|
||||||
|
public string? posTypeId { get; set; }
|
||||||
|
public string? posTypeName { get; set; }
|
||||||
|
public string? posLevelId { get; set; }
|
||||||
|
public string? posLevelName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5,6 +5,29 @@ namespace BMA.EHR.Placement.Service.Requests
|
||||||
{
|
{
|
||||||
public class PersonSelectPositionAppointmentEmployeeRequest
|
public class PersonSelectPositionAppointmentEmployeeRequest
|
||||||
{
|
{
|
||||||
public Guid? OrganizationEmployeeId { get; set; }
|
public DateTime? RecruitDate { get; set; }
|
||||||
|
// public Guid? PosNoId { get; set; }
|
||||||
|
// public Guid? PositionId { get; set; }
|
||||||
|
// public Guid? PositionLevelId { get; set; }
|
||||||
|
// public Guid? PositionLineId { get; set; }
|
||||||
|
// public Guid? PositionPathSideId { get; set; }
|
||||||
|
// public Guid? PositionTypeId { get; set; }
|
||||||
|
public double? Amount { get; set; }
|
||||||
|
|
||||||
|
public string? posmasterId { get; set; }
|
||||||
|
public Guid? personalId { get; set; }
|
||||||
|
public DateTime? reportingDate { get; set; }
|
||||||
|
public int? node { get; set; }
|
||||||
|
public Guid? nodeId { get; set; }
|
||||||
|
public string? orgRevisionId { get; set; }
|
||||||
|
public int? posMasterNo { get; set; }
|
||||||
|
public string? positionId { get; set; }
|
||||||
|
public string? positionName { get; set; }
|
||||||
|
public string? positionField { get; set; }
|
||||||
|
public string? posTypeId { get; set; }
|
||||||
|
public string? posTypeName { get; set; }
|
||||||
|
public string? posLevelId { get; set; }
|
||||||
|
public string? posLevelName { get; set; }
|
||||||
|
public string? typeCommand { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6,12 +6,28 @@ namespace BMA.EHR.Placement.Service.Requests
|
||||||
public class PersonSelectPositionAppointmentRequest
|
public class PersonSelectPositionAppointmentRequest
|
||||||
{
|
{
|
||||||
public DateTime? RecruitDate { get; set; }
|
public DateTime? RecruitDate { get; set; }
|
||||||
public Guid? PosNoId { get; set; }
|
// public Guid? PosNoId { get; set; }
|
||||||
public Guid? PositionId { get; set; }
|
// public Guid? PositionId { get; set; }
|
||||||
public Guid? PositionLevelId { get; set; }
|
// public Guid? PositionLevelId { get; set; }
|
||||||
public Guid? PositionLineId { get; set; }
|
// public Guid? PositionLineId { get; set; }
|
||||||
public Guid? PositionPathSideId { get; set; }
|
// public Guid? PositionPathSideId { get; set; }
|
||||||
public Guid? PositionTypeId { get; set; }
|
// public Guid? PositionTypeId { get; set; }
|
||||||
public double? Amount { get; set; }
|
public double? Amount { get; set; }
|
||||||
|
|
||||||
|
public string? posmasterId { get; set; }
|
||||||
|
public Guid? personalId { get; set; }
|
||||||
|
public DateTime? reportingDate { get; set; }
|
||||||
|
public int? node { get; set; }
|
||||||
|
public Guid? nodeId { get; set; }
|
||||||
|
public string? orgRevisionId { get; set; }
|
||||||
|
public int? posMasterNo { get; set; }
|
||||||
|
public string? positionId { get; set; }
|
||||||
|
public string? positionName { get; set; }
|
||||||
|
public string? positionField { get; set; }
|
||||||
|
public string? posTypeId { get; set; }
|
||||||
|
public string? posTypeName { get; set; }
|
||||||
|
public string? posLevelId { get; set; }
|
||||||
|
public string? posLevelName { get; set; }
|
||||||
|
public string? typeCommand { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6,11 +6,28 @@ namespace BMA.EHR.Placement.Service.Requests
|
||||||
public class PersonSelectPositionReceiveRequest
|
public class PersonSelectPositionReceiveRequest
|
||||||
{
|
{
|
||||||
public DateTime? RecruitDate { get; set; }
|
public DateTime? RecruitDate { get; set; }
|
||||||
public Guid? PosNoId { get; set; }
|
// public Guid? PosNoId { get; set; }
|
||||||
public Guid? PositionId { get; set; }
|
// public Guid? PositionId { get; set; }
|
||||||
public Guid? PositionLevelId { get; set; }
|
// public Guid? PositionLevelId { get; set; }
|
||||||
public Guid? PositionLineId { get; set; }
|
// public Guid? PositionLineId { get; set; }
|
||||||
public Guid? PositionPathSideId { get; set; }
|
// public Guid? PositionPathSideId { get; set; }
|
||||||
public Guid? PositionTypeId { get; set; }
|
// public Guid? PositionTypeId { get; set; }
|
||||||
|
public double? Amount { get; set; }
|
||||||
|
|
||||||
|
public string? posmasterId { get; set; }
|
||||||
|
public Guid? personalId { get; set; }
|
||||||
|
public DateTime? reportingDate { get; set; }
|
||||||
|
public int? node { get; set; }
|
||||||
|
public Guid? nodeId { get; set; }
|
||||||
|
public string? orgRevisionId { get; set; }
|
||||||
|
public int? posMasterNo { get; set; }
|
||||||
|
public string? positionId { get; set; }
|
||||||
|
public string? positionName { get; set; }
|
||||||
|
public string? positionField { get; set; }
|
||||||
|
public string? posTypeId { get; set; }
|
||||||
|
public string? posTypeName { get; set; }
|
||||||
|
public string? posLevelId { get; set; }
|
||||||
|
public string? posLevelName { get; set; }
|
||||||
|
public string? typeCommand { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5,10 +5,10 @@ namespace BMA.EHR.Placement.Service.Requests
|
||||||
{
|
{
|
||||||
public class PlacementReceiveEditRequest
|
public class PlacementReceiveEditRequest
|
||||||
{
|
{
|
||||||
public string CitizenId { get; set; }
|
public string citizenId { get; set; }
|
||||||
public Guid PrefixId { get; set; }
|
public string prefix { get; set; }
|
||||||
public string Firstname { get; set; }
|
public string firstName { get; set; }
|
||||||
public string Lastname { get; set; }
|
public string lastName { get; set; }
|
||||||
public DateTime DateOfBirth { get; set; }
|
public DateTime DateOfBirth { get; set; }
|
||||||
public Guid? GenderId { get; set; }
|
public Guid? GenderId { get; set; }
|
||||||
public string? Nationality { get; set; }
|
public string? Nationality { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@ namespace BMA.EHR.Placement.Service.Requests
|
||||||
{
|
{
|
||||||
public class PlacementReceiveRequest
|
public class PlacementReceiveRequest
|
||||||
{
|
{
|
||||||
public string CitizenId { get; set; }
|
public string citizenId { get; set; }
|
||||||
public Guid Prefix { get; set; }
|
public string prefix { get; set; }
|
||||||
public string Firstname { get; set; }
|
public string firstName { get; set; }
|
||||||
public string Lastname { get; set; }
|
public string lastName { get; set; }
|
||||||
public DateTime BirthDate { get; set; }
|
public DateTime BirthDate { get; set; }
|
||||||
public Guid? GenderId { get; set; }
|
public Guid? GenderId { get; set; }
|
||||||
public string? Nationality { get; set; }
|
public string? Nationality { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Reflection.Metadata;
|
using System.Reflection.Metadata;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
@ -60,7 +61,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
|
private bool? RetirementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -74,64 +77,87 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
[HttpGet()]
|
[HttpGet()]
|
||||||
public async Task<ActionResult<ResponseObject>> GetList()
|
public async Task<ActionResult<ResponseObject>> GetList()
|
||||||
{
|
{
|
||||||
|
var rootId = "";
|
||||||
var retirementDeceaseds = await _context.RetirementDeceaseds.AsQueryable()
|
var child1Id = "";
|
||||||
.OrderByDescending(x => x.CreatedAt)
|
var child2Id = "";
|
||||||
.Select(p => new
|
var child3Id = "";
|
||||||
{
|
var child4Id = "";
|
||||||
p.Id,
|
var apiUrl = $"{_configuration["API"]}org/profile/keycloak/position";
|
||||||
ProfileId = p.Profile.Id,
|
using (var client = new HttpClient())
|
||||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
|
||||||
p.Profile.FirstName,
|
|
||||||
p.Profile.LastName,
|
|
||||||
Position = p.Profile.Position == null ? null : p.Profile.Position.Name,
|
|
||||||
PositionType = p.Profile.PositionType == null ? null : p.Profile.PositionType.Name,
|
|
||||||
p.Profile.PositionLine,
|
|
||||||
// PositionLine = p.Profile.PositionLine == null ? null : p.Profile.PositionLine.Name,
|
|
||||||
PositionLevel = p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name,
|
|
||||||
p.Profile.PositionExecutive,
|
|
||||||
// PositionExecutive = p.Profile.PositionExecutive == null ? null : p.Profile.PositionExecutive.Name,
|
|
||||||
Organization = p.Profile.Oc,
|
|
||||||
// Organization = p.Profile.Oc == null ? null : p.Profile.Oc.Name,
|
|
||||||
p.Number,
|
|
||||||
p.Date,
|
|
||||||
p.Location,
|
|
||||||
p.Reason,
|
|
||||||
FileName = p.Document == null ? null : p.Document.FileName,
|
|
||||||
PathName = p.Document == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Document.Id,
|
|
||||||
p.IsActive,
|
|
||||||
p.CreatedAt,
|
|
||||||
})
|
|
||||||
.ToListAsync();
|
|
||||||
var _retirementDeceaseds = new List<dynamic>();
|
|
||||||
foreach (var data in retirementDeceaseds)
|
|
||||||
{
|
{
|
||||||
var _data = new
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
{
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
data.Id,
|
var _res = await client.SendAsync(_req);
|
||||||
data.ProfileId,
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
data.Prefix,
|
|
||||||
data.FirstName,
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
data.LastName,
|
|
||||||
data.Position,
|
if (org == null || org.result == null)
|
||||||
data.PositionExecutive,
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
data.PositionType,
|
rootId = org.result.rootId == null ? "" : org.result.rootId;
|
||||||
data.PositionLine,
|
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
|
||||||
data.PositionLevel,
|
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
|
||||||
data.Organization,
|
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
|
||||||
data.Number,
|
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
|
||||||
data.Date,
|
|
||||||
data.Location,
|
var retirementDeceaseds = await _context.RetirementDeceaseds.AsQueryable()
|
||||||
data.Reason,
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
data.FileName,
|
.Where(x => RetirementAdmin == true ? true : (rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))))
|
||||||
PathName = data.PathName == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.PathName),
|
.Select(p => new
|
||||||
data.IsActive,
|
{
|
||||||
data.CreatedAt,
|
p.Id,
|
||||||
};
|
p.profileId,
|
||||||
_retirementDeceaseds.Add(_data);
|
p.prefix,
|
||||||
|
p.firstName,
|
||||||
|
p.lastName,
|
||||||
|
p.root,
|
||||||
|
p.rootShortName,
|
||||||
|
p.child1,
|
||||||
|
p.child1ShortName,
|
||||||
|
p.child2,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4ShortName,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.position,
|
||||||
|
p.posLevelName,
|
||||||
|
p.posTypeName,
|
||||||
|
p.CreatedAt,
|
||||||
|
p.IsActive,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
// var _retirementDeceaseds = new List<dynamic>();
|
||||||
|
// foreach (var data in retirementDeceaseds)
|
||||||
|
// {
|
||||||
|
// var _data = new
|
||||||
|
// {
|
||||||
|
// data.Id,
|
||||||
|
// data.ProfileId,
|
||||||
|
// data.Prefix,
|
||||||
|
// data.FirstName,
|
||||||
|
// data.LastName,
|
||||||
|
// data.Position,
|
||||||
|
// data.PositionExecutive,
|
||||||
|
// data.PositionType,
|
||||||
|
// data.PositionLine,
|
||||||
|
// data.PositionLevel,
|
||||||
|
// data.Organization,
|
||||||
|
// data.Number,
|
||||||
|
// data.Date,
|
||||||
|
// data.Location,
|
||||||
|
// data.Reason,
|
||||||
|
// data.FileName,
|
||||||
|
// PathName = data.PathName == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.PathName),
|
||||||
|
// data.IsActive,
|
||||||
|
// data.CreatedAt,
|
||||||
|
// };
|
||||||
|
// _retirementDeceaseds.Add(_data);
|
||||||
|
// }
|
||||||
|
return Success(retirementDeceaseds);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Success(_retirementDeceaseds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -151,26 +177,24 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
ProfileId = p.Profile.Id,
|
p.profileId,
|
||||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
p.prefix,
|
||||||
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
|
p.firstName,
|
||||||
p.Profile.FirstName,
|
p.lastName,
|
||||||
p.Profile.LastName,
|
p.root,
|
||||||
Position = p.Profile.Position == null ? null : p.Profile.Position.Name,
|
p.rootShortName,
|
||||||
PositionId = p.Profile.Position == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Position.Id,
|
p.child1,
|
||||||
PositionType = p.Profile.PositionType == null ? null : p.Profile.PositionType.Name,
|
p.child1ShortName,
|
||||||
PositionTypeId = p.Profile.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionType.Id,
|
p.child2,
|
||||||
p.Profile.PositionLine,
|
p.child2ShortName,
|
||||||
p.Profile.PositionLineId,
|
p.child3,
|
||||||
// PositionLine = p.Profile.PositionLine == null ? null : p.Profile.PositionLine.Name,
|
p.child3ShortName,
|
||||||
PositionLevel = p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name,
|
p.child4,
|
||||||
PositionLevelId = p.Profile.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionLevel.Id,
|
p.child4ShortName,
|
||||||
p.Profile.PositionExecutive,
|
p.posMasterNo,
|
||||||
p.Profile.PositionExecutiveId,
|
p.position,
|
||||||
// PositionExecutive = p.Profile.PositionExecutive == null ? null : p.Profile.PositionExecutive.Name,
|
p.posLevelName,
|
||||||
Organization = p.Profile.Oc,
|
p.posTypeName,
|
||||||
OrganizationId = p.Profile.OcId,
|
|
||||||
// Organization = p.Profile.Oc == null ? null : p.Profile.Oc.Name,
|
|
||||||
p.Number,
|
p.Number,
|
||||||
p.Date,
|
p.Date,
|
||||||
p.Location,
|
p.Location,
|
||||||
|
|
@ -179,7 +203,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
PathName = p.Document == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Document.Id,
|
PathName = p.Document == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Document.Id,
|
||||||
p.IsActive,
|
p.IsActive,
|
||||||
p.CreatedAt,
|
p.CreatedAt,
|
||||||
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
|
|
@ -187,32 +211,32 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
var _data = new
|
var _data = new
|
||||||
{
|
{
|
||||||
data.Id,
|
data.Id,
|
||||||
data.ProfileId,
|
data.profileId,
|
||||||
data.Prefix,
|
data.prefix,
|
||||||
data.PrefixId,
|
data.firstName,
|
||||||
data.FirstName,
|
data.lastName,
|
||||||
data.LastName,
|
data.root,
|
||||||
data.Position,
|
data.rootShortName,
|
||||||
data.PositionExecutive,
|
data.child1,
|
||||||
data.PositionType,
|
data.child1ShortName,
|
||||||
data.PositionLine,
|
data.child2,
|
||||||
data.PositionLevel,
|
data.child2ShortName,
|
||||||
data.Organization,
|
data.child3,
|
||||||
data.PositionId,
|
data.child3ShortName,
|
||||||
data.PositionExecutiveId,
|
data.child4,
|
||||||
data.PositionTypeId,
|
data.child4ShortName,
|
||||||
data.PositionLineId,
|
data.posMasterNo,
|
||||||
data.PositionLevelId,
|
data.position,
|
||||||
data.OrganizationId,
|
data.posLevelName,
|
||||||
|
data.posTypeName,
|
||||||
data.Number,
|
data.Number,
|
||||||
data.Date,
|
data.Date,
|
||||||
data.Location,
|
data.Location,
|
||||||
data.Reason,
|
data.Reason,
|
||||||
data.FileName,
|
|
||||||
PathName = data.PathName == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.PathName),
|
PathName = data.PathName == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.PathName),
|
||||||
data.IsActive,
|
data.IsActive,
|
||||||
data.CreatedAt,
|
data.CreatedAt,
|
||||||
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||||
};
|
};
|
||||||
|
|
||||||
return Success(_data);
|
return Success(_data);
|
||||||
|
|
@ -229,18 +253,19 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
[HttpPost()]
|
[HttpPost()]
|
||||||
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)
|
// .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);
|
||||||
profile.LeaveDate = DateTime.Now;
|
|
||||||
profile.IsLeave = true;
|
// profile.LeaveDate = DateTime.Now;
|
||||||
profile.LeaveReason = "DEATH";
|
// profile.IsLeave = true;
|
||||||
|
// profile.LeaveReason = "DEATH";
|
||||||
|
|
||||||
var retirementDeceased = new RetirementDeceased
|
var retirementDeceased = new RetirementDeceased
|
||||||
{
|
{
|
||||||
Profile = profile,
|
// Profile = profile,
|
||||||
Number = req.Number,
|
Number = req.Number,
|
||||||
Date = req.Date,
|
Date = req.Date,
|
||||||
Location = req.Location,
|
Location = req.Location,
|
||||||
|
|
@ -253,6 +278,46 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
var apiUrl = $"{_configuration["API"]}org/profile/profileid/position/{req.ProfileId}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
|
||||||
|
retirementDeceased.profileId = org.result.profileId;
|
||||||
|
retirementDeceased.prefix = org.result.prefix;
|
||||||
|
retirementDeceased.firstName = org.result.firstName;
|
||||||
|
retirementDeceased.lastName = org.result.lastName;
|
||||||
|
retirementDeceased.citizenId = org.result.citizenId;
|
||||||
|
retirementDeceased.root = org.result.root;
|
||||||
|
retirementDeceased.rootId = org.result.rootId;
|
||||||
|
retirementDeceased.rootShortName = org.result.rootShortName;
|
||||||
|
retirementDeceased.child1 = org.result.child1;
|
||||||
|
retirementDeceased.child1Id = org.result.child1Id;
|
||||||
|
retirementDeceased.child1ShortName = org.result.child1ShortName;
|
||||||
|
retirementDeceased.child2 = org.result.child2;
|
||||||
|
retirementDeceased.child2Id = org.result.child2Id;
|
||||||
|
retirementDeceased.child2ShortName = org.result.child2ShortName;
|
||||||
|
retirementDeceased.child3 = org.result.child3;
|
||||||
|
retirementDeceased.child3Id = org.result.child3Id;
|
||||||
|
retirementDeceased.child3ShortName = org.result.child3ShortName;
|
||||||
|
retirementDeceased.child4 = org.result.child4;
|
||||||
|
retirementDeceased.child4Id = org.result.child4Id;
|
||||||
|
retirementDeceased.child4ShortName = org.result.child4ShortName;
|
||||||
|
retirementDeceased.posMasterNo = org.result.posMasterNo;
|
||||||
|
retirementDeceased.position = org.result.position;
|
||||||
|
retirementDeceased.posTypeId = org.result.posTypeId;
|
||||||
|
retirementDeceased.posTypeName = org.result.posTypeName;
|
||||||
|
retirementDeceased.posLevelId = org.result.posLevelId;
|
||||||
|
retirementDeceased.posLevelName = org.result.posLevelName;
|
||||||
|
}
|
||||||
await _context.RetirementDeceaseds.AddAsync(retirementDeceased);
|
await _context.RetirementDeceaseds.AddAsync(retirementDeceased);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
var _doc = new Domain.Models.Documents.Document();
|
var _doc = new Domain.Models.Documents.Document();
|
||||||
|
|
@ -267,16 +332,68 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
if (_doc != null)
|
if (_doc != null)
|
||||||
retirementDeceased.Document = _doc;
|
retirementDeceased.Document = _doc;
|
||||||
}
|
}
|
||||||
await _context.ProfileSalaries.AddAsync(new ProfileSalary
|
// await _context.ProfileSalaries.AddAsync(new ProfileSalary
|
||||||
|
// {
|
||||||
|
// Date = req.Date,
|
||||||
|
// SalaryRef = req.Number,
|
||||||
|
// CommandNo = "-",
|
||||||
|
// SalaryClass = "-",
|
||||||
|
// PosNoEmployee = "-",
|
||||||
|
// CommandTypeName = "-",
|
||||||
|
// SalaryStatus = "DEATH",
|
||||||
|
// Profile = profile,
|
||||||
|
// CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
// CreatedUserId = UserId ?? "",
|
||||||
|
// CreatedAt = DateTime.Now,
|
||||||
|
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
// LastUpdateUserId = UserId ?? "",
|
||||||
|
// LastUpdatedAt = DateTime.Now,
|
||||||
|
// });
|
||||||
|
// if (_doc != null)
|
||||||
|
// {
|
||||||
|
// await _context.ProfilePapers.AddAsync(new ProfilePaper
|
||||||
|
// {
|
||||||
|
// Detail = "ถึงแก่กรรม",
|
||||||
|
// CategoryName = "DEATH",
|
||||||
|
// Document = _doc,
|
||||||
|
// Profile = profile,
|
||||||
|
// CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
// CreatedUserId = UserId ?? "",
|
||||||
|
// CreatedAt = DateTime.Now,
|
||||||
|
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
// LastUpdateUserId = UserId ?? "",
|
||||||
|
// 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
|
||||||
{
|
{
|
||||||
Date = req.Date,
|
CitizenId = retirementDeceased.citizenId,
|
||||||
SalaryRef = req.Number,
|
Prefix = retirementDeceased.prefix,
|
||||||
CommandNo = "-",
|
FirstName = retirementDeceased.firstName,
|
||||||
SalaryClass = "-",
|
LastName = retirementDeceased.lastName,
|
||||||
PosNoEmployee = "-",
|
IsSendMail = true,
|
||||||
CommandTypeName = "-",
|
IsSendInbox = true,
|
||||||
SalaryStatus = "DEATH",
|
IsSendNotification = true,
|
||||||
Profile = profile,
|
// OrganizationName = retirementDeceased.OrganizationName,
|
||||||
|
// PositionName = retirementDeceased.PositionName,
|
||||||
|
// ReceiveUser = profile,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
CreatedUserId = UserId ?? "",
|
||||||
CreatedAt = DateTime.Now,
|
CreatedAt = DateTime.Now,
|
||||||
|
|
@ -284,60 +401,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
});
|
});
|
||||||
if (_doc != null)
|
// }
|
||||||
{
|
// }
|
||||||
await _context.ProfilePapers.AddAsync(new ProfilePaper
|
|
||||||
{
|
|
||||||
Detail = "ถึงแก่กรรม",
|
|
||||||
CategoryName = "DEATH",
|
|
||||||
Document = _doc,
|
|
||||||
Profile = profile,
|
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
|
||||||
CreatedUserId = UserId ?? "",
|
|
||||||
CreatedAt = DateTime.Now,
|
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
|
||||||
LastUpdateUserId = UserId ?? "",
|
|
||||||
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 = true,
|
|
||||||
IsSendInbox = true,
|
|
||||||
IsSendNotification = true,
|
|
||||||
OrganizationName = orgPos!.OrganizationPosition!.Organization!.OrganizationOrganization!.Name,
|
|
||||||
PositionName = orgPos!.OrganizationPosition!.PositionMaster!.PositionPath!.Name,
|
|
||||||
ReceiveUser = profile,
|
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
|
||||||
CreatedUserId = UserId ?? "",
|
|
||||||
CreatedAt = DateTime.Now,
|
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
|
||||||
LastUpdateUserId = UserId ?? "",
|
|
||||||
LastUpdatedAt = DateTime.Now,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
|
|
@ -532,8 +597,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
var items = await _context.RetirementDeceasedNotis.AsQueryable()
|
var items = await _context.RetirementDeceasedNotis.AsQueryable()
|
||||||
.Include(x => x.ReceiveUser)
|
.Include(x => x.ReceiveUser)
|
||||||
.Include(x => x.RetirementDeceased)
|
.Include(x => x.RetirementDeceased)
|
||||||
.ThenInclude(x => x.Profile)
|
// .ThenInclude(x => x.Profile)
|
||||||
.ThenInclude(x => x.Prefix)
|
// .ThenInclude(x => x.Prefix)
|
||||||
.Where(x => x.RetirementDeceased.Id == id)
|
.Where(x => x.RetirementDeceased.Id == id)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
|
@ -562,14 +627,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
var payload_str = JsonConvert.SerializeObject(payload);
|
var payload_str = JsonConvert.SerializeObject(payload);
|
||||||
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.prefix;
|
||||||
var profile = req.Persons.FirstOrDefault(x => x.ProfileId == item.ReceiveUser.Id);
|
var profile = req.Persons.FirstOrDefault(x => x.ProfileId == item.ReceiveUser.Id);
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
await _repositoryNoti.PushNotificationAsync(
|
await _repositoryNoti.PushNotificationAsync(
|
||||||
item.ReceiveUser.Id,
|
item.ReceiveUser.Id,
|
||||||
$"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
$"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.firstName} {item.RetirementDeceased.lastName}",
|
||||||
$"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
$"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.firstName} {item.RetirementDeceased.lastName}",
|
||||||
payload_str,
|
payload_str,
|
||||||
profile.IsSendInbox,
|
profile.IsSendInbox,
|
||||||
profile.IsSendMail
|
profile.IsSendMail
|
||||||
|
|
@ -582,8 +647,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
{
|
{
|
||||||
await _repositoryNoti.PushNotificationAsync(
|
await _repositoryNoti.PushNotificationAsync(
|
||||||
item.ReceiveUser.Id,
|
item.ReceiveUser.Id,
|
||||||
$"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
$"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.firstName} {item.RetirementDeceased.lastName}",
|
||||||
$"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
$"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.firstName} {item.RetirementDeceased.lastName}",
|
||||||
payload_str,
|
payload_str,
|
||||||
item.IsSendInbox,
|
item.IsSendInbox,
|
||||||
item.IsSendMail
|
item.IsSendMail
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ using BMA.EHR.Retirement.Service.Requests;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace BMA.EHR.Retirement.Service.Controllers
|
namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
|
|
@ -26,18 +28,21 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
|
|
||||||
public RetirementOtherController(RetirementRepository repository,
|
public RetirementOtherController(RetirementRepository repository,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -45,6 +50,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
private bool? RetirementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
private bool? RetirementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
||||||
|
|
||||||
|
|
@ -61,54 +67,70 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
[HttpGet()]
|
[HttpGet()]
|
||||||
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
|
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
|
||||||
{
|
{
|
||||||
|
var rootId = "";
|
||||||
|
var child1Id = "";
|
||||||
|
var child2Id = "";
|
||||||
|
var child3Id = "";
|
||||||
|
var child4Id = "";
|
||||||
|
var apiUrl = $"{_configuration["API"]}org/profile/keycloak/position";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
var retirementOthers = await _context.RetirementOthers.AsQueryable()
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
.OrderByDescending(x => x.CreatedAt)
|
|
||||||
.Select(p => new
|
|
||||||
{
|
|
||||||
p.Id,
|
|
||||||
p.CitizenId,
|
|
||||||
Prefix = p.Prefix == null ? null : p.Prefix.Name,
|
|
||||||
p.Firstname,
|
|
||||||
p.Lastname,
|
|
||||||
p.DateOfBirth,
|
|
||||||
Gender = p.Gender == null ? null : p.Gender.Name,
|
|
||||||
p.Status,
|
|
||||||
p.Amount,
|
|
||||||
p.RecruitDate,
|
|
||||||
PositionNumber = p.PositionNumber == null ? null : p.PositionNumber.Name,
|
|
||||||
PositionPath = p.PositionPath == null ? null : p.PositionPath.Name,
|
|
||||||
PositionPathSide = p.PositionPathSide == null ? null : p.PositionPathSide.Name,
|
|
||||||
PositionType = p.PositionType == null ? null : p.PositionType.Name,
|
|
||||||
PositionLine = p.PositionLine == null ? null : p.PositionLine.Name,
|
|
||||||
PositionLevel = p.PositionLevel == null ? null : p.PositionLevel.Name,
|
|
||||||
PosNoId = p.PositionNumber == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionNumber.Id,
|
|
||||||
PositionId = p.PositionPath == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPath.Id,
|
|
||||||
PositionPathSideId = p.PositionPathSide == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionPathSide.Id,
|
|
||||||
PositionTypeId = p.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionType.Id,
|
|
||||||
PositionLineId = p.PositionLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLine.Id,
|
|
||||||
PositionLevelId = p.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.PositionLevel.Id,
|
|
||||||
OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
|
|
||||||
OrganizationName = p.OrganizationPosition == null ? null : (p.OrganizationPosition.Organization == null ? null : (p.OrganizationPosition.Organization.OrganizationOrganization == null ? null : p.OrganizationPosition.Organization.OrganizationOrganization.Name)),////
|
|
||||||
OrganizationShortName = p.OrganizationPosition == null ? null : (p.OrganizationPosition.Organization == null ? null : (p.OrganizationPosition.Organization.OrganizationShortName == null ? null : p.OrganizationPosition.Organization.OrganizationShortName.Name)),////
|
|
||||||
p.IsActive,
|
|
||||||
p.PositionDate,
|
|
||||||
p.Reason,
|
|
||||||
p.MilitaryDate,
|
|
||||||
p.EducationOld,
|
|
||||||
p.AmountOld,
|
|
||||||
p.PositionTypeOld,
|
|
||||||
p.PositionLevelOld,
|
|
||||||
p.PositionNumberOld,
|
|
||||||
p.OrganizationPositionOld,
|
|
||||||
p.CreatedAt,
|
|
||||||
CommandType = p.CommandType == null ? null : p.CommandType.Name,
|
|
||||||
})
|
|
||||||
.ToListAsync();
|
|
||||||
if (RetirementAdmin == true)
|
|
||||||
retirementOthers.Where(x => x.Status.Trim().ToUpper().Contains("PENDING"));
|
|
||||||
|
|
||||||
return Success(retirementOthers);
|
if (org == null || org.result == null)
|
||||||
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
rootId = org.result.rootId == null ? "" : org.result.rootId;
|
||||||
|
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
|
||||||
|
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
|
||||||
|
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
|
||||||
|
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
|
||||||
|
|
||||||
|
var retirementOthers = await _context.RetirementOthers.AsQueryable()
|
||||||
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
|
.Where(x => RetirementAdmin == true ? true : (rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))))
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
p.Id,
|
||||||
|
p.profileId,
|
||||||
|
p.prefix,
|
||||||
|
p.firstName,
|
||||||
|
p.lastName,
|
||||||
|
p.root,
|
||||||
|
p.rootShortName,
|
||||||
|
p.child1,
|
||||||
|
p.child1ShortName,
|
||||||
|
p.child2,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4ShortName,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.position,
|
||||||
|
p.posLevelName,
|
||||||
|
p.posTypeName,
|
||||||
|
p.Status,
|
||||||
|
p.CreatedAt,
|
||||||
|
p.Reason,
|
||||||
|
p.MilitaryDate,
|
||||||
|
p.EducationOld,
|
||||||
|
p.AmountOld,
|
||||||
|
p.PositionTypeOld,
|
||||||
|
p.PositionLevelOld,
|
||||||
|
p.PositionNumberOld,
|
||||||
|
p.OrganizationPositionOld,
|
||||||
|
p.PositionDate,
|
||||||
|
CommandType = p.CommandType == null ? null : p.CommandType.Name,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return Success(retirementOthers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -128,30 +150,25 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
ProfileId = p.Profile.Id,
|
p.profileId,
|
||||||
p.CitizenId,
|
p.prefix,
|
||||||
Prefix = p.Prefix == null ? null : p.Prefix.Name,
|
p.firstName,
|
||||||
PrefixId = p.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Prefix.Id,
|
p.lastName,
|
||||||
p.Firstname,
|
p.root,
|
||||||
p.Lastname,
|
p.rootShortName,
|
||||||
p.DateOfBirth,
|
p.child1,
|
||||||
Gender = p.Gender == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Gender.Id,
|
p.child1ShortName,
|
||||||
p.Nationality,
|
p.child2,
|
||||||
p.Race,
|
p.child2ShortName,
|
||||||
Religion = p.Religion == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Religion.Id,
|
p.child3,
|
||||||
BloodGroup = p.BloodGroup == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.BloodGroup.Id,
|
p.child3ShortName,
|
||||||
Relationship = p.Relationship == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Relationship.Id,
|
p.child4,
|
||||||
p.TelephoneNumber,
|
p.child4ShortName,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.position,
|
||||||
|
p.posLevelName,
|
||||||
|
p.posTypeName,
|
||||||
p.Status,
|
p.Status,
|
||||||
p.Amount,
|
|
||||||
p.RecruitDate,
|
|
||||||
PosNo = p.PositionNumber == null ? "-" : p.PositionNumber.Name,
|
|
||||||
Position = p.PositionPath == null ? "-" : p.PositionPath.Name,
|
|
||||||
PositionPathSide = p.PositionPathSide == null ? "-" : p.PositionPathSide.Name,
|
|
||||||
PositionType = p.PositionType == null ? "-" : p.PositionType.Name,
|
|
||||||
PositionLine = p.PositionLine == null ? "-" : p.PositionLine.Name,
|
|
||||||
PositionLevel = p.PositionLevel == null ? "-" : p.PositionLevel.Name,
|
|
||||||
OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
|
|
||||||
p.CreatedAt,
|
p.CreatedAt,
|
||||||
p.Reason,
|
p.Reason,
|
||||||
p.MilitaryDate,
|
p.MilitaryDate,
|
||||||
|
|
@ -162,67 +179,67 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
p.PositionNumberOld,
|
p.PositionNumberOld,
|
||||||
p.OrganizationPositionOld,
|
p.OrganizationPositionOld,
|
||||||
p.PositionDate,
|
p.PositionDate,
|
||||||
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
||||||
RetirementOtherDocs = p.RetirementOtherDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
// RetirementOtherDocs = p.RetirementOtherDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||||
CommandType = p.CommandType == null ? null : p.CommandType.Name,
|
CommandType = p.CommandType == null ? null : p.CommandType.Name,
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
var retirementOtherDocs = new List<dynamic>();
|
// var retirementOtherDocs = new List<dynamic>();
|
||||||
foreach (var doc in data.RetirementOtherDocs)
|
// foreach (var doc in data.RetirementOtherDocs)
|
||||||
{
|
// {
|
||||||
var _doc = new
|
// var _doc = new
|
||||||
{
|
// {
|
||||||
doc.FileName,
|
// doc.FileName,
|
||||||
PathName = await _documentService.ImagesPath(doc.Id)
|
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||||
};
|
// };
|
||||||
retirementOtherDocs.Add(_doc);
|
// retirementOtherDocs.Add(_doc);
|
||||||
}
|
// }
|
||||||
var _data = new
|
// var _data = new
|
||||||
{
|
// {
|
||||||
data.Id,
|
// data.Id,
|
||||||
data.ProfileId,
|
// data.ProfileId,
|
||||||
data.CitizenId,
|
// data.CitizenId,
|
||||||
data.Prefix,
|
// data.Prefix,
|
||||||
data.PrefixId,
|
// data.PrefixId,
|
||||||
data.Firstname,
|
// data.Firstname,
|
||||||
data.Lastname,
|
// data.Lastname,
|
||||||
data.DateOfBirth,
|
// data.DateOfBirth,
|
||||||
data.Gender,
|
// data.Gender,
|
||||||
data.Nationality,
|
// data.Nationality,
|
||||||
data.Race,
|
// data.Race,
|
||||||
data.Religion,
|
// data.Religion,
|
||||||
data.BloodGroup,
|
// data.BloodGroup,
|
||||||
data.Relationship,
|
// data.Relationship,
|
||||||
data.TelephoneNumber,
|
// data.TelephoneNumber,
|
||||||
data.Status,
|
// data.Status,
|
||||||
data.Amount,
|
// data.Amount,
|
||||||
data.RecruitDate,
|
// data.RecruitDate,
|
||||||
data.PosNo,
|
// data.PosNo,
|
||||||
data.Position,
|
// data.Position,
|
||||||
data.PositionPathSide,
|
// data.PositionPathSide,
|
||||||
data.PositionType,
|
// data.PositionType,
|
||||||
data.PositionLine,
|
// data.PositionLine,
|
||||||
data.PositionLevel,
|
// data.PositionLevel,
|
||||||
data.OrganizationPositionId,
|
// data.OrganizationPositionId,
|
||||||
data.CreatedAt,
|
// data.CreatedAt,
|
||||||
data.Reason,
|
// data.Reason,
|
||||||
data.MilitaryDate,
|
// data.MilitaryDate,
|
||||||
data.EducationOld,
|
// data.EducationOld,
|
||||||
data.AmountOld,
|
// data.AmountOld,
|
||||||
data.PositionTypeOld,
|
// data.PositionTypeOld,
|
||||||
data.PositionLevelOld,
|
// data.PositionLevelOld,
|
||||||
data.PositionNumberOld,
|
// data.PositionNumberOld,
|
||||||
data.OrganizationPositionOld,
|
// data.OrganizationPositionOld,
|
||||||
data.PositionDate,
|
// data.PositionDate,
|
||||||
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
// // Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||||
Docs = retirementOtherDocs,
|
// // Docs = retirementOtherDocs,
|
||||||
data.CommandType,
|
// data.CommandType,
|
||||||
};
|
// };
|
||||||
|
|
||||||
return Success(_data);
|
return Success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -236,46 +253,33 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
[HttpPost()]
|
[HttpPost()]
|
||||||
public async Task<ActionResult<ResponseObject>> Post([FromForm] RetirementAddProfileRequest req)
|
public async Task<ActionResult<ResponseObject>> Post([FromForm] RetirementAddProfileRequest req)
|
||||||
{
|
{
|
||||||
var profile = await _context.Profiles
|
|
||||||
.Include(x => x.PositionLevel)
|
|
||||||
.Include(x => x.PositionType)
|
|
||||||
.Include(x => x.PosNo)
|
|
||||||
.Include(x => x.Salaries)
|
|
||||||
.Include(x => x.Educations)
|
|
||||||
.Include(x => x.Position)
|
|
||||||
.Include(x => x.Gender)
|
|
||||||
.Include(x => x.Prefix)
|
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.Id);
|
|
||||||
if (profile == null)
|
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
|
||||||
|
|
||||||
var retirementOther = new RetirementOther
|
var retirementOther = new RetirementOther
|
||||||
{
|
{
|
||||||
Profile = profile,
|
// Profile = profile,
|
||||||
CitizenId = profile.CitizenId,
|
// CitizenId = profile.CitizenId,
|
||||||
Prefix = profile.Prefix,
|
// Prefix = profile.Prefix,
|
||||||
Firstname = profile.FirstName,
|
// Firstname = profile.FirstName,
|
||||||
Lastname = profile.LastName,
|
// Lastname = profile.LastName,
|
||||||
DateOfBirth = profile.BirthDate,
|
// DateOfBirth = profile.BirthDate,
|
||||||
Gender = profile.Gender,
|
// Gender = profile.Gender,
|
||||||
Nationality = profile.Nationality,
|
// Nationality = profile.Nationality,
|
||||||
Race = profile.Race,
|
// Race = profile.Race,
|
||||||
Religion = await _context.Religions.FindAsync(profile.ReligionId),
|
// Religion = await _context.Religions.FindAsync(profile.ReligionId),
|
||||||
BloodGroup = await _context.BloodGroups.FindAsync(profile.BloodGroupId),
|
// BloodGroup = await _context.BloodGroups.FindAsync(profile.BloodGroupId),
|
||||||
Relationship = await _context.Relationships.FindAsync(profile.RelationshipId),
|
// Relationship = await _context.Relationships.FindAsync(profile.RelationshipId),
|
||||||
TelephoneNumber = profile.TelephoneNumber,
|
// TelephoneNumber = profile.TelephoneNumber,
|
||||||
EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}",
|
// EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}",
|
||||||
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
// AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||||
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
// PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
||||||
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
// PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
||||||
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
// PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
||||||
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
|
// OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
|
||||||
PositionNumber = profile.PosNo,
|
// PositionNumber = profile.PosNo,
|
||||||
PositionPath = profile.Position,
|
// PositionPath = profile.Position,
|
||||||
PositionPathSide = await _context.PositionPathSides.FindAsync(profile.PositionPathSideId),
|
// PositionPathSide = await _context.PositionPathSides.FindAsync(profile.PositionPathSideId),
|
||||||
PositionType = profile.PositionType,
|
// PositionType = profile.PositionType,
|
||||||
PositionLine = await _context.PositionLines.FindAsync(profile.PositionLineId),
|
// PositionLine = await _context.PositionLines.FindAsync(profile.PositionLineId),
|
||||||
PositionLevel = profile.PositionLevel,
|
// PositionLevel = profile.PositionLevel,
|
||||||
// OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
|
// OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
|
||||||
Status = "WAITTING",
|
Status = "WAITTING",
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
|
@ -285,118 +289,158 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
var apiUrl = $"{_configuration["API"]}org/profile/profileid/position/{req.Id}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
|
||||||
|
retirementOther.profileId = org.result.profileId;
|
||||||
|
retirementOther.prefix = org.result.prefix;
|
||||||
|
retirementOther.firstName = org.result.firstName;
|
||||||
|
retirementOther.lastName = org.result.lastName;
|
||||||
|
retirementOther.citizenId = org.result.citizenId;
|
||||||
|
retirementOther.root = org.result.root;
|
||||||
|
retirementOther.rootId = org.result.rootId;
|
||||||
|
retirementOther.rootShortName = org.result.rootShortName;
|
||||||
|
retirementOther.child1 = org.result.child1;
|
||||||
|
retirementOther.child1Id = org.result.child1Id;
|
||||||
|
retirementOther.child1ShortName = org.result.child1ShortName;
|
||||||
|
retirementOther.child2 = org.result.child2;
|
||||||
|
retirementOther.child2Id = org.result.child2Id;
|
||||||
|
retirementOther.child2ShortName = org.result.child2ShortName;
|
||||||
|
retirementOther.child3 = org.result.child3;
|
||||||
|
retirementOther.child3Id = org.result.child3Id;
|
||||||
|
retirementOther.child3ShortName = org.result.child3ShortName;
|
||||||
|
retirementOther.child4 = org.result.child4;
|
||||||
|
retirementOther.child4Id = org.result.child4Id;
|
||||||
|
retirementOther.child4ShortName = org.result.child4ShortName;
|
||||||
|
retirementOther.posMasterNo = org.result.posMasterNo;
|
||||||
|
retirementOther.position = org.result.position;
|
||||||
|
retirementOther.posTypeId = org.result.posTypeId;
|
||||||
|
retirementOther.posTypeName = org.result.posTypeName;
|
||||||
|
retirementOther.posLevelId = org.result.posLevelId;
|
||||||
|
retirementOther.posLevelName = org.result.posLevelName;
|
||||||
|
}
|
||||||
await _context.RetirementOthers.AddAsync(retirementOther);
|
await _context.RetirementOthers.AddAsync(retirementOther);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
// if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||||
{
|
// {
|
||||||
foreach (var file in Request.Form.Files)
|
// foreach (var file in Request.Form.Files)
|
||||||
{
|
// {
|
||||||
var fileExtension = Path.GetExtension(file.FileName);
|
// var fileExtension = Path.GetExtension(file.FileName);
|
||||||
|
|
||||||
var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
// var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||||
var _doc = await _context.Documents.AsQueryable()
|
// var _doc = await _context.Documents.AsQueryable()
|
||||||
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
// .FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||||
if (_doc != null)
|
// if (_doc != null)
|
||||||
{
|
// {
|
||||||
var retirementOtherDoc = new RetirementOtherDoc
|
// var retirementOtherDoc = new RetirementOtherDoc
|
||||||
{
|
// {
|
||||||
RetirementOther = retirementOther,
|
// RetirementOther = retirementOther,
|
||||||
Document = _doc,
|
// Document = _doc,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
// CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
// CreatedUserId = UserId ?? "",
|
||||||
CreatedAt = DateTime.Now,
|
// CreatedAt = DateTime.Now,
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
LastUpdateUserId = UserId ?? "",
|
// LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
// LastUpdatedAt = DateTime.Now,
|
||||||
};
|
// };
|
||||||
await _context.RetirementOtherDocs.AddAsync(retirementOtherDoc);
|
// await _context.RetirementOtherDocs.AddAsync(retirementOtherDoc);
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
await _context.SaveChangesAsync();
|
// await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// เลือกหน่วยงาน
|
// /// เลือกหน่วยงาน
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="id">Id อื่นๆ</param>
|
// /// <param name="id">Id อื่นๆ</param>
|
||||||
/// <returns></returns>
|
// /// <returns></returns>
|
||||||
/// <response code="200"></response>
|
// /// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPut("position/{id:length(36)}")]
|
// [HttpPut("position/{id:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> UpdatePositionRetirementOther([FromBody] PersonSelectPositionOtherRequest req, Guid id)
|
// public async Task<ActionResult<ResponseObject>> UpdatePositionRetirementOther([FromBody] PersonSelectPositionOtherRequest req, Guid id)
|
||||||
{
|
// {
|
||||||
var uppdated = await _context.RetirementOthers
|
// var uppdated = await _context.RetirementOthers
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
// .FirstOrDefaultAsync(x => x.Id == id);
|
||||||
if (uppdated == null)
|
// if (uppdated == null)
|
||||||
return Error(GlobalMessages.RetirementOtherNotFound, 404);
|
// return Error(GlobalMessages.RetirementOtherNotFound, 404);
|
||||||
if (req.PosNoId != null)
|
// if (req.PosNoId != null)
|
||||||
{
|
// {
|
||||||
var save_posNo = await _context.PositionNumbers.FindAsync(req.PosNoId);
|
// var save_posNo = await _context.PositionNumbers.FindAsync(req.PosNoId);
|
||||||
if (save_posNo == null)
|
// if (save_posNo == null)
|
||||||
return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
// return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
||||||
uppdated.PositionNumber = save_posNo;
|
// uppdated.PositionNumber = save_posNo;
|
||||||
|
|
||||||
var save_orgPosition = await _context.OrganizationPositions.FirstOrDefaultAsync(x => x.PositionNumber == save_posNo);
|
// var save_orgPosition = await _context.OrganizationPositions.FirstOrDefaultAsync(x => x.PositionNumber == save_posNo);
|
||||||
if (save_orgPosition == null)
|
// if (save_orgPosition == null)
|
||||||
return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
// return Error(GlobalMessages.PositionPosNoNotFound, 404);
|
||||||
uppdated.OrganizationPosition = save_orgPosition;
|
// uppdated.OrganizationPosition = save_orgPosition;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (req.PositionId != null)
|
// if (req.PositionId != null)
|
||||||
{
|
// {
|
||||||
var save = await _context.PositionPaths.FindAsync(req.PositionId);
|
// var save = await _context.PositionPaths.FindAsync(req.PositionId);
|
||||||
if (save == null)
|
// if (save == null)
|
||||||
return Error(GlobalMessages.PositionPathNotFound, 404);
|
// return Error(GlobalMessages.PositionPathNotFound, 404);
|
||||||
uppdated.PositionPath = save;
|
// uppdated.PositionPath = save;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (req.PositionLevelId != null)
|
// if (req.PositionLevelId != null)
|
||||||
{
|
// {
|
||||||
var save = await _context.PositionLevels.FindAsync(req.PositionLevelId);
|
// var save = await _context.PositionLevels.FindAsync(req.PositionLevelId);
|
||||||
if (save == null)
|
// if (save == null)
|
||||||
return Error(GlobalMessages.PositionLevelNotFound, 404);
|
// return Error(GlobalMessages.PositionLevelNotFound, 404);
|
||||||
uppdated.PositionLevel = save;
|
// uppdated.PositionLevel = save;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (req.PositionLineId != null)
|
// if (req.PositionLineId != null)
|
||||||
{
|
// {
|
||||||
var save = await _context.PositionLines.FindAsync(req.PositionLineId);
|
// var save = await _context.PositionLines.FindAsync(req.PositionLineId);
|
||||||
if (save == null)
|
// if (save == null)
|
||||||
return Error(GlobalMessages.PositionLineNotFound, 404);
|
// return Error(GlobalMessages.PositionLineNotFound, 404);
|
||||||
uppdated.PositionLine = save;
|
// uppdated.PositionLine = save;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (req.PositionPathSideId != null)
|
// if (req.PositionPathSideId != null)
|
||||||
{
|
// {
|
||||||
var save = await _context.PositionPathSides.FindAsync(req.PositionPathSideId);
|
// var save = await _context.PositionPathSides.FindAsync(req.PositionPathSideId);
|
||||||
if (save == null)
|
// if (save == null)
|
||||||
return Error(GlobalMessages.PositionPathSideNotFound, 404);
|
// return Error(GlobalMessages.PositionPathSideNotFound, 404);
|
||||||
uppdated.PositionPathSide = save;
|
// uppdated.PositionPathSide = save;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (req.PositionTypeId != null)
|
// if (req.PositionTypeId != null)
|
||||||
{
|
// {
|
||||||
var save = await _context.PositionTypes.FindAsync(req.PositionTypeId);
|
// var save = await _context.PositionTypes.FindAsync(req.PositionTypeId);
|
||||||
if (save == null)
|
// if (save == null)
|
||||||
return Error(GlobalMessages.PositionTypeNotFound, 404);
|
// return Error(GlobalMessages.PositionTypeNotFound, 404);
|
||||||
uppdated.PositionType = save;
|
// uppdated.PositionType = save;
|
||||||
}
|
// }
|
||||||
|
|
||||||
uppdated.RecruitDate = req.RecruitDate;
|
// uppdated.RecruitDate = req.RecruitDate;
|
||||||
uppdated.Status = "PENDING";
|
// uppdated.Status = "PENDING";
|
||||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
// uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
uppdated.LastUpdateUserId = UserId ?? "";
|
// uppdated.LastUpdateUserId = UserId ?? "";
|
||||||
uppdated.LastUpdatedAt = DateTime.Now;
|
// uppdated.LastUpdatedAt = DateTime.Now;
|
||||||
await _context.SaveChangesAsync();
|
// await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Success();
|
// return Success();
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// แก้ไขอื่นๆ
|
/// แก้ไขอื่นๆ
|
||||||
|
|
@ -414,53 +458,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
if (uppdated == null)
|
if (uppdated == null)
|
||||||
return Error(GlobalMessages.RetirementOtherNotFound, 404);
|
return Error(GlobalMessages.RetirementOtherNotFound, 404);
|
||||||
|
|
||||||
|
|
||||||
if (req.PrefixId != null)
|
|
||||||
{
|
|
||||||
var save = await _context.Prefixes.FindAsync(req.PrefixId);
|
|
||||||
if (save == null)
|
|
||||||
return Error(GlobalMessages.PrefixNotFound, 404);
|
|
||||||
uppdated.Prefix = save;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (req.RelationshipId != null)
|
|
||||||
{
|
|
||||||
var save = await _context.Relationships.FindAsync(req.RelationshipId);
|
|
||||||
if (save == null)
|
|
||||||
return Error(GlobalMessages.RelationshipNotFound, 404);
|
|
||||||
uppdated.Relationship = save;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (req.ReligionId != null)
|
|
||||||
{
|
|
||||||
var save = await _context.Religions.FindAsync(req.ReligionId);
|
|
||||||
if (save == null)
|
|
||||||
return Error(GlobalMessages.ReligionNotFound, 404);
|
|
||||||
uppdated.Religion = save;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (req.BloodGroupId != null)
|
|
||||||
{
|
|
||||||
var save = await _context.BloodGroups.FindAsync(req.BloodGroupId);
|
|
||||||
if (save == null)
|
|
||||||
return Error(GlobalMessages.BloodGroupNotFound, 404);
|
|
||||||
uppdated.BloodGroup = save;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (req.GenderId != null)
|
|
||||||
{
|
|
||||||
var save = await _context.Genders.FindAsync(req.GenderId);
|
|
||||||
if (save == null)
|
|
||||||
return Error(GlobalMessages.GenderNotFound, 404);
|
|
||||||
uppdated.Gender = save;
|
|
||||||
}
|
|
||||||
uppdated.CitizenId = req.CitizenId;
|
|
||||||
uppdated.Firstname = req.Firstname;
|
|
||||||
uppdated.Lastname = req.Lastname;
|
|
||||||
uppdated.DateOfBirth = req.DateOfBirth;
|
|
||||||
uppdated.Nationality = req.Nationality;
|
|
||||||
uppdated.Race = req.Race;
|
|
||||||
uppdated.TelephoneNumber = req.TelephoneNumber;
|
|
||||||
uppdated.EducationOld = req.EducationOld;
|
uppdated.EducationOld = req.EducationOld;
|
||||||
uppdated.Reason = req.Reason;
|
uppdated.Reason = req.Reason;
|
||||||
uppdated.MilitaryDate = req.MilitaryDate;
|
uppdated.MilitaryDate = req.MilitaryDate;
|
||||||
|
|
@ -468,7 +465,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
uppdated.PositionTypeOld = req.PositionTypeOld;
|
uppdated.PositionTypeOld = req.PositionTypeOld;
|
||||||
uppdated.PositionLevelOld = req.PositionLevelOld;
|
uppdated.PositionLevelOld = req.PositionLevelOld;
|
||||||
uppdated.PositionNumberOld = req.PositionNumberOld;
|
uppdated.PositionNumberOld = req.PositionNumberOld;
|
||||||
uppdated.Amount = req.Amount;
|
|
||||||
uppdated.AmountOld = req.AmountOld;
|
uppdated.AmountOld = req.AmountOld;
|
||||||
uppdated.PositionDate = req.PositionDate;
|
uppdated.PositionDate = req.PositionDate;
|
||||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ using BMA.EHR.Retirement.Service.Requests;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
|
||||||
namespace BMA.EHR.Retirement.Service.Controllers
|
namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
|
|
@ -26,18 +28,21 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
private readonly ApplicationDBContext _context;
|
private readonly ApplicationDBContext _context;
|
||||||
private readonly MinIOService _documentService;
|
private readonly MinIOService _documentService;
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
private readonly IConfiguration _configuration;
|
||||||
|
|
||||||
public RetirementOutController(RetirementRepository repository,
|
public RetirementOutController(RetirementRepository repository,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
ApplicationDBContext context,
|
ApplicationDBContext context,
|
||||||
MinIOService documentService,
|
MinIOService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor)
|
IHttpContextAccessor httpContextAccessor,
|
||||||
|
IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
_context = context;
|
_context = context;
|
||||||
_documentService = documentService;
|
_documentService = documentService;
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
_configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -45,6 +50,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
private bool? RetirementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
private bool? RetirementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
|
||||||
|
|
||||||
|
|
@ -61,35 +67,69 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
[HttpGet()]
|
[HttpGet()]
|
||||||
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
|
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
|
||||||
{
|
{
|
||||||
|
var rootId = "";
|
||||||
|
var child1Id = "";
|
||||||
|
var child2Id = "";
|
||||||
|
var child3Id = "";
|
||||||
|
var child4Id = "";
|
||||||
|
var apiUrl = $"{_configuration["API"]}org/profile/keycloak/position";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
var retirementOuts = await _context.RetirementOuts.AsQueryable()
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
.OrderByDescending(x => x.CreatedAt)
|
|
||||||
.Select(p => new
|
|
||||||
{
|
|
||||||
p.Id,
|
|
||||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
|
||||||
p.Profile.FirstName,
|
|
||||||
p.Profile.LastName,
|
|
||||||
position = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.Position == null ? null : p.Profile.Position.Name) : (p.Profile.PositionEmployeePosition == null ? null : p.Profile.PositionEmployeePosition.Name),
|
|
||||||
posNo = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PosNo == null ? null : p.Profile.PosNo.Name) : p.Profile.PosNoEmployee,
|
|
||||||
positionLevel = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name) : (p.Profile.PositionEmployeeLevel == null ? null : p.Profile.PositionEmployeeLevel.Name),
|
|
||||||
p.CreatedAt,
|
|
||||||
p.Organization,
|
|
||||||
p.Reason,
|
|
||||||
p.Status,
|
|
||||||
p.Date,
|
|
||||||
salary = p.AmountOld,
|
|
||||||
p.PositionTypeOld,
|
|
||||||
p.PositionLevelOld,
|
|
||||||
p.PositionNumberOld,
|
|
||||||
p.OrganizationPositionOld,
|
|
||||||
p.IsActive,
|
|
||||||
})
|
|
||||||
.ToListAsync();
|
|
||||||
if (RetirementAdmin == true)
|
|
||||||
retirementOuts.Where(x => x.Status.Trim().ToUpper().Contains("APPROVE"));
|
|
||||||
|
|
||||||
return Success(retirementOuts);
|
if (org == null || org.result == null)
|
||||||
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
rootId = org.result.rootId == null ? "" : org.result.rootId;
|
||||||
|
child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
|
||||||
|
child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
|
||||||
|
child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
|
||||||
|
child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
|
||||||
|
|
||||||
|
var retirementOuts = await _context.RetirementOuts.AsQueryable()
|
||||||
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
|
.Where(x => RetirementAdmin == true ? true : (rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))))
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
p.Id,
|
||||||
|
p.profileId,
|
||||||
|
p.prefix,
|
||||||
|
p.firstName,
|
||||||
|
p.lastName,
|
||||||
|
p.root,
|
||||||
|
p.rootShortName,
|
||||||
|
p.child1,
|
||||||
|
p.child1ShortName,
|
||||||
|
p.child2,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4ShortName,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.position,
|
||||||
|
p.posLevelName,
|
||||||
|
p.posTypeName,
|
||||||
|
p.CreatedAt,
|
||||||
|
p.Organization,
|
||||||
|
p.Reason,
|
||||||
|
p.Status,
|
||||||
|
p.Date,
|
||||||
|
salary = p.AmountOld,
|
||||||
|
p.PositionTypeOld,
|
||||||
|
p.PositionLevelOld,
|
||||||
|
p.PositionNumberOld,
|
||||||
|
p.OrganizationPositionOld,
|
||||||
|
p.IsActive,
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
return Success(retirementOuts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -106,19 +146,27 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
{
|
{
|
||||||
var data = await _context.RetirementOuts.AsQueryable()
|
var data = await _context.RetirementOuts.AsQueryable()
|
||||||
.Where(x => x.Id == id)
|
.Where(x => x.Id == id)
|
||||||
.Where(x => x.Profile != null)
|
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
p.Id,
|
p.Id,
|
||||||
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
|
p.profileId,
|
||||||
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
p.prefix,
|
||||||
p.Profile.FirstName,
|
p.firstName,
|
||||||
p.Profile.LastName,
|
p.lastName,
|
||||||
ProfileId = p.Profile.Id,
|
p.root,
|
||||||
position = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.Position == null ? null : p.Profile.Position.Name) : (p.Profile.PositionEmployeePosition == null ? null : p.Profile.PositionEmployeePosition.Name),
|
p.rootShortName,
|
||||||
posNo = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PosNo == null ? null : p.Profile.PosNo.Name) : p.Profile.PosNoEmployee,
|
p.child1,
|
||||||
positionLevel = p.Profile.ProfileType.Trim().ToUpper().Contains("OFFICER") ? (p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name) : (p.Profile.PositionEmployeeLevel == null ? null : p.Profile.PositionEmployeeLevel.Name),
|
p.child1ShortName,
|
||||||
organizationOrganization = p.Profile.OrganizationOrganization,
|
p.child2,
|
||||||
|
p.child2ShortName,
|
||||||
|
p.child3,
|
||||||
|
p.child3ShortName,
|
||||||
|
p.child4,
|
||||||
|
p.child4ShortName,
|
||||||
|
p.posMasterNo,
|
||||||
|
p.position,
|
||||||
|
p.posLevelName,
|
||||||
|
p.posTypeName,
|
||||||
p.Reason,
|
p.Reason,
|
||||||
p.Status,
|
p.Status,
|
||||||
p.Organization,
|
p.Organization,
|
||||||
|
|
@ -129,37 +177,37 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
p.PositionLevelOld,
|
p.PositionLevelOld,
|
||||||
p.PositionNumberOld,
|
p.PositionNumberOld,
|
||||||
p.OrganizationPositionOld,
|
p.OrganizationPositionOld,
|
||||||
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
||||||
})
|
})
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
var _data = new
|
// var _data = new
|
||||||
{
|
// {
|
||||||
data.Id,
|
// data.Id,
|
||||||
data.PrefixId,
|
// data.PrefixId,
|
||||||
data.Prefix,
|
// data.Prefix,
|
||||||
data.FirstName,
|
// data.FirstName,
|
||||||
data.LastName,
|
// data.LastName,
|
||||||
data.ProfileId,
|
// data.ProfileId,
|
||||||
data.position,
|
// data.position,
|
||||||
data.posNo,
|
// data.posNo,
|
||||||
data.positionLevel,
|
// data.positionLevel,
|
||||||
data.organizationOrganization,
|
// data.organizationOrganization,
|
||||||
data.Reason,
|
// data.Reason,
|
||||||
data.Status,
|
// data.Status,
|
||||||
data.Organization,
|
// data.Organization,
|
||||||
data.Date,
|
// data.Date,
|
||||||
data.salary,
|
// data.salary,
|
||||||
data.CreatedAt,
|
// data.CreatedAt,
|
||||||
data.PositionTypeOld,
|
// data.PositionTypeOld,
|
||||||
data.PositionLevelOld,
|
// data.PositionLevelOld,
|
||||||
data.PositionNumberOld,
|
// data.PositionNumberOld,
|
||||||
data.OrganizationPositionOld,
|
// data.OrganizationPositionOld,
|
||||||
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||||
};
|
// };
|
||||||
|
|
||||||
return Success(_data);
|
return Success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -173,27 +221,27 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
[HttpPost()]
|
[HttpPost()]
|
||||||
public async Task<ActionResult<ResponseObject>> Post([FromForm] RetirementAddProfileRequest req)
|
public async Task<ActionResult<ResponseObject>> Post([FromForm] RetirementAddProfileRequest req)
|
||||||
{
|
{
|
||||||
var profile = await _context.Profiles
|
// var profile = await _context.Profiles
|
||||||
.Include(x => x.PositionLevel)
|
// .Include(x => x.PositionLevel)
|
||||||
.Include(x => x.PositionType)
|
// .Include(x => x.PositionType)
|
||||||
.Include(x => x.PosNo)
|
// .Include(x => x.PosNo)
|
||||||
.Include(x => x.Salaries)
|
// .Include(x => x.Salaries)
|
||||||
.Include(x => x.Position)
|
// .Include(x => x.Position)
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.Id);
|
// .FirstOrDefaultAsync(x => x.Id == req.Id);
|
||||||
if (profile == null)
|
// if (profile == null)
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
// return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
var retirementOut = new RetirementOut
|
var retirementOut = new RetirementOut
|
||||||
{
|
{
|
||||||
Profile = profile,
|
// Profile = profile,
|
||||||
Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
|
// Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
|
||||||
Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
|
// Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
|
||||||
// Date = req.Date,
|
// // Date = req.Date,
|
||||||
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
// AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||||
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
// PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
||||||
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
// PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
||||||
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
// PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
||||||
OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
|
// OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
|
||||||
Status = "WAITTING",
|
Status = "WAITTING",
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
CreatedUserId = UserId ?? "",
|
||||||
|
|
@ -202,6 +250,46 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
};
|
};
|
||||||
|
var apiUrl = $"{_configuration["API"]}org/profile/profileid/position/{req.Id}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
|
||||||
|
|
||||||
|
if (org == null || org.result == null)
|
||||||
|
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
|
||||||
|
|
||||||
|
retirementOut.profileId = org.result.profileId;
|
||||||
|
retirementOut.prefix = org.result.prefix;
|
||||||
|
retirementOut.firstName = org.result.firstName;
|
||||||
|
retirementOut.lastName = org.result.lastName;
|
||||||
|
retirementOut.citizenId = org.result.citizenId;
|
||||||
|
retirementOut.root = org.result.root;
|
||||||
|
retirementOut.rootId = org.result.rootId;
|
||||||
|
retirementOut.rootShortName = org.result.rootShortName;
|
||||||
|
retirementOut.child1 = org.result.child1;
|
||||||
|
retirementOut.child1Id = org.result.child1Id;
|
||||||
|
retirementOut.child1ShortName = org.result.child1ShortName;
|
||||||
|
retirementOut.child2 = org.result.child2;
|
||||||
|
retirementOut.child2Id = org.result.child2Id;
|
||||||
|
retirementOut.child2ShortName = org.result.child2ShortName;
|
||||||
|
retirementOut.child3 = org.result.child3;
|
||||||
|
retirementOut.child3Id = org.result.child3Id;
|
||||||
|
retirementOut.child3ShortName = org.result.child3ShortName;
|
||||||
|
retirementOut.child4 = org.result.child4;
|
||||||
|
retirementOut.child4Id = org.result.child4Id;
|
||||||
|
retirementOut.child4ShortName = org.result.child4ShortName;
|
||||||
|
retirementOut.posMasterNo = org.result.posMasterNo;
|
||||||
|
retirementOut.position = org.result.position;
|
||||||
|
retirementOut.posTypeId = org.result.posTypeId;
|
||||||
|
retirementOut.posTypeName = org.result.posTypeName;
|
||||||
|
retirementOut.posLevelId = org.result.posLevelId;
|
||||||
|
retirementOut.posLevelName = org.result.posLevelName;
|
||||||
|
}
|
||||||
await _context.RetirementOuts.AddAsync(retirementOut);
|
await _context.RetirementOuts.AddAsync(retirementOut);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
|
||||||
39
BMA.EHR.Retirement.Service/Requests/OrgRequest.cs
Normal file
39
BMA.EHR.Retirement.Service/Requests/OrgRequest.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Retirement.Service.Requests
|
||||||
|
{
|
||||||
|
public class OrgRequest
|
||||||
|
{
|
||||||
|
public OrgRequestData result { get; set; } = new();
|
||||||
|
}
|
||||||
|
public class OrgRequestData
|
||||||
|
{
|
||||||
|
public string? profileId { get; set; }
|
||||||
|
public string? prefix { get; set; }
|
||||||
|
public string? firstName { get; set; }
|
||||||
|
public string? lastName { get; set; }
|
||||||
|
public string? citizenId { get; set; }
|
||||||
|
public string? root { get; set; }
|
||||||
|
public string? rootId { get; set; }
|
||||||
|
public string? rootShortName { get; set; }
|
||||||
|
public string? child1 { get; set; }
|
||||||
|
public string? child1Id { get; set; }
|
||||||
|
public string? child1ShortName { get; set; }
|
||||||
|
public string? child2 { get; set; }
|
||||||
|
public string? child2Id { get; set; }
|
||||||
|
public string? child2ShortName { get; set; }
|
||||||
|
public string? child3 { get; set; }
|
||||||
|
public string? child3Id { get; set; }
|
||||||
|
public string? child3ShortName { get; set; }
|
||||||
|
public string? child4 { get; set; }
|
||||||
|
public string? child4Id { get; set; }
|
||||||
|
public string? child4ShortName { get; set; }
|
||||||
|
public int? posMasterNo { get; set; }
|
||||||
|
public string? position { get; set; }
|
||||||
|
public string? posTypeId { get; set; }
|
||||||
|
public string? posTypeName { get; set; }
|
||||||
|
public string? posLevelId { get; set; }
|
||||||
|
public string? posLevelName { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,25 +5,25 @@ namespace BMA.EHR.Retirement.Service.Requests
|
||||||
{
|
{
|
||||||
public class RetirementOtherEditRequest
|
public class RetirementOtherEditRequest
|
||||||
{
|
{
|
||||||
public string CitizenId { get; set; }
|
// public string CitizenId { get; set; }
|
||||||
public Guid PrefixId { get; set; }
|
// public Guid PrefixId { get; set; }
|
||||||
public string Firstname { get; set; }
|
// public string Firstname { get; set; }
|
||||||
public string Lastname { get; set; }
|
// public string Lastname { get; set; }
|
||||||
public DateTime DateOfBirth { get; set; }
|
// public DateTime DateOfBirth { get; set; }
|
||||||
public Guid? GenderId { get; set; }
|
// public Guid? GenderId { get; set; }
|
||||||
public string? Nationality { get; set; }
|
// public string? Nationality { get; set; }
|
||||||
public string? Race { get; set; }
|
// public string? Race { get; set; }
|
||||||
public Guid? ReligionId { get; set; }
|
// public Guid? ReligionId { get; set; }
|
||||||
public Guid? BloodGroupId { get; set; }
|
// public Guid? BloodGroupId { get; set; }
|
||||||
public Guid? RelationshipId { get; set; }
|
// public Guid? RelationshipId { get; set; }
|
||||||
public string? TelephoneNumber { get; set; }
|
// public string? TelephoneNumber { get; set; }
|
||||||
public string? Reason { get; set; }
|
public string? Reason { get; set; }
|
||||||
public string? EducationOld { get; set; }
|
public string? EducationOld { get; set; }
|
||||||
public string? OrganizationPositionOld { get; set; }
|
public string? OrganizationPositionOld { get; set; }
|
||||||
public string? PositionTypeOld { get; set; }
|
public string? PositionTypeOld { get; set; }
|
||||||
public string? PositionLevelOld { get; set; }
|
public string? PositionLevelOld { get; set; }
|
||||||
public string? PositionNumberOld { get; set; }
|
public string? PositionNumberOld { get; set; }
|
||||||
public double? Amount { get; set; }
|
// public double? Amount { get; set; }
|
||||||
public double? AmountOld { get; set; }
|
public double? AmountOld { get; set; }
|
||||||
public DateTime? PositionDate { get; set; }
|
public DateTime? PositionDate { get; set; }
|
||||||
public DateTime? MilitaryDate { get; set; }
|
public DateTime? MilitaryDate { get; set; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue