private bool CanExecuteOperation(ProtocollingOperations.ProtocollingOperation op, EntityRef orderRef)
        {
            if (orderRef == null)
            {
                return(false);
            }

            var order = this.PersistenceContext.Load <Order>(orderRef);

            return(op.CanExecute(order, this.CurrentUserStaff));
        }
        private bool CanExecuteOperation <T>(ProtocollingOperations.ProtocollingOperation op, EntityRef procedureStepRef)
            where T : ProtocolProcedureStep
        {
            // if there is no proc step ref, operation is not available
            if (procedureStepRef == null)
            {
                return(false);
            }

            var step = this.PersistenceContext.Load <ProcedureStep>(procedureStepRef);

            if (!step.Is <T>())
            {
                return(false);
            }

            return(op.CanExecute(step.As <T>(), this.CurrentUserStaff));
        }