เพิ่มประเภทคำสั่ง ในบรรจุ

This commit is contained in:
Kittapath 2023-09-08 16:41:23 +07:00
parent cba981e432
commit 08fd49a8d0
3 changed files with 10 additions and 14 deletions

View file

@ -101,6 +101,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.PositionNumberOld, p.PositionNumberOld,
p.OrganizationPositionOld, p.OrganizationPositionOld,
p.CreatedAt, p.CreatedAt,
CommandType = p.CommandType == null ? null : p.CommandType.Name,
}) })
.ToListAsync(); .ToListAsync();
if (PlacementAdmin == true) if (PlacementAdmin == true)
@ -161,6 +162,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.PositionDate, p.PositionDate,
PlacementAppointmentDocs = p.PlacementAppointmentDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }), PlacementAppointmentDocs = p.PlacementAppointmentDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id, Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
CommandType = p.CommandType == null ? null : p.CommandType.Name,
}) })
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
if (data == null) if (data == null)
@ -214,6 +216,7 @@ namespace BMA.EHR.Placement.Service.Controllers
data.PositionDate, data.PositionDate,
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar), Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
Docs = placementAppointmentDocs, Docs = placementAppointmentDocs,
data.CommandType,
}; };
return Success(_data); return Success(_data);

View file

@ -101,6 +101,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.PositionNumberOld, p.PositionNumberOld,
p.OrganizationPositionOld, p.OrganizationPositionOld,
p.CreatedAt, p.CreatedAt,
CommandType = p.CommandType == null ? null : p.CommandType.Name,
}) })
.ToListAsync(); .ToListAsync();
if (RetirementAdmin == true) if (RetirementAdmin == true)
@ -161,6 +162,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.PositionDate, p.PositionDate,
Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id, Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
RetirementOtherDocs = p.RetirementOtherDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }), RetirementOtherDocs = p.RetirementOtherDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
CommandType = p.CommandType == null ? null : p.CommandType.Name,
}) })
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
if (data == null) if (data == null)
@ -214,6 +216,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.PositionDate, data.PositionDate,
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar), Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
Docs = retirementOtherDocs, Docs = retirementOtherDocs,
data.CommandType,
}; };
return Success(_data); return Success(_data);

View file

@ -410,20 +410,10 @@ namespace BMA.EHR.Retirement.Service.Controllers
.FirstOrDefaultAsync(x => x.Id == id); .FirstOrDefaultAsync(x => x.Id == id);
if (deleted == null) if (deleted == null)
return Error(GlobalMessages.RetirementResignNotFound, 404); return Error(GlobalMessages.RetirementResignNotFound, 404);
var retirementResignDocs = new List<dynamic>(); deleted.Status = "DELETE";
foreach (var doc in deleted.RetirementResignDocs) deleted.LastUpdateFullName = FullName ?? "System Administrator";
{ deleted.LastUpdateUserId = UserId ?? "";
if (doc.Document != null) deleted.LastUpdatedAt = DateTime.Now;
retirementResignDocs.Add(doc.Document.Id);
}
_context.RetirementResignDocs.RemoveRange(deleted.RetirementResignDocs);
await _context.SaveChangesAsync();
_context.RetirementResigns.Remove(deleted);
foreach (var doc in retirementResignDocs)
{
if (doc != null)
await _documentService.DeleteFileAsync(doc);
}
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
return Success(); return Success();
} }