public ISellableInventoryItemState Get(InventoryItemId id, bool nullAllowed)
        {
            ISellableInventoryItemState state = CurrentSession.Get <SellableInventoryItemState> (id);

            if (!nullAllowed && state == null)
            {
                state = new SellableInventoryItemState();
                (state as SellableInventoryItemState).SellableInventoryItemId = id;
            }
            return(state);
        }
Ejemplo n.º 2
0
 public DtoSellableInventoryItemEntryStates(ISellableInventoryItemState outerState, IEnumerable <ISellableInventoryItemEntryState> innerStates)
 {
     this._outerState = outerState;
     if (innerStates == null)
     {
         this._innerStates = new ISellableInventoryItemEntryState[] { };
     }
     else
     {
         this._innerStates = innerStates;
     }
 }
        public void Save(ISellableInventoryItemState state)
        {
            ISellableInventoryItemState s = state;

            CurrentSession.SaveOrUpdate(s);

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Flush();
        }
        public async Task <ISellableInventoryItemState> GetAsync(InventoryItemId sellableInventoryItemId)
        {
            ISellableInventoryItemState state = null;
            var idObj         = SellableInventoryItemProxyUtils.ToIdString(sellableInventoryItemId);
            var uriParameters = new SellableInventoryItemUriParameters();

            uriParameters.Id = idObj;

            var req = new SellableInventoryItemGetRequest(uriParameters);

            var resp = await _ramlClient.SellableInventoryItem.Get(req);

            SellableInventoryItemProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToSellableInventoryItemState();
            return(state);
        }
		public ISellableInventoryItemState Get(InventoryItemId id)
		{
			ISellableInventoryItemState state = CurrentSession.Get<SellableInventoryItemState>(id);
			return state;
		}
Ejemplo n.º 6
0
 public SellableInventoryItemAggregate(ISellableInventoryItemState state)
 {
     _state = state;
 }
Ejemplo n.º 7
0
        protected virtual ISellableInventoryItemEntryStateCreated MapCreate(ICreateSellableInventoryItemEntry c, ISellableInventoryItemCommand outerCommand, long version, ISellableInventoryItemState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new SellableInventoryItemEntryEventId(c.SellableInventoryItemId, c.EntrySeqId, version);
            ISellableInventoryItemEntryStateCreated e = NewSellableInventoryItemEntryStateCreated(stateEventId);
            var s = outerState.Entries.Get(c.EntrySeqId, true);

            e.SellableQuantity = c.SellableQuantity;
            e.SourceEventId    = c.SourceEventId;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(ICreate... ////////////////////////////
Ejemplo n.º 8
0
        }// END ThrowOnInconsistentCommands /////////////////////

        protected virtual ISellableInventoryItemEntryEvent Map(ISellableInventoryItemEntryCommand c, ISellableInventoryItemCommand outerCommand, long version, ISellableInventoryItemState outerState)
        {
            var create = (c.CommandType == CommandType.Create) ? (c as ICreateSellableInventoryItemEntry) : null;

            if (create != null)
            {
                return(MapCreate(create, outerCommand, version, outerState));
            }

            throw new NotSupportedException();
        }
        protected bool IsRepeatedCommand(ISellableInventoryItemCommand command, IEventStoreAggregateId eventStoreAggregateId, ISellableInventoryItemState state)
        {
            bool repeated = false;

            if (((ISellableInventoryItemStateProperties)state).Version == command.AggregateVersion + 1)
            {
                if (state.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, ISellableInventoryItemAggregate aggregate, ISellableInventoryItemState state)
 {
     StateRepository.Save(state);
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <ISellableInventoryItemAggregate, ISellableInventoryItemState>(aggregate, state, aggregate.Changes));
     }
 }
 public abstract ISellableInventoryItemAggregate GetSellableInventoryItemAggregate(ISellableInventoryItemState state);
Ejemplo n.º 12
0
 public SellableInventoryItemEntryStates(ISellableInventoryItemState outerState)
 {
     this._sellableInventoryItemState = outerState;
     this._forReapplying = outerState.ForReapplying;
 }
Ejemplo n.º 13
0
 public SellableInventoryItemStateDtoWrapper(ISellableInventoryItemState state)
 {
     this._state = state;
 }
Ejemplo n.º 14
0
 public SellableInventoryItemStateDtoWrapper()
 {
     this._state = new SellableInventoryItemState();
 }
 public override ISellableInventoryItemAggregate GetSellableInventoryItemAggregate(ISellableInventoryItemState state)
 {
     return(new SellableInventoryItemAggregate(state));
 }