public IShipmentPackageContentMvoState Get(ShipmentPackageContentId id)
        {
            IShipmentPackageContentMvoState state = CurrentSession.Get <ShipmentPackageContentMvoState>(id);

            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IShipmentPackageContentMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
예제 #2
0
        public IShipmentPackageContentMvoState Get(ShipmentPackageContentId id, bool nullAllowed)
        {
            IShipmentPackageContentMvoState state = CurrentSession.Get <ShipmentPackageContentMvoState> (id);

            if (!nullAllowed && state == null)
            {
                state = new ShipmentPackageContentMvoState();
                (state as ShipmentPackageContentMvoState).ShipmentPackageContentId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IShipmentPackageContentMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
예제 #3
0
        public async Task <IShipmentPackageContentMvoState> GetAsync(ShipmentPackageContentId shipmentPackageContentId)
        {
            IShipmentPackageContentMvoState state = null;
            var idObj         = ShipmentPackageContentMvoProxyUtils.ToIdString(shipmentPackageContentId);
            var uriParameters = new ShipmentPackageContentMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new ShipmentPackageContentMvoGetRequest(uriParameters);

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

            ShipmentPackageContentMvoProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToShipmentPackageContentMvoState();
            return(state);
        }
예제 #4
0
        public void Save(IShipmentPackageContentMvoState state)
        {
            IShipmentPackageContentMvoState s = state;

            if (ReadOnlyProxyGenerator != null)
            {
                s = ReadOnlyProxyGenerator.GetTarget <IShipmentPackageContentMvoState>(state);
            }
            CurrentSession.SaveOrUpdate(s);

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Flush();
        }
 public ShipmentPackageContentMvoStateDtoWrapper(IShipmentPackageContentMvoState state)
 {
     this._state = state;
 }
 public ShipmentPackageContentMvoStateDtoWrapper()
 {
     this._state = new ShipmentPackageContentMvoState();
 }
        protected bool IsRepeatedCommand(IShipmentPackageContentMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IShipmentPackageContentMvoState state)
        {
            bool repeated = false;

            if (((IShipmentPackageContentMvoStateProperties)state).ShipmentPackageVersion > command.AggregateVersion)
            {
                var lastEvent = EventStore.GetEvent(typeof(IShipmentPackageContentMvoEvent), eventStoreAggregateId, command.AggregateVersion);
                if (lastEvent != null && lastEvent.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, IShipmentPackageContentMvoAggregate aggregate, IShipmentPackageContentMvoState state)
 {
     EventStore.AppendEvents(eventStoreAggregateId, ((IShipmentPackageContentMvoStateProperties)state).ShipmentPackageVersion, aggregate.Changes, () => { StateRepository.Save(state); });
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <IShipmentPackageContentMvoAggregate, IShipmentPackageContentMvoState>(aggregate, state, aggregate.Changes));
     }
 }
 public abstract IShipmentPackageContentMvoAggregate GetShipmentPackageContentMvoAggregate(IShipmentPackageContentMvoState state);
 public ShipmentPackageContentMvoAggregate(IShipmentPackageContentMvoState state)
 {
     _state = state;
 }
 public override IShipmentPackageContentMvoAggregate GetShipmentPackageContentMvoAggregate(IShipmentPackageContentMvoState state)
 {
     return(new ShipmentPackageContentMvoAggregate(state));
 }
        public static TMergePatchShipmentPackageContentMvo ToMergePatchShipmentPackageContentMvo <TMergePatchShipmentPackageContentMvo>(this IShipmentPackageContentMvoState state)
            where TMergePatchShipmentPackageContentMvo : IMergePatchShipmentPackageContentMvo, new()
        {
            var cmd = new TMergePatchShipmentPackageContentMvo();

            cmd.ShipmentPackageVersion = ((IShipmentPackageContentMvoStateProperties)state).ShipmentPackageVersion;

            cmd.ShipmentPackageContentId = state.ShipmentPackageContentId;
            cmd.Quantity           = state.Quantity;
            cmd.SubProductId       = state.SubProductId;
            cmd.SubProductQuantity = state.SubProductQuantity;
            cmd.Version            = ((IShipmentPackageContentMvoStateProperties)state).Version;
            cmd.Active             = ((IShipmentPackageContentMvoStateProperties)state).Active;
            cmd.ShipmentPackageShipmentBoxTypeId = state.ShipmentPackageShipmentBoxTypeId;
            cmd.ShipmentPackageDateCreated       = state.ShipmentPackageDateCreated;
            cmd.ShipmentPackageBoxLength         = state.ShipmentPackageBoxLength;
            cmd.ShipmentPackageBoxHeight         = state.ShipmentPackageBoxHeight;
            cmd.ShipmentPackageBoxWidth          = state.ShipmentPackageBoxWidth;
            cmd.ShipmentPackageDimensionUomId    = state.ShipmentPackageDimensionUomId;
            cmd.ShipmentPackageWeight            = state.ShipmentPackageWeight;
            cmd.ShipmentPackageWeightUomId       = state.ShipmentPackageWeightUomId;
            cmd.ShipmentPackageInsuredValue      = state.ShipmentPackageInsuredValue;
            cmd.ShipmentPackageCreatedBy         = state.ShipmentPackageCreatedBy;
            cmd.ShipmentPackageCreatedAt         = state.ShipmentPackageCreatedAt;
            cmd.ShipmentPackageUpdatedBy         = state.ShipmentPackageUpdatedBy;
            cmd.ShipmentPackageUpdatedAt         = state.ShipmentPackageUpdatedAt;
            cmd.ShipmentPackageActive            = state.ShipmentPackageActive;
            cmd.ShipmentPackageDeleted           = state.ShipmentPackageDeleted;

            if (state.Quantity == null)
            {
                cmd.IsPropertyQuantityRemoved = true;
            }
            if (state.SubProductId == null)
            {
                cmd.IsPropertySubProductIdRemoved = true;
            }
            if (state.SubProductQuantity == null)
            {
                cmd.IsPropertySubProductQuantityRemoved = true;
            }
            if (state.ShipmentPackageShipmentBoxTypeId == null)
            {
                cmd.IsPropertyShipmentPackageShipmentBoxTypeIdRemoved = true;
            }
            if (state.ShipmentPackageDateCreated == null)
            {
                cmd.IsPropertyShipmentPackageDateCreatedRemoved = true;
            }
            if (state.ShipmentPackageBoxLength == null)
            {
                cmd.IsPropertyShipmentPackageBoxLengthRemoved = true;
            }
            if (state.ShipmentPackageBoxHeight == null)
            {
                cmd.IsPropertyShipmentPackageBoxHeightRemoved = true;
            }
            if (state.ShipmentPackageBoxWidth == null)
            {
                cmd.IsPropertyShipmentPackageBoxWidthRemoved = true;
            }
            if (state.ShipmentPackageDimensionUomId == null)
            {
                cmd.IsPropertyShipmentPackageDimensionUomIdRemoved = true;
            }
            if (state.ShipmentPackageWeight == null)
            {
                cmd.IsPropertyShipmentPackageWeightRemoved = true;
            }
            if (state.ShipmentPackageWeightUomId == null)
            {
                cmd.IsPropertyShipmentPackageWeightUomIdRemoved = true;
            }
            if (state.ShipmentPackageInsuredValue == null)
            {
                cmd.IsPropertyShipmentPackageInsuredValueRemoved = true;
            }
            if (state.ShipmentPackageCreatedBy == null)
            {
                cmd.IsPropertyShipmentPackageCreatedByRemoved = true;
            }
            if (state.ShipmentPackageUpdatedBy == null)
            {
                cmd.IsPropertyShipmentPackageUpdatedByRemoved = true;
            }
            return(cmd);
        }
        public static TDeleteShipmentPackageContentMvo ToDeleteShipmentPackageContentMvo <TDeleteShipmentPackageContentMvo>(this IShipmentPackageContentMvoState state)
            where TDeleteShipmentPackageContentMvo : IDeleteShipmentPackageContentMvo, new()
        {
            var cmd = new TDeleteShipmentPackageContentMvo();

            cmd.ShipmentPackageContentId = state.ShipmentPackageContentId;
            cmd.ShipmentPackageVersion   = ((IShipmentPackageContentMvoStateProperties)state).ShipmentPackageVersion;

            return(cmd);
        }
        public static IShipmentPackageContentMvoCommand ToCreateOrMergePatchShipmentPackageContentMvo <TCreateShipmentPackageContentMvo, TMergePatchShipmentPackageContentMvo>(this IShipmentPackageContentMvoState state)
            where TCreateShipmentPackageContentMvo : ICreateShipmentPackageContentMvo, new()
            where TMergePatchShipmentPackageContentMvo : IMergePatchShipmentPackageContentMvo, new()
        {
            bool bUnsaved = ((IShipmentPackageContentMvoState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateShipmentPackageContentMvo <TCreateShipmentPackageContentMvo>());
            }
            else
            {
                return(state.ToMergePatchShipmentPackageContentMvo <TMergePatchShipmentPackageContentMvo>());
            }
        }
        public static TCreateShipmentPackageContentMvo ToCreateShipmentPackageContentMvo <TCreateShipmentPackageContentMvo>(this IShipmentPackageContentMvoState state)
            where TCreateShipmentPackageContentMvo : ICreateShipmentPackageContentMvo, new()
        {
            var cmd = new TCreateShipmentPackageContentMvo();

            cmd.ShipmentPackageVersion = ((IShipmentPackageContentMvoStateProperties)state).ShipmentPackageVersion;

            cmd.ShipmentPackageContentId = state.ShipmentPackageContentId;
            cmd.Quantity           = state.Quantity;
            cmd.SubProductId       = state.SubProductId;
            cmd.SubProductQuantity = state.SubProductQuantity;
            cmd.Version            = ((IShipmentPackageContentMvoStateProperties)state).Version;
            cmd.Active             = ((IShipmentPackageContentMvoStateProperties)state).Active;
            cmd.ShipmentPackageShipmentBoxTypeId = state.ShipmentPackageShipmentBoxTypeId;
            cmd.ShipmentPackageDateCreated       = state.ShipmentPackageDateCreated;
            cmd.ShipmentPackageBoxLength         = state.ShipmentPackageBoxLength;
            cmd.ShipmentPackageBoxHeight         = state.ShipmentPackageBoxHeight;
            cmd.ShipmentPackageBoxWidth          = state.ShipmentPackageBoxWidth;
            cmd.ShipmentPackageDimensionUomId    = state.ShipmentPackageDimensionUomId;
            cmd.ShipmentPackageWeight            = state.ShipmentPackageWeight;
            cmd.ShipmentPackageWeightUomId       = state.ShipmentPackageWeightUomId;
            cmd.ShipmentPackageInsuredValue      = state.ShipmentPackageInsuredValue;
            cmd.ShipmentPackageCreatedBy         = state.ShipmentPackageCreatedBy;
            cmd.ShipmentPackageCreatedAt         = state.ShipmentPackageCreatedAt;
            cmd.ShipmentPackageUpdatedBy         = state.ShipmentPackageUpdatedBy;
            cmd.ShipmentPackageUpdatedAt         = state.ShipmentPackageUpdatedAt;
            cmd.ShipmentPackageActive            = state.ShipmentPackageActive;
            cmd.ShipmentPackageDeleted           = state.ShipmentPackageDeleted;
            return(cmd);
        }