Ejemplo n.º 1
0
 public DtoOrderItemShipGroupAssociationStates(IOrderShipGroupState outerState, IEnumerable <IOrderItemShipGroupAssociationState> innerStates)
 {
     this._outerState = outerState;
     if (innerStates == null)
     {
         this._innerStates = new IOrderItemShipGroupAssociationState[] { };
     }
     else
     {
         this._innerStates = innerStates;
     }
 }
        public IOrderShipGroupState Get(OrderShipGroupId id, bool nullAllowed)
        {
            IOrderShipGroupState state = CurrentSession.Get <OrderShipGroupState>(id);

            if (!nullAllowed && state == null)
            {
                state = new OrderShipGroupState();
                (state as OrderShipGroupState).OrderShipGroupId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IOrderShipGroupState>(state, new Type[] { typeof(ISaveable) }, _readOnlyPropertyNames));
            }
            return(state);
        }
        public void Delete(IOrderShipGroupState state)
        {
            IOrderShipGroupState s = state;

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

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Delete(s);
        }
Ejemplo n.º 4
0
        public virtual void When(IOrderStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.OrderTypeId == null)
            {
                if (e.IsPropertyOrderTypeIdRemoved)
                {
                    this.OrderTypeId = default(string);
                }
            }
            else
            {
                this.OrderTypeId = e.OrderTypeId;
            }

            if (e.OrderName == null)
            {
                if (e.IsPropertyOrderNameRemoved)
                {
                    this.OrderName = default(string);
                }
            }
            else
            {
                this.OrderName = e.OrderName;
            }

            if (e.ExternalId == null)
            {
                if (e.IsPropertyExternalIdRemoved)
                {
                    this.ExternalId = default(string);
                }
            }
            else
            {
                this.ExternalId = e.ExternalId;
            }

            if (e.SalesChannelEnumId == null)
            {
                if (e.IsPropertySalesChannelEnumIdRemoved)
                {
                    this.SalesChannelEnumId = default(string);
                }
            }
            else
            {
                this.SalesChannelEnumId = e.SalesChannelEnumId;
            }

            if (e.OrderDate == null)
            {
                if (e.IsPropertyOrderDateRemoved)
                {
                    this.OrderDate = default(DateTime?);
                }
            }
            else
            {
                this.OrderDate = e.OrderDate;
            }

            if (e.Priority == null)
            {
                if (e.IsPropertyPriorityRemoved)
                {
                    this.Priority = default(string);
                }
            }
            else
            {
                this.Priority = e.Priority;
            }

            if (e.EntryDate == null)
            {
                if (e.IsPropertyEntryDateRemoved)
                {
                    this.EntryDate = default(DateTime?);
                }
            }
            else
            {
                this.EntryDate = e.EntryDate;
            }

            if (e.PickSheetPrintedDate == null)
            {
                if (e.IsPropertyPickSheetPrintedDateRemoved)
                {
                    this.PickSheetPrintedDate = default(DateTime?);
                }
            }
            else
            {
                this.PickSheetPrintedDate = e.PickSheetPrintedDate;
            }

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

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

            if (e.SyncStatusId == null)
            {
                if (e.IsPropertySyncStatusIdRemoved)
                {
                    this.SyncStatusId = default(string);
                }
            }
            else
            {
                this.SyncStatusId = e.SyncStatusId;
            }

            if (e.BillingAccountId == null)
            {
                if (e.IsPropertyBillingAccountIdRemoved)
                {
                    this.BillingAccountId = default(string);
                }
            }
            else
            {
                this.BillingAccountId = e.BillingAccountId;
            }

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

            if (e.WebSiteId == null)
            {
                if (e.IsPropertyWebSiteIdRemoved)
                {
                    this.WebSiteId = default(string);
                }
            }
            else
            {
                this.WebSiteId = e.WebSiteId;
            }

            if (e.ProductStoreId == null)
            {
                if (e.IsPropertyProductStoreIdRemoved)
                {
                    this.ProductStoreId = default(string);
                }
            }
            else
            {
                this.ProductStoreId = e.ProductStoreId;
            }

            if (e.TerminalId == null)
            {
                if (e.IsPropertyTerminalIdRemoved)
                {
                    this.TerminalId = default(string);
                }
            }
            else
            {
                this.TerminalId = e.TerminalId;
            }

            if (e.TransactionId == null)
            {
                if (e.IsPropertyTransactionIdRemoved)
                {
                    this.TransactionId = default(string);
                }
            }
            else
            {
                this.TransactionId = e.TransactionId;
            }

            if (e.AutoOrderShoppingListId == null)
            {
                if (e.IsPropertyAutoOrderShoppingListIdRemoved)
                {
                    this.AutoOrderShoppingListId = default(string);
                }
            }
            else
            {
                this.AutoOrderShoppingListId = e.AutoOrderShoppingListId;
            }

            if (e.NeedsInventoryIssuance == null)
            {
                if (e.IsPropertyNeedsInventoryIssuanceRemoved)
                {
                    this.NeedsInventoryIssuance = default(string);
                }
            }
            else
            {
                this.NeedsInventoryIssuance = e.NeedsInventoryIssuance;
            }

            if (e.IsRushOrder == null)
            {
                if (e.IsPropertyIsRushOrderRemoved)
                {
                    this.IsRushOrder = default(string);
                }
            }
            else
            {
                this.IsRushOrder = e.IsRushOrder;
            }

            if (e.InternalCode == null)
            {
                if (e.IsPropertyInternalCodeRemoved)
                {
                    this.InternalCode = default(string);
                }
            }
            else
            {
                this.InternalCode = e.InternalCode;
            }

            if (e.RemainingSubTotal == null)
            {
                if (e.IsPropertyRemainingSubTotalRemoved)
                {
                    this.RemainingSubTotal = default(decimal?);
                }
            }
            else
            {
                this.RemainingSubTotal = e.RemainingSubTotal;
            }

            if (e.GrandTotal == null)
            {
                if (e.IsPropertyGrandTotalRemoved)
                {
                    this.GrandTotal = default(decimal?);
                }
            }
            else
            {
                this.GrandTotal = e.GrandTotal;
            }

            if (e.InvoicePerShipment == null)
            {
                if (e.IsPropertyInvoicePerShipmentRemoved)
                {
                    this.InvoicePerShipment = default(string);
                }
            }
            else
            {
                this.InvoicePerShipment = e.InvoicePerShipment;
            }

            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 (IOrderRoleEvent innerEvent in e.OrderRoleEvents)
            {
                IOrderRoleState innerState = this.OrderRoles.Get(innerEvent.GlobalId.PartyRoleId);

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

            foreach (IOrderItemEvent innerEvent in e.OrderItemEvents)
            {
                IOrderItemState innerState = this.OrderItems.Get(innerEvent.GlobalId.OrderItemSeqId);

                innerState.Mutate(innerEvent);
            }

            foreach (IOrderShipGroupEvent innerEvent in e.OrderShipGroupEvents)
            {
                IOrderShipGroupState innerState = this.OrderShipGroups.Get(innerEvent.GlobalId.ShipGroupSeqId);

                innerState.Mutate(innerEvent);
                var removed = innerEvent as IOrderShipGroupStateRemoved;
                if (removed != null)
                {
                    this.OrderShipGroups.Remove(innerState);
                }
            }
        }
Ejemplo n.º 5
0
        public virtual void When(IOrderStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.OrderTypeId = e.OrderTypeId;

            this.OrderName = e.OrderName;

            this.ExternalId = e.ExternalId;

            this.SalesChannelEnumId = e.SalesChannelEnumId;

            this.OrderDate = e.OrderDate;

            this.Priority = e.Priority;

            this.EntryDate = e.EntryDate;

            this.PickSheetPrintedDate = e.PickSheetPrintedDate;

            this.StatusId = e.StatusId;

            this.CurrencyUomId = e.CurrencyUomId;

            this.SyncStatusId = e.SyncStatusId;

            this.BillingAccountId = e.BillingAccountId;

            this.OriginFacilityId = e.OriginFacilityId;

            this.WebSiteId = e.WebSiteId;

            this.ProductStoreId = e.ProductStoreId;

            this.TerminalId = e.TerminalId;

            this.TransactionId = e.TransactionId;

            this.AutoOrderShoppingListId = e.AutoOrderShoppingListId;

            this.NeedsInventoryIssuance = e.NeedsInventoryIssuance;

            this.IsRushOrder = e.IsRushOrder;

            this.InternalCode = e.InternalCode;

            this.RemainingSubTotal = e.RemainingSubTotal;

            this.GrandTotal = e.GrandTotal;

            this.InvoicePerShipment = e.InvoicePerShipment;

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

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

            foreach (IOrderRoleStateCreated innerEvent in e.OrderRoleEvents)
            {
                IOrderRoleState innerState = this.OrderRoles.Get(innerEvent.GlobalId.PartyRoleId, true);
                innerState.Mutate(innerEvent);
            }
            foreach (IOrderItemStateCreated innerEvent in e.OrderItemEvents)
            {
                IOrderItemState innerState = this.OrderItems.Get(innerEvent.GlobalId.OrderItemSeqId, true);
                innerState.Mutate(innerEvent);
            }
            foreach (IOrderShipGroupStateCreated innerEvent in e.OrderShipGroupEvents)
            {
                IOrderShipGroupState innerState = this.OrderShipGroups.Get(innerEvent.GlobalId.ShipGroupSeqId, true);
                innerState.Mutate(innerEvent);
            }
        }
Ejemplo n.º 6
0
        protected void NewOrderShipGroupOrderShipGroupActionCommandAndExecute(ICreateOrderShipGroup c, IOrderShipGroupState s, IOrderShipGroupStateCreated e)
        {
            var pCommandHandler = this.OrderShipGroupOrderShipGroupActionCommandHandler;
            var pCmdContent     = default(string);
            var pCmd            = new PropertyCommand <string, string> {
                Content = pCmdContent, GetState = () => s.OrderShipGroupStatusId, SetState = p => e.OrderShipGroupStatusId = p, OuterCommandType = CommandType.Create
            };

            pCmd.Context = this.State;
            pCommandHandler.Execute(pCmd);
        }
Ejemplo n.º 7
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IOrderItemShipGroupAssociationStateMergePatched MapMergePatch(IMergePatchOrderItemShipGroupAssociation c, IOrderShipGroupCommand outerCommand, long version, IOrderShipGroupState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new OrderItemShipGroupAssociationEventId(c.OrderId, c.OrderShipGroupShipGroupSeqId, c.OrderItemSeqId, version);
            IOrderItemShipGroupAssociationStateMergePatched e = NewOrderItemShipGroupAssociationStateMergePatched(stateEventId);
            var s = outerState.OrderItemShipGroupAssociations.Get(c.OrderItemSeqId);

            e.Quantity                        = c.Quantity;
            e.CancelQuantity                  = c.CancelQuantity;
            e.Active                          = c.Active;
            e.IsPropertyQuantityRemoved       = c.IsPropertyQuantityRemoved;
            e.IsPropertyCancelQuantityRemoved = c.IsPropertyCancelQuantityRemoved;
            e.IsPropertyActiveRemoved         = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
Ejemplo n.º 8
0
        }// END Map(IRemove... ////////////////////////////

        protected virtual IOrderItemShipGroupAssociationEvent Map(IOrderItemShipGroupAssociationCommand c, IOrderShipGroupCommand outerCommand, long version, IOrderShipGroupState outerState)
        {
            var create = (c.CommandType == CommandType.Create) ? (c as ICreateOrderItemShipGroupAssociation) : null;

            if (create != null)
            {
                return(MapCreate(create, outerCommand, version, outerState));
            }

            var merge = (c.CommandType == CommandType.MergePatch || c.CommandType == null) ? (c as IMergePatchOrderItemShipGroupAssociation) : null;

            if (merge != null)
            {
                return(MapMergePatch(merge, outerCommand, version, outerState));
            }

            var remove = (c.CommandType == CommandType.Remove) ? (c as IRemoveOrderItemShipGroupAssociation) : null;

            if (remove != null)
            {
                return(MapRemove(remove, outerCommand, version));
            }
            throw new NotSupportedException();
        }
Ejemplo n.º 9
0
        public static IOrderShipGroupCommand ToCreateOrMergePatchOrderShipGroup <TCreateOrderShipGroup, TMergePatchOrderShipGroup, TCreateOrderItemShipGroupAssociation, TMergePatchOrderItemShipGroupAssociation>(this IOrderShipGroupState state)
            where TCreateOrderShipGroup : ICreateOrderShipGroup, new()
            where TMergePatchOrderShipGroup : IMergePatchOrderShipGroup, new()
            where TCreateOrderItemShipGroupAssociation : ICreateOrderItemShipGroupAssociation, new()
            where TMergePatchOrderItemShipGroupAssociation : IMergePatchOrderItemShipGroupAssociation, new()
        {
            bool bUnsaved = ((IOrderShipGroupState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateOrderShipGroup <TCreateOrderShipGroup, TCreateOrderItemShipGroupAssociation>());
            }
            else
            {
                return(state.ToMergePatchOrderShipGroup <TMergePatchOrderShipGroup, TCreateOrderItemShipGroupAssociation, TMergePatchOrderItemShipGroupAssociation>());
            }
        }
Ejemplo n.º 10
0
 public OrderShipGroupStateDtoWrapper()
 {
     this._state = new OrderShipGroupState();
 }
Ejemplo n.º 11
0
 public OrderItemShipGroupAssociationStates(IOrderShipGroupState outerState)
 {
     this._orderShipGroupState = outerState;
     this._forReapplying       = outerState.ForReapplying;
 }
Ejemplo n.º 12
0
 public void AddToSave(IOrderShipGroupState state)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 13
0
        public static TMergePatchOrderShipGroup ToMergePatchOrderShipGroup <TMergePatchOrderShipGroup, TCreateOrderItemShipGroupAssociation, TMergePatchOrderItemShipGroupAssociation>(this IOrderShipGroupState state)
            where TMergePatchOrderShipGroup : IMergePatchOrderShipGroup, new()
            where TCreateOrderItemShipGroupAssociation : ICreateOrderItemShipGroupAssociation, new()
            where TMergePatchOrderItemShipGroupAssociation : IMergePatchOrderItemShipGroupAssociation, new()
        {
            var cmd = new TMergePatchOrderShipGroup();

            cmd.ShipGroupSeqId       = state.ShipGroupSeqId;
            cmd.ShipmentMethodTypeId = state.ShipmentMethodTypeId;
            cmd.SupplierPartyId      = state.SupplierPartyId;
            cmd.VendorPartyId        = state.VendorPartyId;
            cmd.CarrierPartyId       = state.CarrierPartyId;
            cmd.CarrierRoleTypeId    = state.CarrierRoleTypeId;
            cmd.FacilityId           = state.FacilityId;
            cmd.ContactMechId        = state.ContactMechId;
            cmd.TelecomContactMechId = state.TelecomContactMechId;
            cmd.TrackingNumber       = state.TrackingNumber;
            cmd.ContactPartyId       = state.ContactPartyId;
            cmd.VehiclePlateNumber   = state.VehiclePlateNumber;
            cmd.ShippingInstructions = state.ShippingInstructions;
            cmd.MaySplit             = state.MaySplit;
            cmd.GiftMessage          = state.GiftMessage;
            cmd.IsGift                      = state.IsGift;
            cmd.ShipAfterDate               = state.ShipAfterDate;
            cmd.ShipByDate                  = state.ShipByDate;
            cmd.EstimatedShipDate           = state.EstimatedShipDate;
            cmd.EstimatedDeliveryDate       = state.EstimatedDeliveryDate;
            cmd.PickwaveId                  = state.PickwaveId;
            cmd.NumberOfPackages            = state.NumberOfPackages;
            cmd.NumberOfContainers          = state.NumberOfContainers;
            cmd.NumberOfPakagesPerContainer = state.NumberOfPakagesPerContainer;
            cmd.Active                      = ((IOrderShipGroupStateProperties)state).Active;
            cmd.OrderId                     = state.OrderId;

            if (state.ShipmentMethodTypeId == null)
            {
                cmd.IsPropertyShipmentMethodTypeIdRemoved = true;
            }
            if (state.SupplierPartyId == null)
            {
                cmd.IsPropertySupplierPartyIdRemoved = true;
            }
            if (state.VendorPartyId == null)
            {
                cmd.IsPropertyVendorPartyIdRemoved = true;
            }
            if (state.CarrierPartyId == null)
            {
                cmd.IsPropertyCarrierPartyIdRemoved = true;
            }
            if (state.CarrierRoleTypeId == null)
            {
                cmd.IsPropertyCarrierRoleTypeIdRemoved = true;
            }
            if (state.FacilityId == null)
            {
                cmd.IsPropertyFacilityIdRemoved = true;
            }
            if (state.ContactMechId == null)
            {
                cmd.IsPropertyContactMechIdRemoved = true;
            }
            if (state.TelecomContactMechId == null)
            {
                cmd.IsPropertyTelecomContactMechIdRemoved = true;
            }
            if (state.TrackingNumber == null)
            {
                cmd.IsPropertyTrackingNumberRemoved = true;
            }
            if (state.ContactPartyId == null)
            {
                cmd.IsPropertyContactPartyIdRemoved = true;
            }
            if (state.VehiclePlateNumber == null)
            {
                cmd.IsPropertyVehiclePlateNumberRemoved = true;
            }
            if (state.ShippingInstructions == null)
            {
                cmd.IsPropertyShippingInstructionsRemoved = true;
            }
            if (state.MaySplit == null)
            {
                cmd.IsPropertyMaySplitRemoved = true;
            }
            if (state.GiftMessage == null)
            {
                cmd.IsPropertyGiftMessageRemoved = true;
            }
            if (state.IsGift == null)
            {
                cmd.IsPropertyIsGiftRemoved = true;
            }
            if (state.ShipAfterDate == null)
            {
                cmd.IsPropertyShipAfterDateRemoved = true;
            }
            if (state.ShipByDate == null)
            {
                cmd.IsPropertyShipByDateRemoved = true;
            }
            if (state.EstimatedShipDate == null)
            {
                cmd.IsPropertyEstimatedShipDateRemoved = true;
            }
            if (state.EstimatedDeliveryDate == null)
            {
                cmd.IsPropertyEstimatedDeliveryDateRemoved = true;
            }
            if (state.PickwaveId == null)
            {
                cmd.IsPropertyPickwaveIdRemoved = true;
            }
            foreach (var d in state.OrderItemShipGroupAssociations)
            {
                var c = d.ToCreateOrMergePatchOrderItemShipGroupAssociation <TCreateOrderItemShipGroupAssociation, TMergePatchOrderItemShipGroupAssociation>();
                cmd.OrderItemShipGroupAssociationCommands.Add(c);
            }
            return(cmd);
        }
Ejemplo n.º 14
0
        public static TRemoveOrderShipGroup ToRemoveOrderShipGroup <TRemoveOrderShipGroup>(this IOrderShipGroupState state)
            where TRemoveOrderShipGroup : IRemoveOrderShipGroup, new()
        {
            var cmd = new TRemoveOrderShipGroup();

            cmd.ShipGroupSeqId = state.ShipGroupSeqId;
            return(cmd);
        }
Ejemplo n.º 15
0
 public virtual void AddToSave(IOrderShipGroupState state)
 {
     this._loadedOrderShipGroupStates[state.GlobalId] = state;
 }
Ejemplo n.º 16
0
 public OrderShipGroupStateDtoWrapper(IOrderShipGroupState state)
 {
     this._state = state;
 }
Ejemplo n.º 17
0
 public virtual void Remove(IOrderShipGroupState state)
 {
     this._removedOrderShipGroupStates.Add(state.GlobalId, state);
 }
        public static TCreateOrderShipGroup ToCreateOrderShipGroup <TCreateOrderShipGroup, TCreateOrderItemShipGroupAssociation>(this IOrderShipGroupState state)
            where TCreateOrderShipGroup : ICreateOrderShipGroup, new()
            where TCreateOrderItemShipGroupAssociation : ICreateOrderItemShipGroupAssociation, new()
        {
            var cmd = new TCreateOrderShipGroup();

            cmd.ShipGroupSeqId        = state.ShipGroupSeqId;
            cmd.ShipmentMethodTypeId  = state.ShipmentMethodTypeId;
            cmd.SupplierPartyId       = state.SupplierPartyId;
            cmd.VendorPartyId         = state.VendorPartyId;
            cmd.CarrierPartyId        = state.CarrierPartyId;
            cmd.CarrierRoleTypeId     = state.CarrierRoleTypeId;
            cmd.FacilityId            = state.FacilityId;
            cmd.DestinationFacilityId = state.DestinationFacilityId;
            cmd.ContactMechId         = state.ContactMechId;
            cmd.TelecomContactMechId  = state.TelecomContactMechId;
            cmd.TrackingNumber        = state.TrackingNumber;
            cmd.ContactPartyId        = state.ContactPartyId;
            cmd.VehiclePlateNumber    = state.VehiclePlateNumber;
            cmd.ShippingInstructions  = state.ShippingInstructions;
            cmd.MaySplit                    = state.MaySplit;
            cmd.GiftMessage                 = state.GiftMessage;
            cmd.IsGift                      = state.IsGift;
            cmd.ShipAfterDate               = state.ShipAfterDate;
            cmd.ShipByDate                  = state.ShipByDate;
            cmd.EstimatedShipDate           = state.EstimatedShipDate;
            cmd.EstimatedDeliveryDate       = state.EstimatedDeliveryDate;
            cmd.PickwaveId                  = state.PickwaveId;
            cmd.NumberOfPackages            = state.NumberOfPackages;
            cmd.NumberOfContainers          = state.NumberOfContainers;
            cmd.NumberOfPakagesPerContainer = state.NumberOfPakagesPerContainer;
            cmd.Active                      = ((IOrderShipGroupStateProperties)state).Active;
            cmd.OrderId                     = state.OrderId;
            foreach (var d in state.OrderItemShipGroupAssociations)
            {
                var c = d.ToCreateOrderItemShipGroupAssociation <TCreateOrderItemShipGroupAssociation>();
                cmd.OrderItemShipGroupAssociations.Add(c);
            }
            return(cmd);
        }