|
@@ -135,6 +135,11 @@ namespace InABox.DynamicGrid
|
|
|
var page = doc.Pages[i] as PdfLoadedPage;
|
|
|
foreach (PdfLoadedAnnotation a in page.Annotations)
|
|
|
{
|
|
|
+
|
|
|
+ var atype = GetAnnotationType(a);
|
|
|
+ if (atype == EntityDocumentAnnotationType.Popup)
|
|
|
+ continue;
|
|
|
+
|
|
|
var a_id = Guid.Empty;
|
|
|
if (!string.IsNullOrWhiteSpace(a.Author))
|
|
|
Guid.TryParse(a.Author, out a_id);
|
|
@@ -143,6 +148,8 @@ namespace InABox.DynamicGrid
|
|
|
currentAnnotations.Remove(a_id);
|
|
|
|
|
|
var annotation = a_id.Equals(Guid.Empty) ? null : annotations.FirstOrDefault(x => x.ID.Equals(a_id));
|
|
|
+
|
|
|
+
|
|
|
if (annotation == null)
|
|
|
{
|
|
|
annotation = new EntityDocumentAnnotation { EntityDocument = _document.ID };
|
|
@@ -150,15 +157,17 @@ namespace InABox.DynamicGrid
|
|
|
}
|
|
|
|
|
|
annotation.Page = i;
|
|
|
- annotation.Type = GetAnnotationType(a);
|
|
|
+ annotation.Type = atype;
|
|
|
annotation.Data = SaveAnnotation(doc, a);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
new Client<EntityDocumentAnnotation>().Save(annotations.Where(x => x.IsChanged()), "");
|
|
|
-
|
|
|
- foreach (var annotation in annotations.Where(x => currentAnnotations.Contains(x.ID)))
|
|
|
- new Client<EntityDocumentAnnotation>().Delete(annotation, "");
|
|
|
+ var _deletes = annotations.Where(x =>
|
|
|
+ currentAnnotations.Contains(x.ID) || x.Type == EntityDocumentAnnotationType.Popup)
|
|
|
+ .ToArray();
|
|
|
+ if (_deletes.Any())
|
|
|
+ new Client<EntityDocumentAnnotation>().Delete(_deletes, "");
|
|
|
}
|
|
|
}
|
|
|
}
|