SHA256
StayExport Tracking - Update Stay upload status when updating export files
- Exported StayEntries (with Export OK) will update it's upload status when the export file is set as "Uploaded".
This commit is contained in:
1 parent
54387a6346
commit
72cd11caf2
3 files changed
+26
-3
No files matched your search
@@ -121,9 +121,32 @@ public class StayExportFileEntityService(
|
||||
|
||||
try
|
||||
{
|
||||
DateTime dtNow = DateTime.UtcNow;
|
||||
|
||||
//Update UploadStatus of StayEntries when new status is "Uploaded".
|
||||
if (newStatus == UploadStatus.Uploaded && dbItem.ExportDetails != null)
|
||||
{
|
||||
//Only StayEntries exported OK will be updated!
|
||||
IEnumerable<long> stayEntryIds = dbItem.ExportDetails.StayEntries
|
||||
.Where(e => e.ExportResult == StayExportDetailsStayEntryResult.OK)
|
||||
.Select(e => e.StayEntryId);
|
||||
|
||||
//Make Update
|
||||
int updatedCount = await dbContext.StayEntries
|
||||
.Where(e => stayEntryIds.Contains(e.Id))
|
||||
.ExecuteUpdateAsync(u =>
|
||||
{
|
||||
u.SetProperty(p => p.StayUploadStatus, UploadStatus.Uploaded);
|
||||
u.SetProperty(p => p.StayUploadStatusTime, dtNow);
|
||||
});
|
||||
|
||||
logger.LogInformation("StayExportFileService - UpdateStayExportUploadStatusAsync: StayEntry UploadStatus updated to 'Uploaded' for {count} entries: '{entryList}'",
|
||||
updatedCount, string.Join(", ", stayEntryIds));
|
||||
}
|
||||
|
||||
//Update Status
|
||||
dbItem.FileUploadStatus = newStatus;
|
||||
dbItem.FileUploadStatusTime = DateTime.UtcNow;
|
||||
dbItem.FileUploadStatusTime = dtNow;
|
||||
|
||||
await dbContext.SaveChangesAsync();
|
||||
|
||||
|
||||
Reference in new issue
Block a user