public IInventoryItemEntryState Get(InventoryItemEntryId id, bool nullAllowed) { IInventoryItemEntryState state = CurrentSession.Get <InventoryItemEntryState>(id); if (!nullAllowed && state == null) { state = new InventoryItemEntryState(); (state as InventoryItemEntryState).InventoryItemEntryId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IInventoryItemEntryState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public void Delete(IInventoryItemEntryState state) { IInventoryItemEntryState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IInventoryItemEntryState>(state); } var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Delete(s); }
public virtual void When(IInventoryItemStateCreated e) { ThrowOnWrongEvent(e); this.OnHandQuantity = (e.OnHandQuantity != null && e.OnHandQuantity.HasValue) ? e.OnHandQuantity.Value : default(decimal); this.InTransitQuantity = (e.InTransitQuantity != null && e.InTransitQuantity.HasValue) ? e.InTransitQuantity.Value : default(decimal); this.ReservedQuantity = (e.ReservedQuantity != null && e.ReservedQuantity.HasValue) ? e.ReservedQuantity.Value : default(decimal); this.OccupiedQuantity = (e.OccupiedQuantity != null && e.OccupiedQuantity.HasValue) ? e.OccupiedQuantity.Value : default(decimal); this.VirtualQuantity = (e.VirtualQuantity != null && e.VirtualQuantity.HasValue) ? e.VirtualQuantity.Value : default(decimal); this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; foreach (IInventoryItemEntryStateCreated innerEvent in e.InventoryItemEntryEvents) { IInventoryItemEntryState innerState = this.Entries.Get(innerEvent.GlobalId.EntrySeqId, true); innerState.Mutate(innerEvent); } }
public virtual void When(IInventoryItemStateMergePatched e) { ThrowOnWrongEvent(e); if (e.OnHandQuantity == null) { if (e.IsPropertyOnHandQuantityRemoved) { this.OnHandQuantity = default(decimal); } } else { this.OnHandQuantity = (e.OnHandQuantity != null && e.OnHandQuantity.HasValue) ? e.OnHandQuantity.Value : default(decimal); } if (e.InTransitQuantity == null) { if (e.IsPropertyInTransitQuantityRemoved) { this.InTransitQuantity = default(decimal); } } else { this.InTransitQuantity = (e.InTransitQuantity != null && e.InTransitQuantity.HasValue) ? e.InTransitQuantity.Value : default(decimal); } if (e.ReservedQuantity == null) { if (e.IsPropertyReservedQuantityRemoved) { this.ReservedQuantity = default(decimal); } } else { this.ReservedQuantity = (e.ReservedQuantity != null && e.ReservedQuantity.HasValue) ? e.ReservedQuantity.Value : default(decimal); } if (e.OccupiedQuantity == null) { if (e.IsPropertyOccupiedQuantityRemoved) { this.OccupiedQuantity = default(decimal); } } else { this.OccupiedQuantity = (e.OccupiedQuantity != null && e.OccupiedQuantity.HasValue) ? e.OccupiedQuantity.Value : default(decimal); } if (e.VirtualQuantity == null) { if (e.IsPropertyVirtualQuantityRemoved) { this.VirtualQuantity = default(decimal); } } else { this.VirtualQuantity = (e.VirtualQuantity != null && e.VirtualQuantity.HasValue) ? e.VirtualQuantity.Value : default(decimal); } this.UpdatedBy = e.CreatedBy; this.UpdatedAt = e.CreatedAt; foreach (IInventoryItemEntryEvent innerEvent in e.InventoryItemEntryEvents) { IInventoryItemEntryState innerState = this.Entries.Get(innerEvent.GlobalId.EntrySeqId); innerState.Mutate(innerEvent); } }
public virtual void Remove(IInventoryItemEntryState state) { this._removedInventoryItemEntryStates.Add(state.GlobalId, state); }
public virtual void AddToSave(IInventoryItemEntryState state) { this._loadedInventoryItemEntryStates[state.GlobalId] = state; }
public InventoryItemEntryStateDtoWrapper(IInventoryItemEntryState state) { this._state = state; }
public InventoryItemEntryStateDtoWrapper() { this._state = new InventoryItemEntryState(); }
public void AddToSave(IInventoryItemEntryState state) { throw new NotSupportedException(); }