ออกคำสั่งวินัย
This commit is contained in:
parent
7556a6c400
commit
be98975ce0
10 changed files with 17496 additions and 68 deletions
|
|
@ -17,6 +17,8 @@ using Microsoft.EntityFrameworkCore;
|
|||
using Microsoft.Extensions.Configuration;
|
||||
using Newtonsoft.Json;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using System.Net.Http.Json;
|
||||
using Command = BMA.EHR.Domain.Models.Commands.Core.Command;
|
||||
using Profile = BMA.EHR.Domain.Models.HR.Profile;
|
||||
|
||||
|
|
@ -1396,11 +1398,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
foreach (var d in response!.result)
|
||||
{
|
||||
if (commandType == null || commandType.Id != d.CommandId)
|
||||
if (commandType == null || commandType.Id != d.commandId)
|
||||
continue;
|
||||
var pf = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == d.id);
|
||||
.FirstOrDefaultAsync(x => x.Id == d.personId);
|
||||
|
||||
if (pf != null)
|
||||
{
|
||||
|
|
@ -1412,6 +1414,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
FirstName = pf.FirstName!,
|
||||
LastName = pf.LastName!,
|
||||
RefPlacementProfileId = pf.Id,
|
||||
RefDisciplineId = d.id,
|
||||
Amount = 0,
|
||||
};
|
||||
seq++;
|
||||
|
|
@ -1497,11 +1500,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
foreach (var d in response!.result)
|
||||
{
|
||||
if (commandType == null || commandType.Id != d.CommandId)
|
||||
if (commandType == null || commandType.Id != d.commandId)
|
||||
continue;
|
||||
var pf = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == d.id);
|
||||
.FirstOrDefaultAsync(x => x.Id == d.personId);
|
||||
|
||||
if (pf != null)
|
||||
{
|
||||
|
|
@ -1513,6 +1516,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
FirstName = pf.FirstName!,
|
||||
LastName = pf.LastName!,
|
||||
RefPlacementProfileId = pf.Id,
|
||||
RefDisciplineId = d.id,
|
||||
Amount = 0,
|
||||
};
|
||||
seq++;
|
||||
|
|
@ -1799,11 +1803,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var seq = 1;
|
||||
foreach (var d in response!.result)
|
||||
{
|
||||
if (commandType == null || commandType.Id != d.CommandId)
|
||||
if (commandType == null || commandType.Id != d.commandId)
|
||||
continue;
|
||||
var pf = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == d.id);
|
||||
.FirstOrDefaultAsync(x => x.Id == d.personId);
|
||||
|
||||
if (pf != null)
|
||||
{
|
||||
|
|
@ -1815,6 +1819,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
FirstName = pf.FirstName!,
|
||||
LastName = pf.LastName!,
|
||||
RefPlacementProfileId = pf.Id,
|
||||
RefDisciplineId = d.id,
|
||||
};
|
||||
seq++;
|
||||
|
||||
|
|
@ -1861,11 +1866,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var seq = 1;
|
||||
foreach (var d in response!.result)
|
||||
{
|
||||
if (commandType == null || commandType.Id != d.CommandId)
|
||||
if (commandType == null || commandType.Id != d.commandId)
|
||||
continue;
|
||||
var pf = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == d.id);
|
||||
.FirstOrDefaultAsync(x => x.Id == d.personId);
|
||||
|
||||
if (pf != null)
|
||||
{
|
||||
|
|
@ -1877,6 +1882,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
FirstName = pf.FirstName!,
|
||||
LastName = pf.LastName!,
|
||||
RefPlacementProfileId = pf.Id,
|
||||
RefDisciplineId = d.id,
|
||||
};
|
||||
seq++;
|
||||
|
||||
|
|
@ -1923,11 +1929,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var seq = 1;
|
||||
foreach (var d in response!.result)
|
||||
{
|
||||
if (commandType == null || commandType.Id != d.CommandId)
|
||||
if (commandType == null || commandType.Id != d.commandId)
|
||||
continue;
|
||||
var pf = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == d.id);
|
||||
.FirstOrDefaultAsync(x => x.Id == d.personId);
|
||||
|
||||
if (pf != null)
|
||||
{
|
||||
|
|
@ -1939,6 +1945,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
FirstName = pf.FirstName!,
|
||||
LastName = pf.LastName!,
|
||||
RefPlacementProfileId = pf.Id,
|
||||
RefDisciplineId = d.id,
|
||||
};
|
||||
seq++;
|
||||
|
||||
|
|
@ -1985,11 +1992,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var seq = 1;
|
||||
foreach (var d in response!.result)
|
||||
{
|
||||
if (commandType == null || commandType.Id != d.CommandId)
|
||||
if (commandType == null || commandType.Id != d.commandId)
|
||||
continue;
|
||||
var pf = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == d.id);
|
||||
.FirstOrDefaultAsync(x => x.Id == d.personId);
|
||||
|
||||
if (pf != null)
|
||||
{
|
||||
|
|
@ -2001,6 +2008,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
FirstName = pf.FirstName!,
|
||||
LastName = pf.LastName!,
|
||||
RefPlacementProfileId = pf.Id,
|
||||
RefDisciplineId = d.id,
|
||||
};
|
||||
seq++;
|
||||
|
||||
|
|
@ -2047,11 +2055,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var seq = 1;
|
||||
foreach (var d in response!.result)
|
||||
{
|
||||
if (commandType == null || commandType.Id != d.CommandId)
|
||||
if (commandType == null || commandType.Id != d.commandId)
|
||||
continue;
|
||||
var pf = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == d.id);
|
||||
.FirstOrDefaultAsync(x => x.Id == d.personId);
|
||||
|
||||
if (pf != null)
|
||||
{
|
||||
|
|
@ -2063,6 +2071,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
FirstName = pf.FirstName!,
|
||||
LastName = pf.LastName!,
|
||||
RefPlacementProfileId = pf.Id,
|
||||
RefDisciplineId = d.id,
|
||||
};
|
||||
seq++;
|
||||
|
||||
|
|
@ -2109,11 +2118,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var seq = 1;
|
||||
foreach (var d in response!.result)
|
||||
{
|
||||
if (commandType == null || commandType.Id != d.CommandId)
|
||||
if (commandType == null || commandType.Id != d.commandId)
|
||||
continue;
|
||||
var pf = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == d.id);
|
||||
.FirstOrDefaultAsync(x => x.Id == d.personId);
|
||||
|
||||
if (pf != null)
|
||||
{
|
||||
|
|
@ -2125,6 +2134,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
FirstName = pf.FirstName!,
|
||||
LastName = pf.LastName!,
|
||||
RefPlacementProfileId = pf.Id,
|
||||
RefDisciplineId = d.id,
|
||||
};
|
||||
seq++;
|
||||
|
||||
|
|
@ -2171,11 +2181,11 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var seq = 1;
|
||||
foreach (var d in response!.result)
|
||||
{
|
||||
if (commandType == null || commandType.Id != d.CommandId)
|
||||
if (commandType == null || commandType.Id != d.commandId)
|
||||
continue;
|
||||
var pf = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == d.id);
|
||||
.FirstOrDefaultAsync(x => x.Id == d.personId);
|
||||
|
||||
if (pf != null)
|
||||
{
|
||||
|
|
@ -2187,6 +2197,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
FirstName = pf.FirstName!,
|
||||
LastName = pf.LastName!,
|
||||
RefPlacementProfileId = pf.Id,
|
||||
RefDisciplineId = d.id,
|
||||
};
|
||||
seq++;
|
||||
|
||||
|
|
@ -2232,7 +2243,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
var pf = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Prefix)
|
||||
.FirstOrDefaultAsync(x => x.Id == d.id);
|
||||
.FirstOrDefaultAsync(x => x.Id == d.personId);
|
||||
|
||||
if (pf != null)
|
||||
{
|
||||
|
|
@ -2244,6 +2255,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
FirstName = pf.FirstName!,
|
||||
LastName = pf.LastName!,
|
||||
RefPlacementProfileId = pf.Id,
|
||||
RefDisciplineId = d.id,
|
||||
};
|
||||
seq++;
|
||||
|
||||
|
|
@ -2264,7 +2276,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
#region " Execute and Deploy "
|
||||
|
||||
private async Task ExecuteCommandByTypeAsync(Command command)
|
||||
private async Task ExecuteCommandByTypeAsync(Command command, string token = "")
|
||||
{
|
||||
switch (command.CommandType.CommandCode.Trim().ToUpper())
|
||||
{
|
||||
|
|
@ -2321,10 +2333,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
await ExecuteCommand18Async(command);
|
||||
break;
|
||||
case "C-PM-19":
|
||||
await ExecuteCommand19Async(command);
|
||||
await ExecuteCommand19Async(command, token);
|
||||
break;
|
||||
case "C-PM-20":
|
||||
await ExecuteCommand20Async(command);
|
||||
await ExecuteCommand20Async(command, token);
|
||||
break;
|
||||
case "C-PM-21":
|
||||
await ExecuteCommand21Async(command);
|
||||
|
|
@ -2338,30 +2350,30 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
case "C-PM-24":
|
||||
await ExecuteCommand24Async(command);
|
||||
break;
|
||||
// case "C-PM-25":
|
||||
// await ExecuteCommand25Async(command);
|
||||
// break;
|
||||
// case "C-PM-26":
|
||||
// await ExecuteCommand26Async(command);
|
||||
// break;
|
||||
// case "C-PM-27":
|
||||
// await ExecuteCommand27Async(command);
|
||||
// break;
|
||||
// case "C-PM-28":
|
||||
// await ExecuteCommand28Async(command);
|
||||
// break;
|
||||
// case "C-PM-29":
|
||||
// await ExecuteCommand29Async(command);
|
||||
// break;
|
||||
// case "C-PM-30":
|
||||
// await ExecuteCommand30Async(command);
|
||||
// break;
|
||||
// case "C-PM-31":
|
||||
// await ExecuteCommand31Async(command);
|
||||
// break;
|
||||
// case "C-PM-32":
|
||||
// await ExecuteCommand32Async(command);
|
||||
// break;
|
||||
case "C-PM-25":
|
||||
await ExecuteCommand25Async(command, token);
|
||||
break;
|
||||
case "C-PM-26":
|
||||
await ExecuteCommand26Async(command, token);
|
||||
break;
|
||||
case "C-PM-27":
|
||||
await ExecuteCommand27Async(command, token);
|
||||
break;
|
||||
case "C-PM-28":
|
||||
await ExecuteCommand28Async(command, token);
|
||||
break;
|
||||
case "C-PM-29":
|
||||
await ExecuteCommand29Async(command, token);
|
||||
break;
|
||||
case "C-PM-30":
|
||||
await ExecuteCommand30Async(command, token);
|
||||
break;
|
||||
case "C-PM-31":
|
||||
await ExecuteCommand31Async(command, token);
|
||||
break;
|
||||
case "C-PM-32":
|
||||
await ExecuteCommand32Async(command, token);
|
||||
break;
|
||||
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
|
||||
}
|
||||
|
||||
|
|
@ -6442,7 +6454,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
private async Task ExecuteCommand19Async(Command command)
|
||||
private async Task ExecuteCommand19Async(Command command, string token = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -6575,6 +6587,22 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
var dataSend = command.Receivers.Select(x => new
|
||||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = dataSend });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
// send cc noti inbox
|
||||
foreach (var cc in command.Deployments)
|
||||
{
|
||||
|
|
@ -6631,7 +6659,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
private async Task ExecuteCommand20Async(Command command)
|
||||
private async Task ExecuteCommand20Async(Command command, string token = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -6764,6 +6792,22 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
var dataSend = command.Receivers.Select(x => new
|
||||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = dataSend });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
// send cc noti inbox
|
||||
foreach (var cc in command.Deployments)
|
||||
{
|
||||
|
|
@ -7575,6 +7619,262 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// C-PM-25 - xxxx
|
||||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
private async Task ExecuteCommand25Async(Command command, string token = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = command.Receivers.Select(x => new
|
||||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/stop/resume";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// C-PM-26 - xxxx
|
||||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
private async Task ExecuteCommand26Async(Command command, string token = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = command.Receivers.Select(x => new
|
||||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/stop/resume";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// C-PM-27 - xxxx
|
||||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
private async Task ExecuteCommand27Async(Command command, string token = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = command.Receivers.Select(x => new
|
||||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// C-PM-28 - xxxx
|
||||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
private async Task ExecuteCommand28Async(Command command, string token = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = command.Receivers.Select(x => new
|
||||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// C-PM-29 - xxxx
|
||||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
private async Task ExecuteCommand29Async(Command command, string token = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = command.Receivers.Select(x => new
|
||||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// C-PM-30 - xxxx
|
||||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
private async Task ExecuteCommand30Async(Command command, string token = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = command.Receivers.Select(x => new
|
||||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/down/resume";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// C-PM-31 - xxxx
|
||||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
private async Task ExecuteCommand31Async(Command command, string token = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = command.Receivers.Select(x => new
|
||||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/down/resume";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// C-PM-32 - xxxx
|
||||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
private async Task ExecuteCommand32Async(Command command, string token = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = command.Receivers.Select(x => new
|
||||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/reject/resume";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Regenerate Json File "
|
||||
|
|
@ -7646,7 +7946,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
#region " Execute Command "
|
||||
|
||||
public async Task ExecuteCommandAsync(Guid id)
|
||||
public async Task ExecuteCommandAsync(Guid id, string token = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -7661,7 +7961,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
if (command == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
else
|
||||
await ExecuteCommandByTypeAsync(command);
|
||||
await ExecuteCommandByTypeAsync(command, token);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -7747,6 +8047,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
FirstName = item.FirstName!,
|
||||
LastName = item.LastName!,
|
||||
RefPlacementProfileId = item.RefPlacementProfileId,
|
||||
RefDisciplineId = item.RefDisciplineId,
|
||||
Amount = salary == null ? 0 : salary.SalaryAmount,
|
||||
MouthSalaryAmount = salary == null ? 0 : salary.MonthSalaryAmount,
|
||||
PositionSalaryAmount = salary == null ? 0 : salary.PositionSalaryAmount
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
public class DisciplineDataResponse
|
||||
{
|
||||
public Guid id { get; set; } = Guid.Empty;
|
||||
|
||||
public Guid? CommandId { get; set; } = Guid.Empty;
|
||||
public Guid personId { get; set; } = Guid.Empty;
|
||||
public Guid? commandId { get; set; } = Guid.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue