diff --git a/RMuseum/RMuseum.xml b/RMuseum/RMuseum.xml
index ce42050e..9d3a73e6 100644
--- a/RMuseum/RMuseum.xml
+++ b/RMuseum/RMuseum.xml
@@ -13607,6 +13607,14 @@
+
+
+ upload artifact to external server
+
+
+
+
+
reschedule jobs
diff --git a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-HarvardDirectly.cs b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-HarvardDirectly.cs
index 6e1727dd..dd750270 100644
--- a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-HarvardDirectly.cs
+++ b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-HarvardDirectly.cs
@@ -152,6 +152,19 @@ namespace RMuseum.Services.Implementation
await context.Artifacts.AddAsync(book);
await context.SaveChangesAsync();
+ var resFTPUpload = await UploadArtifactToExternalServer(book, context);
+ if (!string.IsNullOrEmpty(resFTPUpload.ExceptionString))
+ {
+ job.EndTime = DateTime.Now;
+ job.Status = ImportJobStatus.Failed;
+ job.Exception = $"UploadArtifactToExternalServer: {resFTPUpload.ExceptionString}";
+ job.ArtifactId = book.Id;
+ job.EndTime = DateTime.Now;
+ context.Update(job);
+ await context.SaveChangesAsync();
+ return;
+ }
+
job.ProgressPercent = 100;
job.Status = ImportJobStatus.Succeeded;
job.ArtifactId = book.Id;
diff --git a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportBritishLibrary.cs b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportBritishLibrary.cs
index 05ed5495..fcc1368d 100644
--- a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportBritishLibrary.cs
+++ b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportBritishLibrary.cs
@@ -641,6 +641,19 @@ namespace RMuseum.Services.Implementation
await context.Artifacts.AddAsync(book);
await context.SaveChangesAsync();
+ var resFTPUpload = await UploadArtifactToExternalServer(book, context);
+ if (!string.IsNullOrEmpty(resFTPUpload.ExceptionString))
+ {
+ job.EndTime = DateTime.Now;
+ job.Status = ImportJobStatus.Failed;
+ job.Exception = $"UploadArtifactToExternalServer: {resFTPUpload.ExceptionString}";
+ job.ArtifactId = book.Id;
+ job.EndTime = DateTime.Now;
+ context.Update(job);
+ await context.SaveChangesAsync();
+ return;
+ }
+
job.ProgressPercent = 100;
job.Status = ImportJobStatus.Succeeded;
job.ArtifactId = book.Id;
diff --git a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportCambridge.cs b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportCambridge.cs
index d5673d8e..a3c450b5 100644
--- a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportCambridge.cs
+++ b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportCambridge.cs
@@ -433,6 +433,19 @@ namespace RMuseum.Services.Implementation
await context.Artifacts.AddAsync(book);
await context.SaveChangesAsync();
+ var resFTPUpload = await UploadArtifactToExternalServer(book, context);
+ if (!string.IsNullOrEmpty(resFTPUpload.ExceptionString))
+ {
+ job.EndTime = DateTime.Now;
+ job.Status = ImportJobStatus.Failed;
+ job.Exception = $"UploadArtifactToExternalServer: {resFTPUpload.ExceptionString}";
+ job.ArtifactId = book.Id;
+ job.EndTime = DateTime.Now;
+ context.Update(job);
+ await context.SaveChangesAsync();
+ return;
+ }
+
job.ProgressPercent = 100;
job.Status = ImportJobStatus.Succeeded;
job.ArtifactId = book.Id;
diff --git a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportChesterBeatty.cs b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportChesterBeatty.cs
index 904fce30..d3988131 100644
--- a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportChesterBeatty.cs
+++ b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportChesterBeatty.cs
@@ -328,6 +328,19 @@ namespace RMuseum.Services.Implementation
await context.Artifacts.AddAsync(book);
await context.SaveChangesAsync();
+ var resFTPUpload = await UploadArtifactToExternalServer(book, context);
+ if (!string.IsNullOrEmpty(resFTPUpload.ExceptionString))
+ {
+ job.EndTime = DateTime.Now;
+ job.Status = ImportJobStatus.Failed;
+ job.Exception = $"UploadArtifactToExternalServer: {resFTPUpload.ExceptionString}";
+ job.ArtifactId = book.Id;
+ job.EndTime = DateTime.Now;
+ context.Update(job);
+ await context.SaveChangesAsync();
+ return;
+ }
+
job.ProgressPercent = 100;
job.Status = ImportJobStatus.Succeeded;
job.ArtifactId = book.Id;
diff --git a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportHarvard.cs b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportHarvard.cs
index 8a29f323..0a58a8bf 100644
--- a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportHarvard.cs
+++ b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportHarvard.cs
@@ -213,6 +213,20 @@ namespace RMuseum.Services.Implementation
await context.Artifacts.AddAsync(book);
await context.SaveChangesAsync();
+
+ var resFTPUpload = await UploadArtifactToExternalServer(book, context);
+ if (!string.IsNullOrEmpty(resFTPUpload.ExceptionString))
+ {
+ job.EndTime = DateTime.Now;
+ job.Status = ImportJobStatus.Failed;
+ job.Exception = $"UploadArtifactToExternalServer: {resFTPUpload.ExceptionString}";
+ job.ArtifactId = book.Id;
+ job.EndTime = DateTime.Now;
+ context.Update(job);
+ await context.SaveChangesAsync();
+ return;
+ }
+
job.ProgressPercent = 100;
job.Status = ImportJobStatus.Succeeded;
job.ArtifactId = book.Id;
diff --git a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportHathiTrust.cs b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportHathiTrust.cs
index 4202e08e..a1285935 100644
--- a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportHathiTrust.cs
+++ b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportHathiTrust.cs
@@ -466,6 +466,19 @@ namespace RMuseum.Services.Implementation
await context.Artifacts.AddAsync(book);
await context.SaveChangesAsync();
+ var resFTPUpload = await UploadArtifactToExternalServer(book, context);
+ if (!string.IsNullOrEmpty(resFTPUpload.ExceptionString))
+ {
+ job.EndTime = DateTime.Now;
+ job.Status = ImportJobStatus.Failed;
+ job.Exception = $"UploadArtifactToExternalServer: {resFTPUpload.ExceptionString}";
+ job.ArtifactId = book.Id;
+ job.EndTime = DateTime.Now;
+ context.Update(job);
+ await context.SaveChangesAsync();
+ return;
+ }
+
job.ProgressPercent = 100;
job.Status = ImportJobStatus.Succeeded;
job.ArtifactId = book.Id;
diff --git a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportLoc.cs b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportLoc.cs
index 6c02c7f7..4622b742 100644
--- a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportLoc.cs
+++ b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportLoc.cs
@@ -478,6 +478,19 @@ namespace RMuseum.Services.Implementation
await context.Artifacts.AddAsync(book);
await context.SaveChangesAsync();
+ var resFTPUpload = await UploadArtifactToExternalServer(book, context);
+ if (!string.IsNullOrEmpty(resFTPUpload.ExceptionString))
+ {
+ job.EndTime = DateTime.Now;
+ job.Status = ImportJobStatus.Failed;
+ job.Exception = $"UploadArtifactToExternalServer: {resFTPUpload.ExceptionString}";
+ job.ArtifactId = book.Id;
+ job.EndTime = DateTime.Now;
+ context.Update(job);
+ await context.SaveChangesAsync();
+ return;
+ }
+
job.ProgressPercent = 100;
job.Status = ImportJobStatus.Succeeded;
job.ArtifactId = book.Id;
diff --git a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportPenLibraries.cs b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportPenLibraries.cs
index ecb9f69b..2314c340 100644
--- a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportPenLibraries.cs
+++ b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportPenLibraries.cs
@@ -446,6 +446,19 @@ namespace RMuseum.Services.Implementation
await context.Artifacts.AddAsync(book);
await context.SaveChangesAsync();
+ var resFTPUpload = await UploadArtifactToExternalServer(book, context);
+ if (!string.IsNullOrEmpty(resFTPUpload.ExceptionString))
+ {
+ job.EndTime = DateTime.Now;
+ job.Status = ImportJobStatus.Failed;
+ job.Exception = $"UploadArtifactToExternalServer: {resFTPUpload.ExceptionString}";
+ job.ArtifactId = book.Id;
+ job.EndTime = DateTime.Now;
+ context.Update(job);
+ await context.SaveChangesAsync();
+ return;
+ }
+
job.ProgressPercent = 100;
job.Status = ImportJobStatus.Succeeded;
job.ArtifactId = book.Id;
diff --git a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportServerFolder.cs b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportServerFolder.cs
index 16bed9e1..f8360ef5 100644
--- a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportServerFolder.cs
+++ b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportServerFolder.cs
@@ -138,6 +138,19 @@ namespace RMuseum.Services.Implementation
await context.Artifacts.AddAsync(book);
await context.SaveChangesAsync();
+ var resFTPUpload = await UploadArtifactToExternalServer(book, context);
+ if (!string.IsNullOrEmpty(resFTPUpload.ExceptionString))
+ {
+ job.EndTime = DateTime.Now;
+ job.Status = ImportJobStatus.Failed;
+ job.Exception = $"UploadArtifactToExternalServer: {resFTPUpload.ExceptionString}";
+ job.ArtifactId = book.Id;
+ job.EndTime = DateTime.Now;
+ context.Update(job);
+ await context.SaveChangesAsync();
+ return;
+ }
+
job.ProgressPercent = 100;
job.Status = ImportJobStatus.Succeeded;
job.ArtifactId = book.Id;
@@ -230,12 +243,25 @@ namespace RMuseum.Services.Implementation
pages.InsertRange(0, book.Items);
- book.Items = pages.ToArray();//TODO: check if this is correct
+ book.Items = pages.ToArray();
book.ItemCount = pages.Count;
context.Update(book);
await context.SaveChangesAsync();
+ var resFTPUpload = await UploadArtifactToExternalServer(book, context);
+ if (!string.IsNullOrEmpty(resFTPUpload.ExceptionString))
+ {
+ job.EndTime = DateTime.Now;
+ job.Status = ImportJobStatus.Failed;
+ job.Exception = $"UploadArtifactToExternalServer: {resFTPUpload.ExceptionString}";
+ job.ArtifactId = book.Id;
+ job.EndTime = DateTime.Now;
+ context.Update(job);
+ await context.SaveChangesAsync();
+ return;
+ }
+
job.ProgressPercent = 100;
job.Status = ImportJobStatus.Succeeded;
job.ArtifactId = book.Id;
diff --git a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportWalters.cs b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportWalters.cs
index 082cd306..ce1c95f0 100644
--- a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportWalters.cs
+++ b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtifactService-ImportWalters.cs
@@ -432,6 +432,19 @@ namespace RMuseum.Services.Implementation
await context.Artifacts.AddAsync(book);
await context.SaveChangesAsync();
+ var resFTPUpload = await UploadArtifactToExternalServer(book, context);
+ if (!string.IsNullOrEmpty(resFTPUpload.ExceptionString))
+ {
+ job.EndTime = DateTime.Now;
+ job.Status = ImportJobStatus.Failed;
+ job.Exception = $"UploadArtifactToExternalServer: {resFTPUpload.ExceptionString}";
+ job.ArtifactId = book.Id;
+ job.EndTime = DateTime.Now;
+ context.Update(job);
+ await context.SaveChangesAsync();
+ return;
+ }
+
job.ProgressPercent = 100;
job.Status = ImportJobStatus.Succeeded;
job.ArtifactId = book.Id;
diff --git a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtificatService-ImportPrinceton.cs b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtificatService-ImportPrinceton.cs
index c93e5df0..076b45fe 100644
--- a/RMuseum/Services/Implementation/ArtifactService-Partials/ArtificatService-ImportPrinceton.cs
+++ b/RMuseum/Services/Implementation/ArtifactService-Partials/ArtificatService-ImportPrinceton.cs
@@ -423,6 +423,19 @@ namespace RMuseum.Services.Implementation
await context.Artifacts.AddAsync(book);
await context.SaveChangesAsync();
+ var resFTPUpload = await UploadArtifactToExternalServer(book, context);
+ if(!string.IsNullOrEmpty(resFTPUpload.ExceptionString))
+ {
+ job.EndTime = DateTime.Now;
+ job.Status = ImportJobStatus.Failed;
+ job.Exception = $"UploadArtifactToExternalServer: {resFTPUpload.ExceptionString}";
+ job.ArtifactId = book.Id;
+ job.EndTime = DateTime.Now;
+ context.Update(job);
+ await context.SaveChangesAsync();
+ return;
+ }
+
job.ProgressPercent = 100;
job.Status = ImportJobStatus.Succeeded;
job.ArtifactId = book.Id;