noti วินัย

This commit is contained in:
kittapath 2025-02-19 17:56:02 +07:00
parent 9e513d3f1a
commit ae990c0c5f
21 changed files with 244 additions and 1508 deletions

View file

@ -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);

View file

@ -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 ?? "",

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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>