public static TDeleteOrderRoleMvo ToDeleteOrderRoleMvo <TDeleteOrderRoleMvo>(this IOrderRoleMvoState state)
            where TDeleteOrderRoleMvo : IDeleteOrderRoleMvo, new()
        {
            var cmd = new TDeleteOrderRoleMvo();

            cmd.OrderRoleId  = state.OrderRoleId;
            cmd.OrderVersion = ((IOrderRoleMvoStateProperties)state).OrderVersion;

            return(cmd);
        }
        public IOrderRoleMvoState Get(OrderRoleId id)
        {
            IOrderRoleMvoState state = CurrentSession.Get <OrderRoleMvoState>(id);

            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IOrderRoleMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
Exemple #3
0
        public IOrderRoleMvoState Get(OrderRoleId id, bool nullAllowed)
        {
            IOrderRoleMvoState state = CurrentSession.Get <OrderRoleMvoState> (id);

            if (!nullAllowed && state == null)
            {
                state = new OrderRoleMvoState();
                (state as OrderRoleMvoState).OrderRoleId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IOrderRoleMvoState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
        public async Task <IOrderRoleMvoState> GetAsync(OrderRoleId orderRoleId)
        {
            IOrderRoleMvoState state = null;
            var idObj         = OrderRoleMvoProxyUtils.ToIdString(orderRoleId);
            var uriParameters = new OrderRoleMvoUriParameters();

            uriParameters.Id = idObj;

            var req = new OrderRoleMvoGetRequest(uriParameters);

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

            OrderRoleMvoProxyUtils.ThrowOnHttpResponseError(resp);
            state = (resp.Content == null) ? null : resp.Content.ToOrderRoleMvoState();
            return(state);
        }
Exemple #5
0
        public void Save(IOrderRoleMvoState state)
        {
            IOrderRoleMvoState s = state;

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

            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Flush();
        }
        public static TCreateOrderRoleMvo ToCreateOrderRoleMvo <TCreateOrderRoleMvo>(this IOrderRoleMvoState state)
            where TCreateOrderRoleMvo : ICreateOrderRoleMvo, new()
        {
            var cmd = new TCreateOrderRoleMvo();

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

            cmd.OrderRoleId                  = state.OrderRoleId;
            cmd.Version                      = ((IOrderRoleMvoStateProperties)state).Version;
            cmd.Active                       = ((IOrderRoleMvoStateProperties)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;
            return(cmd);
        }
Exemple #7
0
 public OrderRoleMvoStateDtoWrapper(IOrderRoleMvoState state)
 {
     this._state = state;
 }
Exemple #8
0
 public OrderRoleMvoStateDtoWrapper()
 {
     this._state = new OrderRoleMvoState();
 }
Exemple #9
0
 public OrderRoleMvoAggregate(IOrderRoleMvoState state)
 {
     _state = state;
 }
 public override IOrderRoleMvoAggregate GetOrderRoleMvoAggregate(IOrderRoleMvoState state)
 {
     return(new OrderRoleMvoAggregate(state));
 }
Exemple #11
0
        protected bool IsRepeatedCommand(IOrderRoleMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IOrderRoleMvoState state)
        {
            bool repeated = false;

            if (((IOrderRoleMvoStateProperties)state).OrderVersion > command.AggregateVersion)
            {
                var lastEvent = EventStore.GetEvent(typeof(IOrderRoleMvoEvent), eventStoreAggregateId, command.AggregateVersion);
                if (lastEvent != null && lastEvent.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
Exemple #12
0
 private void Persist(IEventStoreAggregateId eventStoreAggregateId, IOrderRoleMvoAggregate aggregate, IOrderRoleMvoState state)
 {
     EventStore.AppendEvents(eventStoreAggregateId, ((IOrderRoleMvoStateProperties)state).OrderVersion, aggregate.Changes, () => { StateRepository.Save(state); });
     if (AggregateEventListener != null)
     {
         AggregateEventListener.EventAppended(new AggregateEvent <IOrderRoleMvoAggregate, IOrderRoleMvoState>(aggregate, state, aggregate.Changes));
     }
 }
Exemple #13
0
 public abstract IOrderRoleMvoAggregate GetOrderRoleMvoAggregate(IOrderRoleMvoState state);
        public static IOrderRoleMvoCommand ToCreateOrMergePatchOrderRoleMvo <TCreateOrderRoleMvo, TMergePatchOrderRoleMvo>(this IOrderRoleMvoState state)
            where TCreateOrderRoleMvo : ICreateOrderRoleMvo, new()
            where TMergePatchOrderRoleMvo : IMergePatchOrderRoleMvo, new()
        {
            bool bUnsaved = ((IOrderRoleMvoState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreateOrderRoleMvo <TCreateOrderRoleMvo>());
            }
            else
            {
                return(state.ToMergePatchOrderRoleMvo <TMergePatchOrderRoleMvo>());
            }
        }