แก้คำสั่งวินัย
This commit is contained in:
parent
6d7aebaeb5
commit
1c939f6ffc
5 changed files with 784 additions and 91 deletions
|
|
@ -2100,7 +2100,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var resultData = new List<CommandReceiver>();
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/down";
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/up";
|
||||
|
||||
var commandType = await _dbContext.Set<CommandType>()
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-30")
|
||||
|
|
@ -2163,7 +2163,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var resultData = new List<CommandReceiver>();
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/down";
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/up";
|
||||
|
||||
var commandType = await _dbContext.Set<CommandType>()
|
||||
.Where(x => x.CommandCode.Trim().ToUpper() == "C-PM-31")
|
||||
|
|
@ -6476,22 +6476,20 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
foreach (var recv in command.Receivers)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementDischarge>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Salaries)
|
||||
var data = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Salaries)
|
||||
.ThenInclude(x => x.PositionLevel)
|
||||
|
||||
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
|
||||
data.Profile.IsActive = false;
|
||||
data.Profile.IsLeave = true;
|
||||
data.Profile.LeaveReason = "ได้รับโทษทางวินัย ปลดออกจากราชการ";
|
||||
data.Profile.LeaveDate = command.CommandAffectDate;
|
||||
data.IsActive = false;
|
||||
data.IsLeave = true;
|
||||
data.LeaveReason = "ได้รับโทษทางวินัย ปลดออกจากราชการ";
|
||||
data.LeaveDate = command.CommandAffectDate;
|
||||
|
||||
var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
var lastSarary = data.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
var order = 1;
|
||||
if (lastSarary.Order != null)
|
||||
order = lastSarary.Order.Value + 1;
|
||||
|
|
@ -6545,19 +6543,16 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
if (lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId;
|
||||
if (lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId;
|
||||
|
||||
data.Profile.Salaries.Add(salary);
|
||||
data.Salaries.Add(salary);
|
||||
|
||||
// remove profile position
|
||||
var profilePosition = await _dbContext.Set<ProfilePosition>()
|
||||
.Include(x => x.Profile)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.FirstOrDefaultAsync(x => x.Profile!.Id == data.Profile.Id);
|
||||
.FirstOrDefaultAsync(x => x.Profile!.Id == data.Id);
|
||||
if (profilePosition != null)
|
||||
_dbContext.Set<ProfilePosition>().Remove(profilePosition);
|
||||
|
||||
// update placementstatus
|
||||
data.Status = "DONE";
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
|
|
@ -6571,7 +6566,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คุณได้รับคำสั่งปลดออกจากราชการ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = data.Profile.Id,
|
||||
ReceiverUserId = data.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
|
|
@ -6579,7 +6574,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var noti = new Notification
|
||||
{
|
||||
Body = $"คุณได้รับคำสั่งปลดออกจากราชการ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = data.Profile.Id,
|
||||
ReceiverUserId = data.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
|
|
@ -6681,9 +6676,8 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
foreach (var recv in command.Receivers)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementExpulsion>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Salaries)
|
||||
var data = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Salaries)
|
||||
.ThenInclude(x => x.PositionLevel)
|
||||
|
||||
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
|
||||
|
|
@ -6691,12 +6685,12 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
if (data == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
|
||||
data.Profile.IsActive = false;
|
||||
data.Profile.IsLeave = true;
|
||||
data.Profile.LeaveReason = "ได้รับโทษทางวินัย ไล่ออกจากราชการ";
|
||||
data.Profile.LeaveDate = command.CommandAffectDate;
|
||||
data.IsActive = false;
|
||||
data.IsLeave = true;
|
||||
data.LeaveReason = "ได้รับโทษทางวินัย ไล่ออกจากราชการ";
|
||||
data.LeaveDate = command.CommandAffectDate;
|
||||
|
||||
var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
var lastSarary = data.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
var order = 1;
|
||||
if (lastSarary.Order != null)
|
||||
order = lastSarary.Order.Value + 1;
|
||||
|
|
@ -6750,19 +6744,16 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
if (lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId;
|
||||
if (lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId;
|
||||
|
||||
data.Profile.Salaries.Add(salary);
|
||||
data.Salaries.Add(salary);
|
||||
|
||||
// remove profile position
|
||||
var profilePosition = await _dbContext.Set<ProfilePosition>()
|
||||
.Include(x => x.Profile)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.FirstOrDefaultAsync(x => x.Profile!.Id == data.Profile.Id);
|
||||
.FirstOrDefaultAsync(x => x.Profile!.Id == data.Id);
|
||||
if (profilePosition != null)
|
||||
_dbContext.Set<ProfilePosition>().Remove(profilePosition);
|
||||
|
||||
// update placementstatus
|
||||
data.Status = "DONE";
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
|
|
@ -6776,7 +6767,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คุณได้รับคำสั่งไล่ออกจากราชการ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = data.Profile.Id,
|
||||
ReceiverUserId = data.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
|
|
@ -6784,7 +6775,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var noti = new Notification
|
||||
{
|
||||
Body = $"คุณได้รับคำสั่งไล่ออกจากราชการ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = data.Profile.Id,
|
||||
ReceiverUserId = data.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
|
|
@ -7643,6 +7634,65 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
// create command payload
|
||||
var payload_attach = command.Documents
|
||||
.Select(x => new PayloadAttachment
|
||||
{
|
||||
name = x.Category == "cover" ? "สำเนาคำสั่ง" : "สำเนาเอกสารแนบท้าย",
|
||||
url = $"{_configuration["API"]}/order/download/attachment/{x.Document.Id}"
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var payload = new CommandPayload()
|
||||
{
|
||||
attachments = payload_attach
|
||||
};
|
||||
|
||||
var payload_str = JsonConvert.SerializeObject(payload);
|
||||
// send cc noti inbox
|
||||
foreach (var cc in command.Deployments)
|
||||
{
|
||||
var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||
if (pf != null)
|
||||
{
|
||||
if (cc.IsSendInbox)
|
||||
{
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
}
|
||||
|
||||
if (cc.IsSendMail)
|
||||
{
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
}
|
||||
}
|
||||
|
||||
// change command status
|
||||
var cmdStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(x => x.Sequence == 5);
|
||||
command.CommandStatusId = cmdStatus!.Id;
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
}
|
||||
catch
|
||||
|
|
@ -7675,6 +7725,65 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
// create command payload
|
||||
var payload_attach = command.Documents
|
||||
.Select(x => new PayloadAttachment
|
||||
{
|
||||
name = x.Category == "cover" ? "สำเนาคำสั่ง" : "สำเนาเอกสารแนบท้าย",
|
||||
url = $"{_configuration["API"]}/order/download/attachment/{x.Document.Id}"
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var payload = new CommandPayload()
|
||||
{
|
||||
attachments = payload_attach
|
||||
};
|
||||
|
||||
var payload_str = JsonConvert.SerializeObject(payload);
|
||||
// send cc noti inbox
|
||||
foreach (var cc in command.Deployments)
|
||||
{
|
||||
var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||
if (pf != null)
|
||||
{
|
||||
if (cc.IsSendInbox)
|
||||
{
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
}
|
||||
|
||||
if (cc.IsSendMail)
|
||||
{
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
}
|
||||
}
|
||||
|
||||
// change command status
|
||||
var cmdStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(x => x.Sequence == 5);
|
||||
command.CommandStatusId = cmdStatus!.Id;
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
}
|
||||
catch
|
||||
|
|
@ -7707,6 +7816,65 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
// create command payload
|
||||
var payload_attach = command.Documents
|
||||
.Select(x => new PayloadAttachment
|
||||
{
|
||||
name = x.Category == "cover" ? "สำเนาคำสั่ง" : "สำเนาเอกสารแนบท้าย",
|
||||
url = $"{_configuration["API"]}/order/download/attachment/{x.Document.Id}"
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var payload = new CommandPayload()
|
||||
{
|
||||
attachments = payload_attach
|
||||
};
|
||||
|
||||
var payload_str = JsonConvert.SerializeObject(payload);
|
||||
// send cc noti inbox
|
||||
foreach (var cc in command.Deployments)
|
||||
{
|
||||
var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||
if (pf != null)
|
||||
{
|
||||
if (cc.IsSendInbox)
|
||||
{
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
}
|
||||
|
||||
if (cc.IsSendMail)
|
||||
{
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
}
|
||||
}
|
||||
|
||||
// change command status
|
||||
var cmdStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(x => x.Sequence == 5);
|
||||
command.CommandStatusId = cmdStatus!.Id;
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
}
|
||||
catch
|
||||
|
|
@ -7739,6 +7907,65 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
// create command payload
|
||||
var payload_attach = command.Documents
|
||||
.Select(x => new PayloadAttachment
|
||||
{
|
||||
name = x.Category == "cover" ? "สำเนาคำสั่ง" : "สำเนาเอกสารแนบท้าย",
|
||||
url = $"{_configuration["API"]}/order/download/attachment/{x.Document.Id}"
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var payload = new CommandPayload()
|
||||
{
|
||||
attachments = payload_attach
|
||||
};
|
||||
|
||||
var payload_str = JsonConvert.SerializeObject(payload);
|
||||
// send cc noti inbox
|
||||
foreach (var cc in command.Deployments)
|
||||
{
|
||||
var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||
if (pf != null)
|
||||
{
|
||||
if (cc.IsSendInbox)
|
||||
{
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
}
|
||||
|
||||
if (cc.IsSendMail)
|
||||
{
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
}
|
||||
}
|
||||
|
||||
// change command status
|
||||
var cmdStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(x => x.Sequence == 5);
|
||||
command.CommandStatusId = cmdStatus!.Id;
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
}
|
||||
catch
|
||||
|
|
@ -7771,6 +7998,65 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
// create command payload
|
||||
var payload_attach = command.Documents
|
||||
.Select(x => new PayloadAttachment
|
||||
{
|
||||
name = x.Category == "cover" ? "สำเนาคำสั่ง" : "สำเนาเอกสารแนบท้าย",
|
||||
url = $"{_configuration["API"]}/order/download/attachment/{x.Document.Id}"
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var payload = new CommandPayload()
|
||||
{
|
||||
attachments = payload_attach
|
||||
};
|
||||
|
||||
var payload_str = JsonConvert.SerializeObject(payload);
|
||||
// send cc noti inbox
|
||||
foreach (var cc in command.Deployments)
|
||||
{
|
||||
var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||
if (pf != null)
|
||||
{
|
||||
if (cc.IsSendInbox)
|
||||
{
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
}
|
||||
|
||||
if (cc.IsSendMail)
|
||||
{
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
}
|
||||
}
|
||||
|
||||
// change command status
|
||||
var cmdStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(x => x.Sequence == 5);
|
||||
command.CommandStatusId = cmdStatus!.Id;
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
}
|
||||
catch
|
||||
|
|
@ -7795,7 +8081,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/down/resume";
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
|
|
@ -7803,6 +8089,65 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
// create command payload
|
||||
var payload_attach = command.Documents
|
||||
.Select(x => new PayloadAttachment
|
||||
{
|
||||
name = x.Category == "cover" ? "สำเนาคำสั่ง" : "สำเนาเอกสารแนบท้าย",
|
||||
url = $"{_configuration["API"]}/order/download/attachment/{x.Document.Id}"
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var payload = new CommandPayload()
|
||||
{
|
||||
attachments = payload_attach
|
||||
};
|
||||
|
||||
var payload_str = JsonConvert.SerializeObject(payload);
|
||||
// send cc noti inbox
|
||||
foreach (var cc in command.Deployments)
|
||||
{
|
||||
var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||
if (pf != null)
|
||||
{
|
||||
if (cc.IsSendInbox)
|
||||
{
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
}
|
||||
|
||||
if (cc.IsSendMail)
|
||||
{
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
}
|
||||
}
|
||||
|
||||
// change command status
|
||||
var cmdStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(x => x.Sequence == 5);
|
||||
command.CommandStatusId = cmdStatus!.Id;
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
}
|
||||
catch
|
||||
|
|
@ -7827,7 +8172,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/down/resume";
|
||||
var apiUrl = $"{baseAPI}/discipline/result/report/up/resume";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
|
|
@ -7835,6 +8180,65 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
// create command payload
|
||||
var payload_attach = command.Documents
|
||||
.Select(x => new PayloadAttachment
|
||||
{
|
||||
name = x.Category == "cover" ? "สำเนาคำสั่ง" : "สำเนาเอกสารแนบท้าย",
|
||||
url = $"{_configuration["API"]}/order/download/attachment/{x.Document.Id}"
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var payload = new CommandPayload()
|
||||
{
|
||||
attachments = payload_attach
|
||||
};
|
||||
|
||||
var payload_str = JsonConvert.SerializeObject(payload);
|
||||
// send cc noti inbox
|
||||
foreach (var cc in command.Deployments)
|
||||
{
|
||||
var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||
if (pf != null)
|
||||
{
|
||||
if (cc.IsSendInbox)
|
||||
{
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
}
|
||||
|
||||
if (cc.IsSendMail)
|
||||
{
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
}
|
||||
}
|
||||
|
||||
// change command status
|
||||
var cmdStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(x => x.Sequence == 5);
|
||||
command.CommandStatusId = cmdStatus!.Id;
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
}
|
||||
catch
|
||||
|
|
@ -7867,6 +8271,65 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
|
||||
var result = await res.Content.ReadAsStringAsync();
|
||||
}
|
||||
// create command payload
|
||||
var payload_attach = command.Documents
|
||||
.Select(x => new PayloadAttachment
|
||||
{
|
||||
name = x.Category == "cover" ? "สำเนาคำสั่ง" : "สำเนาเอกสารแนบท้าย",
|
||||
url = $"{_configuration["API"]}/order/download/attachment/{x.Document.Id}"
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var payload = new CommandPayload()
|
||||
{
|
||||
attachments = payload_attach
|
||||
};
|
||||
|
||||
var payload_str = JsonConvert.SerializeObject(payload);
|
||||
// send cc noti inbox
|
||||
foreach (var cc in command.Deployments)
|
||||
{
|
||||
var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||
if (pf != null)
|
||||
{
|
||||
if (cc.IsSendInbox)
|
||||
{
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
}
|
||||
|
||||
if (cc.IsSendMail)
|
||||
{
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
}
|
||||
}
|
||||
|
||||
// change command status
|
||||
var cmdStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(x => x.Sequence == 5);
|
||||
command.CommandStatusId = cmdStatus!.Id;
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
}
|
||||
catch
|
||||
|
|
@ -7917,6 +8380,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
.Include(x => x.Placement)
|
||||
.Include(x => x.CommandType)
|
||||
.Include(x => x.CommandStatus)
|
||||
.Include(x => x.Receivers)
|
||||
.OrderBy(x => x.CommandType.CommandCode)
|
||||
.ThenByDescending(x => x.CommandAffectDate)
|
||||
.ToListAsync();
|
||||
|
|
|
|||
|
|
@ -274,7 +274,29 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
//case "C-PM-17":
|
||||
case "C-PM-18":
|
||||
case "C-PM-19":
|
||||
{
|
||||
if (command.CommandNo != "" &&
|
||||
command.CommandYear != null &&
|
||||
command.CommandExcecuteDate != null &&
|
||||
cover != null)
|
||||
{
|
||||
return Success(new { result = "Y" });
|
||||
}
|
||||
else
|
||||
return Success(new { result = "N" });
|
||||
}
|
||||
case "C-PM-20":
|
||||
{
|
||||
if (command.CommandNo != "" &&
|
||||
command.CommandYear != null &&
|
||||
command.CommandExcecuteDate != null &&
|
||||
cover != null)
|
||||
{
|
||||
return Success(new { result = "Y" });
|
||||
}
|
||||
else
|
||||
return Success(new { result = "N" });
|
||||
}
|
||||
case "C-PM-21":
|
||||
case "C-PM-22":
|
||||
case "C-PM-23":
|
||||
|
|
@ -291,13 +313,101 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
}
|
||||
case "C-PM-24":
|
||||
case "C-PM-25":
|
||||
{
|
||||
if (command.CommandNo != "" &&
|
||||
command.CommandYear != null &&
|
||||
command.CommandExcecuteDate != null &&
|
||||
cover != null)
|
||||
{
|
||||
return Success(new { result = "Y" });
|
||||
}
|
||||
else
|
||||
return Success(new { result = "N" });
|
||||
}
|
||||
case "C-PM-26":
|
||||
{
|
||||
if (command.CommandNo != "" &&
|
||||
command.CommandYear != null &&
|
||||
command.CommandExcecuteDate != null &&
|
||||
cover != null)
|
||||
{
|
||||
return Success(new { result = "Y" });
|
||||
}
|
||||
else
|
||||
return Success(new { result = "N" });
|
||||
}
|
||||
case "C-PM-27":
|
||||
{
|
||||
if (command.CommandNo != "" &&
|
||||
command.CommandYear != null &&
|
||||
command.CommandExcecuteDate != null &&
|
||||
cover != null)
|
||||
{
|
||||
return Success(new { result = "Y" });
|
||||
}
|
||||
else
|
||||
return Success(new { result = "N" });
|
||||
}
|
||||
case "C-PM-28":
|
||||
{
|
||||
if (command.CommandNo != "" &&
|
||||
command.CommandYear != null &&
|
||||
command.CommandExcecuteDate != null &&
|
||||
cover != null)
|
||||
{
|
||||
return Success(new { result = "Y" });
|
||||
}
|
||||
else
|
||||
return Success(new { result = "N" });
|
||||
}
|
||||
case "C-PM-29":
|
||||
{
|
||||
if (command.CommandNo != "" &&
|
||||
command.CommandYear != null &&
|
||||
command.CommandExcecuteDate != null &&
|
||||
cover != null)
|
||||
{
|
||||
return Success(new { result = "Y" });
|
||||
}
|
||||
else
|
||||
return Success(new { result = "N" });
|
||||
}
|
||||
case "C-PM-30":
|
||||
{
|
||||
if (command.CommandNo != "" &&
|
||||
command.CommandYear != null &&
|
||||
command.CommandExcecuteDate != null &&
|
||||
cover != null)
|
||||
{
|
||||
return Success(new { result = "Y" });
|
||||
}
|
||||
else
|
||||
return Success(new { result = "N" });
|
||||
}
|
||||
case "C-PM-31":
|
||||
{
|
||||
if (command.CommandNo != "" &&
|
||||
command.CommandYear != null &&
|
||||
command.CommandExcecuteDate != null &&
|
||||
cover != null)
|
||||
{
|
||||
return Success(new { result = "Y" });
|
||||
}
|
||||
else
|
||||
return Success(new { result = "N" });
|
||||
}
|
||||
case "C-PM-32":
|
||||
{
|
||||
if (command.CommandNo != "" &&
|
||||
command.CommandYear != null &&
|
||||
command.CommandExcecuteDate != null &&
|
||||
cover != null)
|
||||
{
|
||||
return Success(new { result = "Y" });
|
||||
}
|
||||
else
|
||||
return Success(new { result = "N" });
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (command.CommandNo != "" &&
|
||||
|
|
@ -406,7 +516,12 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
OrderStatusValue = d.CommandStatusId,
|
||||
OrderStatusName = d.CommandStatus.Name,
|
||||
OrderTypeValue = d.CommandTypeId,
|
||||
OrderTypeName = d.CommandType.Name
|
||||
OrderTypeName = d.CommandType.Name,
|
||||
FaultLevel = d.FaultLevel,
|
||||
CaseFault = d.CaseFault,
|
||||
Result = d.Result,
|
||||
RefRaw = d.RefRaw,
|
||||
FullName = d.Receivers.FirstOrDefault() == null ? null : $"{d.Receivers.FirstOrDefault().Prefix!}{d.Receivers.FirstOrDefault().FirstName!} {d.Receivers.FirstOrDefault().LastName!}",
|
||||
}).ToList();
|
||||
return Success(data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -426,7 +426,10 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.Where(x => x.Id == d.id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data != null)
|
||||
{
|
||||
data.Status = "NEW";
|
||||
data.CommandTypeId = null;
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return Success();
|
||||
|
|
@ -450,7 +453,10 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.Where(x => x.Id == d.id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data != null)
|
||||
{
|
||||
data.StatusDiscard = "NEW";
|
||||
data.CommandTypeDiscardId = null;
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return Success();
|
||||
|
|
@ -504,7 +510,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
.Where(x => x.Id == d.id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data != null)
|
||||
data.Status = "NEW";
|
||||
data.Status = "DONE";
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return Success();
|
||||
|
|
|
|||
|
|
@ -175,9 +175,9 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
|
|||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("report")]
|
||||
// [HttpPut("report/{commandTypeId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] DisciplineProfileRequest req)
|
||||
// [HttpPost("report")]
|
||||
[HttpPut("report/{commandTypeId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] DisciplineProfileRequest req, Guid commandTypeId)
|
||||
{
|
||||
foreach (var item in req.Id)
|
||||
{
|
||||
|
|
@ -186,7 +186,7 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
|
|||
if (uppdated == null)
|
||||
continue;
|
||||
|
||||
// uppdated.CommandTypeId = commandTypeId;
|
||||
uppdated.CommandTypeId = commandTypeId;
|
||||
uppdated.Status = "REPORT";
|
||||
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
uppdated.LastUpdateUserId = UserId ?? "";
|
||||
|
|
|
|||
|
|
@ -1905,42 +1905,80 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
|
||||
#region " C-PM-19 "
|
||||
|
||||
private async Task<byte[]> GenerateCommandReportType19_Cover(Guid commandId, string exportType)
|
||||
private async Task<dynamic> GenerateCommandReportType19_Cover(Guid commandId, string exportType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var command = await _repository.GetByIdAsync(commandId);
|
||||
if (command == null)
|
||||
// var command = await _repository.GetByIdAsync(commandId);
|
||||
// if (command == null)
|
||||
// {
|
||||
// throw new Exception(GlobalMessages.CommandNotFound);
|
||||
// }
|
||||
|
||||
// var data = await _commandReportRepository.GetCommandType19Async(commandId);
|
||||
|
||||
// var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"37-คำสั่งปลดออกจากราชการ.trdp");
|
||||
|
||||
// ReportPackager reportPackager = new ReportPackager();
|
||||
// Telerik.Reporting.Report? report = null;
|
||||
// using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
// {
|
||||
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
// }
|
||||
|
||||
// report.DataSource = data;
|
||||
|
||||
// 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);
|
||||
|
||||
// var content = result.DocumentBytes;
|
||||
|
||||
// return content;
|
||||
var raw_data = await _repository.GetByIdAsync(commandId);
|
||||
if (raw_data == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
}
|
||||
|
||||
var data = await _commandReportRepository.GetCommandType19Async(commandId);
|
||||
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId);
|
||||
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"37-คำสั่งปลดออกจากราชการ.trdp");
|
||||
|
||||
ReportPackager reportPackager = new ReportPackager();
|
||||
Telerik.Reporting.Report? report = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
var command = new
|
||||
{
|
||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
}
|
||||
No = raw_data.CommandNo.ToThaiNumber(),
|
||||
Year = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
||||
Issuerorganizationname = raw_data.IssuerOrganizationName,
|
||||
ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
||||
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
||||
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
PositionList = "",
|
||||
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
||||
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
||||
AuthorizedPosition = raw_data.AuthorizedPosition,
|
||||
ReceiveOrganizationName = raw_data.ReceiveOrganizationName,
|
||||
Title = $"{raw_data.CommandSubject}",
|
||||
|
||||
report.DataSource = data;
|
||||
CaseFault = raw_data.CaseFault,
|
||||
FaultLevel = raw_data.FaultLevel,
|
||||
RefRaw = raw_data.RefRaw,
|
||||
Result = raw_data.Result,
|
||||
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
ReportDocument = report
|
||||
Fullname = raw_data_profile == null ? "" : raw_data_profile.FullName,
|
||||
Positionname = raw_data_profile == null ? "" : raw_data_profile.Positionname,
|
||||
Positionno = raw_data_profile == null ? "" : raw_data_profile.Positionno,
|
||||
Organizationname = raw_data_profile == null ? "" : raw_data_profile.Organizationname,
|
||||
Salary = raw_data_profile == null ? "" : raw_data_profile.Salary,
|
||||
};
|
||||
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
||||
|
||||
var content = result.DocumentBytes;
|
||||
|
||||
return content;
|
||||
return command;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -1952,42 +1990,80 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
|
||||
#region " C-PM-20 "
|
||||
|
||||
private async Task<byte[]> GenerateCommandReportType20_Cover(Guid commandId, string exportType)
|
||||
private async Task<dynamic> GenerateCommandReportType20_Cover(Guid commandId, string exportType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var command = await _repository.GetByIdAsync(commandId);
|
||||
if (command == null)
|
||||
// var command = await _repository.GetByIdAsync(commandId);
|
||||
// if (command == null)
|
||||
// {
|
||||
// throw new Exception(GlobalMessages.CommandNotFound);
|
||||
// }
|
||||
|
||||
// var data = await _commandReportRepository.GetCommandType20Async(commandId);
|
||||
|
||||
// var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"38-คำสั่งลงโทษไล่ข้าราชการออกจากราชการ.trdp");
|
||||
|
||||
// ReportPackager reportPackager = new ReportPackager();
|
||||
// Telerik.Reporting.Report? report = null;
|
||||
// using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
// {
|
||||
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
// }
|
||||
|
||||
// report.DataSource = data;
|
||||
|
||||
// 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);
|
||||
|
||||
// var content = result.DocumentBytes;
|
||||
|
||||
// return content;
|
||||
var raw_data = await _repository.GetByIdAsync(commandId);
|
||||
if (raw_data == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
}
|
||||
|
||||
var data = await _commandReportRepository.GetCommandType20Async(commandId);
|
||||
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId);
|
||||
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"38-คำสั่งลงโทษไล่ข้าราชการออกจากราชการ.trdp");
|
||||
|
||||
ReportPackager reportPackager = new ReportPackager();
|
||||
Telerik.Reporting.Report? report = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
var command = new
|
||||
{
|
||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
}
|
||||
No = raw_data.CommandNo.ToThaiNumber(),
|
||||
Year = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
||||
Issuerorganizationname = raw_data.IssuerOrganizationName,
|
||||
ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
||||
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
||||
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
PositionList = "",
|
||||
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
||||
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
||||
AuthorizedPosition = raw_data.AuthorizedPosition,
|
||||
ReceiveOrganizationName = raw_data.ReceiveOrganizationName,
|
||||
Title = $"{raw_data.CommandSubject}",
|
||||
|
||||
report.DataSource = data;
|
||||
CaseFault = raw_data.CaseFault,
|
||||
FaultLevel = raw_data.FaultLevel,
|
||||
RefRaw = raw_data.RefRaw,
|
||||
Result = raw_data.Result,
|
||||
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
ReportDocument = report
|
||||
Fullname = raw_data_profile == null ? "" : raw_data_profile.FullName,
|
||||
Positionname = raw_data_profile == null ? "" : raw_data_profile.Positionname,
|
||||
Positionno = raw_data_profile == null ? "" : raw_data_profile.Positionno,
|
||||
Organizationname = raw_data_profile == null ? "" : raw_data_profile.Organizationname,
|
||||
Salary = raw_data_profile == null ? "" : raw_data_profile.Salary,
|
||||
};
|
||||
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
||||
|
||||
var content = result.DocumentBytes;
|
||||
|
||||
return content;
|
||||
return command;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -3756,7 +3832,6 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
{
|
||||
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 cmd = await _repository.GetByIdAsync(id);
|
||||
|
|
@ -3764,7 +3839,24 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType19_Cover(id, exportType);
|
||||
return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||
var data = new
|
||||
{
|
||||
template = "DP6_005",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
// // var res = await client.SendAsync(req);
|
||||
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
||||
// var result = await res.Content.ReadAsStringAsync();
|
||||
// return Success(res);
|
||||
|
||||
// }
|
||||
return Success(data);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -3799,7 +3891,6 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
{
|
||||
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 cmd = await _repository.GetByIdAsync(id);
|
||||
|
|
@ -3807,7 +3898,24 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType20_Cover(id, exportType);
|
||||
return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||
var data = new
|
||||
{
|
||||
template = "DP6_008",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
// // var res = await client.SendAsync(req);
|
||||
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
||||
// var result = await res.Content.ReadAsStringAsync();
|
||||
// return Success(res);
|
||||
|
||||
// }
|
||||
return Success(data);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue