public static bool CheckConfirmPermission(long requestID = 0, long documentId = 0) { var request = RequestServices.GetById(requestID); if (CommonSessions.Role == UserRole.Administrator || CommonSessions.Role == UserRole.LanhDaoVP || CommonSessions.Role == UserRole.LanhDaoDonVi) { return(true); } if (requestID > 0) { if (CommonSessions.UserID > 0 && (request.CreatedBy == CommonSessions.UserID || request.Trackings.Any(t => t.UserID == CommonSessions.UserID) || request.RequesterID == CommonSessions.UserID)) { return(true); } } else if (documentId > 0) { var document = DocumentServices.GetById(documentId); if ((document.AgencyDocumentID <= 0 || document.AgencyDocumentID == null) && CommonSessions.UserID > 0 && (document.CreatedBy == CommonSessions.UserID || document.SignerID == CommonSessions.UserID || document.WriterID == CommonSessions.UserID)) { return(true); } } return(false); }
/// <summary> /// /// </summary> /// <param name="requestID"></param> /// <param name="documentId"></param> /// <returns></returns> public static bool CheckUpdatePermission(long requestID = 0, long documentId = 0) { var request = RequestServices.GetById(requestID); var document = DocumentServices.GetById(documentId); //Nếu đây là văn bản của UB tỉnh, thì ko được cập nhật if (document != null && document.AgencyDocumentID > 0) { return(false); } //Nếu đây là ykcd của UB tỉnh, thì ko được cập nhật nếu chưa giao việc if (request != null && request.IsAgencyRequest && !request.IsAssignPerform) { return(false); } //Nếu là tài khoản admin thì được cập nhật tất cả những YKCD nội bộ đơn vị if (CommonSessions.Role == UserRole.Administrator) { return(true); } if (requestID > 0 && request != null) { if (CommonSessions.UserID > 0 && (request.CreatedBy == CommonSessions.UserID || request.RequesterID == CommonSessions.UserID || request.Trackings.Any(t => t.UserID == CommonSessions.UserID))) { return(true); } } else if (documentId > 0 && document != null) { if ((document.AgencyDocumentID <= 0 || document.AgencyDocumentID == null) && CommonSessions.UserID > 0 && (document.CreatedBy == CommonSessions.UserID || document.SignerID == CommonSessions.UserID || document.WriterID == CommonSessions.UserID)) { return(true); } } return(false); }