コード例 #1
0
        public new void SetStateClose()
        {
            Entity.PlanReceiptOrderPersonalAccounts.Where(x => x.State == PlanReceiptOrderPersonalAccountState.Confirm).DoForEach(
                x =>
            {
                var manager = new SetStateEntityManagerFactory <PlanReceiptOrderPersonalAccount, PlanReceiptOrderPersonalAccountState>(_repositoryFactory).Create();
                manager.SetState(x, PlanReceiptOrderPersonalAccountState.Close);
            });

            if (Entity.PlanReceiptOrderPersonalAccounts.Any(
                    x =>
                    x.State == PlanReceiptOrderPersonalAccountState.Confirm ||
                    x.State == PlanReceiptOrderPersonalAccountState.NotСonfirm))
            {
                return;
            }

            base.SetStateClose();
            if (_strategy != null)
            {
                _strategy.SetStateClose();
            }
        }
コード例 #2
0
        public new void SetStateClose()
        {
            if (Entity.PlanReceiptOrderPersonalAccounts.Any(
                    x =>
                    x.State == PlanReceiptOrderPersonalAccountState.NotСonfirm ||
                    x.State == PlanReceiptOrderPersonalAccountState.Confirm))
            {
                return;
            }

            if (Entity.State != PlanCertificateState.Close)
            {
                base.SetStateClose();
            }

            var manager = new SetStateEntityManagerFactory <PlanReceiptOrder, PlanReceiptOrderState>(_repositoryFactory).Create();

            manager.SetState(Entity.PlanReceiptOrder, PlanReceiptOrderState.Close, Sense.Emerge);

            if (_strategy != null)
            {
                _strategy.SetStateClose();
            }
        }
コード例 #3
0
        public void SetState(PlanCertificate entity, PlanCertificateState newState, Sense behavior = Sense.Falling)
        {
            switch (entity.State)
            {
            case PlanCertificateState.NotСonfirm:
                _state = new NotСonfirmState(entity, _repositoryFactory);
                break;

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

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

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

                break;

            case PlanCertificateState.Close:
                if (behavior == Sense.Emerge)
                {
                    _state = new СloseStateEmerge(entity, _repositoryFactory);
                }

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

                if (behavior == Sense.Full)
                {
                    _state = new СloseStateFalling(entity, _repositoryFactory, new СloseStateEmerge(entity, _repositoryFactory));
                }

                break;

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

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

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

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

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