public IItemIssuanceMvoState Get(ShipmentItemIssuanceId id)
        {
            IItemIssuanceMvoState state = CurrentSession.Get <ItemIssuanceMvoState>(id);

            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IItemIssuanceMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
        public IItemIssuanceMvoState Get(ShipmentItemIssuanceId id, bool nullAllowed)
        {
            IItemIssuanceMvoState state = CurrentSession.Get <ItemIssuanceMvoState> (id);

            if (!nullAllowed && state == null)
            {
                state = new ItemIssuanceMvoState();
                (state as ItemIssuanceMvoState).ShipmentItemIssuanceId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IItemIssuanceMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
示例#3
0
        public async Task <IItemIssuanceMvoState> GetAsync(ShipmentItemIssuanceId shipmentItemIssuanceId)
        {
            IItemIssuanceMvoState state = null;
            var idObj         = ItemIssuanceMvoProxyUtils.ToIdString(shipmentItemIssuanceId);
            var uriParameters = new ItemIssuanceMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new ItemIssuanceMvoGetRequest(uriParameters);

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

            ItemIssuanceMvoProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToItemIssuanceMvoState();
            return(state);
        }
        public void Save(IItemIssuanceMvoState state)
        {
            IItemIssuanceMvoState s = state;

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

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Flush();
        }
示例#5
0
 public override IItemIssuanceMvoAggregate GetItemIssuanceMvoAggregate(IItemIssuanceMvoState state)
 {
     return(new ItemIssuanceMvoAggregate(state));
 }
        public static TDeleteItemIssuanceMvo ToDeleteItemIssuanceMvo <TDeleteItemIssuanceMvo>(this IItemIssuanceMvoState state)
            where TDeleteItemIssuanceMvo : IDeleteItemIssuanceMvo, new()
        {
            var cmd = new TDeleteItemIssuanceMvo();

            cmd.ShipmentItemIssuanceId = state.ShipmentItemIssuanceId;
            cmd.ShipmentVersion        = ((IItemIssuanceMvoStateProperties)state).ShipmentVersion;

            return(cmd);
        }
        public static TMergePatchItemIssuanceMvo ToMergePatchItemIssuanceMvo <TMergePatchItemIssuanceMvo>(this IItemIssuanceMvoState state)
            where TMergePatchItemIssuanceMvo : IMergePatchItemIssuanceMvo, new()
        {
            var cmd = new TMergePatchItemIssuanceMvo();

            cmd.ShipmentVersion = ((IItemIssuanceMvoStateProperties)state).ShipmentVersion;

            cmd.ShipmentItemIssuanceId = state.ShipmentItemIssuanceId;
            cmd.OrderId                = state.OrderId;
            cmd.OrderItemSeqId         = state.OrderItemSeqId;
            cmd.ShipGroupSeqId         = state.ShipGroupSeqId;
            cmd.ProductId              = state.ProductId;
            cmd.LocatorId              = state.LocatorId;
            cmd.AttributeSetInstanceId = state.AttributeSetInstanceId;
            cmd.ShipmentItemSeqId      = state.ShipmentItemSeqId;
            cmd.FixedAssetId           = state.FixedAssetId;
            cmd.MaintHistSeqId         = state.MaintHistSeqId;
            cmd.IssuedDateTime         = state.IssuedDateTime;
            cmd.IssuedByUserLoginId    = state.IssuedByUserLoginId;
            cmd.Quantity               = state.Quantity;
            cmd.CancelQuantity         = state.CancelQuantity;
            cmd.Version                = ((IItemIssuanceMvoStateProperties)state).Version;
            cmd.Active = ((IItemIssuanceMvoStateProperties)state).Active;
            cmd.ShipmentShipmentTypeId             = state.ShipmentShipmentTypeId;
            cmd.ShipmentStatusId                   = state.ShipmentStatusId;
            cmd.ShipmentPrimaryOrderId             = state.ShipmentPrimaryOrderId;
            cmd.ShipmentPrimaryReturnId            = state.ShipmentPrimaryReturnId;
            cmd.ShipmentPrimaryShipGroupSeqId      = state.ShipmentPrimaryShipGroupSeqId;
            cmd.ShipmentPicklistBinId              = state.ShipmentPicklistBinId;
            cmd.ShipmentEstimatedReadyDate         = state.ShipmentEstimatedReadyDate;
            cmd.ShipmentEstimatedShipDate          = state.ShipmentEstimatedShipDate;
            cmd.ShipmentEstimatedShipWorkEffId     = state.ShipmentEstimatedShipWorkEffId;
            cmd.ShipmentEstimatedArrivalDate       = state.ShipmentEstimatedArrivalDate;
            cmd.ShipmentEstimatedArrivalWorkEffId  = state.ShipmentEstimatedArrivalWorkEffId;
            cmd.ShipmentLatestCancelDate           = state.ShipmentLatestCancelDate;
            cmd.ShipmentEstimatedShipCost          = state.ShipmentEstimatedShipCost;
            cmd.ShipmentCurrencyUomId              = state.ShipmentCurrencyUomId;
            cmd.ShipmentHandlingInstructions       = state.ShipmentHandlingInstructions;
            cmd.ShipmentOriginFacilityId           = state.ShipmentOriginFacilityId;
            cmd.ShipmentDestinationFacilityId      = state.ShipmentDestinationFacilityId;
            cmd.ShipmentOriginContactMechId        = state.ShipmentOriginContactMechId;
            cmd.ShipmentOriginTelecomNumberId      = state.ShipmentOriginTelecomNumberId;
            cmd.ShipmentDestinationContactMechId   = state.ShipmentDestinationContactMechId;
            cmd.ShipmentDestinationTelecomNumberId = state.ShipmentDestinationTelecomNumberId;
            cmd.ShipmentPartyIdTo                  = state.ShipmentPartyIdTo;
            cmd.ShipmentPartyIdFrom                = state.ShipmentPartyIdFrom;
            cmd.ShipmentAdditionalShippingCharge   = state.ShipmentAdditionalShippingCharge;
            cmd.ShipmentAddtlShippingChargeDesc    = state.ShipmentAddtlShippingChargeDesc;
            cmd.ShipmentCreatedBy                  = state.ShipmentCreatedBy;
            cmd.ShipmentCreatedAt                  = state.ShipmentCreatedAt;
            cmd.ShipmentUpdatedBy                  = state.ShipmentUpdatedBy;
            cmd.ShipmentUpdatedAt                  = state.ShipmentUpdatedAt;
            cmd.ShipmentActive = state.ShipmentActive;

            if (state.OrderId == null)
            {
                cmd.IsPropertyOrderIdRemoved = true;
            }
            if (state.OrderItemSeqId == null)
            {
                cmd.IsPropertyOrderItemSeqIdRemoved = true;
            }
            if (state.ShipGroupSeqId == null)
            {
                cmd.IsPropertyShipGroupSeqIdRemoved = true;
            }
            if (state.ProductId == null)
            {
                cmd.IsPropertyProductIdRemoved = true;
            }
            if (state.LocatorId == null)
            {
                cmd.IsPropertyLocatorIdRemoved = true;
            }
            if (state.AttributeSetInstanceId == null)
            {
                cmd.IsPropertyAttributeSetInstanceIdRemoved = true;
            }
            if (state.ShipmentItemSeqId == null)
            {
                cmd.IsPropertyShipmentItemSeqIdRemoved = true;
            }
            if (state.FixedAssetId == null)
            {
                cmd.IsPropertyFixedAssetIdRemoved = true;
            }
            if (state.MaintHistSeqId == null)
            {
                cmd.IsPropertyMaintHistSeqIdRemoved = true;
            }
            if (state.IssuedDateTime == null)
            {
                cmd.IsPropertyIssuedDateTimeRemoved = true;
            }
            if (state.IssuedByUserLoginId == null)
            {
                cmd.IsPropertyIssuedByUserLoginIdRemoved = true;
            }
            if (state.Quantity == null)
            {
                cmd.IsPropertyQuantityRemoved = true;
            }
            if (state.CancelQuantity == null)
            {
                cmd.IsPropertyCancelQuantityRemoved = true;
            }
            if (state.ShipmentShipmentTypeId == null)
            {
                cmd.IsPropertyShipmentShipmentTypeIdRemoved = true;
            }
            if (state.ShipmentStatusId == null)
            {
                cmd.IsPropertyShipmentStatusIdRemoved = true;
            }
            if (state.ShipmentPrimaryOrderId == null)
            {
                cmd.IsPropertyShipmentPrimaryOrderIdRemoved = true;
            }
            if (state.ShipmentPrimaryReturnId == null)
            {
                cmd.IsPropertyShipmentPrimaryReturnIdRemoved = true;
            }
            if (state.ShipmentPrimaryShipGroupSeqId == null)
            {
                cmd.IsPropertyShipmentPrimaryShipGroupSeqIdRemoved = true;
            }
            if (state.ShipmentPicklistBinId == null)
            {
                cmd.IsPropertyShipmentPicklistBinIdRemoved = true;
            }
            if (state.ShipmentEstimatedReadyDate == null)
            {
                cmd.IsPropertyShipmentEstimatedReadyDateRemoved = true;
            }
            if (state.ShipmentEstimatedShipDate == null)
            {
                cmd.IsPropertyShipmentEstimatedShipDateRemoved = true;
            }
            if (state.ShipmentEstimatedShipWorkEffId == null)
            {
                cmd.IsPropertyShipmentEstimatedShipWorkEffIdRemoved = true;
            }
            if (state.ShipmentEstimatedArrivalDate == null)
            {
                cmd.IsPropertyShipmentEstimatedArrivalDateRemoved = true;
            }
            if (state.ShipmentEstimatedArrivalWorkEffId == null)
            {
                cmd.IsPropertyShipmentEstimatedArrivalWorkEffIdRemoved = true;
            }
            if (state.ShipmentLatestCancelDate == null)
            {
                cmd.IsPropertyShipmentLatestCancelDateRemoved = true;
            }
            if (state.ShipmentEstimatedShipCost == null)
            {
                cmd.IsPropertyShipmentEstimatedShipCostRemoved = true;
            }
            if (state.ShipmentCurrencyUomId == null)
            {
                cmd.IsPropertyShipmentCurrencyUomIdRemoved = true;
            }
            if (state.ShipmentHandlingInstructions == null)
            {
                cmd.IsPropertyShipmentHandlingInstructionsRemoved = true;
            }
            if (state.ShipmentOriginFacilityId == null)
            {
                cmd.IsPropertyShipmentOriginFacilityIdRemoved = true;
            }
            if (state.ShipmentDestinationFacilityId == null)
            {
                cmd.IsPropertyShipmentDestinationFacilityIdRemoved = true;
            }
            if (state.ShipmentOriginContactMechId == null)
            {
                cmd.IsPropertyShipmentOriginContactMechIdRemoved = true;
            }
            if (state.ShipmentOriginTelecomNumberId == null)
            {
                cmd.IsPropertyShipmentOriginTelecomNumberIdRemoved = true;
            }
            if (state.ShipmentDestinationContactMechId == null)
            {
                cmd.IsPropertyShipmentDestinationContactMechIdRemoved = true;
            }
            if (state.ShipmentDestinationTelecomNumberId == null)
            {
                cmd.IsPropertyShipmentDestinationTelecomNumberIdRemoved = true;
            }
            if (state.ShipmentPartyIdTo == null)
            {
                cmd.IsPropertyShipmentPartyIdToRemoved = true;
            }
            if (state.ShipmentPartyIdFrom == null)
            {
                cmd.IsPropertyShipmentPartyIdFromRemoved = true;
            }
            if (state.ShipmentAdditionalShippingCharge == null)
            {
                cmd.IsPropertyShipmentAdditionalShippingChargeRemoved = true;
            }
            if (state.ShipmentAddtlShippingChargeDesc == null)
            {
                cmd.IsPropertyShipmentAddtlShippingChargeDescRemoved = true;
            }
            if (state.ShipmentCreatedBy == null)
            {
                cmd.IsPropertyShipmentCreatedByRemoved = true;
            }
            if (state.ShipmentUpdatedBy == null)
            {
                cmd.IsPropertyShipmentUpdatedByRemoved = true;
            }
            return(cmd);
        }
        protected bool IsRepeatedCommand(IItemIssuanceMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IItemIssuanceMvoState state)
        {
            bool repeated = false;

            if (((IItemIssuanceMvoStateProperties)state).ShipmentVersion > command.AggregateVersion)
            {
                var lastEvent = EventStore.GetEvent(typeof(IItemIssuanceMvoEvent), eventStoreAggregateId, command.AggregateVersion);
                if (lastEvent != null && lastEvent.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
        public static IItemIssuanceMvoCommand ToCreateOrMergePatchItemIssuanceMvo <TCreateItemIssuanceMvo, TMergePatchItemIssuanceMvo>(this IItemIssuanceMvoState state)
            where TCreateItemIssuanceMvo : ICreateItemIssuanceMvo, new()
            where TMergePatchItemIssuanceMvo : IMergePatchItemIssuanceMvo, new()
        {
            bool bUnsaved = ((IItemIssuanceMvoState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateItemIssuanceMvo <TCreateItemIssuanceMvo>());
            }
            else
            {
                return(state.ToMergePatchItemIssuanceMvo <TMergePatchItemIssuanceMvo>());
            }
        }
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, IItemIssuanceMvoAggregate aggregate, IItemIssuanceMvoState state)
 {
     EventStore.AppendEvents(eventStoreAggregateId, ((IItemIssuanceMvoStateProperties)state).ShipmentVersion, aggregate.Changes, () => { StateRepository.Save(state); });
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <IItemIssuanceMvoAggregate, IItemIssuanceMvoState>(aggregate, state, aggregate.Changes));
     }
 }
 public abstract IItemIssuanceMvoAggregate GetItemIssuanceMvoAggregate(IItemIssuanceMvoState state);
示例#12
0
 public ItemIssuanceMvoAggregate(IItemIssuanceMvoState state)
 {
     _state = state;
 }
示例#13
0
 public ItemIssuanceMvoStateDtoWrapper(IItemIssuanceMvoState state)
 {
     this._state = state;
 }
示例#14
0
 public ItemIssuanceMvoStateDtoWrapper()
 {
     this._state = new ItemIssuanceMvoState();
 }