fix bug #2183
All checks were successful
Build & Deploy Retirement Service / build (push) Successful in 1m56s

This commit is contained in:
harid 2026-03-11 14:01:34 +07:00
parent 6902236f48
commit b1df33dc20
2 changed files with 56 additions and 56 deletions

View file

@ -3104,13 +3104,13 @@ namespace BMA.EHR.Retirement.Service.Controllers
}).ToList(); }).ToList();
var baseAPIOrg = _configuration["API"]; var baseAPIOrg = _configuration["API"];
var reportDone = false; //var reportDone = false;
if (data.Where(profile => profile.Status == "DONE").Any()) //if (data.Where(profile => profile.Status == "DONE").Any())
{ //{
reportDone = true; // reportDone = true;
} //}
if (reportDone == true) //if (reportDone == true)
{ //{
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave"; var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave";
using (var client = new HttpClient()) using (var client = new HttpClient())
{ {
@ -3128,27 +3128,27 @@ namespace BMA.EHR.Retirement.Service.Controllers
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
} }
} }
} //}
else //else
{ //{
var apiUrlOrg = $"{baseAPIOrg}/org/command/cancel-resign"; // var apiUrlOrg = $"{baseAPIOrg}/org/command/cancel-resign";
using (var client = new HttpClient()) // using (var client = new HttpClient())
{ // {
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]); // client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
var _res = await client.PostAsJsonAsync(apiUrlOrg, new // var _res = await client.PostAsJsonAsync(apiUrlOrg, new
{ // {
resignId = resultData.Select(x => x.resignId).ToList(), // resignId = resultData.Select(x => x.resignId).ToList(),
}); // });
var _result = await _res.Content.ReadAsStringAsync(); // var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode) // if (_res.IsSuccessStatusCode)
{ // {
data.ForEach(profile => profile.Status = "DONE"); // data.ForEach(profile => profile.Status = "DONE");
data.ForEach(profile => profile.RetirementResign.Status = "CANCEL"); // data.ForEach(profile => profile.RetirementResign.Status = "CANCEL");
await _context.SaveChangesAsync(); // await _context.SaveChangesAsync();
} // }
} // }
} //}
return Success(); return Success();
} }

View file

@ -2598,14 +2598,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
}).ToList(); }).ToList();
var baseAPIOrg = _configuration["API"]; var baseAPIOrg = _configuration["API"];
var reportDone = false; //var reportDone = false;
if (data.Where(profile => profile.Status == "DONE").Any()) //if (data.Where(profile => profile.Status == "DONE").Any())
{ //{
reportDone = true; // reportDone = true;
} //}
if (reportDone == true) //if (reportDone == true)
{ //{
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-employee-leave"; var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-employee-leave";
using (var client = new HttpClient()) using (var client = new HttpClient())
{ {
@ -2623,27 +2623,27 @@ namespace BMA.EHR.Retirement.Service.Controllers
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
} }
} }
} //}
else //else
{ //{
var apiUrlOrg = $"{baseAPIOrg}/org/command/cancel-resign"; // var apiUrlOrg = $"{baseAPIOrg}/org/command/cancel-resign";
using (var client = new HttpClient()) // using (var client = new HttpClient())
{ // {
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]); // client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
var _res = await client.PostAsJsonAsync(apiUrlOrg, new // var _res = await client.PostAsJsonAsync(apiUrlOrg, new
{ // {
resignId = resultData.Select(x => x.resignId).ToList(), // resignId = resultData.Select(x => x.resignId).ToList(),
}); // });
var _result = await _res.Content.ReadAsStringAsync(); // var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode) // if (_res.IsSuccessStatusCode)
{ // {
data.ForEach(profile => profile.Status = "DONE"); // data.ForEach(profile => profile.Status = "DONE");
data.ForEach(profile => profile.RetirementResignEmployee.Status = "CANCEL"); // data.ForEach(profile => profile.RetirementResignEmployee.Status = "CANCEL");
await _context.SaveChangesAsync(); // await _context.SaveChangesAsync();
} // }
} // }
} //}
return Success(); return Success();
} }