Esempio n. 1
0
        /// <summary>
        /// Crea un DeskDocumentResult da un DeskDocument
        /// </summary>
        public DeskDocumentResult CreateDeskDocumentDto(DeskDocument document, BiblosDocumentInfo biblosDocument, Location deskLocation, bool fromDb)
        {
            DeskDocumentVersion deskVersioning = null;
            DeskStoryBoard      lastStoryBoard = null;
            DeskDocumentResult  dto            = MapperDeskDocumentResult.MappingDTO(document);


            // Mappo gli oggetti di Biblos
            dto.Name               = biblosDocument.Name;
            dto.Size               = biblosDocument.Size;
            dto.IsSavedToBiblos    = true;
            dto.IsSigned           = biblosDocument.IsSigned;
            dto.BiblosSerializeKey = biblosDocument.Serialized;

            //Mappo commenti e versioning
            if (fromDb)
            {
                deskVersioning = DeskDocumentVersionFacade.GetLastVersionByIdDeskDocument(document.Id);
                lastStoryBoard = CurrentDeskStoryBoardFacade.GetLastStoryBoard(deskVersioning);
            }

            dto.LastVersion           = fromDb ? deskVersioning.Version : new decimal(1.0);
            dto.IdChainBiblos         = biblosDocument.ChainId;
            dto.IdDocumentBiblos      = biblosDocument.DocumentId;
            dto.IsJustInCollaboration = CurrentDeskCollaborationFacade.IsDocumentJustInCollaboration(document.Desk, dto.Name);

            dto.LastComment = fromDb && lastStoryBoard != null ? lastStoryBoard.Comment : string.Empty;

            return(dto);
        }
Esempio n. 2
0
        /// <summary>
        /// Aggiorna il documento firmato in BiblosDs2010
        /// </summary>
        public BiblosDocumentInfo UpdateSignedDocument(Desk desk, DeskRoleUser roleUser, Guid idDeskDocument, BiblosDocumentInfo documentToUpdate, string userId)
        {
            DeskDocument        deskDocument    = this.GetById(idDeskDocument);
            BiblosDocumentInfo  documentUpdated = documentToUpdate.Update(userId);
            DeskDocumentVersion docVersion      = DeskDocumentVersionFacade.InsertDocumentVersion(documentUpdated.DocumentId, documentUpdated.Version, deskDocument);

            AddCommentStoryBoard(documentUpdated, desk, roleUser, docVersion, DeskStoryBoardType.SignedDocument);
            return(documentUpdated);
        }
Esempio n. 3
0
        /// <summary>
        /// CheckIn di una specifica versione del documento.
        /// </summary>
        /// <param name="idDocument"></param>
        /// <param name="docName"></param>
        /// <param name="content"></param>
        /// <param name="userId"></param>
        /// <param name="contentFormat"></param>
        /// <param name="version">Ritorna la versione corrente del documento appena inserito</param>
        /// <returns></returns>
        public BiblosDocumentInfo CheckIn(Desk desk, DeskRoleUser roleUser, Guid?idDeskDocument, Guid idDocument, string docName, byte[] content, string userId, ContentFormat contentFormat, decimal?version)
        {
            DeskDocument       deskDocument = GetById(idDeskDocument.Value, false);
            BiblosDocumentInfo newDoc       = BiblosDocumentInfo.CheckInDocument(idDocument, docName, content, userId, contentFormat, version);

            UpdateDocumentCheckIn(idDeskDocument, newDoc.DocumentId);
            decimal             newversion = version ?? newDoc.Version;
            DeskDocumentVersion docVersion = DeskDocumentVersionFacade.InsertDocumentVersion(newDoc.DocumentId, newversion, deskDocument);

            AddCommentStoryBoard(newDoc, desk, roleUser, docVersion, DeskStoryBoardType.CheckInComment);
            return(newDoc);
        }