comment AuthPosition

This commit is contained in:
kittapath-Jool 2025-09-14 23:39:16 +07:00
parent eda64c053a
commit 579d82a9df

View file

@ -1594,21 +1594,21 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
// ใช้ dictionary lookup แทน query DB ทีละรอบ
if (!string.IsNullOrEmpty(r.ExamId) && recruitsDict.TryGetValue(r.ExamId, out var recruit))
{
var apiUrl = $"{_configuration["API"]}/org/find/head/officer";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode)
{
var org = JsonConvert.DeserializeObject<dynamic>(_result);
recruit.AuthName = org.result.name == null ? "" : org.result.name;
recruit.AuthPosition = org.result.position == null ? "" : org.result.position;
}
}
// var apiUrl = $"{_configuration["API"]}/org/find/head/officer";
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
// var _res = await client.SendAsync(_req);
// var _result = await _res.Content.ReadAsStringAsync();
// if (_res.IsSuccessStatusCode)
// {
// var org = JsonConvert.DeserializeObject<dynamic>(_result);
// recruit.AuthName = org.result.name == null ? "" : org.result.name;
// recruit.AuthPosition = org.result.position == null ? "" : org.result.position;
// }
// }
r.CitizenId = workSheet?.Cells[row, 3]?.GetValue<string>();