diff --git a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs
index 5ac6dbae..5a060ba3 100644
--- a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs
+++ b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs
@@ -184,6 +184,21 @@ namespace BMA.EHR.Application.Repositories.Commands
case "C-PM-32":
result = await GetReceiver32Async(command, token);
break;
+ case "C-PM-33":
+ result = await GetReceiver33Async(command, token);
+ break;
+ case "C-PM-34":
+ result = await GetReceiver34Async(command, token);
+ break;
+ case "C-PM-35":
+ result = await GetReceiver35Async(command, token);
+ break;
+ case "C-PM-36":
+ result = await GetReceiver36Async(command, token);
+ break;
+ case "C-PM-37":
+ result = await GetReceiver37Async(command, token);
+ break;
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
}
@@ -2272,6 +2287,266 @@ namespace BMA.EHR.Application.Repositories.Commands
}
}
+
+ ///
+ /// C-PM-33
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver33Async(Command command, string token)
+ {
+ try
+ {
+ var resultData = new List();
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/33/{command.SalaryPeriodId}";
+
+ var response = new PassSalaryResponse();
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
+ var res = await client.SendAsync(req);
+ var result = await res.Content.ReadAsStringAsync();
+
+ response = JsonConvert.DeserializeObject(result);
+
+ var seq = 1;
+ foreach (var d in response!.result)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = d.citizenId,
+ Prefix = d.prefix,
+ FirstName = d.firstName,
+ LastName = d.lastName,
+ RefPlacementProfileId = d.profileId,
+ RefDisciplineId = d.id,
+ };
+ seq++;
+
+ resultData.Add(receiver);
+ }
+ }
+
+ return resultData;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+
+ ///
+ /// C-PM-34
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver34Async(Command command, string token)
+ {
+ try
+ {
+ var resultData = new List();
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/34/{command.SalaryPeriodId}";
+
+ var response = new PassSalaryResponse();
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
+ var res = await client.SendAsync(req);
+ var result = await res.Content.ReadAsStringAsync();
+
+ response = JsonConvert.DeserializeObject(result);
+
+ var seq = 1;
+ foreach (var d in response!.result)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = d.citizenId,
+ Prefix = d.prefix,
+ FirstName = d.firstName,
+ LastName = d.lastName,
+ RefPlacementProfileId = d.profileId,
+ RefDisciplineId = d.id,
+ };
+ seq++;
+
+ resultData.Add(receiver);
+ }
+ }
+
+ return resultData;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+
+ ///
+ /// C-PM-35
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver35Async(Command command, string token)
+ {
+ try
+ {
+ var resultData = new List();
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/35/{command.SalaryPeriodId}";
+
+ var response = new PassSalaryResponse();
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
+ var res = await client.SendAsync(req);
+ var result = await res.Content.ReadAsStringAsync();
+
+ response = JsonConvert.DeserializeObject(result);
+
+ var seq = 1;
+ foreach (var d in response!.result)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = d.citizenId,
+ Prefix = d.prefix,
+ FirstName = d.firstName,
+ LastName = d.lastName,
+ RefPlacementProfileId = d.profileId,
+ RefDisciplineId = d.id,
+ };
+ seq++;
+
+ resultData.Add(receiver);
+ }
+ }
+
+ return resultData;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+
+ ///
+ /// C-PM-36
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver36Async(Command command, string token)
+ {
+ try
+ {
+ var resultData = new List();
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/36/{command.SalaryPeriodId}";
+
+ var response = new PassSalaryResponse();
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
+ var res = await client.SendAsync(req);
+ var result = await res.Content.ReadAsStringAsync();
+
+ response = JsonConvert.DeserializeObject(result);
+
+ var seq = 1;
+ foreach (var d in response!.result)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = d.citizenId,
+ Prefix = d.prefix,
+ FirstName = d.firstName,
+ LastName = d.lastName,
+ RefPlacementProfileId = d.profileId,
+ RefDisciplineId = d.id,
+ };
+ seq++;
+
+ resultData.Add(receiver);
+ }
+ }
+
+ return resultData;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+
+ ///
+ /// C-PM-37
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task> GetReceiver37Async(Command command, string token)
+ {
+ try
+ {
+ var resultData = new List();
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/37/{command.SalaryPeriodId}";
+
+ var response = new PassSalaryResponse();
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
+ var res = await client.SendAsync(req);
+ var result = await res.Content.ReadAsStringAsync();
+
+ response = JsonConvert.DeserializeObject(result);
+
+ var seq = 1;
+ foreach (var d in response!.result)
+ {
+ var receiver = new CommandReceiver
+ {
+ Sequence = seq,
+ CitizenId = d.citizenId,
+ Prefix = d.prefix,
+ FirstName = d.firstName,
+ LastName = d.lastName,
+ RefPlacementProfileId = d.profileId,
+ RefDisciplineId = d.id,
+ };
+ seq++;
+
+ resultData.Add(receiver);
+ }
+ }
+
+ return resultData;
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
#endregion
#region " Execute and Deploy "
@@ -2374,6 +2649,21 @@ namespace BMA.EHR.Application.Repositories.Commands
case "C-PM-32":
await ExecuteCommand32Async(command, token);
break;
+ case "C-PM-33":
+ await ExecuteCommand33Async(command, token);
+ break;
+ case "C-PM-34":
+ await ExecuteCommand34Async(command, token);
+ break;
+ case "C-PM-35":
+ await ExecuteCommand35Async(command, token);
+ break;
+ case "C-PM-36":
+ await ExecuteCommand36Async(command, token);
+ break;
+ case "C-PM-37":
+ await ExecuteCommand37Async(command, token);
+ break;
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
}
@@ -9194,6 +9484,1001 @@ namespace BMA.EHR.Application.Repositories.Commands
}
}
+
+ ///
+ /// C-PM-33 - คำสั่งยุติเรื่อง
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task ExecuteCommand33Async(Command command, string token = "")
+ {
+ try
+ {
+ var data = command.Receivers.Select(x => new
+ {
+ PersonId = x.RefPlacementProfileId,
+ Id = x.RefDisciplineId,
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/33/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ // 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);
+ // foreach (var recv in command.Receivers)
+ // {
+ // var dataProfile = await _dbContext.Set()
+ // .Include(x => x.Salaries)
+ // .ThenInclude(x => x.PositionLevel)
+ // .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
+
+ // if (dataProfile == null)
+ // throw new Exception(GlobalMessages.DataNotFound);
+
+ // dataProfile.IsActive = false;
+ // dataProfile.IsLeave = true;
+ // dataProfile.LeaveReason = "ได้รับโทษทางวินัย ยุติเรื่อง";
+ // dataProfile.LeaveDate = command.CommandAffectDate;
+
+ // var lastSarary = dataProfile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
+ // var order = 1;
+ // if (lastSarary != null && lastSarary.Order != null)
+ // order = lastSarary.Order.Value + 1;
+
+ // var salary = new ProfileSalary
+ // {
+ // Order = order,
+ // Date = command.CommandAffectDate,
+ // Amount = lastSarary == null ? null : lastSarary.Amount,
+ // PositionSalaryAmount = lastSarary == null ? null : lastSarary.PositionSalaryAmount,
+ // MouthSalaryAmount = lastSarary == null ? null : lastSarary.MouthSalaryAmount,
+ // SalaryClass = "",
+ // SalaryRef = "คำสั่งยุติเรื่อง คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
+
+ // OcId = lastSarary == null ? null : lastSarary.OcId,
+
+ // PositionId = lastSarary == null ? null : lastSarary.PositionId,
+
+ // PositionLevel = lastSarary == null ? null : lastSarary.PositionLevel,
+ // PositionLineId = lastSarary == null ? null : lastSarary.PositionLineId,
+ // PositionTypeId = lastSarary == null ? null : lastSarary.PositionTypeId,
+ // OrganizationShortNameId = lastSarary == null ? null : lastSarary.OrganizationShortNameId,
+ // PosNoId = lastSarary == null ? null : lastSarary.PosNoId,
+
+ // CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
+ // RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
+ // CommandTypeName = command.CommandType.Name,
+
+
+ // PositionEmployeeGroupId = null,
+ // PositionEmployeeLevelId = null,
+ // PositionEmployeePositionId = null,
+ // PositionEmployeePositionSideId = null,
+ // PosNoEmployee = "",
+
+
+ // //PositionPathSideId = lastSarary ==null? null : lastSarary.PositionPathSideId == null,
+ // PositionExecutiveId = lastSarary == null ? null : lastSarary.PositionExecutiveId,
+ // //PositionExecutiveSideId = lastSarary ==null? null : lastSarary.PositionExecutiveSideId,
+
+ // IsActive = true,
+ // CreatedAt = DateTime.Now,
+ // CreatedFullName = FullName ?? "System Administrator",
+ // CreatedUserId = UserId ?? "",
+ // LastUpdatedAt = DateTime.Now,
+ // LastUpdateFullName = FullName ?? "System Administrator",
+ // LastUpdateUserId = UserId ?? "",
+
+ // };
+
+ // if (lastSarary != null && lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId;
+ // if (lastSarary != null && lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId;
+
+ // dataProfile.Salaries.Add(salary);
+
+ // // remove profile position
+ // var profilePosition = await _dbContext.Set()
+ // .Include(x => x.Profile)
+ // .Include(x => x.OrganizationPosition)
+ // .FirstOrDefaultAsync(x => x.Profile!.Id == dataProfile.Id);
+ // if (profilePosition != null)
+ // _dbContext.Set().Remove(profilePosition);
+
+ // await _dbContext.SaveChangesAsync();
+
+ // // 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 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 = dataProfile.Id,
+ // Payload = payload_str,
+ // };
+ // _dbContext.Set().Add(inbox);
+
+ // var noti = new Notification
+ // {
+ // Body = $"คุณได้รับคำสั่งยุติเรื่อง เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
+ // ReceiverUserId = dataProfile.Id,
+ // Type = "LINK",
+ // Payload = payload_str,
+ // };
+ // _dbContext.Set().Add(noti);
+ // await _dbContext.SaveChangesAsync();
+ // }
+ // send cc noti inbox
+ foreach (var cc in command.Deployments)
+ {
+ var pf = await _dbContext.Set().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().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().Add(noti);
+ }
+ }
+
+ // change command status
+ var cmdStatus = await _dbContext.Set().FirstOrDefaultAsync(x => x.Sequence == 5);
+ command.CommandStatusId = cmdStatus!.Id;
+
+ await _dbContext.SaveChangesAsync();
+
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+
+ ///
+ /// C-PM-34 - คำสั่งยุติเรื่อง
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task ExecuteCommand34Async(Command command, string token = "")
+ {
+ try
+ {
+ var data = command.Receivers.Select(x => new
+ {
+ PersonId = x.RefPlacementProfileId,
+ Id = x.RefDisciplineId,
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/34/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ // 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);
+ // foreach (var recv in command.Receivers)
+ // {
+ // var dataProfile = await _dbContext.Set()
+ // .Include(x => x.Salaries)
+ // .ThenInclude(x => x.PositionLevel)
+ // .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
+
+ // if (dataProfile == null)
+ // throw new Exception(GlobalMessages.DataNotFound);
+
+ // dataProfile.IsActive = false;
+ // dataProfile.IsLeave = true;
+ // dataProfile.LeaveReason = "ได้รับโทษทางวินัย ยุติเรื่อง";
+ // dataProfile.LeaveDate = command.CommandAffectDate;
+
+ // var lastSarary = dataProfile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
+ // var order = 1;
+ // if (lastSarary != null && lastSarary.Order != null)
+ // order = lastSarary.Order.Value + 1;
+
+ // var salary = new ProfileSalary
+ // {
+ // Order = order,
+ // Date = command.CommandAffectDate,
+ // Amount = lastSarary == null ? null : lastSarary.Amount,
+ // PositionSalaryAmount = lastSarary == null ? null : lastSarary.PositionSalaryAmount,
+ // MouthSalaryAmount = lastSarary == null ? null : lastSarary.MouthSalaryAmount,
+ // SalaryClass = "",
+ // SalaryRef = "คำสั่งยุติเรื่อง คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
+
+ // OcId = lastSarary == null ? null : lastSarary.OcId,
+
+ // PositionId = lastSarary == null ? null : lastSarary.PositionId,
+
+ // PositionLevel = lastSarary == null ? null : lastSarary.PositionLevel,
+ // PositionLineId = lastSarary == null ? null : lastSarary.PositionLineId,
+ // PositionTypeId = lastSarary == null ? null : lastSarary.PositionTypeId,
+ // OrganizationShortNameId = lastSarary == null ? null : lastSarary.OrganizationShortNameId,
+ // PosNoId = lastSarary == null ? null : lastSarary.PosNoId,
+
+ // CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
+ // RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
+ // CommandTypeName = command.CommandType.Name,
+
+
+ // PositionEmployeeGroupId = null,
+ // PositionEmployeeLevelId = null,
+ // PositionEmployeePositionId = null,
+ // PositionEmployeePositionSideId = null,
+ // PosNoEmployee = "",
+
+
+ // //PositionPathSideId = lastSarary ==null? null : lastSarary.PositionPathSideId == null,
+ // PositionExecutiveId = lastSarary == null ? null : lastSarary.PositionExecutiveId,
+ // //PositionExecutiveSideId = lastSarary ==null? null : lastSarary.PositionExecutiveSideId,
+
+ // IsActive = true,
+ // CreatedAt = DateTime.Now,
+ // CreatedFullName = FullName ?? "System Administrator",
+ // CreatedUserId = UserId ?? "",
+ // LastUpdatedAt = DateTime.Now,
+ // LastUpdateFullName = FullName ?? "System Administrator",
+ // LastUpdateUserId = UserId ?? "",
+
+ // };
+
+ // if (lastSarary != null && lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId;
+ // if (lastSarary != null && lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId;
+
+ // dataProfile.Salaries.Add(salary);
+
+ // // remove profile position
+ // var profilePosition = await _dbContext.Set()
+ // .Include(x => x.Profile)
+ // .Include(x => x.OrganizationPosition)
+ // .FirstOrDefaultAsync(x => x.Profile!.Id == dataProfile.Id);
+ // if (profilePosition != null)
+ // _dbContext.Set().Remove(profilePosition);
+
+ // await _dbContext.SaveChangesAsync();
+
+ // // 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 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 = dataProfile.Id,
+ // Payload = payload_str,
+ // };
+ // _dbContext.Set().Add(inbox);
+
+ // var noti = new Notification
+ // {
+ // Body = $"คุณได้รับคำสั่งยุติเรื่อง เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
+ // ReceiverUserId = dataProfile.Id,
+ // Type = "LINK",
+ // Payload = payload_str,
+ // };
+ // _dbContext.Set().Add(noti);
+ // await _dbContext.SaveChangesAsync();
+ // }
+ // send cc noti inbox
+ foreach (var cc in command.Deployments)
+ {
+ var pf = await _dbContext.Set().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().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().Add(noti);
+ }
+ }
+
+ // change command status
+ var cmdStatus = await _dbContext.Set().FirstOrDefaultAsync(x => x.Sequence == 5);
+ command.CommandStatusId = cmdStatus!.Id;
+
+ await _dbContext.SaveChangesAsync();
+
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+
+ ///
+ /// C-PM-35 - คำสั่งยุติเรื่อง
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task ExecuteCommand35Async(Command command, string token = "")
+ {
+ try
+ {
+ var data = command.Receivers.Select(x => new
+ {
+ PersonId = x.RefPlacementProfileId,
+ Id = x.RefDisciplineId,
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/35/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ // 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);
+ // foreach (var recv in command.Receivers)
+ // {
+ // var dataProfile = await _dbContext.Set()
+ // .Include(x => x.Salaries)
+ // .ThenInclude(x => x.PositionLevel)
+ // .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
+
+ // if (dataProfile == null)
+ // throw new Exception(GlobalMessages.DataNotFound);
+
+ // dataProfile.IsActive = false;
+ // dataProfile.IsLeave = true;
+ // dataProfile.LeaveReason = "ได้รับโทษทางวินัย ยุติเรื่อง";
+ // dataProfile.LeaveDate = command.CommandAffectDate;
+
+ // var lastSarary = dataProfile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
+ // var order = 1;
+ // if (lastSarary != null && lastSarary.Order != null)
+ // order = lastSarary.Order.Value + 1;
+
+ // var salary = new ProfileSalary
+ // {
+ // Order = order,
+ // Date = command.CommandAffectDate,
+ // Amount = lastSarary == null ? null : lastSarary.Amount,
+ // PositionSalaryAmount = lastSarary == null ? null : lastSarary.PositionSalaryAmount,
+ // MouthSalaryAmount = lastSarary == null ? null : lastSarary.MouthSalaryAmount,
+ // SalaryClass = "",
+ // SalaryRef = "คำสั่งยุติเรื่อง คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
+
+ // OcId = lastSarary == null ? null : lastSarary.OcId,
+
+ // PositionId = lastSarary == null ? null : lastSarary.PositionId,
+
+ // PositionLevel = lastSarary == null ? null : lastSarary.PositionLevel,
+ // PositionLineId = lastSarary == null ? null : lastSarary.PositionLineId,
+ // PositionTypeId = lastSarary == null ? null : lastSarary.PositionTypeId,
+ // OrganizationShortNameId = lastSarary == null ? null : lastSarary.OrganizationShortNameId,
+ // PosNoId = lastSarary == null ? null : lastSarary.PosNoId,
+
+ // CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
+ // RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
+ // CommandTypeName = command.CommandType.Name,
+
+
+ // PositionEmployeeGroupId = null,
+ // PositionEmployeeLevelId = null,
+ // PositionEmployeePositionId = null,
+ // PositionEmployeePositionSideId = null,
+ // PosNoEmployee = "",
+
+
+ // //PositionPathSideId = lastSarary ==null? null : lastSarary.PositionPathSideId == null,
+ // PositionExecutiveId = lastSarary == null ? null : lastSarary.PositionExecutiveId,
+ // //PositionExecutiveSideId = lastSarary ==null? null : lastSarary.PositionExecutiveSideId,
+
+ // IsActive = true,
+ // CreatedAt = DateTime.Now,
+ // CreatedFullName = FullName ?? "System Administrator",
+ // CreatedUserId = UserId ?? "",
+ // LastUpdatedAt = DateTime.Now,
+ // LastUpdateFullName = FullName ?? "System Administrator",
+ // LastUpdateUserId = UserId ?? "",
+
+ // };
+
+ // if (lastSarary != null && lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId;
+ // if (lastSarary != null && lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId;
+
+ // dataProfile.Salaries.Add(salary);
+
+ // // remove profile position
+ // var profilePosition = await _dbContext.Set()
+ // .Include(x => x.Profile)
+ // .Include(x => x.OrganizationPosition)
+ // .FirstOrDefaultAsync(x => x.Profile!.Id == dataProfile.Id);
+ // if (profilePosition != null)
+ // _dbContext.Set().Remove(profilePosition);
+
+ // await _dbContext.SaveChangesAsync();
+
+ // // 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 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 = dataProfile.Id,
+ // Payload = payload_str,
+ // };
+ // _dbContext.Set().Add(inbox);
+
+ // var noti = new Notification
+ // {
+ // Body = $"คุณได้รับคำสั่งยุติเรื่อง เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
+ // ReceiverUserId = dataProfile.Id,
+ // Type = "LINK",
+ // Payload = payload_str,
+ // };
+ // _dbContext.Set().Add(noti);
+ // await _dbContext.SaveChangesAsync();
+ // }
+ // send cc noti inbox
+ foreach (var cc in command.Deployments)
+ {
+ var pf = await _dbContext.Set().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().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().Add(noti);
+ }
+ }
+
+ // change command status
+ var cmdStatus = await _dbContext.Set().FirstOrDefaultAsync(x => x.Sequence == 5);
+ command.CommandStatusId = cmdStatus!.Id;
+
+ await _dbContext.SaveChangesAsync();
+
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+
+ ///
+ /// C-PM-36 - คำสั่งยุติเรื่อง
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task ExecuteCommand36Async(Command command, string token = "")
+ {
+ try
+ {
+ var data = command.Receivers.Select(x => new
+ {
+ PersonId = x.RefPlacementProfileId,
+ Id = x.RefDisciplineId,
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/36/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ // 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);
+ // foreach (var recv in command.Receivers)
+ // {
+ // var dataProfile = await _dbContext.Set()
+ // .Include(x => x.Salaries)
+ // .ThenInclude(x => x.PositionLevel)
+ // .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
+
+ // if (dataProfile == null)
+ // throw new Exception(GlobalMessages.DataNotFound);
+
+ // dataProfile.IsActive = false;
+ // dataProfile.IsLeave = true;
+ // dataProfile.LeaveReason = "ได้รับโทษทางวินัย ยุติเรื่อง";
+ // dataProfile.LeaveDate = command.CommandAffectDate;
+
+ // var lastSarary = dataProfile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
+ // var order = 1;
+ // if (lastSarary != null && lastSarary.Order != null)
+ // order = lastSarary.Order.Value + 1;
+
+ // var salary = new ProfileSalary
+ // {
+ // Order = order,
+ // Date = command.CommandAffectDate,
+ // Amount = lastSarary == null ? null : lastSarary.Amount,
+ // PositionSalaryAmount = lastSarary == null ? null : lastSarary.PositionSalaryAmount,
+ // MouthSalaryAmount = lastSarary == null ? null : lastSarary.MouthSalaryAmount,
+ // SalaryClass = "",
+ // SalaryRef = "คำสั่งยุติเรื่อง คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
+
+ // OcId = lastSarary == null ? null : lastSarary.OcId,
+
+ // PositionId = lastSarary == null ? null : lastSarary.PositionId,
+
+ // PositionLevel = lastSarary == null ? null : lastSarary.PositionLevel,
+ // PositionLineId = lastSarary == null ? null : lastSarary.PositionLineId,
+ // PositionTypeId = lastSarary == null ? null : lastSarary.PositionTypeId,
+ // OrganizationShortNameId = lastSarary == null ? null : lastSarary.OrganizationShortNameId,
+ // PosNoId = lastSarary == null ? null : lastSarary.PosNoId,
+
+ // CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
+ // RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
+ // CommandTypeName = command.CommandType.Name,
+
+
+ // PositionEmployeeGroupId = null,
+ // PositionEmployeeLevelId = null,
+ // PositionEmployeePositionId = null,
+ // PositionEmployeePositionSideId = null,
+ // PosNoEmployee = "",
+
+
+ // //PositionPathSideId = lastSarary ==null? null : lastSarary.PositionPathSideId == null,
+ // PositionExecutiveId = lastSarary == null ? null : lastSarary.PositionExecutiveId,
+ // //PositionExecutiveSideId = lastSarary ==null? null : lastSarary.PositionExecutiveSideId,
+
+ // IsActive = true,
+ // CreatedAt = DateTime.Now,
+ // CreatedFullName = FullName ?? "System Administrator",
+ // CreatedUserId = UserId ?? "",
+ // LastUpdatedAt = DateTime.Now,
+ // LastUpdateFullName = FullName ?? "System Administrator",
+ // LastUpdateUserId = UserId ?? "",
+
+ // };
+
+ // if (lastSarary != null && lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId;
+ // if (lastSarary != null && lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId;
+
+ // dataProfile.Salaries.Add(salary);
+
+ // // remove profile position
+ // var profilePosition = await _dbContext.Set()
+ // .Include(x => x.Profile)
+ // .Include(x => x.OrganizationPosition)
+ // .FirstOrDefaultAsync(x => x.Profile!.Id == dataProfile.Id);
+ // if (profilePosition != null)
+ // _dbContext.Set().Remove(profilePosition);
+
+ // await _dbContext.SaveChangesAsync();
+
+ // // 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 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 = dataProfile.Id,
+ // Payload = payload_str,
+ // };
+ // _dbContext.Set().Add(inbox);
+
+ // var noti = new Notification
+ // {
+ // Body = $"คุณได้รับคำสั่งยุติเรื่อง เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
+ // ReceiverUserId = dataProfile.Id,
+ // Type = "LINK",
+ // Payload = payload_str,
+ // };
+ // _dbContext.Set().Add(noti);
+ // await _dbContext.SaveChangesAsync();
+ // }
+ // send cc noti inbox
+ foreach (var cc in command.Deployments)
+ {
+ var pf = await _dbContext.Set().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().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().Add(noti);
+ }
+ }
+
+ // change command status
+ var cmdStatus = await _dbContext.Set().FirstOrDefaultAsync(x => x.Sequence == 5);
+ command.CommandStatusId = cmdStatus!.Id;
+
+ await _dbContext.SaveChangesAsync();
+
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+
+ ///
+ /// C-PM-37 - คำสั่งยุติเรื่อง
+ ///
+ /// object ของรายการคำสั่ง
+ ///
+ private async Task ExecuteCommand37Async(Command command, string token = "")
+ {
+ try
+ {
+ var data = command.Receivers.Select(x => new
+ {
+ PersonId = x.RefPlacementProfileId,
+ Id = x.RefDisciplineId,
+ });
+
+ var baseAPI = _configuration["API"];
+ var apiUrl = $"{baseAPI}/salary/report/command/37/resume";
+ using (var client = new HttpClient())
+ {
+ client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
+ var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
+ var res = await client.PostAsJsonAsync(apiUrl, new { result = data });
+ var result = await res.Content.ReadAsStringAsync();
+ }
+ // 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);
+ // foreach (var recv in command.Receivers)
+ // {
+ // var dataProfile = await _dbContext.Set()
+ // .Include(x => x.Salaries)
+ // .ThenInclude(x => x.PositionLevel)
+ // .FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
+
+ // if (dataProfile == null)
+ // throw new Exception(GlobalMessages.DataNotFound);
+
+ // dataProfile.IsActive = false;
+ // dataProfile.IsLeave = true;
+ // dataProfile.LeaveReason = "ได้รับโทษทางวินัย ยุติเรื่อง";
+ // dataProfile.LeaveDate = command.CommandAffectDate;
+
+ // var lastSarary = dataProfile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
+ // var order = 1;
+ // if (lastSarary != null && lastSarary.Order != null)
+ // order = lastSarary.Order.Value + 1;
+
+ // var salary = new ProfileSalary
+ // {
+ // Order = order,
+ // Date = command.CommandAffectDate,
+ // Amount = lastSarary == null ? null : lastSarary.Amount,
+ // PositionSalaryAmount = lastSarary == null ? null : lastSarary.PositionSalaryAmount,
+ // MouthSalaryAmount = lastSarary == null ? null : lastSarary.MouthSalaryAmount,
+ // SalaryClass = "",
+ // SalaryRef = "คำสั่งยุติเรื่อง คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
+
+ // OcId = lastSarary == null ? null : lastSarary.OcId,
+
+ // PositionId = lastSarary == null ? null : lastSarary.PositionId,
+
+ // PositionLevel = lastSarary == null ? null : lastSarary.PositionLevel,
+ // PositionLineId = lastSarary == null ? null : lastSarary.PositionLineId,
+ // PositionTypeId = lastSarary == null ? null : lastSarary.PositionTypeId,
+ // OrganizationShortNameId = lastSarary == null ? null : lastSarary.OrganizationShortNameId,
+ // PosNoId = lastSarary == null ? null : lastSarary.PosNoId,
+
+ // CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
+ // RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
+ // CommandTypeName = command.CommandType.Name,
+
+
+ // PositionEmployeeGroupId = null,
+ // PositionEmployeeLevelId = null,
+ // PositionEmployeePositionId = null,
+ // PositionEmployeePositionSideId = null,
+ // PosNoEmployee = "",
+
+
+ // //PositionPathSideId = lastSarary ==null? null : lastSarary.PositionPathSideId == null,
+ // PositionExecutiveId = lastSarary == null ? null : lastSarary.PositionExecutiveId,
+ // //PositionExecutiveSideId = lastSarary ==null? null : lastSarary.PositionExecutiveSideId,
+
+ // IsActive = true,
+ // CreatedAt = DateTime.Now,
+ // CreatedFullName = FullName ?? "System Administrator",
+ // CreatedUserId = UserId ?? "",
+ // LastUpdatedAt = DateTime.Now,
+ // LastUpdateFullName = FullName ?? "System Administrator",
+ // LastUpdateUserId = UserId ?? "",
+
+ // };
+
+ // if (lastSarary != null && lastSarary.PositionPathSideId != null) salary.PositionPathSideId = lastSarary.PositionPathSideId;
+ // if (lastSarary != null && lastSarary.PositionExecutiveSideId != null) salary.PositionExecutiveSideId = lastSarary.PositionExecutiveSideId;
+
+ // dataProfile.Salaries.Add(salary);
+
+ // // remove profile position
+ // var profilePosition = await _dbContext.Set()
+ // .Include(x => x.Profile)
+ // .Include(x => x.OrganizationPosition)
+ // .FirstOrDefaultAsync(x => x.Profile!.Id == dataProfile.Id);
+ // if (profilePosition != null)
+ // _dbContext.Set().Remove(profilePosition);
+
+ // await _dbContext.SaveChangesAsync();
+
+ // // 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 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 = dataProfile.Id,
+ // Payload = payload_str,
+ // };
+ // _dbContext.Set().Add(inbox);
+
+ // var noti = new Notification
+ // {
+ // Body = $"คุณได้รับคำสั่งยุติเรื่อง เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
+ // ReceiverUserId = dataProfile.Id,
+ // Type = "LINK",
+ // Payload = payload_str,
+ // };
+ // _dbContext.Set().Add(noti);
+ // await _dbContext.SaveChangesAsync();
+ // }
+ // send cc noti inbox
+ foreach (var cc in command.Deployments)
+ {
+ var pf = await _dbContext.Set().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().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().Add(noti);
+ }
+ }
+
+ // change command status
+ var cmdStatus = await _dbContext.Set().FirstOrDefaultAsync(x => x.Sequence == 5);
+ command.CommandStatusId = cmdStatus!.Id;
+
+ await _dbContext.SaveChangesAsync();
+
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
#endregion
#region " Regenerate Json File "
diff --git a/BMA.EHR.Application/Responses/PassSalaryResponse.cs b/BMA.EHR.Application/Responses/PassSalaryResponse.cs
new file mode 100644
index 00000000..c41412b0
--- /dev/null
+++ b/BMA.EHR.Application/Responses/PassSalaryResponse.cs
@@ -0,0 +1,20 @@
+namespace BMA.EHR.Application.Responses
+{
+ public class PassSalaryResponse
+ {
+ // public bool successful { get; set; }
+
+ public List result { get; set; } = new();
+ }
+
+ public class SalaryDataResponse
+ {
+ public Guid id { get; set; } = Guid.Empty;
+ public string citizenId { get; set; } = string.Empty;
+ public string prefix { get; set; } = string.Empty;
+ public string firstName { get; set; } = string.Empty;
+ public string lastName { get; set; } = string.Empty;
+ public Guid? profileId { get; set; } = Guid.Empty;
+ // public Guid? commandId { get; set; } = Guid.Empty;
+ }
+}
diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs
index c8f66538..41ed8cd2 100644
--- a/BMA.EHR.Command.Service/Controllers/OrderController.cs
+++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs
@@ -408,6 +408,66 @@ namespace BMA.EHR.Command.Service.Controllers
else
return Success(new { result = "N" });
}
+ case "C-PM-33":
+ {
+ 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-34":
+ {
+ 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-35":
+ {
+ 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-36":
+ {
+ 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-37":
+ {
+ 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 != "" &&
@@ -648,6 +708,10 @@ namespace BMA.EHR.Command.Service.Controllers
Result = data.Result,
RefRaw = data.RefRaw,
ComplaintId = data.ComplaintId,
+
+ SalaryPeriodId = data.SalaryPeriodId,
+ SalaryPeriod = data.SalaryPeriod,
+ Year = data.Year,
};
return Success(result);
@@ -3897,6 +3961,531 @@ namespace BMA.EHR.Command.Service.Controllers
#endregion
+ #region " C-PM-33 "
+
+ ///
+ /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-33
+ ///
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("c-pm-33/detail")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PostType33Async([FromBody] CreateCommandGroup15Request req)
+ {
+ try
+ {
+ var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
+
+ var inserted = new Domain.Models.Commands.Core.Command
+ {
+ CommandNo = req.orderNo,
+ CommandYear = req.orderYear.ToString(),
+ CommandSubject = req.orderTitle,
+ CommandTypeId = req.orderTypeValue,
+ IssuerOrganizationId = req.orderBy,
+ IssuerOrganizationName = req.orderByOrganizationName,
+ AuthorizedUserFullName = req.signatoryBy,
+ AuthorizedPosition = req.signatoryPosition,
+ CommandAffectDate = req.orderDate,
+ OwnerGovId = OcId,
+
+ CaseFault = req.caseFault,
+ FaultLevel = req.faultLevel,
+ RefRaw = req.refRaw,
+ Result = req.result,
+ SalaryPeriodId = req.salaryPeriodId,
+ SalaryPeriod = req.salaryPeriod,
+ Year = req.year,
+ };
+
+ var result = await _repository.AddAsync(inserted);
+
+ return Success(result);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-33
+ ///
+ /// Record Id ของคำสั่ง
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPut("c-pm-33/detail/{orderId}")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PutType33Async(Guid orderId, [FromBody] CreateCommandGroup15Request req)
+ {
+ try
+ {
+ var order = await _repository.GetByIdAsync(orderId);
+ if (order == null)
+ throw new Exception(GlobalMessages.CommandNotFound);
+
+
+ var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
+ var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
+
+ order.CommandNo = req.orderNo;
+ order.CommandYear = req.orderYear.ToString();
+ order.CommandSubject = req.orderTitle;
+ order.CommandType = commandType!;
+ order.IssuerOrganizationId = req.orderBy;
+ order.IssuerOrganizationName = req.orderByOrganizationName;
+ order.AuthorizedUserFullName = req.signatoryBy;
+ order.AuthorizedPosition = req.signatoryPosition;
+ order.CommandStatus = status!;
+ order.CommandAffectDate = req.orderDate;
+ order.CaseFault = req.caseFault;
+ order.FaultLevel = req.faultLevel;
+ order.RefRaw = req.refRaw;
+ order.Result = req.result;
+ order.SalaryPeriodId = req.salaryPeriodId;
+ order.SalaryPeriod = req.salaryPeriod;
+ order.Year = req.year;
+
+ var result = await _repository.UpdateAsync(order);
+
+ return Success(result);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ #endregion
+
+ #region " C-PM-34 "
+
+ ///
+ /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-34
+ ///
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("c-pm-34/detail")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PostType34Async([FromBody] CreateCommandGroup15Request req)
+ {
+ try
+ {
+ var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
+
+ var inserted = new Domain.Models.Commands.Core.Command
+ {
+ CommandNo = req.orderNo,
+ CommandYear = req.orderYear.ToString(),
+ CommandSubject = req.orderTitle,
+ CommandTypeId = req.orderTypeValue,
+ IssuerOrganizationId = req.orderBy,
+ IssuerOrganizationName = req.orderByOrganizationName,
+ AuthorizedUserFullName = req.signatoryBy,
+ AuthorizedPosition = req.signatoryPosition,
+ CommandAffectDate = req.orderDate,
+ OwnerGovId = OcId,
+
+ CaseFault = req.caseFault,
+ FaultLevel = req.faultLevel,
+ RefRaw = req.refRaw,
+ Result = req.result,
+ SalaryPeriodId = req.salaryPeriodId,
+ SalaryPeriod = req.salaryPeriod,
+ Year = req.year,
+ };
+
+ var result = await _repository.AddAsync(inserted);
+
+ return Success(result);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-34
+ ///
+ /// Record Id ของคำสั่ง
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPut("c-pm-34/detail/{orderId}")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PutType34Async(Guid orderId, [FromBody] CreateCommandGroup15Request req)
+ {
+ try
+ {
+ var order = await _repository.GetByIdAsync(orderId);
+ if (order == null)
+ throw new Exception(GlobalMessages.CommandNotFound);
+
+
+ var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
+ var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
+
+ order.CommandNo = req.orderNo;
+ order.CommandYear = req.orderYear.ToString();
+ order.CommandSubject = req.orderTitle;
+ order.CommandType = commandType!;
+ order.IssuerOrganizationId = req.orderBy;
+ order.IssuerOrganizationName = req.orderByOrganizationName;
+ order.AuthorizedUserFullName = req.signatoryBy;
+ order.AuthorizedPosition = req.signatoryPosition;
+ order.CommandStatus = status!;
+ order.CommandAffectDate = req.orderDate;
+ order.CaseFault = req.caseFault;
+ order.FaultLevel = req.faultLevel;
+ order.RefRaw = req.refRaw;
+ order.Result = req.result;
+ order.SalaryPeriodId = req.salaryPeriodId;
+ order.SalaryPeriod = req.salaryPeriod;
+ order.Year = req.year;
+
+ var result = await _repository.UpdateAsync(order);
+
+ return Success(result);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ #endregion
+
+ #region " C-PM-35 "
+
+ ///
+ /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-35
+ ///
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("c-pm-35/detail")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PostType35Async([FromBody] CreateCommandGroup15Request req)
+ {
+ try
+ {
+ var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
+
+ var inserted = new Domain.Models.Commands.Core.Command
+ {
+ CommandNo = req.orderNo,
+ CommandYear = req.orderYear.ToString(),
+ CommandSubject = req.orderTitle,
+ CommandTypeId = req.orderTypeValue,
+ IssuerOrganizationId = req.orderBy,
+ IssuerOrganizationName = req.orderByOrganizationName,
+ AuthorizedUserFullName = req.signatoryBy,
+ AuthorizedPosition = req.signatoryPosition,
+ CommandAffectDate = req.orderDate,
+ OwnerGovId = OcId,
+
+ CaseFault = req.caseFault,
+ FaultLevel = req.faultLevel,
+ RefRaw = req.refRaw,
+ Result = req.result,
+ SalaryPeriodId = req.salaryPeriodId,
+ SalaryPeriod = req.salaryPeriod,
+ Year = req.year,
+ };
+
+ var result = await _repository.AddAsync(inserted);
+
+ return Success(result);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-35
+ ///
+ /// Record Id ของคำสั่ง
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPut("c-pm-35/detail/{orderId}")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PutType35Async(Guid orderId, [FromBody] CreateCommandGroup15Request req)
+ {
+ try
+ {
+ var order = await _repository.GetByIdAsync(orderId);
+ if (order == null)
+ throw new Exception(GlobalMessages.CommandNotFound);
+
+
+ var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
+ var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
+
+ order.CommandNo = req.orderNo;
+ order.CommandYear = req.orderYear.ToString();
+ order.CommandSubject = req.orderTitle;
+ order.CommandType = commandType!;
+ order.IssuerOrganizationId = req.orderBy;
+ order.IssuerOrganizationName = req.orderByOrganizationName;
+ order.AuthorizedUserFullName = req.signatoryBy;
+ order.AuthorizedPosition = req.signatoryPosition;
+ order.CommandStatus = status!;
+ order.CommandAffectDate = req.orderDate;
+ order.CaseFault = req.caseFault;
+ order.FaultLevel = req.faultLevel;
+ order.RefRaw = req.refRaw;
+ order.Result = req.result;
+ order.SalaryPeriodId = req.salaryPeriodId;
+ order.SalaryPeriod = req.salaryPeriod;
+ order.Year = req.year;
+
+ var result = await _repository.UpdateAsync(order);
+
+ return Success(result);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ #endregion
+
+ #region " C-PM-36 "
+
+ ///
+ /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-36
+ ///
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("c-pm-36/detail")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PostType36Async([FromBody] CreateCommandGroup15Request req)
+ {
+ try
+ {
+ var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
+
+ var inserted = new Domain.Models.Commands.Core.Command
+ {
+ CommandNo = req.orderNo,
+ CommandYear = req.orderYear.ToString(),
+ CommandSubject = req.orderTitle,
+ CommandTypeId = req.orderTypeValue,
+ IssuerOrganizationId = req.orderBy,
+ IssuerOrganizationName = req.orderByOrganizationName,
+ AuthorizedUserFullName = req.signatoryBy,
+ AuthorizedPosition = req.signatoryPosition,
+ CommandAffectDate = req.orderDate,
+ OwnerGovId = OcId,
+
+ CaseFault = req.caseFault,
+ FaultLevel = req.faultLevel,
+ RefRaw = req.refRaw,
+ Result = req.result,
+ SalaryPeriodId = req.salaryPeriodId,
+ SalaryPeriod = req.salaryPeriod,
+ Year = req.year,
+ };
+
+ var result = await _repository.AddAsync(inserted);
+
+ return Success(result);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-36
+ ///
+ /// Record Id ของคำสั่ง
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPut("c-pm-36/detail/{orderId}")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PutType36Async(Guid orderId, [FromBody] CreateCommandGroup15Request req)
+ {
+ try
+ {
+ var order = await _repository.GetByIdAsync(orderId);
+ if (order == null)
+ throw new Exception(GlobalMessages.CommandNotFound);
+
+
+ var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
+ var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
+
+ order.CommandNo = req.orderNo;
+ order.CommandYear = req.orderYear.ToString();
+ order.CommandSubject = req.orderTitle;
+ order.CommandType = commandType!;
+ order.IssuerOrganizationId = req.orderBy;
+ order.IssuerOrganizationName = req.orderByOrganizationName;
+ order.AuthorizedUserFullName = req.signatoryBy;
+ order.AuthorizedPosition = req.signatoryPosition;
+ order.CommandStatus = status!;
+ order.CommandAffectDate = req.orderDate;
+ order.CaseFault = req.caseFault;
+ order.FaultLevel = req.faultLevel;
+ order.RefRaw = req.refRaw;
+ order.Result = req.result;
+ order.SalaryPeriodId = req.salaryPeriodId;
+ order.SalaryPeriod = req.salaryPeriod;
+ order.Year = req.year;
+
+ var result = await _repository.UpdateAsync(order);
+
+ return Success(result);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ #endregion
+
+ #region " C-PM-37 "
+
+ ///
+ /// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-37
+ ///
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPost("c-pm-37/detail")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PostType37Async([FromBody] CreateCommandGroup15Request req)
+ {
+ try
+ {
+ var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
+
+ var inserted = new Domain.Models.Commands.Core.Command
+ {
+ CommandNo = req.orderNo,
+ CommandYear = req.orderYear.ToString(),
+ CommandSubject = req.orderTitle,
+ CommandTypeId = req.orderTypeValue,
+ IssuerOrganizationId = req.orderBy,
+ IssuerOrganizationName = req.orderByOrganizationName,
+ AuthorizedUserFullName = req.signatoryBy,
+ AuthorizedPosition = req.signatoryPosition,
+ CommandAffectDate = req.orderDate,
+ OwnerGovId = OcId,
+
+ CaseFault = req.caseFault,
+ FaultLevel = req.faultLevel,
+ RefRaw = req.refRaw,
+ Result = req.result,
+ SalaryPeriodId = req.salaryPeriodId,
+ SalaryPeriod = req.salaryPeriod,
+ Year = req.year,
+ };
+
+ var result = await _repository.AddAsync(inserted);
+
+ return Success(result);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ ///
+ /// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-37
+ ///
+ /// Record Id ของคำสั่ง
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpPut("c-pm-37/detail/{orderId}")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> PutType37Async(Guid orderId, [FromBody] CreateCommandGroup15Request req)
+ {
+ try
+ {
+ var order = await _repository.GetByIdAsync(orderId);
+ if (order == null)
+ throw new Exception(GlobalMessages.CommandNotFound);
+
+
+ var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
+ var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
+
+ order.CommandNo = req.orderNo;
+ order.CommandYear = req.orderYear.ToString();
+ order.CommandSubject = req.orderTitle;
+ order.CommandType = commandType!;
+ order.IssuerOrganizationId = req.orderBy;
+ order.IssuerOrganizationName = req.orderByOrganizationName;
+ order.AuthorizedUserFullName = req.signatoryBy;
+ order.AuthorizedPosition = req.signatoryPosition;
+ order.CommandStatus = status!;
+ order.CommandAffectDate = req.orderDate;
+ order.CaseFault = req.caseFault;
+ order.FaultLevel = req.faultLevel;
+ order.RefRaw = req.refRaw;
+ order.Result = req.result;
+ order.SalaryPeriodId = req.salaryPeriodId;
+ order.SalaryPeriod = req.salaryPeriod;
+ order.Year = req.year;
+
+ var result = await _repository.UpdateAsync(order);
+
+ return Success(result);
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
+ #endregion
+
#endregion
///
diff --git a/BMA.EHR.Command.Service/Requests/CreateCommandGroup15Request.cs b/BMA.EHR.Command.Service/Requests/CreateCommandGroup15Request.cs
new file mode 100644
index 00000000..c2b584af
--- /dev/null
+++ b/BMA.EHR.Command.Service/Requests/CreateCommandGroup15Request.cs
@@ -0,0 +1,22 @@
+namespace BMA.EHR.Command.Service.Requests
+{
+ public class CreateCommandGroup15Request
+ {
+ public string? caseFault { get; set; }
+ public string? faultLevel { get; set; }
+ public string? refRaw { get; set; }
+ public string? result { get; set; }
+ public Guid orderBy { get; set; }
+ public string orderByOrganizationName { get; set; } = string.Empty;
+ public DateTime orderDate { get; set; }
+ public string orderTitle { get; set; } = string.Empty;
+ public string orderNo { get; set; } = string.Empty;
+ public Guid orderTypeValue { get; set; }
+ public int orderYear { get; set; }
+ public string signatoryBy { get; set; } = string.Empty;
+ public string signatoryPosition { get; set; } = string.Empty;
+ public Guid salaryPeriodId { get; set; }
+ public string year { get; set; }
+ public string salaryPeriod { get; set; }
+ }
+}
diff --git a/BMA.EHR.Command.Service/appsettings.json b/BMA.EHR.Command.Service/appsettings.json
index 9cda5cb3..8b9b0f23 100644
--- a/BMA.EHR.Command.Service/appsettings.json
+++ b/BMA.EHR.Command.Service/appsettings.json
@@ -14,7 +14,7 @@
"AllowedHosts": "*",
"ConnectionStrings": {
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
- "DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
+ "DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
diff --git a/BMA.EHR.Domain/Models/Commands/Core/Command.cs b/BMA.EHR.Domain/Models/Commands/Core/Command.cs
index 109c5106..3bda8af3 100644
--- a/BMA.EHR.Domain/Models/Commands/Core/Command.cs
+++ b/BMA.EHR.Domain/Models/Commands/Core/Command.cs
@@ -217,6 +217,18 @@ namespace BMA.EHR.Domain.Models.Commands.Core
[Comment("Id เรื่องร้องเรียน")]
public Guid? ComplaintId { get; set; }
+ #endregion
+ #region " C-PM-33 - C-PM-32 "
+
+ [Comment("Id เรื่องเงินเดือน")]
+ public Guid? SalaryPeriodId { get; set; }
+
+ [MaxLength(4), Comment("ปีรอบเงินเดือน")]
+ public string? Year { get; set; }
+
+ [Comment("รอบเงินเดือน")]
+ public string? SalaryPeriod { get; set; }
+
#endregion
public virtual List Documents { get; set; } = new();
diff --git a/BMA.EHR.Infrastructure/Migrations/20240424180754_update table command add RefDisciplineId.Designer.cs b/BMA.EHR.Infrastructure/Migrations/20240424180754_update table command add RefDisciplineId.Designer.cs
new file mode 100644
index 00000000..f2e403a1
--- /dev/null
+++ b/BMA.EHR.Infrastructure/Migrations/20240424180754_update table command add RefDisciplineId.Designer.cs
@@ -0,0 +1,17158 @@
+//
+using System;
+using BMA.EHR.Infrastructure.Persistence;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace BMA.EHR.Infrastructure.Migrations
+{
+ [DbContext(typeof(ApplicationDBContext))]
+ [Migration("20240424180754_update table command add RefDisciplineId")]
+ partial class updatetablecommandaddRefDisciplineId
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.9")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)")
+ .HasColumnOrder(0)
+ .HasComment("PrimaryKey")
+ .HasAnnotation("Relational:JsonPropertyName", "id");
+
+ b.Property("AuthorizedPosition")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasComment("ตำแหน่งผู้มีอำนาจลงนาม");
+
+ b.Property("AuthorizedUserFullName")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasComment("ชื่อผู้มีอำนาจลงนาม");
+
+ b.Property("AuthorizedUserId")
+ .HasColumnType("char(36)")
+ .HasComment("รหัสอ้างอิงผู้มีอำนาจลงนาม");
+
+ b.Property("CaseFault")
+ .HasColumnType("longtext")
+ .HasComment("กรณีความผิด");
+
+ b.Property("ChairManFullName")
+ .HasColumnType("longtext")
+ .HasComment("ประธานคณะกรรมการ");
+
+ b.Property("CommandAffectDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("วันที่คำสั่งมีผล");
+
+ b.Property("CommandExcecuteDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("วันที่ออกคำสั่ง");
+
+ b.Property("CommandNo")
+ .IsRequired()
+ .HasMaxLength(10)
+ .HasColumnType("varchar(10)")
+ .HasComment("เลขที่คำสั่ง");
+
+ b.Property("CommandStatusId")
+ .HasColumnType("char(36)")
+ .HasComment("รหัสอ้างอิงสถานะคำสั่ง");
+
+ b.Property("CommandSubject")
+ .IsRequired()
+ .HasMaxLength(500)
+ .HasColumnType("varchar(500)")
+ .HasComment("คำสั่งเรื่อง");
+
+ b.Property("CommandTypeId")
+ .HasColumnType("char(36)")
+ .HasComment("รหัสอ้างอิงประเภทคำสั่ง");
+
+ b.Property("CommandYear")
+ .IsRequired()
+ .HasMaxLength(4)
+ .HasColumnType("varchar(4)")
+ .HasComment("ปีที่ออกคำสั่ง");
+
+ b.Property("ComplaintId")
+ .HasColumnType("char(36)")
+ .HasComment("Id เรื่องร้องเรียน");
+
+ b.Property("ConclusionFireDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("ลงวันที่ (เรื่องการดำเนินการทางวินัย)");
+
+ b.Property("ConclusionFireNo")
+ .HasColumnType("longtext")
+ .HasComment("ครั้งที่ (เรื่องการดำเนินการทางวินัย)");
+
+ b.Property("ConclusionFireResolution")
+ .HasColumnType("longtext")
+ .HasComment("มติที่ประชุม (เรื่องการดำเนินการทางวินัย)");
+
+ b.Property("ConclusionMeetingDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("การประชุม ลงวันที่");
+
+ b.Property("ConclusionMeetingNo")
+ .HasColumnType("longtext")
+ .HasComment("การประชุม ครั้งที่");
+
+ b.Property("ConclusionReceiveDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("ลงวันที่ (การรับโอน)");
+
+ b.Property("ConclusionReceiveNo")
+ .HasColumnType("longtext")
+ .HasComment("มติ กก. ครั้งที่ (การรับโอน)");
+
+ b.Property("ConclusionRegisterDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("ลงวันที่ (เรื่อง รับสมัครสอบฯ)");
+
+ b.Property("ConclusionRegisterNo")
+ .HasColumnType("longtext")
+ .HasComment("มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)");
+
+ b.Property("ConclusionResultDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)");
+
+ b.Property("ConclusionResultNo")
+ .HasColumnType("longtext")
+ .HasComment("มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)");
+
+ b.Property("ConclusionReturnDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("ลงวันที่ (เรื่อง กลับเข้ารับราชการ)");
+
+ b.Property("ConclusionReturnNo")
+ .HasColumnType("longtext")
+ .HasComment("มติ กก. ครั้งที่ (เรื่อง กลับเข้ารับราชการ)");
+
+ b.Property("ConclusionTranferDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("การประชุม ลงวันที่");
+
+ b.Property("ConclusionTranferNo")
+ .HasColumnType("longtext")
+ .HasComment("การประชุม ครั้งที่");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(100)
+ .HasComment("สร้างข้อมูลเมื่อ");
+
+ b.Property("CreatedFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(104)
+ .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+ b.Property("CreatedUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(101)
+ .HasComment("User Id ที่สร้างข้อมูล");
+
+ b.Property("Fault")
+ .HasColumnType("longtext")
+ .HasComment("รายละเอียดการกระทำผิด");
+
+ b.Property("FaultLevel")
+ .HasColumnType("longtext")
+ .HasComment("ระดับความผิด");
+
+ b.Property("GovAidCommandDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("ลงวันที่ (คำสั่งช่วยราชการ)");
+
+ b.Property("GovAidCommandNo")
+ .HasColumnType("longtext")
+ .HasComment("คำสั่งเลขที่ (คำสั่งช่วยราชการ)");
+
+ b.Property("GuiltyBasis")
+ .HasColumnType("longtext")
+ .HasComment("ฐานความผิด");
+
+ b.Property("IssuerOrganizationId")
+ .HasColumnType("char(36)")
+ .HasComment("รหัสอ้างอิงหน่วยงานที่ออกคำสั่ง");
+
+ b.Property("IssuerOrganizationName")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasComment("หน่วยงานที่ออกคำสั่ง");
+
+ b.Property("LastUpdateFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(105)
+ .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdateUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(103)
+ .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(102)
+ .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+ b.Property("Member1FullName")
+ .HasColumnType("longtext")
+ .HasComment("กรรมการคนที่ 1");
+
+ b.Property("Member2FullName")
+ .HasColumnType("longtext")
+ .HasComment("กรรมการคนที่ 2");
+
+ b.Property("MilitaryCommanDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("ลงวันที่ (ให้เข้ารับราชการทหาร)");
+
+ b.Property("MilitaryCommandNo")
+ .HasColumnType("longtext")
+ .HasComment("คำสั่งที่ (ให้เข้ารับราชการทหาร)");
+
+ b.Property("OwnerGovId")
+ .HasColumnType("char(36)")
+ .HasComment("รหัสส่วนราชการผู้ออกคำสั่ง");
+
+ b.Property("PlacementCommandDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("คำสั่งบรรจุลงวันที่");
+
+ b.Property("PlacementCommandIssuer")
+ .HasColumnType("longtext")
+ .HasComment("หน่วยงานที่ออกคำสั่งบรรจุ");
+
+ b.Property("PlacementCommandNo")
+ .HasColumnType("longtext")
+ .HasComment("เลขที่คำสั่งบรรจุ");
+
+ b.Property("PlacementId")
+ .HasColumnType("char(36)")
+ .HasComment("อ้างอิงรอบการสอบ");
+
+ b.Property("PlacementOrganizationName")
+ .HasColumnType("longtext")
+ .HasComment("สังกัดที่บรรจุ");
+
+ b.Property("PlacementPositionName")
+ .HasColumnType("longtext")
+ .HasComment("ตำแหน่งที่บรรจุ");
+
+ b.Property("PositionName")
+ .HasColumnType("longtext")
+ .HasComment("ตำแหน่งที่บรรจุ");
+
+ b.Property("ProbationEndDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("วันที่สิ้นสุดการทดลองปฏิบัติราชการ");
+
+ b.Property("ProbationStartDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("วันที่เริ่มทดลองปฏิบัติราชการ");
+
+ b.Property("ReceiveOrganizationName")
+ .HasColumnType("longtext")
+ .HasComment("ส่วนราชการที่รับโอน");
+
+ b.Property("RefRaw")
+ .HasColumnType("longtext")
+ .HasComment("อ้างอิงมาตราตามกฏหมาย");
+
+ b.Property("Result")
+ .HasColumnType("longtext")
+ .HasComment("ผลดำเนินการพิจารณา");
+
+ b.Property("SalaryPeriodId")
+ .HasColumnType("char(36)")
+ .HasComment("Id เรื่องเงินเดือน");
+
+ b.Property("SourceOrganizationName")
+ .HasColumnType("longtext")
+ .HasComment("หน่วยงานต้นสังกัด ก่อนรับราชการทหาร");
+
+ b.Property("TransferOrganizationName")
+ .HasColumnType("longtext")
+ .HasComment("ส่วนราชการที่ให้โอน");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CommandStatusId");
+
+ b.HasIndex("CommandTypeId");
+
+ b.HasIndex("PlacementId");
+
+ b.ToTable("Commands");
+ });
+
+ modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDeployment", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)")
+ .HasColumnOrder(0)
+ .HasComment("PrimaryKey")
+ .HasAnnotation("Relational:JsonPropertyName", "id");
+
+ b.Property("CitizenId")
+ .IsRequired()
+ .HasMaxLength(13)
+ .HasColumnType("varchar(13)")
+ .HasComment("เลขประจำตัวประชาชน");
+
+ b.Property("CommandId")
+ .HasColumnType("char(36)")
+ .HasComment("รหัสอ้างอิงคำสั่ง");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(100)
+ .HasComment("สร้างข้อมูลเมื่อ");
+
+ b.Property("CreatedFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(104)
+ .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+ b.Property("CreatedUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(101)
+ .HasComment("User Id ที่สร้างข้อมูล");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("varchar(100)")
+ .HasComment("ชื่อ");
+
+ b.Property("IsSendInbox")
+ .HasColumnType("tinyint(1)")
+ .HasComment("ส่งกล่องข้อความหรือไม่?");
+
+ b.Property("IsSendMail")
+ .HasColumnType("tinyint(1)")
+ .HasComment("ส่งอีเมล์หรือไม่?");
+
+ b.Property("IsSendNotification")
+ .HasColumnType("tinyint(1)")
+ .HasComment("ส่งแจ้งเตือนหรือไม่?");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("varchar(100)")
+ .HasComment("นามสกุล");
+
+ b.Property("LastUpdateFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(105)
+ .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdateUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(103)
+ .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(102)
+ .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+ b.Property("OrganizationName")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasComment("ชื่อหน่วยงานของผู้รับสำเนาคำสั่ง");
+
+ b.Property("PositionName")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasComment("ชื่อตำแหน่งของผู้รับสำเนาคำสั่ง");
+
+ b.Property("Prefix")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("varchar(50)")
+ .HasComment("คำนำหน้านาม");
+
+ b.Property("ReceiveUserId")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasComment("รหัสอ้างอิงผู้ใช้งานระบบ");
+
+ b.Property("Sequence")
+ .HasColumnType("int")
+ .HasComment("ลำดับ");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CommandId");
+
+ b.ToTable("CommandDeployments");
+ });
+
+ modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)")
+ .HasColumnOrder(0)
+ .HasComment("PrimaryKey")
+ .HasAnnotation("Relational:JsonPropertyName", "id");
+
+ b.Property("Category")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasComment("ประเภทเอกสาร");
+
+ b.Property("CommandId")
+ .HasColumnType("char(36)");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(100)
+ .HasComment("สร้างข้อมูลเมื่อ");
+
+ b.Property("CreatedFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(104)
+ .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+ b.Property("CreatedUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(101)
+ .HasComment("User Id ที่สร้างข้อมูล");
+
+ b.Property("DocumentId")
+ .HasColumnType("char(36)");
+
+ b.Property("LastUpdateFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(105)
+ .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdateUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(103)
+ .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(102)
+ .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CommandId");
+
+ b.HasIndex("DocumentId");
+
+ b.ToTable("CommandDocuments");
+ });
+
+ modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandReceiver", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)")
+ .HasColumnOrder(0)
+ .HasComment("PrimaryKey")
+ .HasAnnotation("Relational:JsonPropertyName", "id");
+
+ b.Property("Amount")
+ .HasColumnType("double")
+ .HasComment("เงินเดือน");
+
+ b.Property("CitizenId")
+ .IsRequired()
+ .HasMaxLength(13)
+ .HasColumnType("varchar(13)")
+ .HasComment("เลขประจำตัวประชาชน");
+
+ b.Property("CommandId")
+ .HasColumnType("char(36)")
+ .HasComment("รหัสอ้างอิงคำสั่ง");
+
+ b.Property("Comment")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasComment("หมายเหตุ");
+
+ b.Property("Comment2")
+ .IsRequired()
+ .HasColumnType("text")
+ .HasComment("หมายเหตุแนวนอน");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(100)
+ .HasComment("สร้างข้อมูลเมื่อ");
+
+ b.Property("CreatedFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(104)
+ .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+ b.Property("CreatedUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(101)
+ .HasComment("User Id ที่สร้างข้อมูล");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("varchar(100)")
+ .HasComment("ชื่อ");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("varchar(100)")
+ .HasComment("นามสกุล");
+
+ b.Property("LastUpdateFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(105)
+ .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdateUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(103)
+ .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(102)
+ .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+ b.Property("MouthSalaryAmount")
+ .HasColumnType("double")
+ .HasComment("เงินค่าตอบแทนรายเดือน");
+
+ b.Property("PositionSalaryAmount")
+ .HasColumnType("double")
+ .HasComment("เงินประจำตำแหน่ง");
+
+ b.Property("Prefix")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("varchar(50)")
+ .HasComment("คำนำหน้านาม");
+
+ b.Property("RefDisciplineId")
+ .HasColumnType("char(36)")
+ .HasComment("รหัสอ้างอิงไปยังข้อมูลวินัย");
+
+ b.Property("RefPlacementProfileId")
+ .HasColumnType("char(36)")
+ .HasComment("รหัสอ้างอิงไปยังข้อมูลผู้บรรจุ");
+
+ b.Property("Sequence")
+ .HasColumnType("int")
+ .HasComment("ลำดับในบัญชีแนบท้าย");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CommandId");
+
+ b.ToTable("CommandReceivers");
+ });
+
+ modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)")
+ .HasColumnOrder(0)
+ .HasComment("PrimaryKey")
+ .HasAnnotation("Relational:JsonPropertyName", "id");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(100)
+ .HasComment("สร้างข้อมูลเมื่อ");
+
+ b.Property("CreatedFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(104)
+ .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+ b.Property("CreatedUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(101)
+ .HasComment("User Id ที่สร้างข้อมูล");
+
+ b.Property("LastUpdateFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(105)
+ .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdateUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(103)
+ .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(102)
+ .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("varchar(100)")
+ .HasComment("สถานะของคำสั่ง");
+
+ b.Property("Sequence")
+ .HasColumnType("int")
+ .HasComment("ลำดับการทำงาน");
+
+ b.HasKey("Id");
+
+ b.ToTable("CommandStatuses");
+ });
+
+ modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandType", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)")
+ .HasColumnOrder(0)
+ .HasComment("PrimaryKey")
+ .HasAnnotation("Relational:JsonPropertyName", "id");
+
+ b.Property("Category")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("varchar(100)")
+ .HasComment("ประเภทคำสั่ง");
+
+ b.Property("CommandCode")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasComment("รหัสของประเภทคำสั่ง");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(100)
+ .HasComment("สร้างข้อมูลเมื่อ");
+
+ b.Property("CreatedFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(104)
+ .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+ b.Property("CreatedUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(101)
+ .HasComment("User Id ที่สร้างข้อมูล");
+
+ b.Property("LastUpdateFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(105)
+ .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdateUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(103)
+ .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(102)
+ .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasComment("ชื่อคำสั่ง");
+
+ b.HasKey("Id");
+
+ b.ToTable("CommandTypes");
+ });
+
+ modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.DeploymentChannel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)")
+ .HasColumnOrder(0)
+ .HasComment("PrimaryKey")
+ .HasAnnotation("Relational:JsonPropertyName", "id");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(100)
+ .HasComment("สร้างข้อมูลเมื่อ");
+
+ b.Property("CreatedFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(104)
+ .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+ b.Property("CreatedUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(101)
+ .HasComment("User Id ที่สร้างข้อมูล");
+
+ b.Property("IsSendEmail")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("IsSendInbox")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("LastUpdateFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(105)
+ .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdateUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(103)
+ .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(102)
+ .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+ b.HasKey("Id");
+
+ b.ToTable("DeploymentChannels");
+ });
+
+ modelBuilder.Entity("BMA.EHR.Domain.Models.Documents.Document", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)");
+
+ b.Property("CreatedDate")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Detail")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("FileName")
+ .IsRequired()
+ .HasMaxLength(255)
+ .HasColumnType("varchar(255)");
+
+ b.Property("FileSize")
+ .HasColumnType("int");
+
+ b.Property("FileType")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("ObjectRefId")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Documents");
+ });
+
+ modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitLeave", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)")
+ .HasColumnOrder(0)
+ .HasComment("PrimaryKey")
+ .HasAnnotation("Relational:JsonPropertyName", "id");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(100)
+ .HasComment("สร้างข้อมูลเมื่อ");
+
+ b.Property("CreatedFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(104)
+ .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+ b.Property("CreatedUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(101)
+ .HasComment("User Id ที่สร้างข้อมูล");
+
+ b.Property("LastUpdateFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(105)
+ .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdateUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(103)
+ .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(102)
+ .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+ b.Property("Name")
+ .HasColumnType("longtext")
+ .HasComment("ยังไม่ชัวใช้อะไรเป็นkey");
+
+ b.HasKey("Id");
+
+ b.ToTable("LimitLeaves");
+ });
+
+ modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)")
+ .HasColumnOrder(0)
+ .HasComment("PrimaryKey")
+ .HasAnnotation("Relational:JsonPropertyName", "id");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(100)
+ .HasComment("สร้างข้อมูลเมื่อ");
+
+ b.Property("CreatedFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(104)
+ .HasComment("ชื่อ User ที่สร้างข้อมูล");
+
+ b.Property("CreatedUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(101)
+ .HasComment("User Id ที่สร้างข้อมูล");
+
+ b.Property("LastUpdateFullName")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("varchar(200)")
+ .HasColumnOrder(105)
+ .HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdateUserId")
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnOrder(103)
+ .HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
+
+ b.Property("LastUpdatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(102)
+ .HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
+
+ b.Property("LimitLeaveId")
+ .HasColumnType("char(36)");
+
+ b.Property("NumLeave")
+ .HasColumnType("double")
+ .HasComment("จำนวนที่ลาได้");
+
+ b.Property("TypeLeaveId")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LimitLeaveId");
+
+ b.HasIndex("TypeLeaveId");
+
+ b.ToTable("LimitTypeLeaves");
+ });
+
+ modelBuilder.Entity("BMA.EHR.Domain.Models.HR.Profile", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("char(36)")
+ .HasColumnOrder(0)
+ .HasComment("PrimaryKey")
+ .HasAnnotation("Relational:JsonPropertyName", "id");
+
+ b.Property("Ability")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("varchar(100)");
+
+ b.Property("AvatarId")
+ .HasColumnType("char(36)");
+
+ b.Property("AvatarRef")
+ .IsRequired()
+ .HasMaxLength(100)
+ .HasColumnType("varchar(100)");
+
+ b.Property("BirthDate")
+ .HasColumnType("datetime(6)")
+ .HasComment("วันเกิด");
+
+ b.Property("BloodGroupId")
+ .HasColumnType("char(36)")
+ .HasComment("Id กลุ่มเลือด");
+
+ b.Property("CitizenId")
+ .HasMaxLength(13)
+ .HasColumnType("varchar(13)")
+ .HasComment("รหัสบัตรประชาชน");
+
+ b.Property("Couple")
+ .HasColumnType("tinyint(1)")
+ .HasComment("คู่สมรส");
+
+ b.Property("CoupleCareer")
+ .HasMaxLength(100)
+ .HasColumnType("varchar(100)")
+ .HasComment("อาชีพคู่สมรส");
+
+ b.Property("CoupleCitizenId")
+ .HasMaxLength(20)
+ .HasColumnType("varchar(20)")
+ .HasComment("เลขที่บัตรประชาชนคู่สมรส");
+
+ b.Property("CoupleFirstName")
+ .HasMaxLength(100)
+ .HasColumnType("varchar(100)")
+ .HasComment("ชื่อคู่สมรส");
+
+ b.Property("CoupleLastName")
+ .HasMaxLength(100)
+ .HasColumnType("varchar(100)")
+ .HasComment("นามสกุลคู่สมรส");
+
+ b.Property("CoupleLastNameOld")
+ .HasMaxLength(100)
+ .HasColumnType("varchar(100)")
+ .HasComment("นามสกุลคู่สมรส(เดิม)");
+
+ b.Property("CoupleLive")
+ .HasColumnType("tinyint(1)")
+ .HasComment("มีชีวิตคู่สมรส");
+
+ b.Property("CouplePrefixId")
+ .HasColumnType("char(36)")
+ .HasComment("Id คำนำหน้าคู่สมรส");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)")
+ .HasColumnOrder(100)
+ .HasComment("สร้างข้อมูลเมื่อ");
+
+ b.Property("CreatedDate")
+ .HasColumnType("datetime(6)");
+
+ b.Property