public IOrderShipGroupMvoState Get(OrderShipGroupId id)
        {
            IOrderShipGroupMvoState state = CurrentSession.Get <OrderShipGroupMvoState>(id);

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

            if (!nullAllowed && state == null)
            {
                state = new OrderShipGroupMvoState();
                (state as OrderShipGroupMvoState).OrderShipGroupId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IOrderShipGroupMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
        public async Task <IOrderShipGroupMvoState> GetAsync(OrderShipGroupId orderShipGroupId)
        {
            IOrderShipGroupMvoState state = null;
            var idObj         = OrderShipGroupMvoProxyUtils.ToIdString(orderShipGroupId);
            var uriParameters = new OrderShipGroupMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new OrderShipGroupMvoGetRequest(uriParameters);

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

            OrderShipGroupMvoProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToOrderShipGroupMvoState();
            return(state);
        }
        public void Save(IOrderShipGroupMvoState state)
        {
            IOrderShipGroupMvoState s = state;

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

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Flush();
        }
        protected bool IsRepeatedCommand(IOrderShipGroupMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IOrderShipGroupMvoState state)
        {
            bool repeated = false;

            if (((IOrderShipGroupMvoStateProperties)state).OrderVersion > command.AggregateVersion)
            {
                var lastEvent = EventStore.GetEvent(typeof(IOrderShipGroupMvoEvent), eventStoreAggregateId, command.AggregateVersion);
                if (lastEvent != null && lastEvent.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, IOrderShipGroupMvoAggregate aggregate, IOrderShipGroupMvoState state)
 {
     EventStore.AppendEvents(eventStoreAggregateId, ((IOrderShipGroupMvoStateProperties)state).OrderVersion, aggregate.Changes, () => { StateRepository.Save(state); });
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <IOrderShipGroupMvoAggregate, IOrderShipGroupMvoState>(aggregate, state, aggregate.Changes));
     }
 }
 public abstract IOrderShipGroupMvoAggregate GetOrderShipGroupMvoAggregate(IOrderShipGroupMvoState state);
 public override IOrderShipGroupMvoAggregate GetOrderShipGroupMvoAggregate(IOrderShipGroupMvoState state)
 {
     return(new OrderShipGroupMvoAggregate(state));
 }
Exemplo n.º 9
0
 public OrderShipGroupMvoAggregate(IOrderShipGroupMvoState state)
 {
     _state = state;
 }
        public static TMergePatchOrderShipGroupMvo ToMergePatchOrderShipGroupMvo <TMergePatchOrderShipGroupMvo>(this IOrderShipGroupMvoState state)
            where TMergePatchOrderShipGroupMvo : IMergePatchOrderShipGroupMvo, new()
        {
            var cmd = new TMergePatchOrderShipGroupMvo();

            cmd.OrderVersion = ((IOrderShipGroupMvoStateProperties)state).OrderVersion;

            cmd.OrderShipGroupId     = state.OrderShipGroupId;
            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.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.Version                      = ((IOrderShipGroupMvoStateProperties)state).Version;
            cmd.Active                       = ((IOrderShipGroupMvoStateProperties)state).Active;
            cmd.OrderOrderTypeId             = state.OrderOrderTypeId;
            cmd.OrderOrderName               = state.OrderOrderName;
            cmd.OrderExternalId              = state.OrderExternalId;
            cmd.OrderSalesChannelEnumId      = state.OrderSalesChannelEnumId;
            cmd.OrderOrderDate               = state.OrderOrderDate;
            cmd.OrderPriority                = state.OrderPriority;
            cmd.OrderEntryDate               = state.OrderEntryDate;
            cmd.OrderPickSheetPrintedDate    = state.OrderPickSheetPrintedDate;
            cmd.OrderStatusId                = state.OrderStatusId;
            cmd.OrderCurrencyUom             = state.OrderCurrencyUom;
            cmd.OrderSyncStatusId            = state.OrderSyncStatusId;
            cmd.OrderBillingAccountId        = state.OrderBillingAccountId;
            cmd.OrderOriginFacilityId        = state.OrderOriginFacilityId;
            cmd.OrderWebSiteId               = state.OrderWebSiteId;
            cmd.OrderProductStoreId          = state.OrderProductStoreId;
            cmd.OrderTerminalId              = state.OrderTerminalId;
            cmd.OrderTransactionId           = state.OrderTransactionId;
            cmd.OrderAutoOrderShoppingListId = state.OrderAutoOrderShoppingListId;
            cmd.OrderNeedsInventoryIssuance  = state.OrderNeedsInventoryIssuance;
            cmd.OrderIsRushOrder             = state.OrderIsRushOrder;
            cmd.OrderInternalCode            = state.OrderInternalCode;
            cmd.OrderRemainingSubTotal       = state.OrderRemainingSubTotal;
            cmd.OrderGrandTotal              = state.OrderGrandTotal;
            cmd.OrderInvoicePerShipment      = state.OrderInvoicePerShipment;
            cmd.OrderCreatedBy               = state.OrderCreatedBy;
            cmd.OrderCreatedAt               = state.OrderCreatedAt;
            cmd.OrderUpdatedBy               = state.OrderUpdatedBy;
            cmd.OrderUpdatedAt               = state.OrderUpdatedAt;
            cmd.OrderActive                  = state.OrderActive;

            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.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;
            }
            if (state.OrderOrderTypeId == null)
            {
                cmd.IsPropertyOrderOrderTypeIdRemoved = true;
            }
            if (state.OrderOrderName == null)
            {
                cmd.IsPropertyOrderOrderNameRemoved = true;
            }
            if (state.OrderExternalId == null)
            {
                cmd.IsPropertyOrderExternalIdRemoved = true;
            }
            if (state.OrderSalesChannelEnumId == null)
            {
                cmd.IsPropertyOrderSalesChannelEnumIdRemoved = true;
            }
            if (state.OrderOrderDate == null)
            {
                cmd.IsPropertyOrderOrderDateRemoved = true;
            }
            if (state.OrderPriority == null)
            {
                cmd.IsPropertyOrderPriorityRemoved = true;
            }
            if (state.OrderEntryDate == null)
            {
                cmd.IsPropertyOrderEntryDateRemoved = true;
            }
            if (state.OrderPickSheetPrintedDate == null)
            {
                cmd.IsPropertyOrderPickSheetPrintedDateRemoved = true;
            }
            if (state.OrderStatusId == null)
            {
                cmd.IsPropertyOrderStatusIdRemoved = true;
            }
            if (state.OrderCurrencyUom == null)
            {
                cmd.IsPropertyOrderCurrencyUomRemoved = true;
            }
            if (state.OrderSyncStatusId == null)
            {
                cmd.IsPropertyOrderSyncStatusIdRemoved = true;
            }
            if (state.OrderBillingAccountId == null)
            {
                cmd.IsPropertyOrderBillingAccountIdRemoved = true;
            }
            if (state.OrderOriginFacilityId == null)
            {
                cmd.IsPropertyOrderOriginFacilityIdRemoved = true;
            }
            if (state.OrderWebSiteId == null)
            {
                cmd.IsPropertyOrderWebSiteIdRemoved = true;
            }
            if (state.OrderProductStoreId == null)
            {
                cmd.IsPropertyOrderProductStoreIdRemoved = true;
            }
            if (state.OrderTerminalId == null)
            {
                cmd.IsPropertyOrderTerminalIdRemoved = true;
            }
            if (state.OrderTransactionId == null)
            {
                cmd.IsPropertyOrderTransactionIdRemoved = true;
            }
            if (state.OrderAutoOrderShoppingListId == null)
            {
                cmd.IsPropertyOrderAutoOrderShoppingListIdRemoved = true;
            }
            if (state.OrderNeedsInventoryIssuance == null)
            {
                cmd.IsPropertyOrderNeedsInventoryIssuanceRemoved = true;
            }
            if (state.OrderIsRushOrder == null)
            {
                cmd.IsPropertyOrderIsRushOrderRemoved = true;
            }
            if (state.OrderInternalCode == null)
            {
                cmd.IsPropertyOrderInternalCodeRemoved = true;
            }
            if (state.OrderRemainingSubTotal == null)
            {
                cmd.IsPropertyOrderRemainingSubTotalRemoved = true;
            }
            if (state.OrderGrandTotal == null)
            {
                cmd.IsPropertyOrderGrandTotalRemoved = true;
            }
            if (state.OrderInvoicePerShipment == null)
            {
                cmd.IsPropertyOrderInvoicePerShipmentRemoved = true;
            }
            if (state.OrderCreatedBy == null)
            {
                cmd.IsPropertyOrderCreatedByRemoved = true;
            }
            if (state.OrderUpdatedBy == null)
            {
                cmd.IsPropertyOrderUpdatedByRemoved = true;
            }
            return(cmd);
        }
        public static TDeleteOrderShipGroupMvo ToDeleteOrderShipGroupMvo <TDeleteOrderShipGroupMvo>(this IOrderShipGroupMvoState state)
            where TDeleteOrderShipGroupMvo : IDeleteOrderShipGroupMvo, new()
        {
            var cmd = new TDeleteOrderShipGroupMvo();

            cmd.OrderShipGroupId = state.OrderShipGroupId;
            cmd.OrderVersion     = ((IOrderShipGroupMvoStateProperties)state).OrderVersion;

            return(cmd);
        }
        public static IOrderShipGroupMvoCommand ToCreateOrMergePatchOrderShipGroupMvo <TCreateOrderShipGroupMvo, TMergePatchOrderShipGroupMvo>(this IOrderShipGroupMvoState state)
            where TCreateOrderShipGroupMvo : ICreateOrderShipGroupMvo, new()
            where TMergePatchOrderShipGroupMvo : IMergePatchOrderShipGroupMvo, new()
        {
            bool bUnsaved = ((IOrderShipGroupMvoState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateOrderShipGroupMvo <TCreateOrderShipGroupMvo>());
            }
            else
            {
                return(state.ToMergePatchOrderShipGroupMvo <TMergePatchOrderShipGroupMvo>());
            }
        }
 public OrderShipGroupMvoStateDtoWrapper(IOrderShipGroupMvoState state)
 {
     this._state = state;
 }
 public OrderShipGroupMvoStateDtoWrapper()
 {
     this._state = new OrderShipGroupMvoState();
 }