Merge branch 'develop' into work

This commit is contained in:
Kittapath 2023-10-12 14:37:53 +07:00
commit e3fb50932a
14 changed files with 385 additions and 41 deletions

View file

@ -1948,6 +1948,7 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = oc == null ? Guid.Empty : oc.Id,
PositionId = position!.Id,
PositionLevel = placementProfile.PositionLevel,
PositionLineId = placementProfile.PositionLine!.Id,
@ -2228,6 +2229,8 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = oc == null ? Guid.Empty : oc.Id,
PositionId = position!.Id,
PositionLevel = placementProfile.PositionLevel,
PositionLineId = placementProfile.PositionLine!.Id,
PositionTypeId = placementProfile.PositionType!.Id,
@ -2265,6 +2268,28 @@ namespace BMA.EHR.Application.Repositories.Commands
profile.Salaries.Add(salary);
// change profile position
var profilePosition = await _dbContext.Set<ProfilePosition>()
.Include(x => x.Profile)
.Include(x => x.OrganizationPosition)
.FirstOrDefaultAsync(x => x.Profile!.Id == profile.Id);
if (profilePosition == null)
{
profilePosition = new ProfilePosition
{
Profile = profile,
OrganizationPosition = placementProfile.OrganizationPosition,
IsActive = true,
IsPublished = true,
};
_dbContext.Set<ProfilePosition>().Add(profilePosition);
}
else
{
profilePosition.OrganizationPosition = placementProfile.OrganizationPosition;
//_dbContext.Attatch(profilePosition);
}
// update placementstatus
placementProfile.PlacementStatus = "CONTAIN";
@ -2481,6 +2506,8 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = oc == null ? Guid.Empty : oc.Id,
PositionId = position!.Id,
PositionLevel = placementProfile.PositionLevel,
PositionLineId = placementProfile.PositionLine!.Id,
PositionTypeId = placementProfile.PositionType!.Id,
@ -2518,6 +2545,28 @@ namespace BMA.EHR.Application.Repositories.Commands
profile.Salaries.Add(salary);
// change profile position
var profilePosition = await _dbContext.Set<ProfilePosition>()
.Include(x => x.Profile)
.Include(x => x.OrganizationPosition)
.FirstOrDefaultAsync(x => x.Profile!.Id == profile.Id);
if (profilePosition == null)
{
profilePosition = new ProfilePosition
{
Profile = profile,
OrganizationPosition = placementProfile.OrganizationPosition,
IsActive = true,
IsPublished = true,
};
_dbContext.Set<ProfilePosition>().Add(profilePosition);
}
else
{
profilePosition.OrganizationPosition = placementProfile.OrganizationPosition;
//_dbContext.Attatch(profilePosition);
}
// update placementstatus
placementProfile.PlacementStatus = "CONTAIN";
@ -2711,6 +2760,8 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = oc == null ? Guid.Empty : oc.Id,
PositionId = position!.Id,
PositionLevel = placementProfile.PositionLevel,
PositionLineId = placementProfile.PositionLine!.Id,
PositionTypeId = placementProfile.PositionType!.Id,
@ -2748,6 +2799,28 @@ namespace BMA.EHR.Application.Repositories.Commands
profile.Salaries.Add(salary);
// change profile position
var profilePosition = await _dbContext.Set<ProfilePosition>()
.Include(x => x.Profile)
.Include(x => x.OrganizationPosition)
.FirstOrDefaultAsync(x => x.Profile!.Id == profile.Id);
if (profilePosition == null)
{
profilePosition = new ProfilePosition
{
Profile = profile,
OrganizationPosition = placementProfile.OrganizationPosition,
IsActive = true,
IsPublished = true,
};
_dbContext.Set<ProfilePosition>().Add(profilePosition);
}
else
{
profilePosition.OrganizationPosition = placementProfile.OrganizationPosition;
//_dbContext.Attatch(profilePosition);
}
// update placementstatus
placementProfile.Status = "DONE";
@ -2941,6 +3014,8 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = oc == null ? Guid.Empty : oc.Id,
PositionId = position!.Id,
PositionLevel = placementProfile.PositionLevel,
PositionLineId = placementProfile.PositionLine!.Id,
PositionTypeId = placementProfile.PositionType!.Id,
@ -2978,6 +3053,28 @@ namespace BMA.EHR.Application.Repositories.Commands
profile.Salaries.Add(salary);
// change profile position
var profilePosition = await _dbContext.Set<ProfilePosition>()
.Include(x => x.Profile)
.Include(x => x.OrganizationPosition)
.FirstOrDefaultAsync(x => x.Profile!.Id == profile.Id);
if (profilePosition == null)
{
profilePosition = new ProfilePosition
{
Profile = profile,
OrganizationPosition = placementProfile.OrganizationPosition,
IsActive = true,
IsPublished = true,
};
_dbContext.Set<ProfilePosition>().Add(profilePosition);
}
else
{
profilePosition.OrganizationPosition = placementProfile.OrganizationPosition;
//_dbContext.Attatch(profilePosition);
}
// update placementstatus
placementProfile.Status = "DONE";
@ -3171,6 +3268,8 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = oc == null ? Guid.Empty : oc.Id,
PositionId = position!.Id,
PositionLevel = placementProfile.PositionLevel,
PositionLineId = placementProfile.PositionLine!.Id,
PositionTypeId = placementProfile.PositionType!.Id,
@ -3208,6 +3307,28 @@ namespace BMA.EHR.Application.Repositories.Commands
profile.Salaries.Add(salary);
// change profile position
var profilePosition = await _dbContext.Set<ProfilePosition>()
.Include(x => x.Profile)
.Include(x => x.OrganizationPosition)
.FirstOrDefaultAsync(x => x.Profile!.Id == profile.Id);
if (profilePosition == null)
{
profilePosition = new ProfilePosition
{
Profile = profile,
OrganizationPosition = placementProfile.OrganizationPosition,
IsActive = true,
IsPublished = true,
};
_dbContext.Set<ProfilePosition>().Add(profilePosition);
}
else
{
profilePosition.OrganizationPosition = placementProfile.OrganizationPosition;
//_dbContext.Attatch(profilePosition);
}
// update placementstatus
placementProfile.Status = "DONE";
@ -3409,6 +3530,8 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = lastSarary.OcId,
PositionId = lastSarary.PositionId,
PositionLevel = lastSarary.PositionLevel,
PositionLineId = lastSarary.PositionLineId,
PositionTypeId = lastSarary.PositionTypeId,
@ -3446,6 +3569,16 @@ namespace BMA.EHR.Application.Repositories.Commands
profile.Salaries.Add(salary);
// add profile position
var profilePosition = new ProfilePosition
{
Profile = profile,
OrganizationPosition = placementProfile.OrganizationPosition,
IsActive = true,
IsPublished = true,
};
_dbContext.Set<ProfilePosition>().Add(profilePosition);
// update placementstatus
placementProfile.Status = "DONE";
@ -3656,6 +3789,8 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = lastSarary.OcId,
PositionId = lastSarary.PositionId,
PositionLevel = lastSarary.PositionLevel,
PositionLineId = lastSarary.PositionLineId,
PositionTypeId = lastSarary.PositionTypeId,
@ -3693,6 +3828,16 @@ namespace BMA.EHR.Application.Repositories.Commands
profile.Salaries.Add(salary);
// add profile position
var profilePosition = new ProfilePosition
{
Profile = profile,
OrganizationPosition = placementProfile.OrganizationPosition,
IsActive = true,
IsPublished = true,
};
_dbContext.Set<ProfilePosition>().Add(profilePosition);
// update placementstatus
placementProfile.Status = "DONE";
@ -3828,6 +3973,7 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = lastSarary.OcId,
PositionId = lastSarary.PositionId,
PositionLevel = lastSarary.PositionLevel,
PositionLineId = lastSarary.PositionLineId,
@ -4003,6 +4149,7 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = lastSarary.OcId,
PositionId = lastSarary.PositionId,
PositionLevel = lastSarary.PositionLevel,
PositionLineId = lastSarary.PositionLineId,
@ -4181,6 +4328,7 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = lastSarary.OcId,
PositionId = lastSarary.PositionId,
PositionLevel = lastSarary.PositionLevel,
PositionLineId = lastSarary.PositionLineId,
@ -4219,6 +4367,14 @@ namespace BMA.EHR.Application.Repositories.Commands
data.Salaries.Add(salary);
// remove profile position
var profilePosition = await _dbContext.Set<ProfilePosition>()
.Include(x => x.Profile)
.Include(x => x.OrganizationPosition)
.FirstOrDefaultAsync(x => x.Profile!.Id == data.Id);
if (profilePosition != null)
_dbContext.Set<ProfilePosition>().Remove(profilePosition);
// update placementstatus
//data.Status = "DONE";
@ -4361,6 +4517,7 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = lastSarary.OcId,
PositionId = lastSarary.PositionId,
PositionLevel = lastSarary.PositionLevel,
PositionLineId = lastSarary.PositionLineId,
@ -4399,6 +4556,14 @@ namespace BMA.EHR.Application.Repositories.Commands
data.Profile.Salaries.Add(salary);
// remove profile position
var profilePosition = await _dbContext.Set<ProfilePosition>()
.Include(x => x.Profile)
.Include(x => x.OrganizationPosition)
.FirstOrDefaultAsync(x => x.Profile!.Id == data.Id);
if (profilePosition != null)
_dbContext.Set<ProfilePosition>().Remove(profilePosition);
// update placementstatus
//data.Status = "DONE";
@ -4483,7 +4648,7 @@ namespace BMA.EHR.Application.Repositories.Commands
}
/// <summary>
/// C-PM-14 - คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ
/// C-PM-14 - คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
@ -4683,6 +4848,7 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = oc == null ? Guid.Empty : oc.Id,
PositionId = position!.Id,
PositionLevel = placementProfile.PositionLevel,
PositionLineId = placementProfile.PositionLine!.Id,
@ -4890,6 +5056,8 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = lastSarary.OcId,
PositionId = lastSarary.PositionId,
PositionLevel = lastSarary.PositionLevel,
PositionLineId = lastSarary.PositionLineId,
PositionTypeId = lastSarary.PositionTypeId,
@ -5069,6 +5237,8 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = lastSarary.OcId,
PositionId = lastSarary.PositionId,
PositionLevel = lastSarary.PositionLevel,
PositionLineId = lastSarary.PositionLineId,
PositionTypeId = lastSarary.PositionTypeId,
@ -5248,6 +5418,7 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = lastSarary.OcId,
PositionId = lastSarary.PositionId,
PositionLevel = lastSarary.PositionLevel,
PositionLineId = lastSarary.PositionLineId,
@ -5286,6 +5457,14 @@ namespace BMA.EHR.Application.Repositories.Commands
data.Profile.Salaries.Add(salary);
// remove profile position
var profilePosition = await _dbContext.Set<ProfilePosition>()
.Include(x => x.Profile)
.Include(x => x.OrganizationPosition)
.FirstOrDefaultAsync(x => x.Profile!.Id == data.Profile.Id);
if (profilePosition != null)
_dbContext.Set<ProfilePosition>().Remove(profilePosition);
// update placementstatus
data.Status = "DONE";
@ -5428,6 +5607,7 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = lastSarary.OcId,
PositionId = lastSarary.PositionId,
PositionLevel = lastSarary.PositionLevel,
PositionLineId = lastSarary.PositionLineId,
@ -5466,6 +5646,14 @@ namespace BMA.EHR.Application.Repositories.Commands
data.Profile.Salaries.Add(salary);
// remove profile position
var profilePosition = await _dbContext.Set<ProfilePosition>()
.Include(x => x.Profile)
.Include(x => x.OrganizationPosition)
.FirstOrDefaultAsync(x => x.Profile!.Id == data.Profile.Id);
if (profilePosition != null)
_dbContext.Set<ProfilePosition>().Remove(profilePosition);
// update placementstatus
data.Status = "DONE";
@ -5550,7 +5738,7 @@ namespace BMA.EHR.Application.Repositories.Commands
}
/// <summary>
/// C-PM-19 - คำสั่งให้ออกจากราชการ
/// C-PM-19 - คำสั่งปลดออกจากราชการ
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
@ -5608,6 +5796,7 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = lastSarary.OcId,
PositionId = lastSarary.PositionId,
PositionLevel = lastSarary.PositionLevel,
PositionLineId = lastSarary.PositionLineId,
@ -5646,6 +5835,14 @@ namespace BMA.EHR.Application.Repositories.Commands
data.Profile.Salaries.Add(salary);
// remove profile position
var profilePosition = await _dbContext.Set<ProfilePosition>()
.Include(x => x.Profile)
.Include(x => x.OrganizationPosition)
.FirstOrDefaultAsync(x => x.Profile!.Id == data.Profile.Id);
if (profilePosition != null)
_dbContext.Set<ProfilePosition>().Remove(profilePosition);
// update placementstatus
data.Status = "DONE";
@ -5730,7 +5927,7 @@ namespace BMA.EHR.Application.Repositories.Commands
}
/// <summary>
/// C-PM-20 - คำสั่งให้ออกจากราชการ
/// C-PM-20 - คำสั่งไล่ออกจากราชการ
/// </summary>
/// <param name="command">object ของรายการคำสั่ง</param>
/// <returns></returns>
@ -5788,6 +5985,7 @@ namespace BMA.EHR.Application.Repositories.Commands
OcId = lastSarary.OcId,
PositionId = lastSarary.PositionId,
PositionLevel = lastSarary.PositionLevel,
PositionLineId = lastSarary.PositionLineId,
@ -5826,6 +6024,14 @@ namespace BMA.EHR.Application.Repositories.Commands
data.Profile.Salaries.Add(salary);
// remove profile position
var profilePosition = await _dbContext.Set<ProfilePosition>()
.Include(x => x.Profile)
.Include(x => x.OrganizationPosition)
.FirstOrDefaultAsync(x => x.Profile!.Id == data.Profile.Id);
if (profilePosition != null)
_dbContext.Set<ProfilePosition>().Remove(profilePosition);
// update placementstatus
data.Status = "DONE";

View file

@ -311,6 +311,84 @@ namespace BMA.EHR.Application.Repositories.Reports
}
#endregion
#region
public async Task<object> GetResignByUser(Guid id)
{
var data = await _dbContext.Set<RetirementResign>().AsQueryable()
.Where(x => x.Id == id)
.Select(p => new
{
p.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,
ProfileId = p.Profile.Id,
p.Location,
p.SendDate,
p.ActiveDate,
p.Reason,
p.Status,
salary = p.AmountOld,
p.ApproveReason,
p.RejectReason,
p.IsActive,
p.CreatedAt,
p.PositionTypeOld,
p.PositionLevelOld,
p.PositionNumberOld,
p.OrganizationPositionOld,
p.OligarchReject,
p.OligarchApproveReason,
p.OligarchRejectReason,
p.OligarchRejectDate,
p.CommanderReject,
p.CommanderApproveReason,
p.CommanderRejectReason,
p.CommanderRejectDate,
p.RemarkHorizontal,
})
.FirstOrDefaultAsync();
if (data == null)
return null;
var _data = new
{
data.Id,
data.ProfileId,
data.Prefix,
data.FirstName,
data.LastName,
data.Location,
FullName = $"{data.Prefix}{data.FirstName} {data.LastName}",
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(),
data.Reason,
data.Status,
data.salary,
data.PositionTypeOld,
data.PositionLevelOld,
data.PositionNumberOld,
data.OrganizationPositionOld,
data.ApproveReason,
data.RejectReason,
data.IsActive,
data.CreatedAt,
data.OligarchReject,
data.OligarchApproveReason,
data.OligarchRejectReason,
OligarchRejectDate = string.IsNullOrEmpty(data.OligarchRejectDate.ToString()) ? string.Empty : DateTime.Parse(data.OligarchRejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
data.CommanderReject,
data.CommanderApproveReason,
data.CommanderRejectReason,
CommanderRejectDate = string.IsNullOrEmpty(data.CommanderRejectDate.ToString()) ? string.Empty : DateTime.Parse(data.CommanderRejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
data.RemarkHorizontal,
};
return _data;
}
#endregion
#endregion
}
}