เพิ่ม Param leaveId และ เรียก api ยกเลิกการลาในทะเบียนประวัติ #1492
This commit is contained in:
parent
249911b931
commit
42bdb66440
1 changed files with 39 additions and 2 deletions
|
|
@ -482,6 +482,24 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
_appDbContext.Set<Notification>().Add(noti);
|
_appDbContext.Set<Notification>().Add(noti);
|
||||||
await _appDbContext.SaveChangesAsync();
|
await _appDbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
||||||
|
var _baseAPI = _configuration["API"];
|
||||||
|
var apiUrlSalary = $"{_baseAPI}/org/profile/leave/cancel/{data.Id}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
|
||||||
|
var request = new HttpRequestMessage(HttpMethod.Patch, apiUrlSalary);
|
||||||
|
|
||||||
|
// ส่ง request
|
||||||
|
var _res = await client.SendAsync(request);
|
||||||
|
if (!_res.IsSuccessStatusCode)
|
||||||
|
throw new Exception("ไม่สามารถอัพเดตการยกเลิกรายการลาไปยังระบบทะเบียนประวัติ");
|
||||||
|
//var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|
@ -527,6 +545,23 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
};
|
};
|
||||||
_appDbContext.Set<Notification>().Add(noti);
|
_appDbContext.Set<Notification>().Add(noti);
|
||||||
await _appDbContext.SaveChangesAsync();
|
await _appDbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
var _baseAPI = _configuration["API"];
|
||||||
|
var apiUrlSalary = $"{_baseAPI}/org/profile/leave/cancel/{rawData.Id}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
|
||||||
|
var request = new HttpRequestMessage(HttpMethod.Patch, apiUrlSalary);
|
||||||
|
|
||||||
|
// ส่ง request
|
||||||
|
var _res = await client.SendAsync(request);
|
||||||
|
if (!_res.IsSuccessStatusCode)
|
||||||
|
throw new Exception("ไม่สามารถอัพเดตการยกเลิกรายการลาไปยังระบบทะเบียนประวัติ");
|
||||||
|
//var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task RejectCancelLeaveRequestAsync(Guid id, string Reason)
|
public async Task RejectCancelLeaveRequestAsync(Guid id, string Reason)
|
||||||
|
|
@ -939,6 +974,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
leaveDays = rawData.LeaveTotal,
|
leaveDays = rawData.LeaveTotal,
|
||||||
status = "approve",
|
status = "approve",
|
||||||
reason = rawData.LeaveDetail,
|
reason = rawData.LeaveDetail,
|
||||||
|
leaveId = rawData.Id,
|
||||||
});
|
});
|
||||||
// var _result = await _res.Content.ReadAsStringAsync();
|
// var _result = await _res.Content.ReadAsStringAsync();
|
||||||
}
|
}
|
||||||
|
|
@ -961,6 +997,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
||||||
leaveDays = rawData.LeaveTotal,
|
leaveDays = rawData.LeaveTotal,
|
||||||
status = "approve",
|
status = "approve",
|
||||||
reason = rawData.LeaveDetail,
|
reason = rawData.LeaveDetail,
|
||||||
|
leaveId = rawData.Id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue