fix issue #854 : ระบบลา (ลูกจ้างฯ) >> รายการขอลาไม่บันทึกในระบบทะเบียนประวัติ
Some checks failed
release-dev / release-dev (push) Failing after 12s
Some checks failed
release-dev / release-dev (push) Failing after 12s
This commit is contained in:
parent
2510009cc6
commit
9cc90131e6
1 changed files with 45 additions and 16 deletions
|
|
@ -553,24 +553,53 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
// };
|
||||
// _appDbContext.Set<ProfileLeave>().Add(profileLeave);
|
||||
var _baseAPI = _configuration["API"];
|
||||
var apiUrlSalary = $"{_baseAPI}/org/profile/leave";
|
||||
using (var client = new HttpClient())
|
||||
var apiUrlSalary = string.Empty;
|
||||
if (profile.ProfileType == "OFFICER")
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||
apiUrlSalary = $"{_baseAPI}/org/profile/leave";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
profileId = profile.Id,
|
||||
leaveTypeId = rawData?.Type?.Id ?? null,
|
||||
dateLeaveStart = rawData.LeaveStartDate,
|
||||
dateLeaveEnd = rawData.LeaveEndDate,
|
||||
totalLeave = 0,//หน้า fe ไม่ได้ใช้
|
||||
leaveCount = 0,//หน้า fe ไม่ได้ใช้
|
||||
leaveDays = rawData.LeaveTotal,
|
||||
status = "approve",
|
||||
reason = rawData.LeaveDetail,
|
||||
});
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||
{
|
||||
profileId = profile.Id,
|
||||
leaveTypeId = rawData?.Type?.Id ?? null,
|
||||
dateLeaveStart = rawData.LeaveStartDate,
|
||||
dateLeaveEnd = rawData.LeaveEndDate,
|
||||
totalLeave = 0,//หน้า fe ไม่ได้ใช้
|
||||
leaveCount = 0,//หน้า fe ไม่ได้ใช้
|
||||
leaveDays = rawData.LeaveTotal,
|
||||
status = "approve",
|
||||
reason = rawData.LeaveDetail,
|
||||
});
|
||||
// var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
}
|
||||
else if (profile.ProfileType == "EMPLOYEE")
|
||||
{
|
||||
apiUrlSalary = $"{_baseAPI}/org/profile-employee/leave";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
|
||||
{
|
||||
profileEmployeeId = profile.Id,
|
||||
leaveTypeId = rawData?.Type?.Id ?? null,
|
||||
dateLeaveStart = rawData.LeaveStartDate,
|
||||
dateLeaveEnd = rawData.LeaveEndDate,
|
||||
totalLeave = 0,
|
||||
leaveCount = 0,
|
||||
leaveDays = rawData.LeaveTotal,
|
||||
status = "approve",
|
||||
reason = rawData.LeaveDetail,
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("ไม่สามารถทำรายการได้");
|
||||
}
|
||||
await _appDbContext.SaveChangesAsync();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue