public bool AllowPrint(Enums.DocumentStatus documentStatus) { int iStatusAllow = Convert.ToInt32(Enums.DocumentStatus.WaitingGovApproval); int currentStatus = Convert.ToInt32(documentStatus); return(currentStatus >= iStatusAllow); }
public bool IsAllowEditLack1(string createdUser, string currentUserId, Enums.DocumentStatus status, Enums.UserRole role, string documentNumber) { if (_poabll.GetUserRole(currentUserId) == Enums.UserRole.Administrator) { return(true); } if (status == Enums.DocumentStatus.WaitingGovApproval) { string originalPoa; if (createdUser == currentUserId) { return(true); } originalPoa = createdUser; if (role == Enums.UserRole.POA) { //get poa Original that already approve or reject var workflowHistoryDto = _workflowHistoryBll.GetDtoApprovedRejectedPoaByDocumentNumber(documentNumber); if (workflowHistoryDto != null) { if (!string.IsNullOrEmpty(workflowHistoryDto.COMMENT) && workflowHistoryDto.COMMENT.Contains(Constans.LabelDelegatedBy)) //approve by delegated { //find the original originalPoa = workflowHistoryDto.COMMENT.Substring( workflowHistoryDto.COMMENT.IndexOf(Constans.LabelDelegatedBy, System.StringComparison.Ordinal)); originalPoa = originalPoa.Replace(Constans.LabelDelegatedBy, ""); originalPoa = originalPoa.Replace("]", ""); } else { originalPoa = workflowHistoryDto.ACTION_BY; } } } //get delegated user var listUser = new List <string>(); listUser.Add(originalPoa); var poaDelegate = _poaDelegationServices.GetPoaDelegationToByPoaFromAndDate(originalPoa, DateTime.Now); listUser.AddRange(poaDelegate); if (originalPoa != createdUser) { //get delegate for created user too poaDelegate = _poaDelegationServices.GetPoaDelegationToByPoaFromAndDate(createdUser, DateTime.Now); listUser.AddRange(poaDelegate); } if (listUser.Contains(currentUserId)) { return(true); } } if (createdUser != currentUserId) { if ( !_poaDelegationServices.IsDelegatedUserByUserAndDate(createdUser, currentUserId, DateTime.Now)) { return(false); } } if (!(status == Enums.DocumentStatus.Draft || status == Enums.DocumentStatus.Rejected || status == Enums.DocumentStatus.WaitingGovApproval || status == Enums.DocumentStatus.Completed)) { return(false); } return(true); }
public List <MASTER_DATA_APPROVAL> GetByPageId(int pageId, Enums.DocumentStatus status = Enums.DocumentStatus.WaitingForMasterApprover) { return(_repository.Get(x => x.STATUS_ID == status && x.PAGE_ID == pageId, null, includeTables).ToList()); }