diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs index c122d54d..f79dbd33 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentController.cs @@ -63,7 +63,7 @@ namespace BMA.EHR.Placement.Service.Controllers { var placementAppointments = await _context.PlacementAppointments.AsQueryable() - .Where(x => (x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeType == "PREM") || (x.Profile.ProfileType == "OFFICER")) + .Where(x => (x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "PREM") || (x.Profile.ProfileType == "OFFICER")) .OrderByDescending(x => x.CreatedAt) .Select(p => new { @@ -124,7 +124,7 @@ namespace BMA.EHR.Placement.Service.Controllers public async Task> GetDetailByUser(Guid id) { var data = await _context.PlacementAppointments.AsQueryable() - .Where(x => (x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeType == "PREM") || (x.Profile.ProfileType == "OFFICER")) + .Where(x => (x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "PREM") || (x.Profile.ProfileType == "OFFICER")) .Where(x => x.Id == id) .Select(p => new { @@ -244,7 +244,7 @@ namespace BMA.EHR.Placement.Service.Controllers .Include(x => x.Position) .Include(x => x.Gender) .Include(x => x.Prefix) - .Where(x => (x.ProfileType == "EMPLOYEE" && x.EmployeeType == "PREM") || (x.ProfileType == "OFFICER")) + .Where(x => (x.ProfileType == "EMPLOYEE" && x.EmployeeClass == "PREM") || (x.ProfileType == "OFFICER")) .FirstOrDefaultAsync(x => x.Id == req.Id); if (profile == null) return Error(GlobalMessages.DataNotFound, 404); @@ -326,7 +326,7 @@ namespace BMA.EHR.Placement.Service.Controllers public async Task> UpdatePositionPlacementAppointment([FromBody] PersonSelectPositionAppointmentRequest req, Guid id) { var uppdated = await _context.PlacementAppointments - .Where(x => (x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeType == "PREM") || (x.Profile.ProfileType == "OFFICER")) + .Where(x => (x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "PREM") || (x.Profile.ProfileType == "OFFICER")) .FirstOrDefaultAsync(x => x.Id == id); if (uppdated == null) return Error(GlobalMessages.PlacementAppointmentNotFound, 404); @@ -406,7 +406,7 @@ namespace BMA.EHR.Placement.Service.Controllers public async Task> Put([FromBody] PlacementAppointmentEditRequest req, Guid id) { var uppdated = await _context.PlacementAppointments - .Where(x => (x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeType == "PREM") || (x.Profile.ProfileType == "OFFICER")) + .Where(x => (x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "PREM") || (x.Profile.ProfileType == "OFFICER")) .FirstOrDefaultAsync(x => x.Id == id); if (uppdated == null) return Error(GlobalMessages.PlacementAppointmentNotFound, 404); @@ -489,7 +489,7 @@ namespace BMA.EHR.Placement.Service.Controllers var deleted = await _context.PlacementAppointments.AsQueryable() .Include(x => x.PlacementAppointmentDocs) .ThenInclude(x => x.Document) - .Where(x => (x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeType == "PREM") || (x.Profile.ProfileType == "OFFICER")) + .Where(x => (x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "PREM") || (x.Profile.ProfileType == "OFFICER")) .FirstOrDefaultAsync(x => x.Id == id); if (deleted == null) return NotFound(); @@ -526,7 +526,7 @@ namespace BMA.EHR.Placement.Service.Controllers foreach (var item in req.Id) { var uppdated = await _context.PlacementAppointments - .Where(x => (x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeType == "PREM") || (x.Profile.ProfileType == "OFFICER")) + .Where(x => (x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "PREM") || (x.Profile.ProfileType == "OFFICER")) .FirstOrDefaultAsync(x => x.Id == item); if (uppdated == null) continue; @@ -556,6 +556,7 @@ namespace BMA.EHR.Placement.Service.Controllers { var appointments = await _context.PlacementAppointments .Where(x => x.PositionNumber != null) + .Where(x => (x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "PREM") || (x.Profile.ProfileType == "OFFICER")) .Select(x => x.PositionNumber.Id) .ToListAsync(); diff --git a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentEmployeeController.cs b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentEmployeeController.cs index 9baa469f..796ea9bc 100644 --- a/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentEmployeeController.cs +++ b/BMA.EHR.Placement.Service/Controllers/PlacementAppointmentEmployeeController.cs @@ -64,7 +64,7 @@ namespace BMA.EHR.Placement.Service.Controllers var placementAppointments = await _context.PlacementAppointments.AsQueryable() .OrderByDescending(x => x.CreatedAt) - .Where(x => x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeType == "TEMP") + .Where(x => x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "TEMP") .Select(p => new { p.Id, @@ -127,7 +127,7 @@ namespace BMA.EHR.Placement.Service.Controllers { var data = await _context.PlacementAppointments.AsQueryable() .Where(x => x.Id == id) - .Where(x => x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeType == "TEMP") + .Where(x => x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "TEMP") .Select(p => new { p.Id, @@ -246,7 +246,7 @@ namespace BMA.EHR.Placement.Service.Controllers .Include(x => x.Position) .Include(x => x.Gender) .Include(x => x.Prefix) - .Where(x => x.ProfileType == "EMPLOYEE" && x.EmployeeType == "TEMP") + .Where(x => x.ProfileType == "EMPLOYEE" && x.EmployeeClass == "TEMP") .FirstOrDefaultAsync(x => x.Id == req.Id); if (profile == null) return Error(GlobalMessages.DataNotFound, 404); @@ -328,7 +328,7 @@ namespace BMA.EHR.Placement.Service.Controllers public async Task> UpdatePositionPlacementAppointment([FromBody] PersonSelectPositionAppointmentRequest req, Guid id) { var uppdated = await _context.PlacementAppointments - .Where(x => x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeType == "TEMP") + .Where(x => x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "TEMP") .FirstOrDefaultAsync(x => x.Id == id); if (uppdated == null) return Error(GlobalMessages.PlacementAppointmentNotFound, 404); @@ -408,7 +408,7 @@ namespace BMA.EHR.Placement.Service.Controllers public async Task> Put([FromBody] PlacementAppointmentEditRequest req, Guid id) { var uppdated = await _context.PlacementAppointments - .Where(x => x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeType == "TEMP") + .Where(x => x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "TEMP") .FirstOrDefaultAsync(x => x.Id == id); if (uppdated == null) return Error(GlobalMessages.PlacementAppointmentNotFound, 404); @@ -491,7 +491,7 @@ namespace BMA.EHR.Placement.Service.Controllers var deleted = await _context.PlacementAppointments.AsQueryable() .Include(x => x.PlacementAppointmentDocs) .ThenInclude(x => x.Document) - .Where(x => x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeType == "TEMP") + .Where(x => x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "TEMP") .FirstOrDefaultAsync(x => x.Id == id); if (deleted == null) return NotFound(); @@ -528,7 +528,7 @@ namespace BMA.EHR.Placement.Service.Controllers foreach (var item in req.Id) { var uppdated = await _context.PlacementAppointments - .Where(x => x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeType == "TEMP") + .Where(x => x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "TEMP") .FirstOrDefaultAsync(x => x.Id == item); if (uppdated == null) continue; @@ -558,6 +558,7 @@ namespace BMA.EHR.Placement.Service.Controllers { var appointments = await _context.PlacementAppointments .Where(x => x.PositionNumber != null) + .Where(x => x.Profile.ProfileType == "EMPLOYEE" && x.Profile.EmployeeClass == "TEMP") .Select(x => x.PositionNumber.Id) .ToListAsync(); diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs index c9b62cf8..29c29dd9 100644 --- a/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs +++ b/BMA.EHR.Retirement.Service/Controllers/RetirementController.cs @@ -439,12 +439,12 @@ namespace BMA.EHR.Retirement.Service.Controllers Document = retire.Document, Total = retire.RetirementProfiles.Count(), ProfileFile = file_name, - CreatedUserId = UserId ?? "System Administrator", - CreatedFullName = FullName ?? "", - CreatedAt = DateTime.Now, - LastUpdateFullName = FullName ?? "System Administrator", - LastUpdateUserId = UserId ?? "", - LastUpdatedAt = DateTime.Now, + CreatedUserId = retire.CreatedUserId, + CreatedFullName = retire.CreatedFullName, + CreatedAt = retire.CreatedAt, + LastUpdateFullName = retire.LastUpdateFullName, + LastUpdateUserId = retire.LastUpdateUserId, + LastUpdatedAt = retire.LastUpdatedAt, }; await _context.RetirementPeriodHistorys.AddAsync(history); // await _context.SaveChangesAsync(); @@ -452,6 +452,9 @@ namespace BMA.EHR.Retirement.Service.Controllers retire.Document = null; retire.Round = retire.Round + 1; retire.TypeReport = req.Option.Trim().ToUpper(); + retire.CreatedUserId = UserId ?? "System Administrator"; + retire.CreatedFullName = FullName ?? ""; + retire.CreatedAt = DateTime.Now; retire.LastUpdateFullName = FullName ?? "System Administrator"; retire.LastUpdateUserId = UserId ?? ""; retire.LastUpdatedAt = DateTime.Now;