コード例 #1
0
        public IShipmentReceiptMvoState Get(ShipmentReceiptId id)
        {
            IShipmentReceiptMvoState state = CurrentSession.Get <ShipmentReceiptMvoState>(id);

            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IShipmentReceiptMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
コード例 #2
0
        public IShipmentReceiptMvoState Get(ShipmentReceiptId id, bool nullAllowed)
        {
            IShipmentReceiptMvoState state = CurrentSession.Get <ShipmentReceiptMvoState> (id);

            if (!nullAllowed && state == null)
            {
                state = new ShipmentReceiptMvoState();
                (state as ShipmentReceiptMvoState).ShipmentReceiptId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IShipmentReceiptMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
コード例 #3
0
        public async Task <IShipmentReceiptMvoState> GetAsync(ShipmentReceiptId shipmentReceiptId)
        {
            IShipmentReceiptMvoState state = null;
            var idObj         = ShipmentReceiptMvoProxyUtils.ToIdString(shipmentReceiptId);
            var uriParameters = new ShipmentReceiptMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new ShipmentReceiptMvoGetRequest(uriParameters);

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

            ShipmentReceiptMvoProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToShipmentReceiptMvoState();
            return(state);
        }
コード例 #4
0
        public void Save(IShipmentReceiptMvoState state)
        {
            IShipmentReceiptMvoState s = state;

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

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Flush();
        }
コード例 #5
0
        public static TMergePatchShipmentReceiptMvo ToMergePatchShipmentReceiptMvo <TMergePatchShipmentReceiptMvo>(this IShipmentReceiptMvoState state)
            where TMergePatchShipmentReceiptMvo : IMergePatchShipmentReceiptMvo, new()
        {
            var cmd = new TMergePatchShipmentReceiptMvo();

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

            cmd.ShipmentReceiptId      = state.ShipmentReceiptId;
            cmd.ProductId              = state.ProductId;
            cmd.AttributeSetInstanceId = state.AttributeSetInstanceId;
            cmd.LocatorId              = state.LocatorId;
            cmd.ShipmentItemSeqId      = state.ShipmentItemSeqId;
            cmd.ShipmentPackageSeqId   = state.ShipmentPackageSeqId;
            cmd.OrderId                            = state.OrderId;
            cmd.OrderItemSeqId                     = state.OrderItemSeqId;
            cmd.ReturnId                           = state.ReturnId;
            cmd.ReturnItemSeqId                    = state.ReturnItemSeqId;
            cmd.RejectionReasonId                  = state.RejectionReasonId;
            cmd.DamageStatusId                     = state.DamageStatusId;
            cmd.DamageReasonId                     = state.DamageReasonId;
            cmd.ReceivedBy                         = state.ReceivedBy;
            cmd.DatetimeReceived                   = state.DatetimeReceived;
            cmd.ItemDescription                    = state.ItemDescription;
            cmd.AcceptedQuantity                   = state.AcceptedQuantity;
            cmd.RejectedQuantity                   = state.RejectedQuantity;
            cmd.DamagedQuantity                    = state.DamagedQuantity;
            cmd.Version                            = ((IShipmentReceiptMvoStateProperties)state).Version;
            cmd.Active                             = ((IShipmentReceiptMvoStateProperties)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.ProductId == null)
            {
                cmd.IsPropertyProductIdRemoved = true;
            }
            if (state.AttributeSetInstanceId == null)
            {
                cmd.IsPropertyAttributeSetInstanceIdRemoved = true;
            }
            if (state.LocatorId == null)
            {
                cmd.IsPropertyLocatorIdRemoved = true;
            }
            if (state.ShipmentItemSeqId == null)
            {
                cmd.IsPropertyShipmentItemSeqIdRemoved = true;
            }
            if (state.ShipmentPackageSeqId == null)
            {
                cmd.IsPropertyShipmentPackageSeqIdRemoved = true;
            }
            if (state.OrderId == null)
            {
                cmd.IsPropertyOrderIdRemoved = true;
            }
            if (state.OrderItemSeqId == null)
            {
                cmd.IsPropertyOrderItemSeqIdRemoved = true;
            }
            if (state.ReturnId == null)
            {
                cmd.IsPropertyReturnIdRemoved = true;
            }
            if (state.ReturnItemSeqId == null)
            {
                cmd.IsPropertyReturnItemSeqIdRemoved = true;
            }
            if (state.RejectionReasonId == null)
            {
                cmd.IsPropertyRejectionReasonIdRemoved = true;
            }
            if (state.DamageStatusId == null)
            {
                cmd.IsPropertyDamageStatusIdRemoved = true;
            }
            if (state.DamageReasonId == null)
            {
                cmd.IsPropertyDamageReasonIdRemoved = true;
            }
            if (state.ReceivedBy == null)
            {
                cmd.IsPropertyReceivedByRemoved = true;
            }
            if (state.DatetimeReceived == null)
            {
                cmd.IsPropertyDatetimeReceivedRemoved = true;
            }
            if (state.ItemDescription == null)
            {
                cmd.IsPropertyItemDescriptionRemoved = true;
            }
            if (state.AcceptedQuantity == null)
            {
                cmd.IsPropertyAcceptedQuantityRemoved = true;
            }
            if (state.RejectedQuantity == null)
            {
                cmd.IsPropertyRejectedQuantityRemoved = true;
            }
            if (state.DamagedQuantity == null)
            {
                cmd.IsPropertyDamagedQuantityRemoved = 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);
        }
コード例 #6
0
        public static TDeleteShipmentReceiptMvo ToDeleteShipmentReceiptMvo <TDeleteShipmentReceiptMvo>(this IShipmentReceiptMvoState state)
            where TDeleteShipmentReceiptMvo : IDeleteShipmentReceiptMvo, new()
        {
            var cmd = new TDeleteShipmentReceiptMvo();

            cmd.ShipmentReceiptId = state.ShipmentReceiptId;
            cmd.ShipmentVersion   = ((IShipmentReceiptMvoStateProperties)state).ShipmentVersion;

            return(cmd);
        }
コード例 #7
0
        public static IShipmentReceiptMvoCommand ToCreateOrMergePatchShipmentReceiptMvo <TCreateShipmentReceiptMvo, TMergePatchShipmentReceiptMvo>(this IShipmentReceiptMvoState state)
            where TCreateShipmentReceiptMvo : ICreateShipmentReceiptMvo, new()
            where TMergePatchShipmentReceiptMvo : IMergePatchShipmentReceiptMvo, new()
        {
            bool bUnsaved = ((IShipmentReceiptMvoState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateShipmentReceiptMvo <TCreateShipmentReceiptMvo>());
            }
            else
            {
                return(state.ToMergePatchShipmentReceiptMvo <TMergePatchShipmentReceiptMvo>());
            }
        }
コード例 #8
0
 public ShipmentReceiptMvoStateDtoWrapper(IShipmentReceiptMvoState state)
 {
     this._state = state;
 }
コード例 #9
0
 public ShipmentReceiptMvoStateDtoWrapper()
 {
     this._state = new ShipmentReceiptMvoState();
 }
コード例 #10
0
 public override IShipmentReceiptMvoAggregate GetShipmentReceiptMvoAggregate(IShipmentReceiptMvoState state)
 {
     return(new ShipmentReceiptMvoAggregate(state));
 }
コード例 #11
0
        protected bool IsRepeatedCommand(IShipmentReceiptMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IShipmentReceiptMvoState state)
        {
            bool repeated = false;

            if (((IShipmentReceiptMvoStateProperties)state).ShipmentVersion > command.AggregateVersion)
            {
                var lastEvent = EventStore.GetEvent(typeof(IShipmentReceiptMvoEvent), eventStoreAggregateId, command.AggregateVersion);
                if (lastEvent != null && lastEvent.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
コード例 #12
0
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, IShipmentReceiptMvoAggregate aggregate, IShipmentReceiptMvoState state)
 {
     EventStore.AppendEvents(eventStoreAggregateId, ((IShipmentReceiptMvoStateProperties)state).ShipmentVersion, aggregate.Changes, () => { StateRepository.Save(state); });
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <IShipmentReceiptMvoAggregate, IShipmentReceiptMvoState>(aggregate, state, aggregate.Changes));
     }
 }
コード例 #13
0
 public abstract IShipmentReceiptMvoAggregate GetShipmentReceiptMvoAggregate(IShipmentReceiptMvoState state);
コード例 #14
0
 public ShipmentReceiptMvoAggregate(IShipmentReceiptMvoState state)
 {
     _state = state;
 }