Example #1
0
        private static string InsertDocument(NewScanCommand command)
        {
            var documentId = Guid.NewGuid().ToString();

            CreateDocumentQuery.Insert(new CreateDocumentCommand
            {
                Id              = documentId,
                PersonId        = command.PersonId.ToString(),
                CorrespondentId = command.CorrespondentId.ToString(),
                DocumentTypeId  = command.DocumentTypeId.ToString(),
                Datum           = command.Datum,
                Description     = command.Description
            });
            return(documentId);
        }
Example #2
0
        public static void Handle(NewScanCommand command)
        {
            var isNewDocument = !command.DocumentId.HasValue;
            var documentId    = isNewDocument
                ? InsertDocument(command)
                : command.DocumentId?.ToString();

            var scannedDocumentId   = Guid.NewGuid().ToString();
            var destinationFilename = MoveDocumentToCorrectLocation(command.Filename, documentId, scannedDocumentId);

            InsertScannedFile(destinationFilename, documentId, scannedDocumentId);
            if (isNewDocument)
            {
                InsertCustomFields(documentId, command.CustomFields);
            }
        }