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

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