Example #1
0
        public virtual IInventoryPostingRuleState ToInventoryPostingRuleState()
        {
            var state = new InventoryPostingRuleState(true);

            state.InventoryPostingRuleId = this.InventoryPostingRuleId;
            state.TriggerInventoryItemId = this.TriggerInventoryItemId;
            state.OutputInventoryItemId  = this.OutputInventoryItemId;
            state.TriggerAccountName     = this.TriggerAccountName;
            state.OutputAccountName      = this.OutputAccountName;
            if (this.IsOutputNegated != null && this.IsOutputNegated.HasValue)
            {
                state.IsOutputNegated = this.IsOutputNegated.Value;
            }
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
Example #2
0
        public virtual void Initialize(IInventoryPostingRuleStateCreated stateCreated)
        {
            var aggregateId = stateCreated.InventoryPostingRuleEventId.InventoryPostingRuleId;
            var state       = new InventoryPostingRuleState();

            state.InventoryPostingRuleId = aggregateId;
            var aggregate = (InventoryPostingRuleAggregate)GetInventoryPostingRuleAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
 public static CreateInventoryPostingRule ToCreateInventoryPostingRule(this InventoryPostingRuleState state)
 {
     return(state.ToCreateInventoryPostingRule <CreateInventoryPostingRule>());
 }
 public static MergePatchInventoryPostingRule ToMergePatchInventoryPostingRule(this InventoryPostingRuleState state)
 {
     return(state.ToMergePatchInventoryPostingRule <MergePatchInventoryPostingRule>());
 }
 public static DeleteInventoryPostingRule ToDeleteInventoryPostingRule(this InventoryPostingRuleState state)
 {
     return(state.ToDeleteInventoryPostingRule <DeleteInventoryPostingRule>());
 }
 public static IInventoryPostingRuleCommand ToCreateOrMergePatchInventoryPostingRule(this InventoryPostingRuleState state)
 {
     return(state.ToCreateOrMergePatchInventoryPostingRule <CreateInventoryPostingRule, MergePatchInventoryPostingRule>());
 }