Example #1
0
        public virtual void Initialize(IPicklistStateCreated stateCreated)
        {
            var aggregateId = stateCreated.PicklistEventId.PicklistId;
            var state       = new PicklistState();

            state.PicklistId = aggregateId;
            var aggregate = (PicklistAggregate)GetPicklistAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Example #2
0
        public virtual IPicklistState ToPicklistState()
        {
            var state = new PicklistState(true);

            state.PicklistId           = this.PicklistId;
            state.Description          = this.Description;
            state.FacilityId           = this.FacilityId;
            state.ShipmentMethodTypeId = this.ShipmentMethodTypeId;
            state.StatusId             = this.StatusId;
            state.PicklistDate         = this.PicklistDate;
            state.PickwaveId           = this.PickwaveId;
            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;
            }
            if (this.PicklistRoles != null)
            {
                foreach (var s in this.PicklistRoles)
                {
                    state.PicklistRoles.AddToSave(s.ToPicklistRoleState());
                }
            }
            ;

            return(state);
        }
Example #3
0
 public static CreatePicklist ToCreatePicklist(this PicklistState state)
 {
     return(state.ToCreatePicklist <CreatePicklist, CreatePicklistRole>());
 }
Example #4
0
 public static MergePatchPicklist ToMergePatchPicklist(this PicklistState state)
 {
     return(state.ToMergePatchPicklist <MergePatchPicklist, CreatePicklistRole, MergePatchPicklistRole>());
 }
Example #5
0
 public static DeletePicklist ToDeletePicklist(this PicklistState state)
 {
     return(state.ToDeletePicklist <DeletePicklist>());
 }
Example #6
0
 public static IPicklistCommand ToCreateOrMergePatchPicklist(this PicklistState state)
 {
     return(state.ToCreateOrMergePatchPicklist <CreatePicklist, MergePatchPicklist, CreatePicklistRole, MergePatchPicklistRole>());
 }