/// <summary> /// CheckIn di una specifica versione del documento. /// </summary> /// <param name="document"></param> /// <param name="content"></param> /// <param name="userId"></param> /// <param name="contentFormat"></param> /// <param name="version"></param> /// <returns></returns> public BiblosDocumentInfo CheckIn(Desk desk, DeskRoleUser roleUser, DeskDocumentResult document, byte[] content, string userId, ContentFormat contentFormat, decimal?version) { string docName = document.Name; DeskDocument deskDocument = GetById(document.IdDeskDocument.Value, false); return(CheckIn(desk, roleUser, document.IdDeskDocument, document.IdDocumentBiblos.Value, docName, content, userId, contentFormat, version)); }
/// <summary> /// Aggiunge un nuovo commento allo storyboard indicando l'azione eseguita e l'utente /// </summary> /// <param name="documentName"></param> /// <param name="desk"></param> /// <param name="roleUser"></param> /// <param name="docVersion"></param> /// <param name="boardType"></param> private void AddCommentStoryBoard(BiblosDocumentInfo biblosDoc, Desk desk, DeskRoleUser roleUser, DeskDocumentVersion docVersion, DeskStoryBoardType boardType) { string commentStringType = string.Empty; switch (boardType) { case DeskStoryBoardType.CheckInComment: commentStringType = checkInComment; break; case DeskStoryBoardType.CheckOutComment: commentStringType = checkOutComment; break; case DeskStoryBoardType.UndoCheckout: commentStringType = undoCheckOutComment; break; case DeskStoryBoardType.SignedDocument: commentStringType = SIGNED_DOCUMENT_LOG_FORMAT; break; case DeskStoryBoardType.RenameDocument: commentStringType = renameComment; break; } string comment = string.Format(commentStringType, _userName, biblosDoc.Name, biblosDoc.Version); CurrentDeskStoryBoardFacade.AddCommentToStoryBoard(comment, desk, roleUser, docVersion, boardType); }
protected override IQueryOver <Desk, Desk> DecorateCriteria(IQueryOver <Desk, Desk> queryOver) { DeskDocumentEndorsement deskDocumentEndorsement = null; DeskRoleUser deskRoleUser = null; DeskDocumentVersion deskDocumentVersion = null; DeskDocument deskDocument = null; queryOver.JoinAlias(o => o.DeskDocuments, () => deskDocument) .JoinAlias(() => deskDocument.DeskDocumentVersions, () => deskDocumentVersion) .JoinAlias(o => o.DeskRoleUsers, () => deskRoleUser) .Left.JoinAlias(() => deskRoleUser.DeskDocumentEndorsements, () => deskDocumentEndorsement, () => deskDocumentEndorsement.DeskDocumentVersion.Id == deskDocumentVersion.Id); if (DeskId.HasValue) { queryOver.Where(desk => desk.Id == DeskId.Value); } FilterByUserPermission(queryOver); queryOver.SelectList(select => select.SelectGroup(() => deskDocument.Id).SelectMax(() => deskDocumentVersion.Version)); if (!VersionFilters.Any()) { return(queryOver); } foreach (KeyValuePair <Guid, decimal> versionFilter in VersionFilters) { queryOver.Where(() => deskDocument.Id == versionFilter.Key) .And(() => deskDocumentVersion.Version == versionFilter.Value); } return(queryOver); }
/// <summary> /// 1) Annulla estrazione del file da parte dell'utente. /// 2) Aggiorna l'ultimo utente che ha eseguito le operazioni sul file e la data. /// 3) Aggiunge un commento nello storyboard. /// </summary> /// <param name="desk"></param> /// <param name="roleUser"></param> /// <param name="docVersion"></param> /// <param name="idDeskDocument"></param> /// <param name="idDocument"></param> /// <param name="userId"></param> public void UndoCheckOut(Desk desk, DeskRoleUser roleUser, DeskDocumentVersion docVersion, Guid?idDeskDocument, Guid idDocument, string userId) { BiblosDocumentInfo.UndoCheckOutDocument(idDocument, userId); BiblosDocumentInfo undoDoc = BiblosDocumentInfo.GetDocumentByVersion(idDocument, null, null); UpdateDocumentLastChages(idDeskDocument); AddCommentStoryBoard(undoDoc, desk, roleUser, docVersion, DeskStoryBoardType.UndoCheckout); }
/// <summary> /// Esegue l'estrazione del documento con lock esclusivo /// </summary> /// <param name="idDocument"></param> /// <param name="userId"></param> /// <param name="contentFormat"></param> /// <param name="returnContent"></param> /// <returns></returns> public BiblosDocumentInfo CheckOut(Desk desk, DeskRoleUser roleUser, DeskDocumentVersion docVersion, Guid?idDeskDocument, Guid idDocument, string userId, ContentFormat contentFormat, bool?returnContent) { BiblosDocumentInfo checkOutDoc = BiblosDocumentInfo.CheckOutDocument(idDocument, userId, contentFormat, returnContent); UpdateDocumentLastChages(idDeskDocument); AddCommentStoryBoard(checkOutDoc, desk, roleUser, docVersion, DeskStoryBoardType.CheckOutComment); return(checkOutDoc); }
/// <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); }
public ICollection <DeskDocumentEndorsement> GetByIdVersionAndAccount(Guid idDeskDocumentVersion, string account) { DeskRoleUser deskRoleUser = null; return(NHibernateSession.QueryOver <DeskDocumentEndorsement>() .Where(x => x.DeskDocumentVersion.Id == idDeskDocumentVersion) .JoinAlias(x => x.DeskRoleUser, () => deskRoleUser) .AndRestrictionOn(() => deskRoleUser.AccountName).IsInsensitiveLike(account) .List <DeskDocumentEndorsement>()); }
/// <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); }
/// <summary> /// Filtro gli utenti visibili nella griglia di approvazione. /// Solo coloro che possono approvare i documenti dovranno essere previsti nel riepilogo di approvazione. /// </summary> /// <param name="queryOver"></param> /// <returns></returns> public IQueryOver <Desk, Desk> FilterByUserPermission(IQueryOver <Desk, Desk> queryOver) { DeskRoleUser deskRoleUser = null; // Filtro su utenti che hanno i diritti ICollection <DeskPermissionType> userWithRole = new Collection <DeskPermissionType>(); userWithRole.Add(DeskPermissionType.Admin); userWithRole.Add(DeskPermissionType.Approval); userWithRole.Add(DeskPermissionType.Manage); queryOver.Where(() => deskRoleUser.PermissionType.IsIn(userWithRole.ToArray())); return(queryOver); }
protected override IQueryOver <DeskDocumentEndorsement, DeskDocumentEndorsement> MappingProjection(IQueryOver <DeskDocumentEndorsement, DeskDocumentEndorsement> queryOver) { DeskEndorsement deskEndorsment = null; DeskRoleUser deskRoleUser = null; DeskDocumentVersion deskDocumentVersion = null; DeskDocument deskDocument = null; queryOver.JoinAlias(o => o.DeskRoleUser, () => deskRoleUser) .SelectList(list => list // Mappatura degli oggetti DeskDocumentEndorsment .Select(x => x.Endorsement).WithAlias(() => deskEndorsment.IsApprove) // Mappatura degli oggetti DeskDocumentVersion .Select(() => deskDocumentVersion.Version).WithAlias(() => deskEndorsment.Version) // Mappatura degli oggetti DeskDocument .Select(() => deskDocument.Id).WithAlias(() => deskEndorsment.DeskDocumentId) .Select(() => deskRoleUser.AccountName).WithAlias(() => deskEndorsment.AccountName)); return(queryOver); }
/// <summary> /// Mappo gli oggetti di DeskDocumentEndorsement su DeskEndorsement. /// <see cref="IsApprove">IsApprove viene settato intero poichè in una PivotGrid ho la necessità di aggregare questa informazione</see> /// </summary> /// <param name="queryOver"></param> /// <returns></returns> protected override IQueryOver <Desk, Desk> MappingProjection(IQueryOver <Desk, Desk> queryOver) { DeskEndorsement deskEndorsment = null; DeskDocumentEndorsement deskDocumentEndorsement = null; DeskRoleUser deskRoleUser = null; DeskDocumentVersion deskDocumentVersion = null; DeskDocument deskDocument = null; queryOver .SelectList(list => list // Mappatura degli oggetti DeskDocumentEndorsmen //.Select(Projections.Cast(NHibernateUtil.Int32, Projections.Property(() => deskDocumentEndorsement.Endorsement))).WithAlias(() => deskEndorsment.IsApprove) .Select(() => deskDocumentEndorsement.Endorsement).WithAlias(() => deskEndorsment.IsApprove) // Mappatura degli oggetti DeskDocumentVersion .Select(() => deskDocumentVersion.Version).WithAlias(() => deskEndorsment.Version) // Mappatura degli oggetti DeskDocument .Select(() => deskDocument.Id).WithAlias(() => deskEndorsment.DeskDocumentId) .Select(() => deskDocument.IdDocument).WithAlias(() => deskEndorsment.IdChainBiblos) .Select(() => deskRoleUser.AccountName).WithAlias(() => deskEndorsment.AccountName)); return(queryOver); }
/// <summary> /// Inserisce una nuova approvazione o un nuovo rifiuto per il documento specificato /// </summary> /// <param name="idDeskDocument"></param> /// <param name="version"></param> /// <param name="user"></param> /// <param name="approve">Se true approva il documento, se false lo rifiuta</param> public void AddApproveOrRefuse(Guid idDeskDocument, decimal version, DeskRoleUser user, bool approve) { DeskDocument doc = CurrentDeskDocumentFacade.GetById(idDeskDocument); DeskDocumentEndorsement endorsment = new DeskDocumentEndorsement(); if (!doc.DeskDocumentVersions.Any(x => x.Version.Equals(version))) { throw new Exception("Nessuna versione presente per quanto specificato"); } DeskDocumentVersion docVersion = doc.DeskDocumentVersions.Single(x => x.Version.Equals(version)); endorsment.DeskDocumentVersion = docVersion; endorsment.DeskRoleUser = user; endorsment.Endorsement = approve; //Aggiungo il commento relativo all'approvazione string authorName = CommonUtil.GetInstance().UserDescription; DateTime approveDate = DateTime.Now; string comment = string.Empty; if (approve) { comment = string.Format(APPROVE_COMMENT_FORMAT, authorName, approveDate); } else { comment = string.Format(REFUSE_COMMENT_FORMAT, authorName, approveDate); } Save(ref endorsment); CurrentDeskStoryBoardFacade.AddCommentToStoryBoard(comment, authorName, approveDate, doc.Desk, user, docVersion); //Inserisco il log di approvazione CurrentDeskLogFacade.InsertLog(DeskLogType.Approve, comment, doc.Desk, SeverityLog.Info); }
public void AddCommentToStoryBoard(string comment, string authorName, Desk desk, DeskRoleUser user, DeskDocumentVersion docVersion, DeskStoryBoardType commentType = DeskStoryBoardType.TextComment) { AddCommentToStoryBoard(comment, authorName, DateTime.Now, desk, user, docVersion, commentType); }
public void AddCommentToStoryBoard(string comment, string authorName, DateTime commentDate, Desk desk, DeskRoleUser user, DeskDocumentVersion docVersion, DeskStoryBoardType commentType = DeskStoryBoardType.TextComment) { DeskStoryBoard storyBoardComment = new DeskStoryBoard(_userName) { Author = authorName, BoardType = commentType, DateBoard = commentDate.ToLocalTime(), Comment = comment, Desk = desk, DeskDocumentVersion = docVersion }; if (user != null) { storyBoardComment.DeskRoleUser = user; } Save(ref storyBoardComment); }
/// <summary> /// Inserisce una nuova approvazione per il documento specificato per l'ultimo versioning presente /// </summary> public void AddApprove(Guid idDeskDocument, DeskRoleUser user) { decimal lastVersion = CurrentDeskDocumentVersionFacade.GetLastVersionByIdDeskDocument(idDeskDocument).Version.Value; AddApproveOrRefuse(idDeskDocument, lastVersion, user, true); }
/// <summary> /// 1) Annulla estrazione del file da parte dell'utente. /// 2) Aggiorna l'ultimo utente che ha eseguito le operazioni sul file e la data. /// 3) Aggiunge un commento nello storyboard. /// </summary> /// <param name="desk"></param> /// <param name="roleUser"></param> /// <param name="docVersion"></param> /// <param name="document"></param> /// <param name="userId"></param> public void UndoCheckOut(Desk desk, DeskRoleUser roleUser, DeskDocumentVersion docVersion, DeskDocumentResult document, string userId) { UndoCheckOut(desk, roleUser, docVersion, document.IdDeskDocument, document.IdDocumentBiblos.Value, userId); }
public void RenameDoc(Desk desk, DeskRoleUser roleUser, DeskDocumentVersion docVersion, BiblosDocumentInfo document, string userId) { Service.UpdateDocument(document, DocSuiteContext.Current.User.FullUserName); AddCommentStoryBoard(document, desk, roleUser, docVersion, DeskStoryBoardType.RenameDocument); }
/// <summary> /// Aggiorna il documento firmato in BiblosDs2010 /// </summary> public BiblosDocumentInfo UpdateSignedDocument(Desk desk, DeskRoleUser roleUser, DeskDocumentResult document, BiblosDocumentInfo documentToUpdate, string userId) { Guid idDeskDocument = document.IdDeskDocument.Value; return(this.UpdateSignedDocument(desk, roleUser, idDeskDocument, documentToUpdate, userId)); }
public void AddCommentToStoryBoard(string comment, Desk desk, DeskRoleUser user, DeskDocumentVersion docVersion, DeskStoryBoardType commentType = DeskStoryBoardType.TextComment) { AddCommentToStoryBoard(comment, CommonUtil.GetInstance().UserDescription, desk, user, docVersion, commentType); }
/// <summary> /// Esegue l'estrazione del documento con lock esclusivo /// </summary> /// <param name="document"></param> /// <param name="userId"></param> /// <param name="contentFormat"></param> /// <param name="returnContent"></param> /// <returns></returns> public BiblosDocumentInfo CheckOut(Desk desk, DeskRoleUser roleUser, DeskDocumentVersion docVersion, DeskDocumentResult document, string userId, ContentFormat contentFormat, bool?returnContent) { return(CheckOut(desk, roleUser, docVersion, document.IdDeskDocument, document.IdDocumentBiblos.Value, userId, contentFormat, returnContent)); }