public override void SetStateClose()
 {
     base.SetStateClose();
     if (_strategy != null)
     {
         _strategy.SetStateClose();
     }
 }
        public void SetState(
            PlanReceiptOrderPersonalAccount entity,
            PlanReceiptOrderPersonalAccountState newState,
            Sense behavios = Sense.Falling)
        {
            switch (entity.State)
            {
            case PlanReceiptOrderPersonalAccountState.NotСonfirm:
                _state = new NotСonfirmState(entity, _repositoryFactory);
                break;

            case PlanReceiptOrderPersonalAccountState.Confirm:
                if (behavios == Sense.Emerge)
                {
                    _state = new СonfirmStateEmerge(entity, _repositoryFactory);
                }

                if (behavios == Sense.Falling)
                {
                    _state = new СonfirmStateFalling(entity, _repositoryFactory);
                }

                if (behavios == Sense.Full)
                {
                    _state = new СonfirmStateFalling(
                        entity,
                        _repositoryFactory,
                        new СonfirmStateEmerge(entity, _repositoryFactory));
                }
                break;

            case PlanReceiptOrderPersonalAccountState.Close:
                if (behavios == Sense.Emerge)
                {
                    _state = new СloseStateEmergy(entity, _repositoryFactory);
                }

                if (behavios == Sense.Falling)
                {
                    _state = new СloseStateFalling(entity, _repositoryFactory);
                }

                if (behavios == Sense.Full)
                {
                    _state = new СloseStateFalling(
                        entity,
                        _repositoryFactory,
                        new СloseStateEmergy(entity, _repositoryFactory));
                }
                break;

            default:
                throw new CheckingSetStatePlanReceiptOrderInvalidException(
                          Resource.PCOStateNotExist.StringFormat(entity.Rn));
            }

            switch (newState)
            {
            case PlanReceiptOrderPersonalAccountState.NotСonfirm:
                _state.SetStateNotConfirm();
                break;

            case PlanReceiptOrderPersonalAccountState.Confirm:
                _state.SetStateConfirm();
                break;

            case PlanReceiptOrderPersonalAccountState.Close:
                _state.SetStateClose();
                break;

            default:
                throw new CheckingSetStatePlanReceiptOrderInvalidException(
                          Resource.PCOStateNotExist.StringFormat(entity.Rn));
            }
        }