noti วินัย
This commit is contained in:
parent
9e513d3f1a
commit
ae990c0c5f
21 changed files with 244 additions and 1508 deletions
|
|
@ -10913,7 +10913,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
try
|
||||
{
|
||||
var orgIdSend = new List<Guid>() { Guid.Parse("08dc31bb-0707-4ce0-82fd-7e76903e9fca"), Guid.Parse("08dc30ee-2be8-40d0-81bf-b3f2f52dc0ad") };
|
||||
var orgIdSend = new List<Guid>() { Guid.Parse("") };
|
||||
var profiles = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Prefix)
|
||||
.Include(x => x.Gender)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Json;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Domain.Models.Discipline;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using BMA.EHR.Application.Requests;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories
|
||||
{
|
||||
|
|
@ -13,33 +18,60 @@ namespace BMA.EHR.Application.Repositories
|
|||
private readonly IDisciplineDbContext _dbDisContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly IConfiguration _configuration;
|
||||
public DisciplineRepository(IApplicationDBContext dbContext,
|
||||
IDisciplineDbContext dbDisContext,
|
||||
NotificationRepository repositoryNoti,
|
||||
IConfiguration configuration,
|
||||
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_dbDisContext = dbDisContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
//เรื่องร้องเรียน
|
||||
public async Task NotifyDisciplineComplaint()
|
||||
{
|
||||
var cronjobNotis = await _dbDisContext.Set<DisciplineComplaint>()
|
||||
.Include(x => x.DisciplineComplaint_Profiles)
|
||||
.Where(x => x.DateNotification != null)
|
||||
.Where(x => x.DateNotification.Value.Date == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director";
|
||||
var refId = new List<Guid>();
|
||||
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(apiUrlOrg, new
|
||||
{
|
||||
refId = cronjobNoti.DisciplineComplaint_Profiles.Select(x => x.PersonId),
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
var org = JsonConvert.DeserializeObject<DirectorRequest>(_result);
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
refId = org.result.Select(x => Guid.Parse(x.id)).ToList();
|
||||
}
|
||||
}
|
||||
await _repositoryNoti.PushNotificationsAsync(
|
||||
refId.ToArray(),
|
||||
$"แจ้งเตือนบันทึกข้อมูลร้องเรียนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}",
|
||||
$"แจ้งเตือนบันทึกข้อมูลร้องเรียนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}"
|
||||
);
|
||||
$"แจ้งเตือนบันทึกข้อมูลร้องเรียนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}",
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
|
@ -47,16 +79,39 @@ namespace BMA.EHR.Application.Repositories
|
|||
public async Task NotifyDisciplineInvestigate()
|
||||
{
|
||||
var cronjobNotis = await _dbDisContext.Set<DisciplineInvestigate>()
|
||||
.Include(x => x.DisciplineInvestigate_ProfileComplaints)
|
||||
.Where(x => x.InvestigationDateEnd != null && x.InvestigationDateEnd.Value.Date.AddDays(-7) == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director";
|
||||
var refId = new List<Guid>();
|
||||
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(apiUrlOrg, new
|
||||
{
|
||||
refId = cronjobNoti.DisciplineInvestigate_ProfileComplaints.Select(x => x.PersonId),
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
var org = JsonConvert.DeserializeObject<DirectorRequest>(_result);
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
refId = org.result.Select(x => Guid.Parse(x.id)).ToList();
|
||||
}
|
||||
}
|
||||
await _repositoryNoti.PushNotificationsAsync(
|
||||
refId.ToArray(),
|
||||
$"แจ้งเตือนบันทึกข้อมูลสืบสวนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}",
|
||||
$"แจ้งเตือนบันทึกข้อมูลสืบสวนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}"
|
||||
);
|
||||
$"แจ้งเตือนบันทึกข้อมูลสืบสวนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}",
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
true
|
||||
);
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
|
@ -65,16 +120,39 @@ namespace BMA.EHR.Application.Repositories
|
|||
public async Task NotifyDisciplineDisciplinary()
|
||||
{
|
||||
var cronjobNotis = await _dbDisContext.Set<DisciplineDisciplinary>()
|
||||
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates)
|
||||
.Where(x => x.DisciplinaryDateEnd != null && x.DisciplinaryDateEnd.Value.Date.AddDays(-7) == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director";
|
||||
var refId = new List<Guid>();
|
||||
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(apiUrlOrg, new
|
||||
{
|
||||
refId = cronjobNoti.DisciplineDisciplinary_ProfileComplaintInvestigates.Select(x => x.PersonId),
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
var org = JsonConvert.DeserializeObject<DirectorRequest>(_result);
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
refId = org.result.Select(x => Guid.Parse(x.id)).ToList();
|
||||
}
|
||||
}
|
||||
await _repositoryNoti.PushNotificationsAsync(
|
||||
refId.ToArray(),
|
||||
$"แจ้งเตือนบันทึกข้อมูลสอบสวนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}",
|
||||
$"แจ้งเตือนบันทึกข้อมูลสอบสวนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}"
|
||||
);
|
||||
$"แจ้งเตือนบันทึกข้อมูลสอบสวนก่อนวันสิ้นสุดเรื่อง {cronjobNoti.Title}",
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
true
|
||||
);
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,49 +104,6 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
_appContext.Set<Notification>().Add(noti);
|
||||
await _appContext.SaveChangesAsync();
|
||||
|
||||
|
||||
//var profile_id = profile == null ? Guid.Empty : profile.Id;
|
||||
|
||||
//var rootOc = _userProfileRepository.GetRootOcId(profile_id, AccessToken);
|
||||
//var approver = string.Empty;
|
||||
//var list = new List<OrganizationApproverResponse>();
|
||||
//if (rootOc != null)
|
||||
//{
|
||||
// list = await _commandRepository.GetOrgApproverAsync(rootOc ?? Guid.Empty);
|
||||
//}
|
||||
//if (list.Count > 0)
|
||||
//{
|
||||
// var appr = list.FirstOrDefault();
|
||||
|
||||
// // send inbox and notification
|
||||
// var subject_str = $"มีการขออนุมัติลงเวลากรณีพิเศษ";
|
||||
// var body_str = $"โปรดพิจารณาคำร้องขอลงเวลาในกรณีพิเศษจาก {profile.Prefix}{profile.FirstName} {profile.LastName} ในวันที่ {entity.CheckDate.Date.ToThaiShortDate2()}";
|
||||
|
||||
// var subject = subject_str;
|
||||
// var body = body_str;
|
||||
// _emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
|
||||
|
||||
// var inbox = new Inbox
|
||||
// {
|
||||
// Subject = subject_str,
|
||||
// Body = body_str,
|
||||
// ReceiverUserId = appr.Id == Guid.Empty ? Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6") : appr.Id,
|
||||
// Payload = "",
|
||||
// };
|
||||
// _appContext.Set<Inbox>().Add(inbox);
|
||||
|
||||
// var noti = new Notification
|
||||
// {
|
||||
// Body = body_str,
|
||||
// ReceiverUserId = appr.Id == Guid.Empty ? Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6") : appr.Id,
|
||||
// Type = "",
|
||||
// Payload = "",
|
||||
// };
|
||||
// _appContext.Set<Notification>().Add(noti);
|
||||
// await _appContext.SaveChangesAsync();
|
||||
//}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
var org = JsonConvert.DeserializeObject<ResultRequest>(_result);
|
||||
if (org != null && org.result != null)
|
||||
if (org != null && org.result != null && org.result != "")
|
||||
_emailSenderService.SendMail(Subject, Body, org.result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,24 +251,6 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
p.posMasterNo,
|
||||
p.posLevelName,
|
||||
p.posTypeName,
|
||||
|
||||
// ProfileId = p.Profile.Id,
|
||||
// Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
|
||||
// PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
|
||||
// p.Profile.FirstName,
|
||||
// p.Profile.LastName,
|
||||
// Position = p.Profile.Position == null ? null : p.Profile.Position.Name,
|
||||
// PositionId = p.Profile.Position == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Position.Id,
|
||||
// PositionType = p.Profile.PositionType == null ? null : p.Profile.PositionType.Name,
|
||||
// PositionTypeId = p.Profile.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionType.Id,
|
||||
// p.Profile.PositionLine,
|
||||
// p.Profile.PositionLineId,
|
||||
// PositionLevel = p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name,
|
||||
// PositionLevelId = p.Profile.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionLevel.Id,
|
||||
// p.Profile.PositionExecutive,
|
||||
// p.Profile.PositionExecutiveId,
|
||||
// Organization = p.Profile.Oc,
|
||||
// OrganizationId = p.Profile.OcId,
|
||||
p.position,
|
||||
p.Number,
|
||||
p.Date,
|
||||
|
|
|
|||
|
|
@ -49,11 +49,6 @@ namespace BMA.EHR.Application.Repositories
|
|||
cronjobNoti.Profile.IsLeave = true;
|
||||
cronjobNoti.Profile.LeaveReason = "DISCHARGE";
|
||||
cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}"
|
||||
// );
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
|
@ -72,11 +67,6 @@ namespace BMA.EHR.Application.Repositories
|
|||
cronjobNoti.Profile.IsLeave = true;
|
||||
cronjobNoti.Profile.LeaveReason = "DISMISS";
|
||||
cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}"
|
||||
// );
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
|
@ -90,17 +80,6 @@ namespace BMA.EHR.Application.Repositories
|
|||
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
|
||||
.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var cronjobNoti in cronjobNotis)
|
||||
{
|
||||
//cronjobNoti.Profile.IsLeave = true;
|
||||
//cronjobNoti.Profile.LeaveReason = "LAYOFF";
|
||||
//cronjobNoti.Profile.LeaveDate = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",
|
||||
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}"
|
||||
// );
|
||||
}
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
|
|
|||
13
BMA.EHR.Application/Requests/DirectorRequest.cs
Normal file
13
BMA.EHR.Application/Requests/DirectorRequest.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Application.Requests
|
||||
{
|
||||
public class DirectorRequest
|
||||
{
|
||||
public DirectorRequestData[] result { get; set; }
|
||||
}
|
||||
public class DirectorRequestData
|
||||
{
|
||||
public string id { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ using System.Security.Claims;
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||
{
|
||||
|
|
@ -31,11 +32,13 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly PermissionRepository _permission;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public DisciplineComplaintController(DisciplineDbContext context,
|
||||
MinIODisciplineService documentService,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IConfiguration configuration,
|
||||
PermissionRepository permission)
|
||||
{
|
||||
// _repository = repository;
|
||||
|
|
@ -44,13 +47,14 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
_httpContextAccessor = httpContextAccessor;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_permission = permission;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private string? token => _httpContextAccessor.HttpContext.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -372,15 +376,6 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
|
||||
$"มีคำขอร้องเรียนเรื่อง {req.title}",
|
||||
$"มีคำขอร้องเรียนเรื่อง {req.title}",
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
true
|
||||
);
|
||||
await _context.DisciplineComplaints.AddAsync(disciplineComplaint);
|
||||
await _context.SaveChangesAsync();
|
||||
return Success(disciplineComplaint.Id);
|
||||
|
|
@ -679,6 +674,33 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
|||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director";
|
||||
var refId = new List<Guid>();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
refId = persons.Select(x => x.PersonId),
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
var org = JsonConvert.DeserializeObject<DirectorRequest>(_result);
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
refId = org.result.Select(x => Guid.Parse(x.id)).ToList();
|
||||
}
|
||||
}
|
||||
await _repositoryNoti.PushNotificationsAsync(
|
||||
refId.ToArray(),
|
||||
$"มีคำขอสืบสวนเรื่อง {data.Title}",
|
||||
$"มีคำขอสืบสวนเรื่อง {data.Title}",
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
data.DisciplineInvestigates.Add(disciplineInvestigate);
|
||||
await _context.SaveChangesAsync();
|
||||
|
|
|
|||
|
|
@ -395,8 +395,23 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
|||
}
|
||||
}
|
||||
}
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director";
|
||||
var refId = new List<Guid>();
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var __res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
refId = new List<Guid> { id },
|
||||
});
|
||||
var __result = await __res.Content.ReadAsStringAsync();
|
||||
var __org = JsonConvert.DeserializeObject<DirectorRequest>(__result);
|
||||
if (__res.IsSuccessStatusCode)
|
||||
{
|
||||
refId = __org.result.Select(x => Guid.Parse(x.id)).ToList();
|
||||
}
|
||||
await _repositoryNoti.PushNotificationsAsync(
|
||||
refId.ToArray(),
|
||||
$"มีคำขอยื่นอุทธรณ์/ร้องทุกข์จาก {req.Fullname}",
|
||||
$"มีคำขอยื่นอุทธรณ์/ร้องทุกข์จาก {req.Fullname}",
|
||||
"",
|
||||
|
|
@ -482,14 +497,34 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
|||
}
|
||||
}
|
||||
}
|
||||
// await _repositoryNoti.PushNotificationAsyncV2(
|
||||
// req.ProfileId,
|
||||
// $"เจ้าหน้าที่ได้ทำการสร้างคำร้องอุทธรณ์ร้องทุกข์",
|
||||
// $"เจ้าหน้าที่ได้ทำการสร้างคำร้องอุทธรณ์ร้องทุกข์",
|
||||
// "",
|
||||
// true,
|
||||
// true
|
||||
// );
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director";
|
||||
var refId = new List<Guid>();
|
||||
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var __res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
refId = new List<Guid> { Guid.Parse(req.ProfileId) },
|
||||
});
|
||||
var __result = await __res.Content.ReadAsStringAsync();
|
||||
var __org = JsonConvert.DeserializeObject<DirectorRequest>(__result);
|
||||
if (__res.IsSuccessStatusCode)
|
||||
{
|
||||
refId = __org.result.Select(x => Guid.Parse(x.id)).ToList();
|
||||
}
|
||||
await _repositoryNoti.PushNotificationsAsync(
|
||||
refId.ToArray(),
|
||||
$"มีคำขอยื่นอุทธรณ์/ร้องทุกข์จาก {req.Fullname}",
|
||||
$"มีคำขอยื่นอุทธรณ์/ร้องทุกข์จาก {req.Fullname}",
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
true
|
||||
);
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
return Success(disciplineComplaint_Appeal.Id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
private readonly DisciplineDbContext _context;
|
||||
private readonly MinIODisciplineService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly PermissionRepository _permission;
|
||||
|
||||
public DisciplineDisciplinaryController(DisciplineDbContext context,
|
||||
MinIODisciplineService documentService,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
PermissionRepository permission)
|
||||
{
|
||||
|
|
@ -39,6 +41,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_permission = permission;
|
||||
}
|
||||
|
||||
|
|
@ -97,309 +100,6 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// get รายการวินัยเรื่องร้องเรียน
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpGet("complaint/{id:guid}")]
|
||||
// public async Task<ActionResult<ResponseObject>> GetByDisciplineDisciplinaryComplaint(Guid id)
|
||||
// {
|
||||
// var _data = await _context.DisciplineDisciplinarys
|
||||
// .Select(x => new
|
||||
// {
|
||||
// Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
||||
// IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน
|
||||
// IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
// RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||
// Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Select(p => new
|
||||
// {
|
||||
// Id = p.Id,
|
||||
// Idcard = p.CitizenId,
|
||||
// Name = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
||||
// Prefix = p.Prefix,
|
||||
// FirstName = p.FirstName,
|
||||
// LastName = p.LastName,
|
||||
// Position = p.Position,
|
||||
// PositionLevel = p.PositionLevel,
|
||||
// Salary = p.Salary,
|
||||
// PersonId = p.PersonId,
|
||||
// PosNo = p.PosNo,
|
||||
// Organization = p.Organization,
|
||||
// IsSend = p.IsReport,
|
||||
// }),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
||||
// OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
||||
// ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
||||
// Title = x.Title,//ชื่อเรื่อง
|
||||
// Description = x.Description,//รายละเอียด
|
||||
// DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
||||
// LevelConsideration = x.LevelConsideration,//ระดับการพัฒนา
|
||||
// DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||
// OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||
// DateNotification = x.DateNotification,//วันแจ้งเตือนล่วงหน้า
|
||||
// ComplaintFrom = x.ComplaintFrom,//รับเรื่องสืบสวนจาก
|
||||
// Appellant = x.Appellant,//ผู้ถูกสืบสวน
|
||||
// Result = x.ResultComplaint,//ผลการตรวจสอบ
|
||||
// Status = x.Status,//สถานะเรื่องสืบสวน
|
||||
// DisciplineDisciplinaryDocComplaintInvestigates = x.DisciplineDisciplinary_DocComplaintInvestigates.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
// })
|
||||
// .Where(x => x.Id == id)
|
||||
// .FirstOrDefaultAsync();
|
||||
// if (_data == null)
|
||||
// return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
|
||||
// var disciplineDisciplinaryDocComplaintInvestigates = new List<dynamic>();
|
||||
// foreach (var doc in _data.DisciplineDisciplinaryDocComplaintInvestigates)
|
||||
// {
|
||||
// var _doc = new
|
||||
// {
|
||||
// doc.Id,
|
||||
// doc.FileName,
|
||||
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||
// };
|
||||
// disciplineDisciplinaryDocComplaintInvestigates.Add(_doc);
|
||||
// }
|
||||
// var data = new
|
||||
// {
|
||||
// _data.Id,
|
||||
// _data.IdInvestigate,
|
||||
// _data.IdComplaint,
|
||||
// _data.RespondentType,
|
||||
// _data.Persons,
|
||||
// _data.OrganizationId,
|
||||
// _data.ConsideredAgency,
|
||||
// _data.Title,
|
||||
// _data.Description,
|
||||
// _data.DateReceived,
|
||||
// _data.LevelConsideration,
|
||||
// _data.DateConsideration,
|
||||
// _data.OffenseDetails,
|
||||
// _data.DateNotification,
|
||||
// _data.ComplaintFrom,
|
||||
// _data.Appellant,
|
||||
// _data.Result,
|
||||
// _data.Status,
|
||||
// disciplineDisciplinaryDocComplaintInvestigates,
|
||||
// };
|
||||
// return Success(data);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// แก้ไขรายการวินัยเรื่องร้องเรียน
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpPut("complaint/{id:guid}")]
|
||||
// public async Task<ActionResult<ResponseObject>> UpdateDisciplineDisciplinaryComplaint([FromBody] DisciplineDisciplinaryComplaintRequest req, Guid id)
|
||||
// {
|
||||
// var data = await _context.DisciplineDisciplinarys.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates).Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||
// if (data == null)
|
||||
// return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
// if (data.Status.Trim().ToUpper() != "NEW")
|
||||
// return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
|
||||
|
||||
// data.Title = req.title;
|
||||
// data.Description = req.description;
|
||||
// data.OffenseDetails = req.offenseDetails.Trim().ToUpper();
|
||||
// data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
// data.LastUpdateUserId = UserId ?? "";
|
||||
// data.LastUpdatedAt = DateTime.Now;
|
||||
// // var hisprofile = data.DisciplineDisciplinary_ProfileComplaintInvestigates;
|
||||
// // _context.DisciplineDisciplinary_ProfileComplaintInvestigates.RemoveRange(data.DisciplineDisciplinary_ProfileComplaintInvestigates);
|
||||
// // if (data.RespondentType.Trim().ToUpper() == "PERSON")
|
||||
// // {
|
||||
// // foreach (var item in req.persons)
|
||||
// // {
|
||||
// // var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
|
||||
// // data.DisciplineDisciplinary_ProfileComplaintInvestigates.Add(
|
||||
// // new DisciplineDisciplinary_ProfileComplaintInvestigate
|
||||
// // {
|
||||
// // CitizenId = item.idcard,
|
||||
// // Prefix = item.prefix,
|
||||
// // FirstName = item.firstName,
|
||||
// // LastName = item.lastName,
|
||||
// // Organization = item.organization,
|
||||
// // Position = item.position,
|
||||
// // PositionLevel = item.positionLevel,
|
||||
// // Salary = item.salary,
|
||||
// // PersonId = item.personId,
|
||||
// // PosNo = item.posNo,
|
||||
// // Status = "NEW",
|
||||
// // IsReport = isReport == null ? false : isReport.IsReport,
|
||||
// // CreatedFullName = FullName ?? "System Administrator",
|
||||
// // CreatedUserId = UserId ?? "",
|
||||
// // CreatedAt = DateTime.Now,
|
||||
// // LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// // LastUpdateUserId = UserId ?? "",
|
||||
// // LastUpdatedAt = DateTime.Now,
|
||||
// // }
|
||||
// // );
|
||||
// // }
|
||||
// // }
|
||||
// await _context.SaveChangesAsync();
|
||||
// return Success(data.Id);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// get รายการวินัยเรื่องสืบสวน
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpGet("investigate/{id:guid}")]
|
||||
// public async Task<ActionResult<ResponseObject>> GetByDisciplineDisciplinaryInvestigate(Guid id)
|
||||
// {
|
||||
// var _data = await _context.DisciplineDisciplinarys
|
||||
// .Select(x => new
|
||||
// {
|
||||
// Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
||||
// IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน
|
||||
// IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
// InvestigationDetail = x.InvestigationDetail,
|
||||
// InvestigationDetailOther = x.InvestigationDetailOther,
|
||||
// InvestigationDateStart = x.InvestigationDateStart,
|
||||
// InvestigationDateEnd = x.InvestigationDateEnd,
|
||||
// InvestigationDescription = x.InvestigationDescription,
|
||||
// InvestigationStatusResult = x.InvestigationStatusResult,
|
||||
// InvestigationCauseText = x.InvestigationCauseText,
|
||||
// InvestigationExtendStatus = x.InvestigationExtendStatus,
|
||||
// InvestigationDaysExtend = x.InvestigationDaysExtend,
|
||||
// Status = x.Status,//สถานะเรื่องสืบสวน
|
||||
// Result = x.Result,//ผลการตรวจสอบ
|
||||
// Director = x.DisciplineDisciplinary_DirectorInvestigates.Select(d => new
|
||||
// {
|
||||
// DirectorId = d.Id,
|
||||
// Id = d.DisciplineDirector.Id,
|
||||
// Prefix = d.DisciplineDirector.Prefix,
|
||||
// FirstName = d.DisciplineDirector.FirstName,
|
||||
// LastName = d.DisciplineDirector.LastName,
|
||||
// Position = d.DisciplineDirector.Position,
|
||||
// Email = d.DisciplineDirector.Email,
|
||||
// Duty = "",
|
||||
// Phone = d.DisciplineDirector.Phone,
|
||||
// // Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
||||
// }).ToList(),
|
||||
// DisciplineDisciplinaryDocInvestigates = x.DisciplineDisciplinary_DocInvestigates.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
// DisciplineDisciplinaryDocInvestigateRelevants = x.DisciplineDisciplinary_DocInvestigateRelevants.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
// })
|
||||
// .Where(x => x.Id == id)
|
||||
// .FirstOrDefaultAsync();
|
||||
// if (_data == null)
|
||||
// return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
|
||||
// var disciplineDisciplinaryDocInvestigates = new List<dynamic>();
|
||||
// foreach (var doc in _data.DisciplineDisciplinaryDocInvestigates)
|
||||
// {
|
||||
// var _doc = new
|
||||
// {
|
||||
// doc.Id,
|
||||
// doc.FileName,
|
||||
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||
// };
|
||||
// disciplineDisciplinaryDocInvestigates.Add(_doc);
|
||||
// }
|
||||
|
||||
// var disciplineDisciplinaryDocInvestigateRelevants = new List<dynamic>();
|
||||
// foreach (var doc in _data.DisciplineDisciplinaryDocInvestigateRelevants)
|
||||
// {
|
||||
// var _doc = new
|
||||
// {
|
||||
// doc.Id,
|
||||
// doc.FileName,
|
||||
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||
// };
|
||||
// disciplineDisciplinaryDocInvestigateRelevants.Add(_doc);
|
||||
// }
|
||||
// var data = new
|
||||
// {
|
||||
// _data.Id,
|
||||
// _data.IdInvestigate,
|
||||
// _data.IdComplaint,
|
||||
// _data.InvestigationDetail,
|
||||
// _data.InvestigationDetailOther,
|
||||
// _data.InvestigationDateStart,
|
||||
// _data.InvestigationDateEnd,
|
||||
// _data.InvestigationDescription,
|
||||
// _data.InvestigationStatusResult,
|
||||
// _data.InvestigationCauseText,
|
||||
// _data.InvestigationExtendStatus,
|
||||
// _data.InvestigationDaysExtend,
|
||||
// _data.Status,
|
||||
// _data.Result,
|
||||
// _data.Director,
|
||||
// disciplineDisciplinaryDocInvestigates,
|
||||
// disciplineDisciplinaryDocInvestigateRelevants,
|
||||
// };
|
||||
// return Success(data);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// แก้ไขรายการวินัยเรื่องสืบสวน
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpPut("investigate/{id:guid}")]
|
||||
// public async Task<ActionResult<ResponseObject>> UpdateDisciplineDisciplinaryInvestigate([FromBody] DisciplineDisciplinaryInvestigateRequest req, Guid id)
|
||||
// {
|
||||
// var data = await _context.DisciplineDisciplinarys
|
||||
// .Include(x => x.DisciplineDisciplinary_DirectorInvestigates)
|
||||
// .ThenInclude(x => x.DisciplineDirector)
|
||||
// .Where(x => x.Id == id)
|
||||
// .FirstOrDefaultAsync();
|
||||
// if (data == null)
|
||||
// return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
// if (data.Status.Trim().ToUpper() != "NEW")
|
||||
// return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
|
||||
|
||||
// data.InvestigationDetail = req.investigationDetail.Trim().ToUpper();
|
||||
// data.InvestigationDetailOther = req.investigationDetailOther;
|
||||
// data.InvestigationDateStart = req.investigationDateStart;
|
||||
// data.InvestigationDateEnd = req.investigationDateEnd;
|
||||
// data.InvestigationDescription = req.investigationDescription;
|
||||
// data.InvestigationStatusResult = req.investigationStatusResult.Trim().ToUpper();
|
||||
// data.InvestigationCauseText = req.investigationCauseText.Trim().ToUpper();
|
||||
// data.InvestigationExtendStatus = req.investigationExtendStatus;
|
||||
// data.InvestigationDaysExtend = req.investigationDaysExtend;
|
||||
// data.Result = req.result;
|
||||
// data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
// data.LastUpdateUserId = UserId ?? "";
|
||||
// data.LastUpdatedAt = DateTime.Now;
|
||||
// _context.DisciplineDisciplinary_DirectorInvestigates.RemoveRange(data.DisciplineDisciplinary_DirectorInvestigates);
|
||||
// foreach (var item in req.directors)
|
||||
// {
|
||||
// var director = await _context.DisciplineDirectors.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == item);
|
||||
// if (director != null)
|
||||
// {
|
||||
// data.DisciplineDisciplinary_DirectorInvestigates.Add(
|
||||
// new DisciplineDisciplinary_DirectorInvestigate
|
||||
// {
|
||||
// DisciplineDirector = director,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// await _context.SaveChangesAsync();
|
||||
// return Success(data.Id);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// get รายการวินัยเรื่องสอบสวน
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ using System.Security.Claims;
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using System.Net.Http.Headers;
|
||||
|
||||
namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
||||
{
|
||||
|
|
@ -28,25 +29,31 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
private readonly DisciplineDbContext _context;
|
||||
private readonly MinIODisciplineService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly PermissionRepository _permission;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public DisciplineInvestigateController(DisciplineDbContext context,
|
||||
MinIODisciplineService documentService,
|
||||
NotificationRepository repositoryNoti,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IConfiguration configuration,
|
||||
PermissionRepository permission)
|
||||
{
|
||||
// _repository = repository;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_permission = permission;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
private string? token => _httpContextAccessor.HttpContext.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -786,20 +793,33 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
LastUpdatedAt = DateTime.Now,
|
||||
});
|
||||
}
|
||||
// foreach (var item in data.DisciplineInvestigate_Directors)
|
||||
// {
|
||||
// disciplineDisciplinary.DisciplineDisciplinary_DirectorInvestigates.Add(
|
||||
// new DisciplineDisciplinary_DirectorInvestigate
|
||||
// {
|
||||
// DisciplineDirector = item.DisciplineDirector,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// });
|
||||
// }
|
||||
var baseAPIOrg = _configuration["API"];
|
||||
var apiUrlOrg = $"{baseAPIOrg}/org/workflow/find/director";
|
||||
var refId = new List<Guid>();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
|
||||
{
|
||||
refId = persons.Select(x => x.PersonId),
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
var org = JsonConvert.DeserializeObject<DirectorRequest>(_result);
|
||||
if (_res.IsSuccessStatusCode)
|
||||
{
|
||||
refId = org.result.Select(x => Guid.Parse(x.id)).ToList();
|
||||
}
|
||||
}
|
||||
await _repositoryNoti.PushNotificationsAsync(
|
||||
refId.ToArray(),
|
||||
$"มีคำขอสอบสวนเรื่อง {data.Title}",
|
||||
$"มีคำขอสอบสวนเรื่อง {data.Title}",
|
||||
"",
|
||||
"",
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
data.DisciplineDisciplinarys.Add(disciplineDisciplinary);
|
||||
await _context.SaveChangesAsync();
|
||||
|
|
|
|||
13
BMA.EHR.Discipline.Service/Requests/DirectorRequest.cs
Normal file
13
BMA.EHR.Discipline.Service/Requests/DirectorRequest.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Discipline.Service.Requests
|
||||
{
|
||||
public class DirectorRequest
|
||||
{
|
||||
public DirectorRequestData[] result { get; set; }
|
||||
}
|
||||
public class DirectorRequestData
|
||||
{
|
||||
public string id { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -34,6 +34,13 @@
|
|||
"SecretKey": "rVPzB05giC7bA400cUuIThzT4T9SGCcpcmL3tBBg",
|
||||
"BucketName": "bma-ehr-fpt"
|
||||
},
|
||||
"Mail": {
|
||||
"Server": "smtp.gmail.com",
|
||||
"User": "suphonchai.ph@gmail.com",
|
||||
"Password": "nnjazjcnwhepkxdm",
|
||||
"MailFrom": "suphonchai.ph@gmail.com",
|
||||
"Port": "587"
|
||||
},
|
||||
"KeycloakCron": {
|
||||
"Hour": "08",
|
||||
"Minute": "00"
|
||||
|
|
|
|||
|
|
@ -98,8 +98,6 @@ namespace BMA.EHR.Infrastructure.MessageQueue
|
|||
if (organization == null)
|
||||
continue;
|
||||
|
||||
//if(organization.Id != Guid.Parse("e8493cd1-d371-402e-add6-566e68d5d1b3")) continue;
|
||||
|
||||
var result = await insigniaRepo.GetInsigniaRequest(periodId, organization.Id);
|
||||
if (result != null)
|
||||
{
|
||||
|
|
@ -110,7 +108,7 @@ namespace BMA.EHR.Infrastructure.MessageQueue
|
|||
if (requestStatus == null)
|
||||
{
|
||||
// บันทึกรายชื่อ
|
||||
await insigniaRepo.InsertCandidate(period, organization.Id,organization.OrgRootName, candidate);
|
||||
await insigniaRepo.InsertCandidate(period, organization.Id, organization.OrgRootName, candidate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -583,13 +583,6 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
posTypeName = placementTransfer.posTypeNameOld,
|
||||
});
|
||||
}
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dbc953-6268-4e2c-80a3-aca65eedc6d0"),
|
||||
// $"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำขอโอน",
|
||||
// $"{profile.Prefix?.Name}{profile.FirstName} {profile.LastName} ได้ทำการยื่นคำขอโอนไปยัง {req.Organization}",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success(placementTransfer.Id);
|
||||
|
|
@ -661,20 +654,6 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
uppdated.LastUpdatedAt = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dbc953-6268-4e2c-80a3-aca65eedc6d0"),
|
||||
// $"{uppdated.Profile.Prefix?.Name}{uppdated.Profile.FirstName} {uppdated.Profile.LastName} ได้ทำการยื่นคำขอโอนได้รับการอนุมัติ",
|
||||
// $"{uppdated.Profile.Prefix?.Name}{uppdated.Profile.FirstName} {uppdated.Profile.LastName} ได้ทำการยื่นคำขอโอนไปยัง {uppdated.Organization}ได้รับการอนุมัติ",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
|
||||
// $"{uppdated.Profile.Prefix?.Name}{uppdated.Profile.FirstName} {uppdated.Profile.LastName} ได้ทำการยื่นคำขอโอน",
|
||||
// $"{uppdated.Profile.Prefix?.Name}{uppdated.Profile.FirstName} {uppdated.Profile.LastName} ได้ทำการยื่นคำขอโอนไปยัง {uppdated.Organization}ได้รับการอนุมัติ",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
|
|||
|
|
@ -52,47 +52,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
var avatar = await _service.GetExamAvatarCandidateAsync(Id);
|
||||
if (candidate != null)
|
||||
{
|
||||
//var mimeType = "";
|
||||
//switch (exportType.Trim().ToLower())
|
||||
//{
|
||||
// case "pdf": mimeType = "application/pdf"; break;
|
||||
// case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
// case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||
//}
|
||||
|
||||
//var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"ผลสอบคัดเลือกรายบุคคล.trdp");
|
||||
//ReportPackager reportPacker = new ReportPackager();
|
||||
//Telerik.Reporting.Report? report = null;
|
||||
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
//{
|
||||
// report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
|
||||
//}
|
||||
//report.DataSource = candidate;
|
||||
|
||||
//var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
||||
//tblData.DataSource = careers;
|
||||
|
||||
//Console.WriteLine("000000");
|
||||
//if (avatar != Guid.Parse("00000000-0000-0000-0000-000000000000"))
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// // Get avatar Image
|
||||
var picContent = avatar == null ? null : await _minIOExamService.ImagesPath(avatar);
|
||||
//var pictureBox = (Telerik.Reporting.PictureBox)report.Items["detailSection1"].Items["picAvatar"];
|
||||
//pictureBox.Value = Image.FromStream(new MemoryStream(picContent.FileContent));
|
||||
// }
|
||||
// catch { }
|
||||
//}
|
||||
|
||||
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
//{
|
||||
// ReportDocument = report,
|
||||
//};
|
||||
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
//RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
|
||||
//return File(result.DocumentBytes, mimeType, $"ใบสมัครสอบคัดเลือก.{exportType.Trim().ToLower()}");
|
||||
var mapData = new
|
||||
{
|
||||
Id = candidate.GetType().GetProperty("Id").GetValue(candidate),
|
||||
|
|
@ -145,7 +105,8 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
Careers = careers,
|
||||
};
|
||||
|
||||
var data = new {
|
||||
var data = new
|
||||
{
|
||||
template = "ผลสอบคัดเลือกรายบุคคล",
|
||||
reportName = "docx-report",
|
||||
data = mapData
|
||||
|
|
|
|||
|
|
@ -167,7 +167,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
PathName = p.Document == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Document.Id,
|
||||
p.IsActive,
|
||||
p.CreatedAt,
|
||||
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
|
|
@ -201,7 +200,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
PathName = data.PathName == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.PathName),
|
||||
data.IsActive,
|
||||
data.CreatedAt,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
};
|
||||
|
||||
return Success(_data);
|
||||
|
|
|
|||
|
|
@ -235,66 +235,12 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
p.PositionOld,
|
||||
p.OrganizationOld,
|
||||
p.PositionDate,
|
||||
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
||||
// RetirementOtherDocs = p.RetirementOtherDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
CommandType = p.CommandType == null ? null : p.CommandType.Name,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
// var retirementOtherDocs = new List<dynamic>();
|
||||
// foreach (var doc in data.RetirementOtherDocs)
|
||||
// {
|
||||
// var _doc = new
|
||||
// {
|
||||
// doc.FileName,
|
||||
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||
// };
|
||||
// retirementOtherDocs.Add(_doc);
|
||||
// }
|
||||
// var _data = new
|
||||
// {
|
||||
// data.Id,
|
||||
// data.ProfileId,
|
||||
// data.CitizenId,
|
||||
// data.Prefix,
|
||||
// data.PrefixId,
|
||||
// data.Firstname,
|
||||
// data.Lastname,
|
||||
// data.DateOfBirth,
|
||||
// data.Gender,
|
||||
// data.Nationality,
|
||||
// data.Race,
|
||||
// data.Religion,
|
||||
// data.BloodGroup,
|
||||
// data.Relationship,
|
||||
// data.TelephoneNumber,
|
||||
// data.Status,
|
||||
// data.Amount,
|
||||
// data.RecruitDate,
|
||||
// data.PosNo,
|
||||
// data.Position,
|
||||
// data.PositionPathSide,
|
||||
// data.PositionType,
|
||||
// data.PositionLine,
|
||||
// data.PositionLevel,
|
||||
// data.OrganizationPositionId,
|
||||
// data.CreatedAt,
|
||||
// data.Reason,
|
||||
// data.MilitaryDate,
|
||||
// data.EducationOld,
|
||||
// data.AmountOld,
|
||||
// data.PositionTypeOld,
|
||||
// data.PositionLevelOld,
|
||||
// data.PositionNumberOld,
|
||||
// data.OrganizationPositionOld,
|
||||
// data.PositionDate,
|
||||
// // Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
// // Docs = retirementOtherDocs,
|
||||
// data.CommandType,
|
||||
// };
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
|
||||
|
|
@ -317,32 +263,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
var retirementOther = new RetirementOther
|
||||
{
|
||||
// Profile = profile,
|
||||
// CitizenId = profile.CitizenId,
|
||||
// Prefix = profile.Prefix,
|
||||
// Firstname = profile.FirstName,
|
||||
// Lastname = profile.LastName,
|
||||
// DateOfBirth = profile.BirthDate,
|
||||
// Gender = profile.Gender,
|
||||
// Nationality = profile.Nationality,
|
||||
// Race = profile.Race,
|
||||
// Religion = await _context.Religions.FindAsync(profile.ReligionId),
|
||||
// BloodGroup = await _context.BloodGroups.FindAsync(profile.BloodGroupId),
|
||||
// Relationship = await _context.Relationships.FindAsync(profile.RelationshipId),
|
||||
// TelephoneNumber = profile.TelephoneNumber,
|
||||
// EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}",
|
||||
// AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
// PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
|
||||
// PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
|
||||
// PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
|
||||
// OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
|
||||
// PositionNumber = profile.PosNo,
|
||||
// PositionPath = profile.Position,
|
||||
// PositionPathSide = await _context.PositionPathSides.FindAsync(profile.PositionPathSideId),
|
||||
// PositionType = profile.PositionType,
|
||||
// PositionLine = await _context.PositionLines.FindAsync(profile.PositionLineId),
|
||||
// PositionLevel = profile.PositionLevel,
|
||||
// OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
|
||||
Status = "WAITTING",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
|
|
|
|||
|
|
@ -217,35 +217,10 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
p.OrganizationPositionOld,
|
||||
p.PositionOld,
|
||||
p.OrganizationOld,
|
||||
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
// var _data = new
|
||||
// {
|
||||
// data.Id,
|
||||
// data.PrefixId,
|
||||
// data.Prefix,
|
||||
// data.FirstName,
|
||||
// data.LastName,
|
||||
// data.ProfileId,
|
||||
// data.position,
|
||||
// data.posNo,
|
||||
// data.positionLevel,
|
||||
// data.organizationOrganization,
|
||||
// data.Reason,
|
||||
// data.Status,
|
||||
// data.Organization,
|
||||
// data.Date,
|
||||
// data.salary,
|
||||
// data.CreatedAt,
|
||||
// data.PositionTypeOld,
|
||||
// data.PositionLevelOld,
|
||||
// data.PositionNumberOld,
|
||||
// data.OrganizationPositionOld,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
// };
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -424,9 +424,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
p.IsDiscipline,
|
||||
p.CancelReason,
|
||||
RetirementResignCancels = p.RetirementResignCancels.FirstOrDefault(),
|
||||
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
||||
RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
// RetirementResignDebtDocs = p.RetirementResignDebtDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
|
|
@ -443,23 +441,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
};
|
||||
retirementResignDocs.Add(_doc);
|
||||
}
|
||||
// var retirementResignDebtDocs = new List<dynamic>();
|
||||
// foreach (var doc in data.RetirementResignDebtDocs)
|
||||
// {
|
||||
// var _doc = new
|
||||
// {
|
||||
// FileName = doc.FileName,
|
||||
// PathName = await _documentService.ImagesPath(doc.Id),
|
||||
// doc.Id,
|
||||
// };
|
||||
// retirementResignDebtDocs.Add(_doc);
|
||||
// }
|
||||
var _data = new
|
||||
{
|
||||
data.Id,
|
||||
data.profileId,
|
||||
data.prefix,
|
||||
// data.PrefixId,
|
||||
data.firstName,
|
||||
data.lastName,
|
||||
data.Location,
|
||||
|
|
@ -519,9 +505,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
idCancel = data.RetirementResignCancels?.Id ?? null,
|
||||
statusCancel = data.RetirementResignCancels?.Status ?? null,
|
||||
statusMain = data.Status == "CANCEL" ? "DONECANCEL" : data.Status,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignDocs,
|
||||
// DocDebts = retirementResignDebtDocs,
|
||||
};
|
||||
|
||||
return Success(_data);
|
||||
|
|
@ -687,9 +671,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
data.idMain,
|
||||
data.statusMain,
|
||||
statusCancel = data.Status,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignDocs,
|
||||
// DocDebts = retirementResignDebtDocs,
|
||||
};
|
||||
return Success(_data);
|
||||
}
|
||||
|
|
@ -864,9 +846,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
data.CancelReason,
|
||||
data.idMain,
|
||||
data.statusMain,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignDocs,
|
||||
// DocDebts = retirementResignDebtDocs,
|
||||
};
|
||||
return Success(_data);
|
||||
}
|
||||
|
|
@ -997,14 +977,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
}
|
||||
}
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
|
||||
// $"{retirementResign.prefix}{retirementResign.firstName} {retirementResign.lastName} ได้ทำการยื่นขอลาออก",
|
||||
// $"{retirementResign.prefix}{retirementResign.firstName} {retirementResign.lastName} ได้ทำการยื่นขอลาออก",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
await _context.SaveChangesAsync();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -1380,25 +1352,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc432c-2bc5-4b81-8089-9c057c51192c"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1429,25 +1382,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc432c-2bc5-4b81-8089-9c057c51192c"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1476,25 +1410,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc4307-0adc-4bcd-8213-5479bb010236"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1525,25 +1440,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc4307-0adc-4bcd-8213-5479bb010236"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1571,25 +1467,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1620,25 +1497,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1803,7 +1661,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
PositionLevel = p.RetirementResign.posLevelNameOld,
|
||||
Org = p.RetirementResign.OrganizationOld,
|
||||
Fullname = $"{p.RetirementResign.prefix}{p.RetirementResign.firstName} {p.RetirementResign.lastName}",
|
||||
// Avatar = p.RetirementResign.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.RetirementResign.Profile.Avatar.Id,
|
||||
ReasonWork = p.ReasonWork == null ? p.ReasonWork : Newtonsoft.Json.JsonConvert.DeserializeObject(p.ReasonWork),
|
||||
ReasonWorkOther = p.ReasonWorkOther,
|
||||
TimeThink = p.TimeThink,
|
||||
|
|
@ -1853,49 +1710,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(GlobalMessages.RetirementQuestionNotFound, 404);
|
||||
// var _data = new
|
||||
// {
|
||||
// data.Id,
|
||||
// // data.PrefixId,
|
||||
// data.Position,
|
||||
// data.PositionLevel,
|
||||
// data.Org,
|
||||
// data.Fullname,
|
||||
// data.Prefix,
|
||||
// // Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
// data.ReasonWork,
|
||||
// data.ReasonWorkOther,
|
||||
// data.TimeThink,
|
||||
// data.ExitFactor,
|
||||
// data.ExitFactorOther,
|
||||
// data.Adjust,
|
||||
// data.AdjustOther,
|
||||
// data.RealReason,
|
||||
// data.NotExitFactor,
|
||||
// data.Havejob,
|
||||
// data.HavejobReason,
|
||||
// data.SuggestFriends,
|
||||
// data.SuggestFriendsReason,
|
||||
// data.FutureWork,
|
||||
// data.FutureWorkReason,
|
||||
// data.Suggestion,
|
||||
// data.AppointDate,
|
||||
// data.OrganizationPositionOld,
|
||||
// data.LastUpdatedAt,
|
||||
// data.CreatedAt,
|
||||
// data.Score1,
|
||||
// data.Score2,
|
||||
// data.Score3,
|
||||
// data.Score4,
|
||||
// data.Score5,
|
||||
// data.Score6,
|
||||
// data.Score7,
|
||||
// data.Score8,
|
||||
// data.Score9,
|
||||
// data.Score10,
|
||||
// data.ScoreTotal,
|
||||
// data.Comment,
|
||||
// };
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -362,9 +362,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
p.IsDiscipline,
|
||||
p.CancelReason,
|
||||
RetirementResignEmployeeCancels = p.RetirementResignEmployeeCancels.FirstOrDefault(),
|
||||
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
|
||||
RetirementResignEmployeeDocs = p.RetirementResignEmployeeDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
// RetirementResignEmployeeDebtDocs = p.RetirementResignEmployeeDebtDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
|
|
@ -381,23 +379,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
};
|
||||
retirementResignEmployeeDocs.Add(_doc);
|
||||
}
|
||||
// var retirementResignEmployeeDebtDocs = new List<dynamic>();
|
||||
// foreach (var doc in data.RetirementResignEmployeeDebtDocs)
|
||||
// {
|
||||
// var _doc = new
|
||||
// {
|
||||
// FileName = doc.FileName,
|
||||
// PathName = await _documentService.ImagesPath(doc.Id),
|
||||
// doc.Id,
|
||||
// };
|
||||
// retirementResignEmployeeDebtDocs.Add(_doc);
|
||||
// }
|
||||
var _data = new
|
||||
{
|
||||
data.Id,
|
||||
data.profileId,
|
||||
data.prefix,
|
||||
// data.PrefixId,
|
||||
data.firstName,
|
||||
data.lastName,
|
||||
data.Location,
|
||||
|
|
@ -457,9 +443,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
idCancel = data.RetirementResignEmployeeCancels?.Id ?? Guid.Empty,
|
||||
statusCancel = data.RetirementResignEmployeeCancels?.Status ?? null,
|
||||
statusMain = data.Status,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignEmployeeDocs,
|
||||
// DocDebts = retirementResignEmployeeDebtDocs,
|
||||
};
|
||||
|
||||
return Success(_data);
|
||||
|
|
@ -566,7 +550,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
data.Id,
|
||||
data.profileId,
|
||||
data.prefix,
|
||||
// data.PrefixId,
|
||||
data.firstName,
|
||||
data.lastName,
|
||||
data.Location,
|
||||
|
|
@ -625,9 +608,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
data.idMain,
|
||||
data.statusMain,
|
||||
statusCancel = data.Status,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignEmployeeDocs,
|
||||
// DocDebts = retirementResignEmployeeDebtDocs,
|
||||
};
|
||||
return Success(_data);
|
||||
}
|
||||
|
|
@ -802,9 +783,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
data.CancelReason,
|
||||
data.idMain,
|
||||
data.statusMain,
|
||||
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
Docs = retirementResignEmployeeDocs,
|
||||
// DocDebts = retirementResignEmployeeDebtDocs,
|
||||
};
|
||||
return Success(_data);
|
||||
}
|
||||
|
|
@ -934,14 +913,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
}
|
||||
}
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
|
||||
// $"{retirementResignEmployee.prefix}{retirementResignEmployee.firstName} {retirementResignEmployee.lastName} ได้ทำการยื่นขอลาออก",
|
||||
// $"{retirementResignEmployee.prefix}{retirementResignEmployee.firstName} {retirementResignEmployee.lastName} ได้ทำการยื่นขอลาออก",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
await _context.SaveChangesAsync();
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -1047,33 +1018,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
|
||||
// if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||
// {
|
||||
// foreach (var file in Request.Form.Files)
|
||||
// {
|
||||
// var fileExtension = Path.GetExtension(file.FileName);
|
||||
|
||||
// var doc = await _documentService.UploadFileAsync(file, file.FileName);
|
||||
// var _doc = await _context.Documents.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||
// if (_doc != null)
|
||||
// {
|
||||
// var retirementResignEmployeeDebtDoc = new RetirementResignEmployeeDebtDoc
|
||||
// {
|
||||
// RetirementResignEmployee = updated,
|
||||
// Document = _doc,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// };
|
||||
// await _context.RetirementResignEmployeeDebtDocs.AddAsync(retirementResignEmployeeDebtDoc);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
|
@ -1208,43 +1152,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
}
|
||||
updated.IsCancel = true;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
updated.Status = "CANCEL";
|
||||
// }
|
||||
// if (updated.OfficerReject != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
// if (updated.CommanderReject != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc432c-2bc5-4b81-8089-9c057c51192c"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
// if (updated.OligarchReject != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc4307-0adc-4bcd-8213-5479bb010236"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้ทำการขอยกเลิก",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
|
|
@ -1353,25 +1261,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc432c-2bc5-4b81-8089-9c057c51192c"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1395,32 +1284,12 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
return Error(GlobalMessages.RetirementResignEmployeeNotFound, 404);
|
||||
if ((DateTime.Now - updated.CreatedAt).TotalDays >= 90)
|
||||
return Error("สามารถยับยั้งได้ไม่เกิน 90 วัน");
|
||||
// updated.Status = "REJECT";
|
||||
updated.OfficerReject = true;
|
||||
updated.OfficerRejectReason = req.Reason;
|
||||
updated.OfficerRejectDate = req.Date;
|
||||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc432c-2bc5-4b81-8089-9c057c51192c"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1443,31 +1312,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
if (updated == null)
|
||||
return Error(GlobalMessages.RetirementResignEmployeeNotFound, 404);
|
||||
|
||||
// updated.Status = "APPROVE";
|
||||
updated.CommanderReject = false;
|
||||
updated.CommanderApproveReason = req.Reason;
|
||||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc4307-0adc-4bcd-8213-5479bb010236"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้บังคับบัญชา",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1491,32 +1340,12 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
return Error(GlobalMessages.RetirementResignEmployeeNotFound, 404);
|
||||
if ((DateTime.Now - updated.CreatedAt).TotalDays >= 90)
|
||||
return Error("สามารถยับยั้งได้ไม่เกิน 90 วัน");
|
||||
// updated.Status = "REJECT";
|
||||
updated.CommanderReject = true;
|
||||
updated.CommanderRejectReason = req.Reason;
|
||||
updated.CommanderRejectDate = req.Date;
|
||||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc4307-0adc-4bcd-8213-5479bb010236"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้บังคับบัญชา",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1544,25 +1373,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1593,25 +1403,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
updated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
updated.LastUpdateUserId = UserId ?? "";
|
||||
updated.LastUpdatedAt = DateTime.Now;
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse("08dc3db9-257d-470d-8256-3dc24f6fa332"),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากผู้มีอำนาจ",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// if (updated.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(updated.profileId),
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
|
||||
// $"คำขอลาออกของ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากผู้มีอำนาจ",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return Success();
|
||||
|
|
@ -1752,512 +1543,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
return Success(data);
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// get รายละเอียดแบบสอบถามหลังลาออก
|
||||
// /// </summary>
|
||||
// /// <param name="id">Id แบบสอบถามหลังลาออก</param>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpGet("questionnaire/{id:length(36)}")]
|
||||
// public async Task<ActionResult<ResponseObject>> GetByIdQuestion(Guid id)
|
||||
// {
|
||||
// var data = await _context.RetirementQuestions.AsQueryable()
|
||||
// .Where(x => x.Id == id)
|
||||
// .Select(p => new
|
||||
// {
|
||||
// Id = p.Id,
|
||||
// Prefix = p.RetirementResignEmployee.prefix,
|
||||
// FirstName = p.RetirementResignEmployee.firstName,
|
||||
// LastName = p.RetirementResignEmployee.lastName,
|
||||
// Position = p.RetirementResignEmployee.PositionOld,
|
||||
// PositionLevel = p.RetirementResignEmployee.posLevelNameOld,
|
||||
// Org = p.RetirementResignEmployee.OrganizationOld,
|
||||
// Fullname = $"{p.RetirementResignEmployee.prefix}{p.RetirementResignEmployee.firstName} {p.RetirementResignEmployee.lastName}",
|
||||
// // Avatar = p.RetirementResignEmployee.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.RetirementResignEmployee.Profile.Avatar.Id,
|
||||
// ReasonWork = p.ReasonWork == null ? p.ReasonWork : Newtonsoft.Json.JsonConvert.DeserializeObject(p.ReasonWork),
|
||||
// ReasonWorkOther = p.ReasonWorkOther,
|
||||
// TimeThink = p.TimeThink,
|
||||
// ExitFactor = p.ExitFactor == null ? p.ExitFactor : Newtonsoft.Json.JsonConvert.DeserializeObject(p.ExitFactor),
|
||||
// ExitFactorOther = p.ExitFactorOther,
|
||||
// Adjust = p.Adjust == null ? p.Adjust : Newtonsoft.Json.JsonConvert.DeserializeObject(p.Adjust),
|
||||
// AdjustOther = p.AdjustOther,
|
||||
// RealReason = p.RealReason,
|
||||
// NotExitFactor = p.NotExitFactor,
|
||||
// Havejob = p.Havejob,
|
||||
// HavejobReason = p.HavejobReason,
|
||||
// SuggestFriends = p.SuggestFriends,
|
||||
// SuggestFriendsReason = p.SuggestFriendsReason,
|
||||
// FutureWork = p.FutureWork,
|
||||
// FutureWorkReason = p.FutureWorkReason,
|
||||
// Suggestion = p.Suggestion,
|
||||
// AppointDate = p.AppointDate,
|
||||
// LastUpdatedAt = p.LastUpdatedAt,
|
||||
// OrganizationPositionOld = p.RetirementResignEmployee.OrganizationPositionOld,
|
||||
// CreatedAt = p.CreatedAt,
|
||||
// posTypeName = p.RetirementResignEmployee.posTypeNameOld,
|
||||
// posLevelName = p.RetirementResignEmployee.posLevelNameOld,
|
||||
// posMasterNo = p.RetirementResignEmployee.posMasterNoOld,
|
||||
// root = p.RetirementResignEmployee.rootOld,
|
||||
// rootShortName = p.RetirementResignEmployee.rootShortNameOld,
|
||||
// child1 = p.RetirementResignEmployee.child1Old,
|
||||
// child1ShortName = p.RetirementResignEmployee.child1ShortNameOld,
|
||||
// child2 = p.RetirementResignEmployee.child2Old,
|
||||
// child2ShortName = p.RetirementResignEmployee.child2ShortNameOld,
|
||||
// child3 = p.RetirementResignEmployee.child3Old,
|
||||
// child3ShortName = p.RetirementResignEmployee.child3ShortNameOld,
|
||||
// child4 = p.RetirementResignEmployee.child4Old,
|
||||
// child4ShortName = p.RetirementResignEmployee.child4ShortNameOld,
|
||||
// Score1 = p.Score1,
|
||||
// Score2 = p.Score2,
|
||||
// Score3 = p.Score3,
|
||||
// Score4 = p.Score4,
|
||||
// Score5 = p.Score5,
|
||||
// Score6 = p.Score6,
|
||||
// Score7 = p.Score7,
|
||||
// Score8 = p.Score8,
|
||||
// Score9 = p.Score9,
|
||||
// Score10 = p.Score10,
|
||||
// ScoreTotal = p.ScoreTotal,
|
||||
// Comment = p.Comment,
|
||||
// })
|
||||
// .FirstOrDefaultAsync();
|
||||
// if (data == null)
|
||||
// return Error(GlobalMessages.RetirementQuestionNotFound, 404);
|
||||
// // var _data = new
|
||||
// // {
|
||||
// // data.Id,
|
||||
// // // data.PrefixId,
|
||||
// // data.Position,
|
||||
// // data.PositionLevel,
|
||||
// // data.Org,
|
||||
// // data.Fullname,
|
||||
// // data.Prefix,
|
||||
// // // Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||
// // data.ReasonWork,
|
||||
// // data.ReasonWorkOther,
|
||||
// // data.TimeThink,
|
||||
// // data.ExitFactor,
|
||||
// // data.ExitFactorOther,
|
||||
// // data.Adjust,
|
||||
// // data.AdjustOther,
|
||||
// // data.RealReason,
|
||||
// // data.NotExitFactor,
|
||||
// // data.Havejob,
|
||||
// // data.HavejobReason,
|
||||
// // data.SuggestFriends,
|
||||
// // data.SuggestFriendsReason,
|
||||
// // data.FutureWork,
|
||||
// // data.FutureWorkReason,
|
||||
// // data.Suggestion,
|
||||
// // data.AppointDate,
|
||||
// // data.OrganizationPositionOld,
|
||||
// // data.LastUpdatedAt,
|
||||
// // data.CreatedAt,
|
||||
// // data.Score1,
|
||||
// // data.Score2,
|
||||
// // data.Score3,
|
||||
// // data.Score4,
|
||||
// // data.Score5,
|
||||
// // data.Score6,
|
||||
// // data.Score7,
|
||||
// // data.Score8,
|
||||
// // data.Score9,
|
||||
// // data.Score10,
|
||||
// // data.ScoreTotal,
|
||||
// // data.Comment,
|
||||
// // };
|
||||
|
||||
// return Success(data);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// สร้างแบบสอบถามหลังลาออก
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpPost("questionnaire")]
|
||||
// public async Task<ActionResult<ResponseObject>> PostQuestion([FromBody] RetirementQuestionRequest req)
|
||||
// {
|
||||
// var retirementResignEmployee = await _context.RetirementResignEmployees.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == req.RetirementResignEmployeeId);
|
||||
// if (retirementResignEmployee == null)
|
||||
// return Error(GlobalMessages.RetirementResignEmployeeNotFound);
|
||||
|
||||
// var period = new RetirementQuestion
|
||||
// {
|
||||
// RetirementResignEmployee = retirementResignEmployee,
|
||||
// ReasonWork = Newtonsoft.Json.JsonConvert.SerializeObject(req.ReasonWork),
|
||||
// ReasonWorkOther = req.ReasonWorkOther,
|
||||
// TimeThink = req.TimeThink,
|
||||
// ExitFactor = Newtonsoft.Json.JsonConvert.SerializeObject(req.ExitFactor),
|
||||
// ExitFactorOther = req.ExitFactorOther,
|
||||
// Adjust = Newtonsoft.Json.JsonConvert.SerializeObject(req.Adjust),
|
||||
// AdjustOther = req.AdjustOther,
|
||||
// RealReason = req.RealReason,
|
||||
// NotExitFactor = req.NotExitFactor,
|
||||
// Havejob = req.Havejob,
|
||||
// HavejobReason = req.HavejobReason,
|
||||
// SuggestFriends = req.SuggestFriends,
|
||||
// SuggestFriendsReason = req.SuggestFriendsReason,
|
||||
// FutureWork = req.FutureWork,
|
||||
// FutureWorkReason = req.FutureWorkReason,
|
||||
// Suggestion = req.Suggestion,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// };
|
||||
// await _context.RetirementQuestions.AddAsync(period);
|
||||
// await _context.SaveChangesAsync();
|
||||
|
||||
// return Success();
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// ลบแบบสอบถามหลังลาออก
|
||||
// /// </summary>
|
||||
// /// <param name="id">Id แบบสอบถามหลังลาออก</param>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpDelete("questionnaire/{id:length(36)}")]
|
||||
// public async Task<ActionResult<ResponseObject>> DeleteQuestion(Guid id)
|
||||
// {
|
||||
// var deleted = await _context.RetirementQuestions.AsQueryable()
|
||||
// .Where(x => x.Id == id)
|
||||
// .FirstOrDefaultAsync();
|
||||
|
||||
// if (deleted == null)
|
||||
// return Error(GlobalMessages.RetirementQuestionNotFound);
|
||||
// _context.RetirementQuestions.Remove(deleted);
|
||||
// await _context.SaveChangesAsync();
|
||||
|
||||
// return Success();
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// แก้ไขแบบสอบถามหลังลาออก
|
||||
// /// </summary>
|
||||
// /// <param name="id">Id แบบสอบถามหลังลาออก</param>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpPut("questionnaire/{id:length(36)}")]
|
||||
// public async Task<ActionResult<ResponseObject>> PutQuestion([FromBody] RetirementQuestionRequest req, Guid id)
|
||||
// {
|
||||
// var uppdated = await _context.RetirementQuestions.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == id);
|
||||
// if (uppdated == null)
|
||||
// return Error(GlobalMessages.RetirementQuestionNotFound);
|
||||
|
||||
// var retirementResignEmployee = await _context.RetirementResignEmployees.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == req.RetirementResignEmployeeId);
|
||||
// if (retirementResignEmployee == null)
|
||||
// return Error(GlobalMessages.InsigniaNotFound);
|
||||
|
||||
// // uppdated.RetirementResignEmployee = retirementResignEmployee;
|
||||
// uppdated.ReasonWork = Newtonsoft.Json.JsonConvert.SerializeObject(req.ReasonWork);
|
||||
// uppdated.ReasonWorkOther = req.ReasonWorkOther;
|
||||
// uppdated.TimeThink = req.TimeThink;
|
||||
// uppdated.ExitFactor = Newtonsoft.Json.JsonConvert.SerializeObject(req.ExitFactor);
|
||||
// uppdated.ExitFactorOther = req.ExitFactorOther;
|
||||
// uppdated.Adjust = Newtonsoft.Json.JsonConvert.SerializeObject(req.Adjust);
|
||||
// uppdated.AdjustOther = req.AdjustOther;
|
||||
// uppdated.RealReason = req.RealReason;
|
||||
// uppdated.NotExitFactor = req.NotExitFactor;
|
||||
// uppdated.Havejob = req.Havejob;
|
||||
// uppdated.HavejobReason = req.HavejobReason;
|
||||
// uppdated.SuggestFriends = req.SuggestFriends;
|
||||
// uppdated.SuggestFriendsReason = req.SuggestFriendsReason;
|
||||
// uppdated.FutureWork = req.FutureWork;
|
||||
// uppdated.FutureWorkReason = req.FutureWorkReason;
|
||||
// uppdated.Suggestion = req.Suggestion;
|
||||
// uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
// uppdated.LastUpdateUserId = UserId ?? "";
|
||||
// uppdated.LastUpdatedAt = DateTime.Now;
|
||||
|
||||
// await _context.SaveChangesAsync();
|
||||
|
||||
// return Success();
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// แก้ไขคะแนนแบบสอบถามหลังลาออก
|
||||
// /// </summary>
|
||||
// /// <param name="id">Id แบบสอบถามหลังลาออก</param>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpPut("questionnaire/comment/{id:length(36)}")]
|
||||
// public async Task<ActionResult<ResponseObject>> PutQuestionComment([FromBody] RetirementQuestionCommentRequest req, Guid id)
|
||||
// {
|
||||
// var getPermission = await _permission.GetPermissionAPIAsync("UPDATE", "SYS_RESIGN_INTERVIEW");
|
||||
// var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
// if (jsonData["status"]?.ToString() != "200")
|
||||
// {
|
||||
// return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
// }
|
||||
// var uppdated = await _context.RetirementQuestions.AsQueryable()
|
||||
// .FirstOrDefaultAsync(x => x.Id == id);
|
||||
// if (uppdated == null)
|
||||
// return Error(GlobalMessages.RetirementQuestionNotFound);
|
||||
|
||||
// uppdated.Score1 = req.Score1;
|
||||
// uppdated.Score2 = req.Score2;
|
||||
// uppdated.Score3 = req.Score3;
|
||||
// uppdated.Score4 = req.Score4;
|
||||
// uppdated.Score5 = req.Score5;
|
||||
// uppdated.Score6 = req.Score6;
|
||||
// uppdated.Score7 = req.Score7;
|
||||
// uppdated.Score8 = req.Score8;
|
||||
// uppdated.Score9 = req.Score9;
|
||||
// uppdated.Score10 = req.Score10;
|
||||
// uppdated.ScoreTotal = req.ScoreTotal;
|
||||
// uppdated.Comment = req.Comment;
|
||||
// uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
// uppdated.LastUpdateUserId = UserId ?? "";
|
||||
// uppdated.LastUpdatedAt = DateTime.Now;
|
||||
|
||||
// await _context.SaveChangesAsync();
|
||||
|
||||
// return Success();
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// แก้ไขกําหนดวันนัดหมายเพื่อทําการสัมภาษณ์การลาออก
|
||||
// /// </summary>
|
||||
// /// <param name="id">Id กําหนดวันนัดหมายเพื่อทําการสัมภาษณ์การลาออก</param>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpPut("questionnaire/appoint/{id:length(36)}")]
|
||||
// public async Task<ActionResult<ResponseObject>> UpdateAppointQuestion([FromBody] RetirementQuestionAppointRequest req, Guid id)
|
||||
// {
|
||||
// var getPermission = await _permission.GetPermissionAPIAsync("UPDATE", "SYS_RESIGN_INTERVIEW");
|
||||
// var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
// if (jsonData["status"]?.ToString() != "200")
|
||||
// {
|
||||
// return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
// }
|
||||
// var uppdated = await _context.RetirementQuestions.AsQueryable()
|
||||
// .Include(x => x.RetirementResignEmployee)
|
||||
// .FirstOrDefaultAsync(x => x.Id == id);
|
||||
// if (uppdated == null)
|
||||
// return Error(GlobalMessages.RetirementQuestionNotFound);
|
||||
|
||||
// uppdated.AppointDate = req.AppointDate;
|
||||
// uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
// uppdated.LastUpdateUserId = UserId ?? "";
|
||||
// uppdated.LastUpdatedAt = DateTime.Now;
|
||||
// if (uppdated.RetirementResignEmployee != null && uppdated.RetirementResignEmployee.profileId != null)
|
||||
// {
|
||||
// await _repositoryNoti.PushNotificationAsync(
|
||||
// Guid.Parse(uppdated.RetirementResignEmployee.profileId),
|
||||
// $"การนัดสัมภาษณ์เหตุผลการลาออก {req.AppointDate.ToThaiFullDate()}",
|
||||
// $"การนัดสัมภาษณ์เหตุผลการลาออก {req.AppointDate.ToThaiFullDate()}",
|
||||
// "",
|
||||
// "",
|
||||
// true
|
||||
// );
|
||||
// }
|
||||
// await _context.SaveChangesAsync();
|
||||
|
||||
// return Success();
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// list คำถาม (USER)
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpGet("questionnaire/question")]
|
||||
// public async Task<ActionResult<ResponseObject>> GetQuestionnaireQuestion()
|
||||
// {
|
||||
// //var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_RESIGN_INTERVIEW");
|
||||
// //var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
// //if (jsonData["status"]?.ToString() != "200")
|
||||
// //{
|
||||
// // return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
// //}
|
||||
// var retirementQuestionnaireQuestion = await _context.RetirementQuestionnaireQuestions.AsQueryable()
|
||||
// .Select(x => new
|
||||
// {
|
||||
// Question1Desc = x.Question1Desc,
|
||||
// Question1Score = x.Question1Score,
|
||||
// Question1Answer = x.Question1Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question1Answer),
|
||||
// Question2Desc = x.Question2Desc,
|
||||
// Question2Score = x.Question2Score,
|
||||
// Question2Answer = x.Question2Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question2Answer),
|
||||
// Question3Desc = x.Question3Desc,
|
||||
// Question3Score = x.Question3Score,
|
||||
// Question3Answer = x.Question3Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question3Answer),
|
||||
// Question4Desc = x.Question4Desc,
|
||||
// Question4Score = x.Question4Score,
|
||||
// Question4Answer = x.Question4Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question4Answer),
|
||||
// Question5Desc = x.Question5Desc,
|
||||
// Question5Score = x.Question5Score,
|
||||
// Question5Answer = x.Question5Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question5Answer),
|
||||
// Question6Desc = x.Question6Desc,
|
||||
// Question6Score = x.Question6Score,
|
||||
// Question6Answer = x.Question6Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question6Answer),
|
||||
// Question7Desc = x.Question7Desc,
|
||||
// Question7Score = x.Question7Score,
|
||||
// Question7Answer = x.Question7Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question7Answer),
|
||||
// Question8Desc = x.Question8Desc,
|
||||
// Question8Score = x.Question8Score,
|
||||
// Question8Answer = x.Question8Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question8Answer),
|
||||
// Question9Desc = x.Question9Desc,
|
||||
// Question9Score = x.Question9Score,
|
||||
// Question9Answer = x.Question9Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question9Answer),
|
||||
// Question10Desc = x.Question10Desc,
|
||||
// Question10Score = x.Question10Score,
|
||||
// Question10Answer = x.Question10Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question10Answer),
|
||||
// })
|
||||
// .FirstOrDefaultAsync();
|
||||
// if (retirementQuestionnaireQuestion == null)
|
||||
// return Error(GlobalMessages.RetirementQuestionNotFound);
|
||||
|
||||
// return Success(retirementQuestionnaireQuestion);
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// update คำถาม
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpPut("questionnaire/question")]
|
||||
// public async Task<ActionResult<ResponseObject>> UpdateQuestionnaireQuestion([FromBody] RetirementQuestionnaireQuestionRequest req)
|
||||
// {
|
||||
// var getPermission = await _permission.GetPermissionAPIAsync("UPDATE", "SYS_RESIGN_INTERVIEW");
|
||||
// var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
// if (jsonData["status"]?.ToString() != "200")
|
||||
// {
|
||||
// return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
// }
|
||||
// var uppdated = await _context.RetirementQuestionnaireQuestions.AsQueryable()
|
||||
// .FirstOrDefaultAsync();
|
||||
// if (uppdated == null)
|
||||
// return Error(GlobalMessages.RetirementQuestionnaireQuestionNotFound);
|
||||
|
||||
// uppdated.Question1Desc = req.Question1Desc;
|
||||
// uppdated.Question1Score = req.Question1Score;
|
||||
// uppdated.Question1Answer = JsonConvert.SerializeObject(req.Question1Answer);
|
||||
// uppdated.Question2Desc = req.Question2Desc;
|
||||
// uppdated.Question2Score = req.Question2Score;
|
||||
// uppdated.Question2Answer = JsonConvert.SerializeObject(req.Question2Answer);
|
||||
// uppdated.Question3Desc = req.Question3Desc;
|
||||
// uppdated.Question3Score = req.Question3Score;
|
||||
// uppdated.Question3Answer = JsonConvert.SerializeObject(req.Question3Answer);
|
||||
// uppdated.Question4Desc = req.Question4Desc;
|
||||
// uppdated.Question4Score = req.Question4Score;
|
||||
// uppdated.Question4Answer = JsonConvert.SerializeObject(req.Question4Answer);
|
||||
// uppdated.Question5Desc = req.Question5Desc;
|
||||
// uppdated.Question5Score = req.Question5Score;
|
||||
// uppdated.Question5Answer = JsonConvert.SerializeObject(req.Question5Answer);
|
||||
// uppdated.Question6Desc = req.Question6Desc;
|
||||
// uppdated.Question6Score = req.Question6Score;
|
||||
// uppdated.Question6Answer = JsonConvert.SerializeObject(req.Question6Answer);
|
||||
// uppdated.Question7Desc = req.Question7Desc;
|
||||
// uppdated.Question7Score = req.Question7Score;
|
||||
// uppdated.Question7Answer = JsonConvert.SerializeObject(req.Question7Answer);
|
||||
// uppdated.Question8Desc = req.Question8Desc;
|
||||
// uppdated.Question8Score = req.Question8Score;
|
||||
// uppdated.Question8Answer = JsonConvert.SerializeObject(req.Question8Answer);
|
||||
// uppdated.Question9Desc = req.Question9Desc;
|
||||
// uppdated.Question9Score = req.Question9Score;
|
||||
// uppdated.Question9Answer = JsonConvert.SerializeObject(req.Question9Answer);
|
||||
// uppdated.Question10Desc = req.Question10Desc;
|
||||
// uppdated.Question10Score = req.Question10Score;
|
||||
// uppdated.Question10Answer = JsonConvert.SerializeObject(req.Question10Answer);
|
||||
// uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
// uppdated.LastUpdateUserId = UserId ?? "";
|
||||
// uppdated.LastUpdatedAt = DateTime.Now;
|
||||
|
||||
// await _context.SaveChangesAsync();
|
||||
|
||||
// return Success();
|
||||
// }
|
||||
|
||||
// /// <summary>
|
||||
// /// list คำถาม (ADMIN)
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpGet("questionnaire/question/admin")]
|
||||
// public async Task<ActionResult<ResponseObject>> GetQuestionnaireQuestionAdmin()
|
||||
// {
|
||||
// var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_RESIGN_INTERVIEW");
|
||||
// var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
// if (jsonData["status"]?.ToString() != "200")
|
||||
// {
|
||||
// return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
// }
|
||||
// var retirementQuestionnaireQuestion = await _context.RetirementQuestionnaireQuestions.AsQueryable()
|
||||
// .Select(x => new
|
||||
// {
|
||||
// Question1Desc = x.Question1Desc,
|
||||
// Question1Score = x.Question1Score,
|
||||
// Question1Answer = x.Question1Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question1Answer),
|
||||
// Question2Desc = x.Question2Desc,
|
||||
// Question2Score = x.Question2Score,
|
||||
// Question2Answer = x.Question2Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question2Answer),
|
||||
// Question3Desc = x.Question3Desc,
|
||||
// Question3Score = x.Question3Score,
|
||||
// Question3Answer = x.Question3Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question3Answer),
|
||||
// Question4Desc = x.Question4Desc,
|
||||
// Question4Score = x.Question4Score,
|
||||
// Question4Answer = x.Question4Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question4Answer),
|
||||
// Question5Desc = x.Question5Desc,
|
||||
// Question5Score = x.Question5Score,
|
||||
// Question5Answer = x.Question5Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question5Answer),
|
||||
// Question6Desc = x.Question6Desc,
|
||||
// Question6Score = x.Question6Score,
|
||||
// Question6Answer = x.Question6Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question6Answer),
|
||||
// Question7Desc = x.Question7Desc,
|
||||
// Question7Score = x.Question7Score,
|
||||
// Question7Answer = x.Question7Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question7Answer),
|
||||
// Question8Desc = x.Question8Desc,
|
||||
// Question8Score = x.Question8Score,
|
||||
// Question8Answer = x.Question8Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question8Answer),
|
||||
// Question9Desc = x.Question9Desc,
|
||||
// Question9Score = x.Question9Score,
|
||||
// Question9Answer = x.Question9Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question9Answer),
|
||||
// Question10Desc = x.Question10Desc,
|
||||
// Question10Score = x.Question10Score,
|
||||
// Question10Answer = x.Question10Answer == null ? null : JsonConvert.DeserializeObject<List<string>>(x.Question10Answer),
|
||||
// })
|
||||
// .FirstOrDefaultAsync();
|
||||
// if (retirementQuestionnaireQuestion == null)
|
||||
// return Error(GlobalMessages.RetirementQuestionNotFound);
|
||||
|
||||
// return Success(retirementQuestionnaireQuestion);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// ส่งรายชื่อออกคำสั่ง C-PM-23
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue