/// <summary> /// Returns a list of registered transaction types that are applicable based on the current context record and the limitations /// imposed by the agent and channel associated with the work session. /// </summary> /// <param name="session"></param> /// <param name="contextRecord"></param> /// <returns></returns> public IReadOnlyList <ITransactionType> GetAvaialbleTransactionTypes(IProcessExecutionContext executionContext, IWorkSession session, ITransactionContext transactionContext) { try { executionContext.Trace("Getting Transaction Types for context record type {0} and status {1}", transactionContext.RecordType, transactionContext.RecordStatus); var availableTransactions = RegisteredTransactionTypes .Where(t => session.SupportsChannel(t.AuthorizedChannels) && session.HasRole(t.AuthorizedRoles) && session.CanOperateAgainstCustomer(transactionContext.Customer) && transactionContext.IsContextType(t.EligibleContexts)) .OrderBy(t => t.Group.DisplayRank) .ThenBy(t => t.Group.Name) .ThenBy(t => t.DisplayRank) .ThenBy(t => t.Name) .ToList(); executionContext.Trace("Returning {0} eligible Transaction Types out of {1} registered Transaction Types", availableTransactions.Count, RegisteredTransactionTypes.Count); return(availableTransactions); } catch (Exception) { throw; } }
public bool CanWaive(IWorkSession workSession) { if (Requirement.AuthorizedWaiverRoles.Count > 0) { return(workSession.HasRole(Requirement.AuthorizedWaiverRoles)); } return(false); }