예제 #1
0
        /// <summary>
        /// Update a existing Annotation
        /// </summary>
        /// <param name="annotation"></param>
        /// <returns></returns>
        public async Task UpdateAnnotation(Annotation annotation)
        {
            await DomainEvents.Publish(new PublicationOpeningEvent(annotation.BookId, false));

            annotation.UpdatedTime = DateTime.UtcNow;
            annotation.Status      = AnnotationStatusEnum.Updated;
            annotation.IsUpdated   = true;

            annotationAccess.UpdateAnnotation(annotation.DocId, annotation.Type, AnnotationStatusEnum.Updated, annotation.ToXmlString(), DateTime.Now, false, annotation.AnnotationCode);
        }
예제 #2
0
        private bool UpdateAnnotationToOrphaned(Annotations anno)
        {
            anno.Status = (int)AnnotationStatusEnum.Orphaned;
            var annotation = AnnotationFactory.CreateAnnotation(anno.AnnotationContent);

            annotation.Status      = AnnotationStatusEnum.Orphaned;
            annotation.IsUpdated   = true;
            anno.AnnotationContent = annotation.ToXmlString();
            annotationAccess.UpdateAnnotation(anno);
            return(true);
        }
예제 #3
0
 public Task Handle(TagDeletedEvent evt)
 {
     return(Task.Run(() =>
     {
         var annotations = annotationAccess.GetAnnotations(evt.Email, evt.ServiceCode);
         if (annotations.Count > 0)
         {
             var ConvertedAnnotations = AnnotationFactory.CreateAnnotations(annotations);
             foreach (var annotation in ConvertedAnnotations)
             {
                 if (annotation.CategoryTagIDs.Remove(evt.TagId))
                 {
                     annotationAccess.UpdateAnnotation(annotation.DocId, annotation.Type, AnnotationStatusEnum.Updated, annotation.ToXmlString(), DateTime.Now, false, annotation.AnnotationCode);
                 }
             }
         }
     }));
 }