Add last downloaded info to exports

This commit is contained in:
Mbucari 2023-03-03 15:06:06 -07:00
parent 02371f2221
commit cdb27ef712

View File

@ -106,6 +106,12 @@ namespace ApplicationServices
[Name("Language")] [Name("Language")]
public string Language { get; set; } public string Language { get; set; }
[Name("LastDownloaded")]
public DateTime? LastDownloaded { get; set; }
[Name("LastDownloadedVersion")]
public string LastDownloadedVersion { get; set; }
} }
public static class LibToDtos public static class LibToDtos
{ {
@ -140,7 +146,10 @@ namespace ApplicationServices
PdfStatus = a.Book.UserDefinedItem.PdfStatus.ToString(), PdfStatus = a.Book.UserDefinedItem.PdfStatus.ToString(),
ContentType = a.Book.ContentType.ToString(), ContentType = a.Book.ContentType.ToString(),
AudioFormat = a.Book.AudioFormat.ToString(), AudioFormat = a.Book.AudioFormat.ToString(),
Language = a.Book.Language Language = a.Book.Language,
LastDownloaded = a.Book.UserDefinedItem.LastDownloaded,
LastDownloadedVersion = a.Book.UserDefinedItem.LastDownloadedVersion?.ToString() ?? "",
}).ToList(); }).ToList();
} }
public static class LibraryExporter public static class LibraryExporter
@ -212,7 +221,9 @@ namespace ApplicationServices
nameof(ExportDto.PdfStatus), nameof(ExportDto.PdfStatus),
nameof(ExportDto.ContentType), nameof(ExportDto.ContentType),
nameof(ExportDto.AudioFormat), nameof(ExportDto.AudioFormat),
nameof(ExportDto.Language) nameof(ExportDto.Language),
nameof(ExportDto.LastDownloaded),
nameof(ExportDto.LastDownloadedVersion),
}; };
var col = 0; var col = 0;
foreach (var c in columns) foreach (var c in columns)
@ -238,9 +249,9 @@ namespace ApplicationServices
row.CreateCell(col++).SetCellValue(dto.Account); row.CreateCell(col++).SetCellValue(dto.Account);
var dateAddedCell = row.CreateCell(col++); var dateCell = row.CreateCell(col++);
dateAddedCell.CellStyle = dateStyle; dateCell.CellStyle = dateStyle;
dateAddedCell.SetCellValue(dto.DateAdded); dateCell.SetCellValue(dto.DateAdded);
row.CreateCell(col++).SetCellValue(dto.AudibleProductId); row.CreateCell(col++).SetCellValue(dto.AudibleProductId);
row.CreateCell(col++).SetCellValue(dto.Locale); row.CreateCell(col++).SetCellValue(dto.Locale);
@ -281,6 +292,15 @@ namespace ApplicationServices
row.CreateCell(col++).SetCellValue(dto.AudioFormat); row.CreateCell(col++).SetCellValue(dto.AudioFormat);
row.CreateCell(col++).SetCellValue(dto.Language); row.CreateCell(col++).SetCellValue(dto.Language);
if (dto.LastDownloaded.HasValue)
{
dateCell = row.CreateCell(col);
dateCell.CellStyle = dateStyle;
dateCell.SetCellValue(dto.LastDownloaded.Value);
}
row.CreateCell(++col).SetCellValue(dto.LastDownloadedVersion);
rowIndex++; rowIndex++;
} }