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

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.OrganizationPositionOld,
p.CreatedAt,
CommandType = p.CommandType == null ? null : p.CommandType.Name,
})
.ToListAsync();
if (PlacementAdmin == true)
@ -161,6 +162,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.PositionDate,
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,
CommandType = p.CommandType == null ? null : p.CommandType.Name,
})
.FirstOrDefaultAsync();
if (data == null)
@ -214,6 +216,7 @@ namespace BMA.EHR.Placement.Service.Controllers
data.PositionDate,
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
Docs = placementAppointmentDocs,
data.CommandType,
};
return Success(_data);

View file

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

View file

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