public static TRemoveItemIssuance ToRemoveItemIssuance <TRemoveItemIssuance>(this IItemIssuanceState state)
            where TRemoveItemIssuance : IRemoveItemIssuance, new()
        {
            var cmd = new TRemoveItemIssuance();

            cmd.ItemIssuanceSeqId = state.ItemIssuanceSeqId;
            return(cmd);
        }
Ejemplo n.º 2
0
        public IItemIssuanceState Get(ShipmentItemIssuanceId id, bool nullAllowed)
        {
            IItemIssuanceState state = CurrentSession.Get <ItemIssuanceState>(id);

            if (!nullAllowed && state == null)
            {
                state = new ItemIssuanceState();
                (state as ItemIssuanceState).ShipmentItemIssuanceId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IItemIssuanceState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
Ejemplo n.º 3
0
        public void Delete(IItemIssuanceState state)
        {
            IItemIssuanceState s = state;

            if (ReadOnlyProxyGenerator != null)
            {
                s = ReadOnlyProxyGenerator.GetTarget <IItemIssuanceState>(state);
            }
            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Delete(s);
        }
        public static TCreateItemIssuance ToCreateItemIssuance <TCreateItemIssuance>(this IItemIssuanceState state)
            where TCreateItemIssuance : ICreateItemIssuance, new()
        {
            var cmd = new TCreateItemIssuance();

            cmd.ItemIssuanceSeqId      = state.ItemIssuanceSeqId;
            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.Active     = ((IItemIssuanceStateProperties)state).Active;
            cmd.ShipmentId = state.ShipmentId;
            return(cmd);
        }
Ejemplo n.º 5
0
        public virtual void When(IShipmentStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.ShipmentTypeId == null)
            {
                if (e.IsPropertyShipmentTypeIdRemoved)
                {
                    this.ShipmentTypeId = default(string);
                }
            }
            else
            {
                this.ShipmentTypeId = e.ShipmentTypeId;
            }

            if (e.StatusId == null)
            {
                if (e.IsPropertyStatusIdRemoved)
                {
                    this.StatusId = default(string);
                }
            }
            else
            {
                this.StatusId = e.StatusId;
            }

            if (e.PrimaryOrderId == null)
            {
                if (e.IsPropertyPrimaryOrderIdRemoved)
                {
                    this.PrimaryOrderId = default(string);
                }
            }
            else
            {
                this.PrimaryOrderId = e.PrimaryOrderId;
            }

            if (e.PrimaryReturnId == null)
            {
                if (e.IsPropertyPrimaryReturnIdRemoved)
                {
                    this.PrimaryReturnId = default(string);
                }
            }
            else
            {
                this.PrimaryReturnId = e.PrimaryReturnId;
            }

            if (e.PrimaryShipGroupSeqId == null)
            {
                if (e.IsPropertyPrimaryShipGroupSeqIdRemoved)
                {
                    this.PrimaryShipGroupSeqId = default(string);
                }
            }
            else
            {
                this.PrimaryShipGroupSeqId = e.PrimaryShipGroupSeqId;
            }

            if (e.PicklistBinId == null)
            {
                if (e.IsPropertyPicklistBinIdRemoved)
                {
                    this.PicklistBinId = default(string);
                }
            }
            else
            {
                this.PicklistBinId = e.PicklistBinId;
            }

            if (e.BolNumber == null)
            {
                if (e.IsPropertyBolNumberRemoved)
                {
                    this.BolNumber = default(string);
                }
            }
            else
            {
                this.BolNumber = e.BolNumber;
            }

            if (e.SealNumber == null)
            {
                if (e.IsPropertySealNumberRemoved)
                {
                    this.SealNumber = default(string);
                }
            }
            else
            {
                this.SealNumber = e.SealNumber;
            }

            if (e.VehicleId == null)
            {
                if (e.IsPropertyVehicleIdRemoved)
                {
                    this.VehicleId = default(string);
                }
            }
            else
            {
                this.VehicleId = e.VehicleId;
            }

            if (e.ExternalOrderNumber == null)
            {
                if (e.IsPropertyExternalOrderNumberRemoved)
                {
                    this.ExternalOrderNumber = default(string);
                }
            }
            else
            {
                this.ExternalOrderNumber = e.ExternalOrderNumber;
            }

            if (e.Carrier == null)
            {
                if (e.IsPropertyCarrierRemoved)
                {
                    this.Carrier = default(string);
                }
            }
            else
            {
                this.Carrier = e.Carrier;
            }

            if (e.DateShipped == null)
            {
                if (e.IsPropertyDateShippedRemoved)
                {
                    this.DateShipped = default(DateTime?);
                }
            }
            else
            {
                this.DateShipped = e.DateShipped;
            }

            if (e.EstimatedReadyDate == null)
            {
                if (e.IsPropertyEstimatedReadyDateRemoved)
                {
                    this.EstimatedReadyDate = default(DateTime?);
                }
            }
            else
            {
                this.EstimatedReadyDate = e.EstimatedReadyDate;
            }

            if (e.EstimatedShipDate == null)
            {
                if (e.IsPropertyEstimatedShipDateRemoved)
                {
                    this.EstimatedShipDate = default(DateTime?);
                }
            }
            else
            {
                this.EstimatedShipDate = e.EstimatedShipDate;
            }

            if (e.EstimatedShipWorkEffId == null)
            {
                if (e.IsPropertyEstimatedShipWorkEffIdRemoved)
                {
                    this.EstimatedShipWorkEffId = default(string);
                }
            }
            else
            {
                this.EstimatedShipWorkEffId = e.EstimatedShipWorkEffId;
            }

            if (e.EstimatedArrivalDate == null)
            {
                if (e.IsPropertyEstimatedArrivalDateRemoved)
                {
                    this.EstimatedArrivalDate = default(DateTime?);
                }
            }
            else
            {
                this.EstimatedArrivalDate = e.EstimatedArrivalDate;
            }

            if (e.EstimatedArrivalWorkEffId == null)
            {
                if (e.IsPropertyEstimatedArrivalWorkEffIdRemoved)
                {
                    this.EstimatedArrivalWorkEffId = default(string);
                }
            }
            else
            {
                this.EstimatedArrivalWorkEffId = e.EstimatedArrivalWorkEffId;
            }

            if (e.LatestCancelDate == null)
            {
                if (e.IsPropertyLatestCancelDateRemoved)
                {
                    this.LatestCancelDate = default(DateTime?);
                }
            }
            else
            {
                this.LatestCancelDate = e.LatestCancelDate;
            }

            if (e.EstimatedShipCost == null)
            {
                if (e.IsPropertyEstimatedShipCostRemoved)
                {
                    this.EstimatedShipCost = default(decimal?);
                }
            }
            else
            {
                this.EstimatedShipCost = e.EstimatedShipCost;
            }

            if (e.CurrencyUomId == null)
            {
                if (e.IsPropertyCurrencyUomIdRemoved)
                {
                    this.CurrencyUomId = default(string);
                }
            }
            else
            {
                this.CurrencyUomId = e.CurrencyUomId;
            }

            if (e.HandlingInstructions == null)
            {
                if (e.IsPropertyHandlingInstructionsRemoved)
                {
                    this.HandlingInstructions = default(string);
                }
            }
            else
            {
                this.HandlingInstructions = e.HandlingInstructions;
            }

            if (e.OriginFacilityId == null)
            {
                if (e.IsPropertyOriginFacilityIdRemoved)
                {
                    this.OriginFacilityId = default(string);
                }
            }
            else
            {
                this.OriginFacilityId = e.OriginFacilityId;
            }

            if (e.DestinationFacilityId == null)
            {
                if (e.IsPropertyDestinationFacilityIdRemoved)
                {
                    this.DestinationFacilityId = default(string);
                }
            }
            else
            {
                this.DestinationFacilityId = e.DestinationFacilityId;
            }

            if (e.OriginContactMechId == null)
            {
                if (e.IsPropertyOriginContactMechIdRemoved)
                {
                    this.OriginContactMechId = default(string);
                }
            }
            else
            {
                this.OriginContactMechId = e.OriginContactMechId;
            }

            if (e.OriginTelecomNumberId == null)
            {
                if (e.IsPropertyOriginTelecomNumberIdRemoved)
                {
                    this.OriginTelecomNumberId = default(string);
                }
            }
            else
            {
                this.OriginTelecomNumberId = e.OriginTelecomNumberId;
            }

            if (e.DestinationContactMechId == null)
            {
                if (e.IsPropertyDestinationContactMechIdRemoved)
                {
                    this.DestinationContactMechId = default(string);
                }
            }
            else
            {
                this.DestinationContactMechId = e.DestinationContactMechId;
            }

            if (e.DestinationTelecomNumberId == null)
            {
                if (e.IsPropertyDestinationTelecomNumberIdRemoved)
                {
                    this.DestinationTelecomNumberId = default(string);
                }
            }
            else
            {
                this.DestinationTelecomNumberId = e.DestinationTelecomNumberId;
            }

            if (e.PartyIdTo == null)
            {
                if (e.IsPropertyPartyIdToRemoved)
                {
                    this.PartyIdTo = default(string);
                }
            }
            else
            {
                this.PartyIdTo = e.PartyIdTo;
            }

            if (e.PartyIdFrom == null)
            {
                if (e.IsPropertyPartyIdFromRemoved)
                {
                    this.PartyIdFrom = default(string);
                }
            }
            else
            {
                this.PartyIdFrom = e.PartyIdFrom;
            }

            if (e.AdditionalShippingCharge == null)
            {
                if (e.IsPropertyAdditionalShippingChargeRemoved)
                {
                    this.AdditionalShippingCharge = default(decimal?);
                }
            }
            else
            {
                this.AdditionalShippingCharge = e.AdditionalShippingCharge;
            }

            if (e.AddtlShippingChargeDesc == null)
            {
                if (e.IsPropertyAddtlShippingChargeDescRemoved)
                {
                    this.AddtlShippingChargeDesc = default(string);
                }
            }
            else
            {
                this.AddtlShippingChargeDesc = e.AddtlShippingChargeDesc;
            }

            if (e.Active == null)
            {
                if (e.IsPropertyActiveRemoved)
                {
                    this.Active = default(bool);
                }
            }
            else
            {
                this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);
            }


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;


            foreach (IShipmentImageEvent innerEvent in e.ShipmentImageEvents)
            {
                IShipmentImageState innerState = this.ShipmentImages.Get(innerEvent.GlobalId.SequenceId);

                innerState.Mutate(innerEvent);
                var removed = innerEvent as IShipmentImageStateRemoved;
                if (removed != null)
                {
                    this.ShipmentImages.Remove(innerState);
                }
            }

            foreach (IShipmentItemEvent innerEvent in e.ShipmentItemEvents)
            {
                IShipmentItemState innerState = this.ShipmentItems.Get(innerEvent.GlobalId.ShipmentItemSeqId);

                innerState.Mutate(innerEvent);
            }

            foreach (IShipmentReceiptEvent innerEvent in e.ShipmentReceiptEvents)
            {
                IShipmentReceiptState innerState = this.ShipmentReceipts.Get(innerEvent.GlobalId.ReceiptSeqId);

                innerState.Mutate(innerEvent);
            }

            foreach (IItemIssuanceEvent innerEvent in e.ItemIssuanceEvents)
            {
                IItemIssuanceState innerState = this.ItemIssuances.Get(innerEvent.GlobalId.ItemIssuanceSeqId);

                innerState.Mutate(innerEvent);
                var removed = innerEvent as IItemIssuanceStateRemoved;
                if (removed != null)
                {
                    this.ItemIssuances.Remove(innerState);
                }
            }
        }
Ejemplo n.º 6
0
        public virtual void When(IShipmentStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.ShipmentTypeId = e.ShipmentTypeId;

            this.StatusId = e.StatusId;

            this.PrimaryOrderId = e.PrimaryOrderId;

            this.PrimaryReturnId = e.PrimaryReturnId;

            this.PrimaryShipGroupSeqId = e.PrimaryShipGroupSeqId;

            this.PicklistBinId = e.PicklistBinId;

            this.BolNumber = e.BolNumber;

            this.SealNumber = e.SealNumber;

            this.VehicleId = e.VehicleId;

            this.ExternalOrderNumber = e.ExternalOrderNumber;

            this.Carrier = e.Carrier;

            this.DateShipped = e.DateShipped;

            this.EstimatedReadyDate = e.EstimatedReadyDate;

            this.EstimatedShipDate = e.EstimatedShipDate;

            this.EstimatedShipWorkEffId = e.EstimatedShipWorkEffId;

            this.EstimatedArrivalDate = e.EstimatedArrivalDate;

            this.EstimatedArrivalWorkEffId = e.EstimatedArrivalWorkEffId;

            this.LatestCancelDate = e.LatestCancelDate;

            this.EstimatedShipCost = e.EstimatedShipCost;

            this.CurrencyUomId = e.CurrencyUomId;

            this.HandlingInstructions = e.HandlingInstructions;

            this.OriginFacilityId = e.OriginFacilityId;

            this.DestinationFacilityId = e.DestinationFacilityId;

            this.OriginContactMechId = e.OriginContactMechId;

            this.OriginTelecomNumberId = e.OriginTelecomNumberId;

            this.DestinationContactMechId = e.DestinationContactMechId;

            this.DestinationTelecomNumberId = e.DestinationTelecomNumberId;

            this.PartyIdTo = e.PartyIdTo;

            this.PartyIdFrom = e.PartyIdFrom;

            this.AdditionalShippingCharge = e.AdditionalShippingCharge;

            this.AddtlShippingChargeDesc = e.AddtlShippingChargeDesc;

            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;

            foreach (IShipmentImageStateCreated innerEvent in e.ShipmentImageEvents)
            {
                IShipmentImageState innerState = this.ShipmentImages.Get(innerEvent.GlobalId.SequenceId, true);
                innerState.Mutate(innerEvent);
            }
            foreach (IShipmentItemStateCreated innerEvent in e.ShipmentItemEvents)
            {
                IShipmentItemState innerState = this.ShipmentItems.Get(innerEvent.GlobalId.ShipmentItemSeqId, true);
                innerState.Mutate(innerEvent);
            }
            foreach (IShipmentReceiptStateCreated innerEvent in e.ShipmentReceiptEvents)
            {
                IShipmentReceiptState innerState = this.ShipmentReceipts.Get(innerEvent.GlobalId.ReceiptSeqId, true);
                innerState.Mutate(innerEvent);
            }
            foreach (IItemIssuanceStateCreated innerEvent in e.ItemIssuanceEvents)
            {
                IItemIssuanceState innerState = this.ItemIssuances.Get(innerEvent.GlobalId.ItemIssuanceSeqId, true);
                innerState.Mutate(innerEvent);
            }
        }
Ejemplo n.º 7
0
 public virtual void Remove(IItemIssuanceState state)
 {
     this._removedItemIssuanceStates.Add(state.GlobalId, state);
 }
Ejemplo n.º 8
0
 public virtual void AddToSave(IItemIssuanceState state)
 {
     this._loadedItemIssuanceStates[state.GlobalId] = state;
 }
Ejemplo n.º 9
0
 public void AddToSave(IItemIssuanceState state)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 10
0
 public ItemIssuanceStateDtoWrapper(IItemIssuanceState state)
 {
     this._state = state;
 }
Ejemplo n.º 11
0
 public ItemIssuanceStateDtoWrapper()
 {
     this._state = new ItemIssuanceState();
 }
        public static TMergePatchItemIssuance ToMergePatchItemIssuance <TMergePatchItemIssuance>(this IItemIssuanceState state)
            where TMergePatchItemIssuance : IMergePatchItemIssuance, new()
        {
            var cmd = new TMergePatchItemIssuance();

            cmd.ItemIssuanceSeqId      = state.ItemIssuanceSeqId;
            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.Active     = ((IItemIssuanceStateProperties)state).Active;
            cmd.ShipmentId = state.ShipmentId;

            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;
            }
            return(cmd);
        }
        public static IItemIssuanceCommand ToCreateOrMergePatchItemIssuance <TCreateItemIssuance, TMergePatchItemIssuance>(this IItemIssuanceState state)
            where TCreateItemIssuance : ICreateItemIssuance, new()
            where TMergePatchItemIssuance : IMergePatchItemIssuance, new()
        {
            bool bUnsaved = ((IItemIssuanceState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateItemIssuance <TCreateItemIssuance>());
            }
            else
            {
                return(state.ToMergePatchItemIssuance <TMergePatchItemIssuance>());
            }
        }