//TODO Вынести имперсонацию отсюда
 public bool IsAllowedToExecuteCommand(Guid instanceUid, WorkflowCommandType commandType)
 {
     return(IsAllowedToExecuteCommand(instanceUid, new List <WorkflowCommandType>(1)
     {
         commandType
     }).Count(ctx => ctx == commandType) == 1);
 }
        public bool IsCommandSupportsInState(WorkflowState state, WorkflowCommandType commandType, Guid instanceId)
        {
            if (state == null)
            {
                if (commandType == WorkflowCommandType.StartProcessing)
                    return true;
                return false;
            }

            if (state.Type != WorkflowType.DemandAdjustmentWorkflow)
                return false;

            if (commandType == WorkflowCommandType.PostingAccounting || commandType == WorkflowCommandType.DenialByTechnicalCauses)
                return false;

            if ((state == WorkflowState.DemandAdjustmentAgreed) || (state == WorkflowState.DemandAdjustmentArchived))
                return false;

            if (commandType == WorkflowCommandType.StartProcessing && state == WorkflowState.DemandAdjustmentDraft)
                return true;

            if ((commandType == WorkflowCommandType.Sighting || commandType == WorkflowCommandType.Denial) && state != WorkflowState.DemandAdjustmentDraft)
                return true;

            return false;
        }
        public bool IsAllowedToExecuteCommand(IEnumerable<Guid> instanceIds, WorkflowCommandType commandType)
        {
            //STUB Сюда добавится еще и масс согласование заявок
            if (commandType != WorkflowCommandType.Export)
                return false;

            if (SecurityEntityService.CheckTrusteeWithIdIsInRole(AuthenticationService.GetCurrentIdentity().Id,BudgetRole.Accountant))
                return true;
            return false;
        }
Exemplo n.º 4
0
        public bool IsCommandSupportsInState(WorkflowState state, WorkflowCommandType commandType, Guid instanceId)
        {
            if (state == null)
            {
                if (commandType == WorkflowCommandType.StartProcessing)
                {
                    return(true);
                }
                return(false);
            }

            if (state.Type != WorkflowType.DemandWorkflow)
            {
                return(false);
            }


            if ((commandType == WorkflowCommandType.Sighting) &&
                ((state == WorkflowState.DemandInitiatorHeadSighting) ||
                 (state == WorkflowState.DemandOPExpertSighting) ||
                 (state == WorkflowState.DemandOPHeadSighting) ||
                 (state == WorkflowState.DemandUPKZCuratorSighting) ||
                 (state == WorkflowState.DemandUPKZHeadSighting) ||
                 //(state == WorkflowState.DemandAgreementInitiatorHeadSighting) ||
                 //(state == WorkflowState.DemandAgreementOPHeadSighting) ||
                 (state == WorkflowState.DemandAgreementOPExpertSighting) || (state == WorkflowState.DemandRollbackRequested)
                )
                )
            {
                return(true);
            }

            if ((commandType == WorkflowCommandType.Denial) &&
                ((state == WorkflowState.DemandInitiatorHeadSighting) ||
                 (state == WorkflowState.DemandOPExpertSighting) ||
                 (state == WorkflowState.DemandOPHeadSighting) ||
                 (state == WorkflowState.DemandUPKZCuratorSighting) ||
                 (state == WorkflowState.DemandUPKZHeadSighting) ||
                 //(state == WorkflowState.DemandAgreementInitiatorHeadSighting) ||
                 // (state == WorkflowState.DemandAgreementOPHeadSighting) ||
                 (state == WorkflowState.DemandAgreementOPExpertSighting) || (state == WorkflowState.DemandRollbackRequested)
                )
                )
            {
                return(true);
            }
            if ((commandType == WorkflowCommandType.StartProcessing) && (state == WorkflowState.DemandDraft))
            {
                return(true);
            }

            return(false);
        }
        public bool IsAllowedToExecuteCommand(IEnumerable <Guid> instanceIds, WorkflowCommandType commandType)
        {
            //STUB Сюда добавится еще и масс согласование заявок
            if (commandType != WorkflowCommandType.Export)
            {
                return(false);
            }

            if (SecurityEntityService.CheckTrusteeWithIdIsInRole(AuthenticationService.GetCurrentIdentity().Id, BudgetRole.Accountant))
            {
                return(true);
            }
            return(false);
        }
        public bool IsCommandSupportsInState(WorkflowState state, WorkflowCommandType commandType, Guid instanceId)
        {
            if (state == null)
            {
                if (commandType == WorkflowCommandType.StartProcessing)
                    return true;
                return false;
            }

            if (state.Type != WorkflowType.DemandWorkflow)
                return false;

            
            if ((commandType == WorkflowCommandType.Sighting) &&
                ((state == WorkflowState.DemandInitiatorHeadSighting) ||
                 (state == WorkflowState.DemandOPExpertSighting) ||
                 (state == WorkflowState.DemandOPHeadSighting) ||
                 (state == WorkflowState.DemandUPKZCuratorSighting) ||
                 (state == WorkflowState.DemandUPKZHeadSighting) ||
                 //(state == WorkflowState.DemandAgreementInitiatorHeadSighting) ||
                 //(state == WorkflowState.DemandAgreementOPHeadSighting) ||
                 (state == WorkflowState.DemandAgreementOPExpertSighting) || (state == WorkflowState.DemandRollbackRequested) 
                )
                )
                return true;

            if ((commandType == WorkflowCommandType.Denial) &&
               ((state == WorkflowState.DemandInitiatorHeadSighting) ||
                (state == WorkflowState.DemandOPExpertSighting) ||
                (state == WorkflowState.DemandOPHeadSighting) ||
                (state == WorkflowState.DemandUPKZCuratorSighting) ||
                (state == WorkflowState.DemandUPKZHeadSighting) ||
                //(state == WorkflowState.DemandAgreementInitiatorHeadSighting) ||
                // (state == WorkflowState.DemandAgreementOPHeadSighting) ||
                 (state == WorkflowState.DemandAgreementOPExpertSighting) || (state == WorkflowState.DemandRollbackRequested) 
               )
               )
                return true;
            if ((commandType == WorkflowCommandType.StartProcessing) && (state == WorkflowState.DemandDraft))
                return true;

            return false;
        }
        public bool IsCommandSupportsInState(WorkflowState state, WorkflowCommandType commandType, Guid instanceId)
        {
            if (state == null)
            {
                if (commandType == WorkflowCommandType.StartProcessing)
                {
                    return(true);
                }
                return(false);
            }

            if (state.Type != WorkflowType.DemandAdjustmentWorkflow)
            {
                return(false);
            }

            if (commandType == WorkflowCommandType.PostingAccounting || commandType == WorkflowCommandType.DenialByTechnicalCauses)
            {
                return(false);
            }

            if ((state == WorkflowState.DemandAdjustmentAgreed) || (state == WorkflowState.DemandAdjustmentArchived))
            {
                return(false);
            }

            if (commandType == WorkflowCommandType.StartProcessing && state == WorkflowState.DemandAdjustmentDraft)
            {
                return(true);
            }

            if ((commandType == WorkflowCommandType.Sighting || commandType == WorkflowCommandType.Denial) && state != WorkflowState.DemandAdjustmentDraft)
            {
                return(true);
            }

            return(false);
        }
        public bool IsCommandSupportsInState(WorkflowState state, WorkflowCommandType commandType, Guid instanceId)
        {
            if (state == null)
            {
                if (commandType == WorkflowCommandType.StartProcessing)
                    return true;
                return false;
            }

            if (state.Type != WorkflowType.BillDemandWorkfow)
                return false;

            if ((commandType == WorkflowCommandType.Sighting) &&
                ((state == WorkflowState.BillDemandUPKZCuratorSighting) ||
                 (state == WorkflowState.BillLimitManagerSighting) ||
                 (state == WorkflowState.BillDemandUPKZCntrollerSighting) ||
                 (state == WorkflowState.BillDemandLimitExecutorSighting) ||
                 (state == WorkflowState.BillDemandUPKZHeadSighting) ||
                 (state == WorkflowState.BillDemandHeadInitiatorSighting)
                )
                )
                return true;

            if (((commandType == WorkflowCommandType.Denial) ||
                 (commandType == WorkflowCommandType.DenialByTechnicalCauses)) &&
                (
                    (state == WorkflowState.BillDemandUPKZCuratorSighting) ||
                    (state == WorkflowState.BillLimitManagerSighting) ||
                    (state == WorkflowState.BillDemandLimitExecutorSighting) ||
                     (state == WorkflowState.BillDemandUPKZHeadSighting) ||
                     (state == WorkflowState.BillDemandHeadInitiatorSighting))
                )
                return true;

            if ((commandType == WorkflowCommandType.Denial) &&
                ((state == WorkflowState.BillDemandPostingAccounting) ||
                 (state == WorkflowState.BillDemandUPKZCntrollerSighting) ||
                 (state == WorkflowState.BillDemandDraftForTechnicalDenial)))
                return true;

            if ((commandType == WorkflowCommandType.PostingAccounting) &&
                (state == WorkflowState.BillDemandPostingAccounting))
                return true;

            if ((commandType == WorkflowCommandType.Export) && (state == WorkflowState.BillDemandInAccountingWithExport) && BillDemandBuinessService.IsBillDemandFilialSupportsExport(instanceId))
                return true;

            if ((commandType == WorkflowCommandType.SetPaidStatus || commandType == WorkflowCommandType.SetDenialStatus) && (state == WorkflowState.BillDemandInAccountingWithExport))
                return true;

            if ((commandType == WorkflowCommandType.SetPaidStatus || commandType == WorkflowCommandType.Denial) && state == WorkflowState.BillDemandInitiatorConfirmation)
                return true;

            if ((commandType == WorkflowCommandType.StartProcessing) && (state == WorkflowState.BillDemandDraft || state == WorkflowState.BillDemandDraftForTechnicalDenial))
                return true;

            if (commandType == WorkflowCommandType.CheckStatus && state == WorkflowState.BillDemandOnPayment)
                return true;

            return false;
        }
Exemplo n.º 9
0
        public bool IsCommandSupportsInState(WorkflowState state, WorkflowCommandType commandType, Guid instanceId)
        {
            if (state == null)
            {
                if (commandType == WorkflowCommandType.StartProcessing)
                {
                    return(true);
                }
                return(false);
            }

            if (state.Type != WorkflowType.BillDemandWorkfow)
            {
                return(false);
            }

            if ((commandType == WorkflowCommandType.Sighting) &&
                ((state == WorkflowState.BillDemandUPKZCuratorSighting) ||
                 (state == WorkflowState.BillLimitManagerSighting) ||
                 (state == WorkflowState.BillDemandUPKZCntrollerSighting) ||
                 (state == WorkflowState.BillDemandLimitExecutorSighting) ||
                 (state == WorkflowState.BillDemandUPKZHeadSighting) ||
                 (state == WorkflowState.BillDemandHeadInitiatorSighting)
                )
                )
            {
                return(true);
            }

            if (((commandType == WorkflowCommandType.Denial) ||
                 (commandType == WorkflowCommandType.DenialByTechnicalCauses)) &&
                (
                    (state == WorkflowState.BillDemandUPKZCuratorSighting) ||
                    (state == WorkflowState.BillLimitManagerSighting) ||
                    (state == WorkflowState.BillDemandLimitExecutorSighting) ||
                    (state == WorkflowState.BillDemandUPKZHeadSighting) ||
                    (state == WorkflowState.BillDemandHeadInitiatorSighting))
                )
            {
                return(true);
            }

            if ((commandType == WorkflowCommandType.Denial) &&
                ((state == WorkflowState.BillDemandPostingAccounting) ||
                 (state == WorkflowState.BillDemandUPKZCntrollerSighting) ||
                 (state == WorkflowState.BillDemandDraftForTechnicalDenial)))
            {
                return(true);
            }

            if ((commandType == WorkflowCommandType.PostingAccounting) &&
                (state == WorkflowState.BillDemandPostingAccounting))
            {
                return(true);
            }

            if ((commandType == WorkflowCommandType.Export) && (state == WorkflowState.BillDemandInAccountingWithExport) && BillDemandBuinessService.IsBillDemandFilialSupportsExport(instanceId))
            {
                return(true);
            }

            if ((commandType == WorkflowCommandType.SetPaidStatus || commandType == WorkflowCommandType.SetDenialStatus) && (state == WorkflowState.BillDemandInAccountingWithExport))
            {
                return(true);
            }

            if ((commandType == WorkflowCommandType.SetPaidStatus || commandType == WorkflowCommandType.Denial) && state == WorkflowState.BillDemandInitiatorConfirmation)
            {
                return(true);
            }

            if ((commandType == WorkflowCommandType.StartProcessing) && (state == WorkflowState.BillDemandDraft || state == WorkflowState.BillDemandDraftForTechnicalDenial))
            {
                return(true);
            }

            if (commandType == WorkflowCommandType.CheckStatus && state == WorkflowState.BillDemandOnPayment)
            {
                return(true);
            }

            return(false);
        }
 //TODO Вынести имперсонацию отсюда
 public bool IsAllowedToExecuteCommand(Guid instanceUid, WorkflowCommandType commandType)
 {
     return IsAllowedToExecuteCommand(instanceUid, new List<WorkflowCommandType>(1) {commandType}).Count(ctx=>ctx == commandType) == 1;
 }