public IPhysicalInventoryLineMvoState Get(PhysicalInventoryLineId id) { IPhysicalInventoryLineMvoState state = CurrentSession.Get <PhysicalInventoryLineMvoState>(id); if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IPhysicalInventoryLineMvoState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public IPhysicalInventoryLineMvoState Get(PhysicalInventoryLineId id, bool nullAllowed) { IPhysicalInventoryLineMvoState state = CurrentSession.Get <PhysicalInventoryLineMvoState> (id); if (!nullAllowed && state == null) { state = new PhysicalInventoryLineMvoState(); (state as PhysicalInventoryLineMvoState).PhysicalInventoryLineId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IPhysicalInventoryLineMvoState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public async Task <IPhysicalInventoryLineMvoState> GetAsync(PhysicalInventoryLineId physicalInventoryLineId) { IPhysicalInventoryLineMvoState state = null; var idObj = PhysicalInventoryLineMvoProxyUtils.ToIdString(physicalInventoryLineId); var uriParameters = new PhysicalInventoryLineMvoUriParameters(); uriParameters.Id = idObj; var req = new PhysicalInventoryLineMvoGetRequest(uriParameters); var resp = await _ramlClient.PhysicalInventoryLineMvo.Get(req); PhysicalInventoryLineMvoProxyUtils.ThrowOnHttpResponseError(resp); state = (resp.Content == null) ? null : resp.Content.ToPhysicalInventoryLineMvoState(); return(state); }
public void Save(IPhysicalInventoryLineMvoState state) { IPhysicalInventoryLineMvoState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IPhysicalInventoryLineMvoState>(state); } CurrentSession.SaveOrUpdate(s); var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Flush(); }
public PhysicalInventoryLineMvoAggregate(IPhysicalInventoryLineMvoState state) { _state = state; }
public static TMergePatchPhysicalInventoryLineMvo ToMergePatchPhysicalInventoryLineMvo <TMergePatchPhysicalInventoryLineMvo>(this IPhysicalInventoryLineMvoState state) where TMergePatchPhysicalInventoryLineMvo : IMergePatchPhysicalInventoryLineMvo, new() { var cmd = new TMergePatchPhysicalInventoryLineMvo(); cmd.PhysicalInventoryVersion = ((IPhysicalInventoryLineMvoStateProperties)state).PhysicalInventoryVersion; cmd.PhysicalInventoryLineId = state.PhysicalInventoryLineId; cmd.BookQuantity = state.BookQuantity; cmd.CountedQuantity = state.CountedQuantity; cmd.Processed = state.Processed; cmd.LineNumber = state.LineNumber; cmd.ReversalLineNumber = state.ReversalLineNumber; cmd.Description = state.Description; cmd.Version = ((IPhysicalInventoryLineMvoStateProperties)state).Version; cmd.PhysicalInventoryDocumentStatusId = state.PhysicalInventoryDocumentStatusId; cmd.PhysicalInventoryWarehouseId = state.PhysicalInventoryWarehouseId; cmd.PhysicalInventoryLocatorIdPattern = state.PhysicalInventoryLocatorIdPattern; cmd.PhysicalInventoryProductIdPattern = state.PhysicalInventoryProductIdPattern; cmd.PhysicalInventoryPosted = state.PhysicalInventoryPosted; cmd.PhysicalInventoryProcessed = state.PhysicalInventoryProcessed; cmd.PhysicalInventoryProcessing = state.PhysicalInventoryProcessing; cmd.PhysicalInventoryDocumentTypeId = state.PhysicalInventoryDocumentTypeId; cmd.PhysicalInventoryMovementDate = state.PhysicalInventoryMovementDate; cmd.PhysicalInventoryDescription = state.PhysicalInventoryDescription; cmd.PhysicalInventoryIsApproved = state.PhysicalInventoryIsApproved; cmd.PhysicalInventoryApprovalAmount = state.PhysicalInventoryApprovalAmount; cmd.PhysicalInventoryIsQuantityUpdated = state.PhysicalInventoryIsQuantityUpdated; cmd.PhysicalInventoryReversalDocumentNumber = state.PhysicalInventoryReversalDocumentNumber; cmd.PhysicalInventoryCreatedBy = state.PhysicalInventoryCreatedBy; cmd.PhysicalInventoryCreatedAt = state.PhysicalInventoryCreatedAt; cmd.PhysicalInventoryUpdatedBy = state.PhysicalInventoryUpdatedBy; cmd.PhysicalInventoryUpdatedAt = state.PhysicalInventoryUpdatedAt; cmd.PhysicalInventoryActive = state.PhysicalInventoryActive; if (state.LineNumber == null) { cmd.IsPropertyLineNumberRemoved = true; } if (state.Description == null) { cmd.IsPropertyDescriptionRemoved = true; } if (state.PhysicalInventoryDocumentStatusId == null) { cmd.IsPropertyPhysicalInventoryDocumentStatusIdRemoved = true; } if (state.PhysicalInventoryWarehouseId == null) { cmd.IsPropertyPhysicalInventoryWarehouseIdRemoved = true; } if (state.PhysicalInventoryLocatorIdPattern == null) { cmd.IsPropertyPhysicalInventoryLocatorIdPatternRemoved = true; } if (state.PhysicalInventoryProductIdPattern == null) { cmd.IsPropertyPhysicalInventoryProductIdPatternRemoved = true; } if (state.PhysicalInventoryProcessing == null) { cmd.IsPropertyPhysicalInventoryProcessingRemoved = true; } if (state.PhysicalInventoryDocumentTypeId == null) { cmd.IsPropertyPhysicalInventoryDocumentTypeIdRemoved = true; } if (state.PhysicalInventoryMovementDate == null) { cmd.IsPropertyPhysicalInventoryMovementDateRemoved = true; } if (state.PhysicalInventoryDescription == null) { cmd.IsPropertyPhysicalInventoryDescriptionRemoved = true; } if (state.PhysicalInventoryReversalDocumentNumber == null) { cmd.IsPropertyPhysicalInventoryReversalDocumentNumberRemoved = true; } if (state.PhysicalInventoryCreatedBy == null) { cmd.IsPropertyPhysicalInventoryCreatedByRemoved = true; } if (state.PhysicalInventoryUpdatedBy == null) { cmd.IsPropertyPhysicalInventoryUpdatedByRemoved = true; } return(cmd); }
public static TDeletePhysicalInventoryLineMvo ToDeletePhysicalInventoryLineMvo <TDeletePhysicalInventoryLineMvo>(this IPhysicalInventoryLineMvoState state) where TDeletePhysicalInventoryLineMvo : IDeletePhysicalInventoryLineMvo, new() { var cmd = new TDeletePhysicalInventoryLineMvo(); cmd.PhysicalInventoryLineId = state.PhysicalInventoryLineId; cmd.PhysicalInventoryVersion = ((IPhysicalInventoryLineMvoStateProperties)state).PhysicalInventoryVersion; return(cmd); }
public static IPhysicalInventoryLineMvoCommand ToCreateOrMergePatchPhysicalInventoryLineMvo <TCreatePhysicalInventoryLineMvo, TMergePatchPhysicalInventoryLineMvo>(this IPhysicalInventoryLineMvoState state) where TCreatePhysicalInventoryLineMvo : ICreatePhysicalInventoryLineMvo, new() where TMergePatchPhysicalInventoryLineMvo : IMergePatchPhysicalInventoryLineMvo, new() { bool bUnsaved = ((IPhysicalInventoryLineMvoState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreatePhysicalInventoryLineMvo <TCreatePhysicalInventoryLineMvo>()); } else { return(state.ToMergePatchPhysicalInventoryLineMvo <TMergePatchPhysicalInventoryLineMvo>()); } }
public PhysicalInventoryLineMvoStateDtoWrapper(IPhysicalInventoryLineMvoState state) { this._state = state; }
public PhysicalInventoryLineMvoStateDtoWrapper() { this._state = new PhysicalInventoryLineMvoState(); }
public override IPhysicalInventoryLineMvoAggregate GetPhysicalInventoryLineMvoAggregate(IPhysicalInventoryLineMvoState state) { return(new PhysicalInventoryLineMvoAggregate(state)); }
protected bool IsRepeatedCommand(IPhysicalInventoryLineMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IPhysicalInventoryLineMvoState state) { bool repeated = false; if (((IPhysicalInventoryLineMvoStateProperties)state).PhysicalInventoryVersion > command.AggregateVersion) { var lastEvent = EventStore.GetEvent(typeof(IPhysicalInventoryLineMvoEvent), eventStoreAggregateId, command.AggregateVersion); if (lastEvent != null && lastEvent.CommandId == command.CommandId) { repeated = true; } } return(repeated); }
private void Persist(IEventStoreAggregateId eventStoreAggregateId, IPhysicalInventoryLineMvoAggregate aggregate, IPhysicalInventoryLineMvoState state) { EventStore.AppendEvents(eventStoreAggregateId, ((IPhysicalInventoryLineMvoStateProperties)state).PhysicalInventoryVersion, aggregate.Changes, () => { StateRepository.Save(state); }); if (AggregateEventListener != null) { AggregateEventListener.EventAppended(new AggregateEvent <IPhysicalInventoryLineMvoAggregate, IPhysicalInventoryLineMvoState>(aggregate, state, aggregate.Changes)); } }
public abstract IPhysicalInventoryLineMvoAggregate GetPhysicalInventoryLineMvoAggregate(IPhysicalInventoryLineMvoState state);