fix : change add new officer to insignia list
This commit is contained in:
parent
92a162f93e
commit
907b7143ff
2 changed files with 24 additions and 12 deletions
|
|
@ -39,6 +39,8 @@ namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
|
||||||
public string? Gender { get; set; }
|
public string? Gender { get; set; }
|
||||||
|
|
||||||
|
public string ProfileType { get; set; } = string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PosLevel
|
public class PosLevel
|
||||||
|
|
@ -89,9 +91,11 @@ namespace BMA.EHR.Application.Responses.Profiles
|
||||||
|
|
||||||
public string PositionLevel { get; set; } = string.Empty;
|
public string PositionLevel { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string PositionType { get; set; } = string.Empty;
|
public string PositionType { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string Position { get; set; } = string.Empty;
|
public string Position { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ProfileInsignia
|
public class ProfileInsignia
|
||||||
|
|
|
||||||
|
|
@ -1041,10 +1041,13 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
|
|
||||||
|
|
||||||
//var profile = await _context.Profiles.Include(x => x.Salaries).FirstOrDefaultAsync(x => x.Id == req.ProfileId);
|
//var profile = await _context.Profiles.Include(x => x.Salaries).FirstOrDefaultAsync(x => x.Id == req.ProfileId);
|
||||||
var profile = _userProfileRepository.GetOfficerProfileById(req.ProfileId, AccessToken);
|
var profileTest = _userProfileRepository.GetOfficerProfileById(req.ProfileId, AccessToken);
|
||||||
|
|
||||||
if (profile == null)
|
if (profileTest == null)
|
||||||
return Error(GlobalMessages.DataNotFound);
|
return Error(GlobalMessages.DataNotFound);
|
||||||
|
|
||||||
|
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(profileTest.Keycloak ?? Guid.Empty, AccessToken ?? "");
|
||||||
|
|
||||||
var insignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Id == req.insigniaId);
|
var insignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Id == req.insigniaId);
|
||||||
|
|
||||||
if (insignia == null)
|
if (insignia == null)
|
||||||
|
|
@ -1103,6 +1106,15 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var lastInsignia = string.Empty;
|
||||||
|
if (profile.ProfileInsignia != null)
|
||||||
|
{
|
||||||
|
var id = profile.ProfileInsignia.Id ?? Guid.Empty;
|
||||||
|
var insigniaEnt = _insigniaPeriodRepository.GetInsigniaById(id);
|
||||||
|
if (insigniaEnt != null)
|
||||||
|
lastInsignia = insigniaEnt.Name;
|
||||||
|
}
|
||||||
|
|
||||||
await _context.AddAsync(new InsigniaRequestProfile
|
await _context.AddAsync(new InsigniaRequestProfile
|
||||||
{
|
{
|
||||||
Status = "PENDING",
|
Status = "PENDING",
|
||||||
|
|
@ -1112,8 +1124,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
Reason = req.Reason,
|
Reason = req.Reason,
|
||||||
RequestDate = DateTime.Now,
|
RequestDate = DateTime.Now,
|
||||||
MatchingConditions = System.Text.Json.JsonSerializer.Serialize(new List<dynamic>()), // serialize to string
|
MatchingConditions = System.Text.Json.JsonSerializer.Serialize(new List<dynamic>()), // serialize to string
|
||||||
Salary = profile.ProfileSalary == null || profile.ProfileSalary.Count == 0 ? 0 :
|
Salary = profile.ProfileSalary == null ? 0 : profile.ProfileSalary.Amount, //profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||||
profile.ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().Amount, //profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
CreatedUserId = UserId ?? "",
|
||||||
CreatedAt = DateTime.Now,
|
CreatedAt = DateTime.Now,
|
||||||
|
|
@ -1133,13 +1144,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
Gender = profile.Gender,
|
Gender = profile.Gender,
|
||||||
PosTypeName = profile.PosType!.PosTypeName,
|
PosTypeName = profile.PosType!.PosTypeName,
|
||||||
PosLevelName = profile.PosLevel!.PosLevelName,
|
PosLevelName = profile.PosLevel!.PosLevelName,
|
||||||
PosNo = profile.ProfileSalary == null || profile.ProfileSalary.Count == 0 ? "" :
|
PosNo = profile.ProfileSalary == null ? "" : profile.ProfileSalary.PosNo,
|
||||||
profile.ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().PosNo,
|
Amount = profile.ProfileSalary == null ? 0 : profile.ProfileSalary.Amount,
|
||||||
Amount = profile.ProfileSalary == null || profile.ProfileSalary.Count == 0 ? 0 :
|
PositionSalaryAmount = profile.ProfileSalary == null ? 0 : profile.ProfileSalary.PositionSalaryAmount,
|
||||||
profile.ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
LastInsigniaName = lastInsignia
|
||||||
PositionSalaryAmount = profile.ProfileSalary == null || profile.ProfileSalary.Count == 0 ? 0 :
|
|
||||||
profile.ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
|
|
||||||
LastInsigniaName = ""
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue